Bug 411929 - Private Browsing UI; r=mconnor,bzbarsky sr=bzbarsky

This commit is contained in:
Ehsan Akhgari 2008-11-04 02:52:23 +03:30
Родитель 022eb9cad7
Коммит 07521d5740
38 изменённых файлов: 657 добавлений и 17 удалений

Просмотреть файл

@ -794,3 +794,6 @@ pref("security.alternate_certificate_error_page", "certerror");
// Whether to start the private browsing mode at application startup
pref("browser.privatebrowsing.autostart", false);
// Whether we should skip prompting before starting the private browsing mode
pref("browser.privatebrowsing.dont_prompt_on_enter", false);

Просмотреть файл

@ -466,6 +466,12 @@
key="key_viewInfo" command="View:PageInfo"/>
#endif
<menuseparator id="sanitizeSeparator"/>
<menuitem id="privateBrowsingItem"
label="&privateBrowsingCmd.label;"
accesskey="&privateBrowsingCmd.accesskey;"
type="checkbox"
autocheck="false"
command="Tools:PrivateBrowsing"/>
<menuitem id="sanitizeItem"
accesskey="&clearPrivateDataCmd.accesskey;"
label="&clearPrivateDataCmd.label;"

Просмотреть файл

@ -126,6 +126,7 @@
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Sanitize"
oncommand="Cc[GLUE_CID].getService(Ci.nsIBrowserGlue).sanitize(window || null);"/>
<command id="Tools:PrivateBrowsing" oncommand="gPrivateBrowsingUI.toggleMode();"/>
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
</commandset>

Просмотреть файл

