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/
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.
14
The Original Code is Mozilla Communicator client code, released
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
25
<!DOCTYPE overlay SYSTEM "chrome://cookie/locale/cookieTasksOverlay.dtd">
27
<overlay id="cookieTasksOverlay"
28
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
30
<script type="application/x-javascript" src="chrome://cookie/content/cookieOverlay.js"/>
32
<script type="application/x-javascript">
35
/******* THE FOLLOWING IS FOR THE STATUSBAR OVERLAY *******/
39
var cookieIconObserver = {
40
observe: function(subject, topic, state) {
41
if (topic != "cookieIcon" || !document) {
44
var cookieIcon = document.getElementById("privacy-button");
47
cookieIcon.removeAttribute("hidden");
48
} else if (state == "off") {
49
cookieIcon.setAttribute("hidden", "true");
55
function viewP3PDialog() {
56
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
57
observerService.notifyObservers(null, "cookieIcon", "off");
60
("chrome://cookie/content/p3pDialog.xul","_blank","modal=yes,chrome,resizable=no", this);
61
if (gButtonPressed == "cookie") {
62
viewCookiesFromIcon();
63
} else if (gButtonPressed == "p3p") {
68
function CookieTasksOnLoad(event) {
69
addEventListener("unload", CookieTasksOnUnload, false);
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) {
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);
82
if ("@mozilla.org/cookie-consent;1" in Components.classes) {
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);
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");
94
cookieIcon.removeAttribute("hidden");
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);
107
addEventListener("load", CookieTasksOnLoad, false);
112
<!-- statusbarOverlay items -->
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;"/>