~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/extensions/cookie/resources/content/cookieTasksOverlay.xul

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0"?>
 
2
 
 
3
<!--
 
4
   The contents of this file are subject to the Netscape Public
 
5
   License Version 1.1 (the "License"); you may not use this file
 
6
   except in compliance with the License. You may obtain a copy of
 
7
   the License at http://www.mozilla.org/NPL/
 
8
    
 
9
   Software distributed under the License is distributed on an "AS
 
10
   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 
11
   implied. See the License for the specific language governing
 
12
   rights and limitations under the License.
 
13
    
 
14
   The Original Code is Mozilla Communicator client code, released
 
15
   March 31, 1998.
 
16
   
 
17
   The Initial Developer of the Original Code is Netscape
 
18
   Communications Corporation. Portions created by Netscape are
 
19
   Copyright (C) 1998-1999 Netscape Communications Corporation. All
 
20
   Rights Reserved.
 
21
   
 
22
   Contributor(s): 
 
23
  -->
 
24
 
 
25
<!DOCTYPE overlay SYSTEM "chrome://cookie/locale/cookieTasksOverlay.dtd">
 
26
 
 
27
<overlay id="cookieTasksOverlay"
 
28
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
29
 
 
30
  <script type="application/x-javascript" src="chrome://cookie/content/cookieOverlay.js"/>
 
31
 
 
32
  <script type="application/x-javascript">
 
33
  <![CDATA[
 
34
 
 
35
    /******* THE FOLLOWING IS FOR THE STATUSBAR OVERLAY *******/
 
36
 
 
37
    var gButtonPressed;
 
38
 
 
39
    var cookieIconObserver = {
 
40
      observe: function(subject, topic, state) {
 
41
        if (topic != "cookieIcon" || !document) {
 
42
          return;
 
43
        }
 
44
        var cookieIcon = document.getElementById("privacy-button");
 
45
        if (cookieIcon) {
 
46
          if (state == "on") {
 
47
            cookieIcon.removeAttribute("hidden");
 
48
          } else if (state == "off")  {
 
49
            cookieIcon.setAttribute("hidden", "true");
 
50
          }
 
51
        }
 
52
      }
 
53
    }
 
54
 
 
55
    function viewP3PDialog() {
 
56
      var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
 
57
      observerService.notifyObservers(null, "cookieIcon", "off");
 
58
 
 
59
      window.openDialog
 
60
        ("chrome://cookie/content/p3pDialog.xul","_blank","modal=yes,chrome,resizable=no", this);
 
61
      if (gButtonPressed == "cookie") {
 
62
        viewCookiesFromIcon();
 
63
      } else if (gButtonPressed == "p3p") {
 
64
        viewP3P();
 
65
      }
 
66
    }
 
67
 
 
68
    function CookieTasksOnLoad(event) {
 
69
      addEventListener("unload", CookieTasksOnUnload, false);
 
70
 
 
71
      // determine if p3p pref is set
 
72
      var pref = Components.classes['@mozilla.org/preferences-service;1'].
 
73
                     getService(Components.interfaces.nsIPrefBranch);
 
74
      if (pref.getIntPref("network.cookie.cookieBehavior") == 3) {
 
75
 
 
76
        // make sure p3p dll exists, else we can't keep pref set
 
77
        if (!("@mozilla.org/cookie-consent;1" in Components.classes)) {
 
78
          pref.setIntPref("network.cookie.cookieBehavior", 0);
 
79
        }
 
80
      }
 
81
 
 
82
      if ("@mozilla.org/cookie-consent;1" in Components.classes) {
 
83
 
 
84
        // p3p dll exists so create an observer for changes in visibility of cookie icon
 
85
        var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
 
86
        observerService.addObserver(cookieIconObserver, "cookieIcon", false);
 
87
 
 
88
        // determine whether or not cookie icon in this new window should be displayed
 
89
        var cookieservice = Components.classes["@mozilla.org/cookieService;1"].getService();
 
90
        cookieservice = cookieservice.QueryInterface(Components.interfaces.nsICookieService);
 
91
        if (cookieservice.cookieIconIsVisible) {
 
92
          var cookieIcon = document.getElementById("privacy-button");
 
93
          if (cookieIcon) {
 
94
            cookieIcon.removeAttribute("hidden");
 
95
          }
 
96
        }
 
97
      }
 
98
    }
 
99
 
 
100
    function CookieTasksOnUnload(event) {
 
101
      if ("@mozilla.org/cookie-consent;1" in Components.classes) {
 
102
        var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
 
103
        observerService.removeObserver(cookieIconObserver, "cookieIcon", false);
 
104
      }
 
105
    }
 
106
 
 
107
    addEventListener("load", CookieTasksOnLoad, false);
 
108
 
 
109
  ]]>
 
110
  </script>         
 
111
 
 
112
  <!-- statusbarOverlay items -->
 
113
 
 
114
  <statusbar id="status-bar">
 
115
    <statusbarpanel class="statusbarpanel-iconic" id="privacy-button"
 
116
                    hidden="true" insertbefore="security-button"
 
117
                    oncommand="viewP3PDialog()" tooltiptext="&cookieIcon.label;"/>
 
118
  </statusbar>
 
119
 
 
120
</overlay>