@ -1347,6 +1347,7 @@ function BrowserShutdown()
BrowserOffline.uninit();
OfflineApps.uninit();
DownloadMonitorPanel.uninit();
gPrivateBrowsingUI.uninit();
var windowManager = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
var windowManagerInterface = windowManager.QueryInterface(Components.interfaces.nsIWindowMediator);
@ -6745,20 +6746,22 @@ function getNavToolbox() gNavToolbox;
let gPrivateBrowsingUI = {
_observerService: null,
_privateBrowsingService: null,
_privateBrowsingAutoStarted: false,
init: function PBUI_init() {
this._observerService = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
this._observerService.addObserver(this, "private-browsing", false);
this._observerService.addObserver(this, "quit-application", false);
this._privateBrowsingService = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
if (this._privateBrowsingService.privateBrowsingEnabled)
if (this.privateBrowsingEnabled)
this.onEnterPrivateBrowsing();
else
this.onExitPrivateBrowsing();
},
uninit: function PBUI_unint() {
this._observerService.removeObserver(this, "private-browsing");
},
observe: function PBUI_observe(aSubject, aTopic, aData) {
@ -6768,21 +6771,119 @@ let gPrivateBrowsingUI = {
else if (aData == "exit")
this.onExitPrivateBrowsing();
}
else if (aTopic == "quit-application") {
this._observerService.removeObserver(this, "quit-application");
this._observerService.removeObserver(this, "private-browsing");
},
_shouldEnter: function PBUI__shouldEnter() {
try {
// Never prompt if the session is not going to be closed, or if user has
// already requested not to be prompted.
if (gPrefService.getBoolPref("browser.privatebrowsing.dont_prompt_on_enter") ||
gPrefService.getBoolPref("browser.privatebrowsing.keep_current_session"))
return true;
}
catch (ex) { }
var bundleService = Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService);
var pbBundle = bundleService.createBundle("chrome://browser/locale/browser.properties");
var brandBundle = bundleService.createBundle("chrome://branding/locale/brand.properties");
var appName = brandBundle.GetStringFromName("brandShortName");
var dialogTitle = pbBundle.GetStringFromName("privateBrowsingDialogTitle");
var message = pbBundle.formatStringFromName("privateBrowsingMessage", [appName], 1);
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"].
getService(Ci.nsIPromptService);
var flags = promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0 +
promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_1 +
promptService.BUTTON_POS_0_DEFAULT;
var neverAsk = {value:false};
var button0Title = pbBundle.GetStringFromName("privateBrowsingYesTitle");
var button1Title = pbBundle.GetStringFromName("privateBrowsingNoTitle");
var neverAskText = pbBundle.GetStringFromName("privateBrowsingNeverAsk");
var result;
var choice = promptService.confirmEx(null, dialogTitle, message,
flags, button0Title, button1Title, null,
neverAskText, neverAsk);
switch (choice) {
case 0: // Start Private Browsing
result = true;
if (neverAsk.value)
gPrefService.setBoolPref("browser.privatebrowsing.dont_prompt_on_enter", true);
break;
case 1: // Keep
result = false;
break;
}
return result;
},
onEnterPrivateBrowsing: function PBUI_onEnterPrivateBrowsing() {
let pbMenuItem = document.getElementById("privateBrowsingItem");
if (pbMenuItem)
pbMenuItem.setAttribute("checked", "true");
this._privateBrowsingAutoStarted = this._privateBrowsingService.autoStarted;
if (!this._privateBrowsingAutoStarted) {
// Adjust the window's title
let docElement = document.documentElement;
#ifdef XP_MACOSX // see bug 411929 comment 38 for the reason behind this
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_privatebrowsing"));
docElement.setAttribute("titledefault", "");
#else
docElement.setAttribute("title",
docElement.getAttribute("title_privatebrowsing"));
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_privatebrowsing"));
#endif
}
else {
// Disable the menu item in auto-start mode
if (pbMenuItem)
pbMenuItem.setAttribute("disabled", "true");
document.getElementById("Tools:PrivateBrowsing")
.setAttribute("disabled", "true");
}
},
onExitPrivateBrowsing: function PBUI_onExitPrivateBrowsing() {
let pbMenuItem = document.getElementById("privateBrowsingItem");
if (pbMenuItem)
pbMenuItem.removeAttribute("checked");
if (!this._privateBrowsingAutoStarted) {
// Adjust the window's title
let docElement = document.documentElement;
#ifdef XP_MACOSX // see bug 411929 comment 38 for the reason behind this
docElement.setAttribute("titlemodifier", "");
docElement.setAttribute("titledefault",
docElement.getAttribute("titlemodifier_normal"));
#else
docElement.setAttribute("title",
docElement.getAttribute("title_normal"));
docElement.setAttribute("titlemodifier",
docElement.getAttribute("titlemodifier_normal"));
#endif
}
else
this._privateBrowsingAutoStarted = false;
},
toggleMode: function PBUI_toggleMode() {
// prompt the users on entering the private mode, if needed
if (!this.privateBrowsingEnabled)
if (!this._shouldEnter())
return;
this._privateBrowsingService.privateBrowsingEnabled =
!this._privateBrowsingService.privateBrowsingEnabled;
!this.privateBrowsingEnabled;
},
get privateBrowsingEnabled PBUI_get_privateBrowsingEnabled() {

Просмотреть файл

@ -66,7 +66,11 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="BrowserStartup()" onunload="BrowserShutdown()" onclose="return WindowIsClosing();"
title="&mainWindow.title;"
titlemodifier="&mainWindow.title;"
title_normal="&mainWindow.title;"
title_privatebrowsing="&mainWindowPrivateBrowsing.titlemodifier;"
titlemodifier="&mainWindow.titlemodifier;"
titlemodifier_normal="&mainWindow.titlemodifier;"
titlemodifier_privatebrowsing="&mainWindowPrivateBrowsing.titlemodifier;"
titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
windowtype="navigator:browser"
screenX="4" screenY="4"

Просмотреть файл

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Private Browsing.
#
# The Initial Developer of the Original Code is
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
# Portions created by the Initial Developer are Copyright (C) 2008
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
-->
<!DOCTYPE html [
<!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
%htmlDTD;
<!ENTITY % netErrorDTD SYSTEM "chrome://global/locale/netError.dtd">
%netErrorDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % privatebrowsingpageDTD SYSTEM "chrome://browser/locale/aboutPrivateBrowsing.dtd">
%privatebrowsingpageDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>&privatebrowsingpage.tabtitle;</title>
<link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all"/>
<link rel="stylesheet" href="chrome://browser/skin/aboutPrivateBrowsing.css" type="text/css" media="all"/>
<link rel="icon" type="image/png" href="chrome://browser/skin/Privacy-16.png"/>
</head>
<body dir="&locale.dir;">
<!-- PAGE CONTAINER (for styling purposes only) -->
<div id="errorPageContainer">
<!-- Error Title -->
<div id="errorTitle">
<h1 id="errorTitleText">&privatebrowsingpage.pagetitle;</h1>
</div>
<!-- LONG CONTENT (the section most likely to require scrolling) -->
<div id="errorLongContent">
<!-- Short Description -->
<div id="errorShortDesc">
<p id="errorShortDescText">&privatebrowsingpage.issueDesc;</p>
</div>
<!-- Long Description (Note: See netError.dtd for used XHTML tags) -->
<div id="errorLongDesc">
<p>&privatebrowsingpage.longDesc;</p>
</div>
<!-- Clear Recent History -->
<div id="clearRecentHistoryDesc">
<p>&privatebrowsingpage.clearRecentHistoryDesc;</p>
<button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
id="showClearRecentHistory" label="&privatebrowsingpage.recentHistory.label;"
accesskey="&privatebrowsingpage.recentHistory.accesskey;"
disabled="true"/>
</div>
<!-- Footer -->
<div id="footerDesc">
<p>&privatebrowsingpage.howToStopDesc;</p>
<p id="enjoyDesc">&privatebrowsingpage.footerDesc;</p>
</div>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,2 @@
browser.jar:
* content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)

Просмотреть файл

@ -42,6 +42,9 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
EXTRA_PP_COMPONENTS = nsPrivateBrowsingService.js
EXTRA_PP_COMPONENTS = \
nsPrivateBrowsingService.js \
aboutPrivateBrowsing.js \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,63 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Private Browsing.
*
* The Initial Developer of the Original Code is
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
const Cc = Components.classes;
const Ci = Components.interfaces;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
function AboutPrivateBrowsing() { }
AboutPrivateBrowsing.prototype = {
classDescription: "about:privatebrowsing",
contractID: "@mozilla.org/network/protocol/about;1?what=privatebrowsing",
classID: Components.ID("{d92a18c8-234d-49e4-9936-3b7e020c29a2}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
getURIFlags: function(aURI) {
return Ci.nsIAboutModule.ALLOW_SCRIPT;
},
newChannel: function(aURI) {
let ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
let channel = ios.newChannel("chrome://browser/content/aboutPrivateBrowsing.xhtml",
null, null);
channel.originalURI = aURI;
return channel;
}
};
function NSGetModule(compMgr, fileSpec)
XPCOMUtils.generateModule([AboutPrivateBrowsing]);

Просмотреть файл

@ -75,6 +75,9 @@ PrivateBrowsingService.prototype = {
// Whether we're entering the private browsing mode at application startup
_autoStart: false,
// Whether the private browsing mode has been started automatically
_autoStarted: false,
// XPCOM registration
classDescription: "PrivateBrowsing Service",
contractID: "@mozilla.org/privatebrowsing;1",
@ -126,8 +129,8 @@ PrivateBrowsingService.prototype = {
// Close all windows
this._closeAllWindows();
// Open a single window
this._openSingleWindow();
// Open about:privatebrowsing
this._openAboutPrivateBrowsing();
}
}
else {
@ -139,8 +142,9 @@ PrivateBrowsingService.prototype = {
// restore the windows/tabs which were open before entering the private mode
if (this._saveSession && this._savedBrowserState) {
if (!this._quitting) // don't restore when shutting down!
if (!this._quitting) { // don't restore when shutting down!
ss.setBrowserState(this._savedBrowserState);
}
this._savedBrowserState = null;
}
}
@ -168,11 +172,14 @@ PrivateBrowsingService.prototype = {
}
},
_openSingleWindow: function PBS__openSingleWindow() {
_openAboutPrivateBrowsing: function PBS__openAboutPrivateBrowsing() {
let windowWatcher = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
let url = Cc["@mozilla.org/supports-string;1"].
createInstance(Ci.nsISupportsString);
url.data = "about:privatebrowsing";
windowWatcher.openWindow(null, "chrome://browser/content/browser.xul",
null, "chrome,all,resizable=yes,dialog=no", null);
null, "chrome,all,resizable=yes,dialog=no", url);
},
_canEnterPrivateBrowsingMode: function PBS__canEnterPrivateBrowsingMode() {
@ -204,6 +211,7 @@ PrivateBrowsingService.prototype = {
getService(Ci.nsIPrefBranch);
this._autoStart = prefsService.getBoolPref("browser.privatebrowsing.autostart");
if (this._autoStart) {
this._autoStarted = true;
this.privateBrowsingEnabled = true;
this._autoStart = false;
}
@ -249,6 +257,8 @@ PrivateBrowsingService.prototype = {
return;
}
if (!val)
this._autoStarted = false;
this._inPrivateBrowsing = val != false;
let data = val ? "enter" : "exit";
@ -266,6 +276,13 @@ PrivateBrowsingService.prototype = {
} finally {
this._alreadyChangingMode = false;
}
},
/**
* Whether private browsing has been started automatically.
*/
get autoStarted PBS_get_autoStarted() {
return this._autoStarted;
}
};

Просмотреть файл

@ -35,7 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
// This test makes sure that the gPrivateBrowsingUI object works correctly.
// This test makes sure that the gPrivateBrowsingUI object, the Private Browsing
// menu item and its XUL <command> element work correctly.
function test() {
// initialization
@ -54,13 +55,120 @@ function test() {
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
os.addObserver(observer, "private-browsing", false);
let pbMenuItem = document.getElementById("privateBrowsingItem");
// add a new blank tab to ensure the title
let blankTab = gBrowser.addTab();
gBrowser.selectedTab = blankTab;
let originalTitle = document.title;
let privateBrowsingTitle = document.documentElement.getAttribute("titlemodifier_privatebrowsing");
waitForExplicitFinish();
// test the gPrivateBrowsingUI object
ok(gPrivateBrowsingUI, "The gPrivateBrowsingUI object exists");
ok(pbMenuItem, "The Private Browsing menu item exists");
ok(!pbMenuItem.hasAttribute("checked"), "The Private Browsing menu item is not checked initially");
gPrivateBrowsingUI.toggleMode();
// check to see if the Private Browsing mode was activated successfully
is(observer.data, "enter", "Private Browsing mode was activated using the gPrivateBrowsingUI object");
ok(pbMenuItem.hasAttribute("checked"), "The Private Browsing menu item was correctly checked");
gPrivateBrowsingUI.toggleMode()
// check to see if the Private Browsing mode was deactivated successfully
is(observer.data, "exit", "Private Browsing mode was deactivated using the gPrivateBrowsingUI object");
ok(!pbMenuItem.hasAttribute("checked"), "The Private Browsing menu item was correctly unchecked");
// test the menu item
window.focus();
let timer = Cc["@mozilla.org/timer;1"].
createInstance(Ci.nsITimer);
timer.initWithCallback({
notify: function(timer) {
// get the access keys
let toolsKey = document.getElementById("tools-menu").getAttribute("accesskey");
let pbKey = pbMenuItem.getAttribute("accesskey");
// get the access key modifier
function accessKeyModifier () {
switch (gPrefService.getIntPref("ui.key.generalAccessKey")) {
case -1:
let chromeAccessKey = gPrefService.getIntPref("ui.key.chromeAccess");
if (chromeAccessKey == 0)
ok(false, "ui.key.chromeAccess was set to 0, so access keys for chrome are disabled");
else
return {
shiftKey: (chromeAccessKey & 1) != 0,
accelKey: (chromeAccessKey & 2) != 0,
altKey: (chromeAccessKey & 4) != 0,
metaKey: (chromeAccessKey & 8) != 0
};
break;
case Ci.nsIDOMKeyEvent.DOM_VK_SHIFT:
return { shiftKey: true };
case Ci.nsIDOMKeyEvent.DOM_VK_CONTROL:
return { accelKey: true };
case Ci.nsIDOMKeyEvent.DOM_VK_ALT:
return { altKey: true };
case Ci.nsIDOMKeyEvent.DOM_VK_META:
return { metaKey: true };
default:
ok(false, "Invalid value for the ui.key.generalAccessKey pref: " +
gPrefService.getIntPref("ui.key.generalAccessKey"));
}
}
let popup = document.getElementById("menu_ToolsPopup");
// activate the Private Browsing menu item
popup.addEventListener("popupshown", function () {
this.removeEventListener("popupshown", arguments.callee, false);
this.addEventListener("popuphidden", function () {
this.removeEventListener("popuphidden", arguments.callee, false);
// check to see if the Private Browsing mode was activated successfully
is(observer.data, "enter", "Private Browsing mode was activated using the menu");
// check to see that the window title has been changed correctly
is(document.title, privateBrowsingTitle, "Private browsing mode has correctly changed the title");
// toggle the Private Browsing menu item
this.addEventListener("popupshown", function () {
this.removeEventListener("popupshown", arguments.callee, false);
this.addEventListener("popuphidden", function () {
this.removeEventListener("popuphidden", arguments.callee, false);
// check to see if the Private Browsing mode was deactivated successfully
is(observer.data, "exit", "Private Browsing mode was deactivated using the menu");
// check to see that the window title has been restored correctly
is(document.title, originalTitle, "Private browsing mode has correctly restored the title");
// now, test using the <command> object
let cmd = document.getElementById("Tools:PrivateBrowsing");
isnot(cmd, null, "XUL command object for the private browsing service exists");
var func = new Function("", cmd.getAttribute("oncommand"));
func.call(cmd);
// check to see if the Private Browsing mode was activated successfully
is(observer.data, "enter", "Private Browsing mode was activated using the command object");
// check to see that the window title has been changed correctly
is(document.title, privateBrowsingTitle, "Private browsing mode has correctly changed the title");
func.call(cmd);
// check to see if the Private Browsing mode was deactivated successfully
is(observer.data, "exit", "Private Browsing mode was deactivated using the command object");
// check to see that the window title has been restored correctly
is(document.title, originalTitle, "Private browsing mode has correctly restored the title");
// cleanup
gBrowser.removeTab(blankTab);
os.removeObserver(observer, "private-browsing");
prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
finish();
}, false);
EventUtils.synthesizeKey(pbKey, accessKeyModifier());
}, false);
EventUtils.synthesizeKey(toolsKey, accessKeyModifier());
}, false);
EventUtils.synthesizeKey(pbKey, accessKeyModifier());
}, false);
EventUtils.synthesizeKey(toolsKey, accessKeyModifier());
}
}, 2000, Ci.nsITimer.TYPE_ONE_SHOT);
}

Просмотреть файл

@ -66,12 +66,16 @@ function run_test() {
// private browsing should be turned off initially
do_check_false(pb.privateBrowsingEnabled);
// private browsing not auto-started
do_check_false(pb.autoStarted);
// it should be possible to toggle its status
pb.privateBrowsingEnabled = true;
do_check_true(pb.privateBrowsingEnabled);
do_check_false(pb.autoStarted);
pb.privateBrowsingEnabled = false;
do_check_false(pb.privateBrowsingEnabled);
do_check_false(pb.autoStarted);
// test the private-browsing notification
var observer = {

Просмотреть файл

@ -48,9 +48,21 @@ function run_test() {
getService(Ci.nsIPrivateBrowsingService).
QueryInterface(Ci.nsIObserver);
// private browsing not auto-started yet
do_check_false(pb.autoStarted);
// simulate startup to make the PB service read the prefs
pb.observe(null, "profile-after-change", "");
// the private mode should be entered automatically
do_check_true(pb.privateBrowsingEnabled);
// private browsing is auto-started
do_check_true(pb.autoStarted);
// leave private browsing mode
pb.privateBrowsingEnabled = false;
// private browsing not auto-started
do_check_false(pb.autoStarted);
}

Просмотреть файл

@ -229,6 +229,7 @@ bin/components/extensions.xpt
bin/components/update.xpt
bin/components/nsSessionStartup.js
bin/components/nsSessionStore.js
bin/components/aboutPrivateBrowsing.js
bin/components/aboutSessionRestore.js
bin/components/sessionstore.xpt
bin/components/nsURLFormatter.js

Просмотреть файл

@ -236,6 +236,7 @@ bin\components\extensions.xpt
bin\components\update.xpt
bin\components\nsSessionStartup.js
bin\components\nsSessionStore.js
bin\components\aboutPrivateBrowsing.js
bin\components\aboutSessionRestore.js
bin\components\sessionstore.xpt
bin\components\nsURLFormatter.js

Просмотреть файл

@ -0,0 +1,13 @@
<!ENTITY privatebrowsingpage.tabtitle "Private Browsing">
<!ENTITY privatebrowsingpage.pagetitle "Private Browsing">
<!ENTITY privatebrowsingpage.issueDesc "&brandShortName; won't remember any history for this session.">
<!ENTITY privatebrowsingpage.longDesc "No history will be recorded by &brandShortName; during this browsing session. This includes browser history, search history, download history, web form history, cookies, and temporary internet files. However, any files you download or bookmarks you create will be preserved.">
<!ENTITY privatebrowsingpage.clearRecentHistoryDesc "You may want to start by also clearing your recent history.">
<!ENTITY privatebrowsingpage.recentHistory.label "Clear Recent History">
<!ENTITY privatebrowsingpage.recentHistory.accesskey "C">
<!ENTITY privatebrowsingpage.howToStopDesc "To stop private browsing, uncheck Tools &gt; Private Browsing.">
<!ENTITY privatebrowsingpage.footerDesc "Enjoy!">

Просмотреть файл

@ -7,6 +7,9 @@
<!ENTITY mainWindow.titlemodifier "&brandFullName;">
<!-- LOCALIZATION NOTE (mainWindow.titlemodifiermenuseparator): DONT_TRANSLATE -->
<!ENTITY mainWindow.titlemodifiermenuseparator " - ">
<!-- LOCALIZATION NOTE (mainWindowPrivateBrowsing.titlemodifier): This will be appended to the window's title
inside the private browsing mode -->
<!ENTITY mainWindowPrivateBrowsing.titlemodifier "&mainWindow.titlemodifier; (Private Browsing)">
<!ENTITY tabCmd.label "New Tab">
<!ENTITY tabCmd.accesskey "T">
@ -161,6 +164,9 @@
<!ENTITY clearPrivateDataCmd.label "Clear Private Data">
<!ENTITY clearPrivateDataCmd.accesskey "P">
<!ENTITY privateBrowsingCmd.label "Private Browsing">
<!ENTITY privateBrowsingCmd.accesskey "B">
<!ENTITY viewMenu.label "View">
<!ENTITY viewMenu.accesskey "V">
<!ENTITY viewToolbarsMenu.label "Toolbars">

Просмотреть файл

@ -161,3 +161,14 @@ safebrowsing.notAForgeryButton.accessKey=F
safebrowsing.reportedAttackSite=Reported Attack Site!
safebrowsing.notAnAttackButton.label=This isn't an attack site…
safebrowsing.notAnAttackButton.accessKey=A
# Private Browsing Confirmation dialog
# LOCALIZATION NOTE (privateBrowsingMessage): %S will be replaced
# by the name of the application.
# LOCALIZATION NOTE (privateBrowsingYesTitle, privateBrowsingNoTitle, privateBrowsingNeverAsk):
# Access keys are specified by prefixing the desired letter with an ampersand.
privateBrowsingDialogTitle=Start Private Browsing
privateBrowsingMessage=%S will save your current tabs for when you are done with your Private Browsing session.
privateBrowsingYesTitle=&Start Private Browsing
privateBrowsingNoTitle=&Cancel
privateBrowsingNeverAsk=&Do not show this message again

Просмотреть файл

@ -4,6 +4,7 @@
% locale browser @AB_CD@ %locale/browser/
locale/browser/aboutCertError.dtd (%chrome/browser/aboutCertError.dtd)
locale/browser/aboutDialog.dtd (%chrome/browser/aboutDialog.dtd)
locale/browser/aboutPrivateBrowsing.dtd (%chrome/browser/aboutPrivateBrowsing.dtd)
locale/browser/aboutRights.dtd (%chrome/browser/aboutRights.dtd)
locale/browser/aboutRights.properties (%chrome/browser/aboutRights.properties)
locale/browser/aboutRobots.dtd (%chrome/browser/aboutRobots.dtd)

Двоичные данные
browser/themes/gnomestripe/browser/Privacy-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 713 B

Двоичные данные
browser/themes/gnomestripe/browser/Privacy-32.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
browser/themes/gnomestripe/browser/Privacy-48.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичные данные
browser/themes/gnomestripe/browser/Privacy-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.9 KiB

Просмотреть файл

@ -0,0 +1,53 @@
%if 0
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Private Browsing.
*
* The Initial Developer of the Original Code is
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
%endif
#errorPageContainer {
background-image: url("chrome://browser/skin/Privacy-48.png");
}
#clearRecentHistoryDesc {
margin-top: 2em;
}
#clearRecentHistoryDesc > button {
-moz-margin-start: 0;
}
#enjoyDesc {
margin-top: 2em;
}

Просмотреть файл

@ -1,5 +1,6 @@
classic.jar:
% skin browser classic/1.0 %skin/classic/browser/
* skin/classic/browser/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css)
* skin/classic/browser/aboutSessionRestore.css (aboutSessionRestore.css)
skin/classic/browser/aboutCertError.css (aboutCertError.css)
* skin/classic/browser/browser.css (browser.css)
@ -14,6 +15,10 @@ classic.jar:
* skin/classic/browser/pageInfo.css
skin/classic/browser/pageInfo.png
skin/classic/browser/page-livemarks.png
skin/classic/browser/Privacy-16.png
skin/classic/browser/Privacy-32.png
skin/classic/browser/Privacy-48.png
skin/classic/browser/Privacy-64.png
skin/classic/browser/searchbar.css (searchbar.css)
skin/classic/browser/Search-glass.png
skin/classic/browser/Search-glass-rtl.png

Двоичные данные
browser/themes/pinstripe/browser/Privacy-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 713 B

Двоичные данные
browser/themes/pinstripe/browser/Privacy-32.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
browser/themes/pinstripe/browser/Privacy-48.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичные данные
browser/themes/pinstripe/browser/Privacy-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.9 KiB

Просмотреть файл

@ -0,0 +1,53 @@
%if 0
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Private Browsing.
*
* The Initial Developer of the Original Code is
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
%endif
#errorPageContainer {
background-image: url("chrome://browser/skin/Privacy-48.png");
}
#clearRecentHistoryDesc {
margin-top: 2em;
}
#clearRecentHistoryDesc > button {
-moz-margin-start: 0;
}
#enjoyDesc {
margin-top: 2em;
}

