[tbb-commits] [tor-browser] 33/67: Bug 27511: Add new identity button to toolbar

gitolite role git at cupani.torproject.org
Wed May 4 20:44:51 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch geckoview-96.0.3-11.0-1
in repository tor-browser.

commit 4cecf95a119336822c11fe56d5582fc94994d1ac
Author: Alex Catarineu <acat at torproject.org>
AuthorDate: Fri Oct 4 19:08:33 2019 +0200

    Bug 27511: Add new identity button to toolbar
    
    Also added 'New circuit for this site' button to CustomizableUI, but
    not visible by default.
---
 browser/base/content/navigator-toolbox.inc.xhtml    | 10 ++++++++++
 .../components/customizableui/CustomizableUI.jsm    | 21 +++++++++++++++++++++
 browser/themes/shared/icons/new_circuit.svg         |  8 ++++++++
 browser/themes/shared/icons/new_identity.svg        |  9 +++++++++
 browser/themes/shared/jar.inc.mn                    |  3 +++
 browser/themes/shared/menupanel.inc.css             |  8 ++++++++
 browser/themes/shared/toolbarbutton-icons.inc.css   |  8 ++++++++
 7 files changed, 67 insertions(+)

diff --git a/browser/base/content/navigator-toolbox.inc.xhtml b/browser/base/content/navigator-toolbox.inc.xhtml
index d362ba5ace895..39b4a955d1946 100644
--- a/browser/base/content/navigator-toolbox.inc.xhtml
+++ b/browser/base/content/navigator-toolbox.inc.xhtml
@@ -536,6 +536,16 @@
                    ondragover="newWindowButtonObserver.onDragOver(event)"
                    ondragenter="newWindowButtonObserver.onDragOver(event)"/>
 
+    <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
+                   label="&torbutton.context_menu.new_identity;"
+                   oncommand="torbutton_new_identity();"
+                   tooltiptext="&torbutton.context_menu.new_identity;"/>
+
+    <toolbarbutton id="new-circuit-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
+                   label="&torbutton.context_menu.new_circuit;"
+                   oncommand="torbutton_new_circuit();"
+                   tooltiptext="&torbutton.context_menu.new_circuit;"/>
+
     <toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
                    observes="View:FullScreen"
                    type="checkbox"
diff --git a/browser/components/customizableui/CustomizableUI.jsm b/browser/components/customizableui/CustomizableUI.jsm
index 87aede1449d7a..b5ae0b381d084 100644
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -65,6 +65,8 @@ const kSubviewEvents = ["ViewShowing", "ViewHiding"];
  */
 var kVersion = 17;
 
