Bug 816914 - Revamp about:privatebrowsing to support per-window private browsing mode; r=jdm ui-r=shorlander
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 02 Dec 2012 15:11:48 -0500
changeset 115049 277998cf11cd918674390a85395eaa09278cf978
parent 115048 bf0f66f0ab9dac0c1ee27c5f618070f009da6b3e
child 115050 e315b3972412ed15e847eec5b9c81df7170de691
child 115109 77d88ac7bb306d2e47bb014f71e36c0d561736c5
push id23960
push usereakhgari@mozilla.com
push dateWed, 05 Dec 2012 19:59:07 +0000
treeherdermozilla-central@277998cf11cd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm, shorlander
bugs816914
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 816914 - Revamp about:privatebrowsing to support per-window private browsing mode; r=jdm ui-r=shorlander DONTBUILD since this is NPOTB for global PB builds
browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
browser/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
@@ -8,37 +8,51 @@
   <!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 % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
   %browserDTD;
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+#ifdef XP_MACOSX
+  <!ENTITY basePBMenu.label   "&fileMenu.label;">
+#else
+  <!ENTITY basePBMenu.label   "<span class='appMenuButton'>&brandShortName;</span><span class='fileMenu'>&fileMenu.label;</span>">
+#endif
+#else
 #ifdef XP_MACOSX
   <!ENTITY basePBMenu.label   "&toolsMenu.label;">
 #else
   <!ENTITY basePBMenu.label   "<span class='appMenuButton'>&brandShortName;</span><span class='toolsMenu'>&toolsMenu.label;</span>">
 #endif
+#endif
   <!ENTITY % privatebrowsingpageDTD SYSTEM "chrome://browser/locale/aboutPrivateBrowsing.dtd">
   %privatebrowsingpageDTD;
 ]>
 
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <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"/>
     <style type="text/css"><![CDATA[
       body.normal .showPrivate,
       body.private .showNormal {
         display: none;
       }
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+      body.appMenuButtonVisible .fileMenu {
+        display: none;
+      }
+#else
       body.appMenuButtonVisible .toolsMenu {
         display: none;
       }
+#endif
       body.appMenuButtonInvisible .appMenuButton {
         display: none;
       }
     ]]></style>
     <script type="application/javascript;version=1.7"><![CDATA[
       const Cc = Components.classes;
       const Ci = Components.interfaces;
 
@@ -88,20 +102,26 @@
 
         // Show the correct menu structure based on whether the App Menu button is
         // shown or not.
         var menuBar = mainWindow.document.getElementById("toolbar-menubar");
         var appMenuButtonIsVisible = menuBar.getAttribute("autohide") == "true";
         document.body.classList.add(appMenuButtonIsVisible ? "appMenuButtonVisible" :
                                                              "appMenuButtonInvisible");
       }, false);
-      
+
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+      function openPrivateWindow() {
+        mainWindow.OpenBrowserWindow({private: true});
+      }
+#else
       function togglePrivateBrowsing() {
         mainWindow.gPrivateBrowsingUI.toggleMode();
       }
+#endif
     ]]></script>
   </head>
 
   <body dir="&locale.dir;"
         class="private">
 
     <!-- PAGE CONTAINER (for styling purposes only) -->
     <div id="errorPageContainer">
@@ -112,37 +132,58 @@
         <h1 id="errorTitleTextNormal" class="showNormal">&privatebrowsingpage.title.normal;</h1>
       </div>
 
       <!-- LONG CONTENT (the section most likely to require scrolling) -->
       <div id="errorLongContent">
 
         <!-- Short Description -->
         <div id="errorShortDesc">
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+          <p id="errorShortDescText" class="showPrivate">&privatebrowsingpage.perwindow.issueDesc;</p>
+          <p id="errorShortDescTextNormal" class="showNormal">&privatebrowsingpage.perwindow.issueDesc.normal;</p>
+#else
           <p id="errorShortDescText" class="showPrivate">&privatebrowsingpage.issueDesc;</p>
           <p id="errorShortDescTextNormal" class="showNormal">&privatebrowsingpage.issueDesc.normal;</p>
+#endif
         </div>
 
         <!-- Long Description -->
         <div id="errorLongDesc">
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+          <p id="errorLongDescText">&privatebrowsingpage.perwindow.description;</p>
+#else
           <p id="errorLongDescText">&privatebrowsingpage.description;</p>