Просмотреть файл

@ -1,5 +1,6 @@
classic.jar:
% skin browser classic/1.0 %skin/classic/browser/
* skin/classic/browser/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css)
* skin/classic/browser/aboutSessionRestore.css (aboutSessionRestore.css)
skin/classic/browser/aboutCertError.css (aboutCertError.css)
skin/classic/browser/bookmark_toolbar_background.png
@ -36,6 +37,10 @@ classic.jar:
skin/classic/browser/pageInfo.css
skin/classic/browser/pageInfo.png
skin/classic/browser/Popup-blocked.png
skin/classic/browser/Privacy-16.png
skin/classic/browser/Privacy-32.png
skin/classic/browser/Privacy-48.png
skin/classic/browser/Privacy-64.png
skin/classic/browser/searchbar.css
skin/classic/browser/Search.png
skin/classic/browser/Search-addengines.png

Двоичные данные
browser/themes/winstripe/browser/Privacy-16.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 713 B

Двоичные данные
browser/themes/winstripe/browser/Privacy-32.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
browser/themes/winstripe/browser/Privacy-48.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.9 KiB

Двоичные данные
browser/themes/winstripe/browser/Privacy-64.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 3.9 KiB

Просмотреть файл

@ -0,0 +1,53 @@
%if 0
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Private Browsing.
*
* The Initial Developer of the Original Code is
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
%endif
#errorPageContainer {
background-image: url("chrome://browser/skin/Privacy-48.png");
}
#clearRecentHistoryDesc {
margin-top: 2em;
}
#clearRecentHistoryDesc > button {
-moz-margin-start: 0;
}
#enjoyDesc {
margin-top: 2em;
}

