Skip to content

Commit

Permalink
new feature new identity for more privacy
Browse files Browse the repository at this point in the history
Ponchale committed Nov 26, 2024
1 parent 979d35e commit 0ce1da3
Showing 18 changed files with 713 additions and 2 deletions.
5 changes: 4 additions & 1 deletion browser/app/profile/firefox.js
Original file line number Diff line number Diff line change
@@ -1519,7 +1519,10 @@ pref("browser.bookmarks.editDialog.maxRecentFolders", 7);

pref("browser.taskbar.lists.legacyBackend", false);

pref("browser.taskbar.lists.enabled", true);
// Log levels
pref("browser.new_identity.log_level", "Info");

pref("browser.taskbar.lists.enabled", false);
pref("browser.taskbar.lists.frequent.enabled", true);
pref("browser.taskbar.lists.recent.enabled", false);
pref("browser.taskbar.lists.maxListItemCount", 7);
4 changes: 4 additions & 0 deletions browser/base/content/appmenu-viewcache.inc.xhtml
Original file line number Diff line number Diff line change
@@ -47,6 +47,10 @@
data-l10n-id="appmenuitem-new-private-window"
key="key_privatebrowsing"
command="Tools:PrivateBrowsing"/>
<toolbarbutton id="appMenu-new-identity"
class="subviewbutton"
data-l10n-id="appmenuitem-new-identity"
key="new-identity-key"/>
<toolbarseparator/>

<!-- Floorp Injections +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
5 changes: 5 additions & 0 deletions browser/base/content/browser-init.js
Original file line number Diff line number Diff line change
@@ -233,6 +233,9 @@ var gBrowserInit = {
// doesn't flicker as the window is being shown.
DownloadsButton.init();

// Init the NewIdentityButton
NewIdentityButton.init();

// Certain kinds of automigration rely on this notification to complete
// their tasks BEFORE the browser window is shown. SessionStore uses it to
// restore tabs into windows AFTER important parts like gMultiProcessBrowser
@@ -1128,6 +1131,8 @@ var gBrowserInit = {

DownloadsButton.uninit();

NewIdentityButton.uninit();

if (gToolbarKeyNavEnabled) {
ToolbarKeyboardNavigator.uninit();
}
4 changes: 4 additions & 0 deletions browser/base/content/browser-menubar.inc
Original file line number Diff line number Diff line change
@@ -28,6 +28,10 @@
<menuitem id="menu_newPrivateWindow"
command="Tools:PrivateBrowsing"
key="key_privatebrowsing" data-l10n-id="menu-file-new-private-window"/>
<menuseparator/>
<menuitem id="menu_newIdentity"
key="new-identity-key" data-l10n-id="menu-new-identity"/>

<menuitem id="menu_openLocation"
hidden="true"
command="Browser:OpenLocation"
1 change: 1 addition & 0 deletions browser/base/content/browser-sets.inc
Original file line number Diff line number Diff line change
@@ -391,4 +391,5 @@
modifiers="accel,alt"
internal="true"/>
#endif
<key id="new-identity-key" modifiers="accel shift" key="U" oncommand="NewIdentityButton.onCommand(event)"/>
</keyset>
5 changes: 5 additions & 0 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
@@ -247,6 +247,11 @@ XPCOMUtils.defineLazyScriptGetter(
["DownloadsButton", "DownloadsIndicatorView"],
"chrome://browser/content/downloads/indicator.js"
);
XPCOMUtils.defineLazyScriptGetter(
this,
["NewIdentityButton"],
"chrome://browser/content/newidentity.js"
);
XPCOMUtils.defineLazyScriptGetter(
this,
"gEditItemOverlay",
3 changes: 2 additions & 1 deletion browser/base/content/browser.js.globals
Original file line number Diff line number Diff line change
@@ -274,5 +274,6 @@
"gFindBar",
"gFindBarInitialized",
"gFindBarPromise",
"BrowserSearch"
"BrowserSearch",
"NewIdentityButton"
]
5 changes: 5 additions & 0 deletions browser/base/content/navigator-toolbox.inc.xhtml
Original file line number Diff line number Diff line change
@@ -587,6 +587,11 @@
ondragover="newWindowButtonObserver.onDragOver(event)"
ondragenter="newWindowButtonObserver.onDragOver(event)"/>


<toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
data-l10n-id="toolbar-new-identity"/>


<toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
observes="View:FullScreen"
type="checkbox"
1 change: 1 addition & 0 deletions browser/components/moz.build
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ DIRS += [
"ion",
"messagepreview",
"migration",
"newidentity",
"newtab",
"originattributes",
"pagedata",
8 changes: 8 additions & 0 deletions browser/components/newidentity/content/newIdentityDialog.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#infoTitle {
font-weight: 600;
}

19 changes: 19 additions & 0 deletions browser/components/newidentity/content/newIdentityDialog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

document.addEventListener("dialogaccept", () => {
const retvals = window.arguments[0];
retvals.confirmed = true;
retvals.neverAskAgain = document.getElementById("neverAskAgain").checked;
});

document.addEventListener("DOMContentLoaded", () => {
const dialog = document.getElementById("newIdentityDialog");

const accept = dialog.getButton("accept");
document.l10n.setAttributes(accept, "new-identity-dialog-confirm");
accept.classList.add("danger-button");
});


63 changes: 63 additions & 0 deletions browser/components/newidentity/content/newIdentityDialog.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0"?>

<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<!-- based on resetProfile.xhtml -->

<window
id="newIdentityDialogWindow"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
aria-labelledby="infoTitle"
aria-describedby="infoBody"
>
<dialog id="newIdentityDialog" buttons="accept,cancel" defaultButton="accept">
<linkset>
<html:link rel="stylesheet" href="chrome://global/skin/global.css" />
<html:link
rel="stylesheet"
href="chrome://global/content/commonDialog.css"
/>
<html:link
rel="stylesheet"
href="chrome://global/skin/commonDialog.css"
/>
<html:link
rel="stylesheet"
href="chrome://browser/content/newIdentityDialog.css"
/>

<html:link rel="localization" href="branding/brand.ftl" />
<html:link rel="localization" href="toolkit/global/base-browser.ftl" />
</linkset>

<div xmlns="http://www.w3.org/1999/xhtml">
<div id="dialogGrid">
<div class="dialogRow" id="infoRow">
<div id="iconContainer">
<xul:image id="infoIcon" />
</div>
<div id="infoContainer">
<xul:description
id="infoTitle"
data-l10n-id="new-identity-dialog-title"
/>
<xul:description
id="infoBody"
data-l10n-id="new-identity-dialog-description"
/>
<xul:checkbox
id="neverAskAgain"
data-l10n-id="new-identity-dialog-never-ask-checkbox"
/>
</div>
</div>
</div>
</div>

<script src="chrome://browser/content/newIdentityDialog.js" />
</dialog>
</window>
Loading

0 comments on commit 0ce1da3

Please sign in to comment.