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

gitolite role git at cupani.torproject.org
Thu Oct 20 14:33:31 UTC 2022


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

richard pushed a commit to branch geckoview-102.4.0esr-11.5-1
in repository tor-browser.

commit e130995894351cfd6fe3e8278f8e76b32cc1289d
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.css                 |  8 ++++++++
 browser/themes/shared/toolbarbutton-icons.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 4e216ac82508..d39c05a5e087 100644
--- a/browser/base/content/navigator-toolbox.inc.xhtml
+++ b/browser/base/content/navigator-toolbox.inc.xhtml
@@ -537,6 +537,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 26f59d02d3ef..66da9d8cffc0 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
@@ -609,6 +611,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() {
@@ -2501,6 +2517,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;
@@ -2579,6 +2599,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 000000000000..e0a93cc83502
--- /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 000000000000..91d5b35f7e80
--- /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 833b3d03ad6b..879099195842 100644
--- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn
@@ -262,3 +262,6 @@
   skin/classic/browser/privatebrowsing/favicon.svg             (../shared/privatebrowsing/favicon.svg)
 
   skin/classic/browser/syncedtabs/sidebar.css                  (../shared/syncedtabs/sidebar.css)
+
+  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.css b/browser/themes/shared/menupanel.css
index e20b3cfaa433..c755990d1a84 100644
--- a/browser/themes/shared/menupanel.css
+++ b/browser/themes/shared/menupanel.css
@@ -25,3 +25,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.css b/browser/themes/shared/toolbarbutton-icons.css
index a4d40af3b421..b2cb4d277e1e 100644
--- a/browser/themes/shared/toolbarbutton-icons.css
+++ b/browser/themes/shared/toolbarbutton-icons.css
@@ -263,6 +263,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