Просмотреть файл

@ -3,6 +3,7 @@ classic.jar:
% skin browser classic/1.0 %skin/classic/browser/ os!=WINNT
# NOTE: If you add a new file here, you'll need to add it to the aero
# section at the bottom of this file
* skin/classic/browser/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css)
* skin/classic/browser/aboutSessionRestore.css (aboutSessionRestore.css)
skin/classic/browser/aboutCertError.css (aboutCertError.css)
* skin/classic/browser/browser.css (browser.css)
@ -16,6 +17,10 @@ classic.jar:
skin/classic/browser/livemark-item.png (livemark-item.png)
skin/classic/browser/livemark-folder.png (livemark-folder.png)
skin/classic/browser/Bookmarks-folder.png (Bookmarks-folder.png)
skin/classic/browser/Privacy-16.png
skin/classic/browser/Privacy-32.png
skin/classic/browser/Privacy-48.png
skin/classic/browser/Privacy-64.png
skin/classic/browser/Secure.png (Secure.png)
skin/classic/browser/Secure24.png (Secure24.png)
skin/classic/browser/Security-broken.png (Security-broken.png)
@ -93,6 +98,7 @@ classic.jar:
#ifdef XP_WIN
classic.jar:
% skin browser classic/1.0 %skin/classic/aero/browser/ os=WINNT osversion>=6
* skin/classic/aero/browser/aboutPrivateBrowsing.css (aboutPrivateBrowsing.css)
* skin/classic/aero/browser/aboutSessionRestore.css (aboutSessionRestore.css)
skin/classic/aero/browser/aboutCertError.css (aboutCertError.css)
* skin/classic/aero/browser/browser.css (browser-aero.css)
@ -106,6 +112,10 @@ classic.jar:
skin/classic/aero/browser/livemark-item.png (livemark-item-aero.png)
skin/classic/aero/browser/livemark-folder.png (livemark-folder-aero.png)
skin/classic/aero/browser/Bookmarks-folder.png (Bookmarks-folder-aero.png)
skin/classic/aero/browser/Privacy-16.png
skin/classic/aero/browser/Privacy-32.png
skin/classic/aero/browser/Privacy-48.png
skin/classic/aero/browser/Privacy-64.png
skin/classic/aero/browser/Secure.png (Secure-aero.png)
skin/classic/aero/browser/Secure24.png (Secure24-aero.png)
skin/classic/aero/browser/Security-broken.png (Security-broken-aero.png)

Просмотреть файл

@ -37,7 +37,7 @@
#include "nsISupports.idl"
[scriptable, uuid(d2943870-c781-11dc-95ff-0800200c9a66)]
[scriptable, uuid(effb626c-676f-4c9d-b6ca-70696787901a)]
interface nsIPrivateBrowsingService : nsISupports
{
// When read, determines whether the private browsing mode is currently
@ -46,6 +46,11 @@ interface nsIPrivateBrowsingService : nsISupports
// Setting this value while handling one of the notifications generated
// by the private browsing service throws NS_ERROR_FAILURE.
attribute boolean privateBrowsingEnabled;
// Determine whether the private browsing mode has been started
// automatically at application startup.
// This value will never be true if privateBrowsingEnabled is false.
readonly attribute boolean autoStarted;
};
%{C++