+var kTorVersion = 1;
+
 /**
  * Buttons removed from built-ins by version they were removed. kVersion must be
  * bumped any time a new id is added to this. Use the button id as key, and
@@ -605,6 +607,20 @@ var CustomizableUIInternal = {
         navbarPlacements.splice(newPosition, 0, "save-to-pocket-button");
       }
     }
+
+    let currentTorVersion = gSavedState.currentTorVersion;
+    if (currentTorVersion < 1 && gSavedState.placements) {
+      let navbarPlacements = gSavedState.placements[CustomizableUI.AREA_NAVBAR];
+      if (navbarPlacements) {
+        let secLevelIndex = navbarPlacements.indexOf("security-level-button");
+        if (secLevelIndex === -1) {
+          let urlbarIndex = navbarPlacements.indexOf("urlbar-container");
+          secLevelIndex = urlbarIndex + 1;
+          navbarPlacements.splice(secLevelIndex, 0, "security-level-button");
+        }
+        navbarPlacements.splice(secLevelIndex + 1, 0, "new-identity-button");
+      }
+    }
   },
 
   _updateForNewProtonVersion() {
@@ -2536,6 +2552,10 @@ var CustomizableUIInternal = {
       gSavedState.currentVersion = 0;
     }
 
+    if (!("currentTorVersion" in gSavedState)) {
+      gSavedState.currentTorVersion = 0;
+    }
+
     gSeenWidgets = new Set(gSavedState.seen || []);
     gDirtyAreaCache = new Set(gSavedState.dirtyAreaCache || []);
     gNewElementCount = gSavedState.newElementCount || 0;
@@ -2614,6 +2634,7 @@ var CustomizableUIInternal = {
       seen: gSeenWidgets,
       dirtyAreaCache: gDirtyAreaCache,
       currentVersion: kVersion,
+      currentTorVersion: kTorVersion,
       newElementCount: gNewElementCount,
     };
 
diff --git a/browser/themes/shared/icons/new_circuit.svg b/browser/themes/shared/icons/new_circuit.svg
new file mode 100644
index 0000000000000..e0a93cc83502c
--- /dev/null
+++ b/browser/themes/shared/icons/new_circuit.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>Icon / New Circuit at 1.5x</title>
+    <g id="Icon-/-New-Circuit" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <path d="M13.4411138,10.1446317 L9.5375349,10.1446317 C8.99786512,10.1446317 8.56164018,10.5818326 8.56164018,11.1205264 C8.56164018,11.6592203 8.99786512,12.0964212 9.5375349,12.0964212 L11.4571198,12.0964212 C10.7554515,13.0479185 9.73466563,13.692009 8.60067597,13.9359827 C8.41818366,13.9720908 8.23276366,14.0033194 8.04734366,14.0218614 C7.97219977,14.0277168 7.89803177,14.0306445 7.82288788,14.0335722 C6.07506044,14.137017 4.290149,13.4499871 3.38647049,11.857327 C2.52280367 [...]
+        <path d="M5.107,7.462 C4.405,8.078 4,8.946 4,9.839 C4,10.712 4.422,11.57 5.13,12.132 C5.724,12.607 6.627,12.898 7.642,12.949 L7.642,5.8 C7.39,6.029 7.103,6.227 6.791,6.387 C5.993,6.812 5.489,7.133 5.107,7.462" id="Fill-1" fill="context-fill" fill-opacity="context-fill-opacity"></path>
+    </g>
+</svg>
diff --git a/browser/themes/shared/icons/new_identity.svg b/browser/themes/shared/icons/new_identity.svg
new file mode 100644
index 0000000000000..91d5b35f7e80b
--- /dev/null
+++ b/browser/themes/shared/icons/new_identity.svg
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="16px" height="16px" viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>New Identity Icon</title>
+    <g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="New-Identity-Icon" fill="#000000" fill-rule="nonzero">
+            <path d="M4.65687153,14.5532899 L5.79494313,12.0855326 C5.8689125,11.9251399 5.6620883,11.7793527 5.53742729,11.9040137 L3.77194352,13.6694975 L2.32342782,12.2228406 L4.089841,10.4564274 C4.21450201,10.3317664 4.06871482,10.1249422 3.90832206,10.1989116 L1.43773764,11.338287 L0.206601383,10.1087306 C0.0509544211,9.9532834 -0.0167994233,9.75447206 0.00351451705,9.53432844 C0.0238284574,9.31418483 0.154794797,9.13897939 0.330406365,9.0302193 L4.61213917,6.53066101 C4.98542292,6 [...]
+        </g>
+    </g>
+</svg>
\ No newline at end of file
diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn
index 67ab42eeeecd9..0af8b9d4dffb6 100644
--- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn
@@ -225,3 +225,6 @@
   skin/classic/browser/places/tree-icons.css                   (../shared/places/tree-icons.css)
   skin/classic/browser/privatebrowsing/aboutPrivateBrowsing.css (../shared/privatebrowsing/aboutPrivateBrowsing.css)
   skin/classic/browser/privatebrowsing/favicon.svg             (../shared/privatebrowsing/favicon.svg)
+
+  skin/classic/browser/new_circuit.svg                         (../shared/icons/new_circuit.svg)
+  skin/classic/browser/new_identity.svg                        (../shared/icons/new_identity.svg)
diff --git a/browser/themes/shared/menupanel.inc.css b/browser/themes/shared/menupanel.inc.css
index 4629e5e868912..355477453773c 100644
--- a/browser/themes/shared/menupanel.inc.css
+++ b/browser/themes/shared/menupanel.inc.css
@@ -23,3 +23,11 @@
 #appMenu-fullscreen-button2[checked] {
   list-style-image: url(chrome://browser/skin/fullscreen-exit.svg);
 }
+
+#appMenuNewIdentity {
+  list-style-image: url("chrome://browser/skin/new_identity.svg");
+}
+
+#appMenuNewCircuit {
+  list-style-image: url("chrome://browser/skin/new_circuit.svg");
+}
diff --git a/browser/themes/shared/toolbarbutton-icons.inc.css b/browser/themes/shared/toolbarbutton-icons.inc.css
index d6d5ec8825aef..d198aa1d406a7 100644
--- a/browser/themes/shared/toolbarbutton-icons.inc.css
+++ b/browser/themes/shared/toolbarbutton-icons.inc.css
@@ -261,6 +261,14 @@ toolbar {
   list-style-image: url("chrome://browser/skin/new-tab.svg");
 }
 
+#new-identity-button {
+  list-style-image: url("chrome://browser/skin/new_identity.svg");
+}
+
+#new-circuit-button {
+  list-style-image: url("chrome://browser/skin/new_circuit.svg");
+}
+
 #privatebrowsing-button {
   list-style-image: url("chrome://browser/skin/privateBrowsing.svg");
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list