+#endif
         </div>
 
         <!-- Start Private Browsing -->
         <div id="startPrivateBrowsingDesc" class="showNormal">
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+          <button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+                  id="startPrivateBrowsing" label="&privatebrowsingpage.openPrivateWindow.label;"
+                  accesskey="&privatebrowsingpage.openPrivateWindow.accesskey;"
+                  oncommand="openPrivateWindow();"/>
+#else
           <button xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
                   id="startPrivateBrowsing" label="&privatebrowsingpage.startPrivateBrowsing.label;"
                   accesskey="&privatebrowsingpage.startPrivateBrowsing.accesskey;"
                   oncommand="togglePrivateBrowsing();"/>
+#endif
         </div>
 
         <!-- Footer -->
         <div id="footerDesc">
+#ifdef MOZ_PER_WINDOW_PRIVATE_BROWSING
+          <p id="footerText" class="showPrivate">&privatebrowsingpage.howToStop3;</p>
+          <p id="footerTextNormal" class="showNormal">&privatebrowsingpage.howToStart3;</p>
+#else
           <p id="footerText" class="showPrivate">&privatebrowsingpage.howToStop2;</p>
           <p id="footerTextNormal" class="showNormal">&privatebrowsingpage.howToStart2;</p>
+#endif
         </div>
 
         <!-- More Info -->
         <div id="moreInfo" class="showPrivate">
           <p id="moreInfoText">
             &privatebrowsingpage.moreInfo;
           </p>
           <p id="moreInfoLinkContainer">
--- a/browser/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd
+++ b/browser/locales/en-US/chrome/browser/aboutPrivateBrowsing.dtd
@@ -3,21 +3,32 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!ENTITY privatebrowsingpage.title                 "Private Browsing">
 <!ENTITY privatebrowsingpage.title.normal          "Would you like to start Private Browsing?">
 
 <!ENTITY privatebrowsingpage.issueDesc                 "&brandShortName; won't remember any history for this session.">
 <!ENTITY privatebrowsingpage.issueDesc.normal          "&brandShortName; is not currently in Private Browsing mode.">
 
+<!ENTITY privatebrowsingpage.perwindow.issueDesc        "&brandShortName; won't remember any history for this window.">
+<!ENTITY privatebrowsingpage.perwindow.issueDesc.normal "You are not currently in a private window.">
+
 <!ENTITY privatebrowsingpage.description               "In a Private Browsing session, &brandShortName; won't keep any browser history, search history, download history, web form history, cookies, or temporary internet files.  However, files you download and bookmarks you make will be kept.">
 
+<!ENTITY privatebrowsingpage.perwindow.description     "In a Private Browsing window, &brandShortName; won't keep any browser history, search history, download history, web form history, cookies, or temporary internet files.  However, files you download and bookmarks you make will be kept.">
 
 <!ENTITY privatebrowsingpage.startPrivateBrowsing.label "Start Private Browsing">
 <!ENTITY privatebrowsingpage.startPrivateBrowsing.accesskey "P">
 
+<!ENTITY privatebrowsingpage.openPrivateWindow.label "Open a Private Window">
+<!ENTITY privatebrowsingpage.openPrivateWindow.accesskey "P">
+
 <!-- LOCALIZATION NOTE (privatebrowsingpage.howToStop2): please leave &basePBMenu.label; intact in the translation -->
 <!-- LOCALIZATION NOTE (privatebrowsingpage.howToStart2): please leave &basePBMenu.label; intact in the translation -->
 <!ENTITY privatebrowsingpage.howToStop2                "To stop Private Browsing, select &basePBMenu.label; &gt; &privateBrowsingCmd.stop.label;, or close &brandShortName;.">
 <!ENTITY privatebrowsingpage.howToStart2               "To start Private Browsing, you can also select &basePBMenu.label; &gt; &privateBrowsingCmd.start.label;.">
 
+<!-- LOCALIZATION NOTE (privatebrowsingpage.howToStart3): please leave &basePBMenu.label; intact in the translation -->
+<!ENTITY privatebrowsingpage.howToStart3               "To start Private Browsing, you can also select &basePBMenu.label; &gt; &newPrivateWindow.label;.">
+<!ENTITY privatebrowsingpage.howToStop3                "To stop Private Browsing, you can close this window.">
+
 <!ENTITY privatebrowsingpage.moreInfo                  "While this computer won't have a record of your browsing history, your internet service provider or employer can still track the pages you visit.">
 <!ENTITY privatebrowsingpage.learnMore                 "Learn More">