From 83f4549190ddf87aeed90caa6efb7078da52cbaf Mon Sep 17 00:00:00 2001 From: Ben Hearsum Date: Thu, 8 Sep 2022 13:09:10 +0000 Subject: [PATCH] Bug 1782295: Use Nimbus for Felt Privacy window separation r=dao We'll be defaulting Felt Privacy features to enabled, and allowing them to be disabled by Nimbus (primarily for a holdback study). Differential Revision: https://phabricator.services.mozilla.com/D153275 --- browser/app/profile/firefox.js | 5 ++--- browser/components/BrowserContentHandler.jsm | 13 ++++++------- browser/components/BrowserGlue.jsm | 6 +++--- toolkit/components/nimbus/FeatureManifest.yaml | 4 ++++ widget/windows/nsWindow.cpp | 5 +++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 4120685ff5ba..6b4476d163b9 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -653,9 +653,8 @@ pref("browser.privatebrowsing.enable-new-logo", true); pref("browser.dataFeatureRecommendations.enabled", false); // Temporary pref to control whether or not Private Browsing windows show up -// as separate icons in the Windows taskbar. This will be removed and become -// the default behaviour with 106. -pref("browser.privacySegmentation.windowSeparation.enabled", false); +// as separate icons in the Windows taskbar. +pref("browser.privacySegmentation.windowSeparation.enabled", true); // Use dark theme variant for PBM windows. This is only supported if the theme // sets darkTheme data. diff --git a/browser/components/BrowserContentHandler.jsm b/browser/components/BrowserContentHandler.jsm index 0f1a9ca39c6d..974692ca479d 100644 --- a/browser/components/BrowserContentHandler.jsm +++ b/browser/components/BrowserContentHandler.jsm @@ -22,6 +22,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, { HomePage: "resource:///modules/HomePage.jsm", FirstStartup: "resource://gre/modules/FirstStartup.jsm", LaterRun: "resource:///modules/LaterRun.jsm", + NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm", PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm", SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm", ShellService: "resource:///modules/ShellService.jsm", @@ -54,8 +55,6 @@ const ONCE_PREF = "browser.startup.homepage_override.once"; // Index of Private Browsing icon in firefox.exe // Must line up with the one in nsNativeAppSupportWin.h. const PRIVATE_BROWSING_ICON_INDEX = 5; -const PRIVATE_WINDOW_SEPARATION_PREF = - "browser.privacySegmentation.windowSeparation.enabled"; function shouldLoadURI(aURI) { if (aURI && !aURI.schemeIs("chrome")) { @@ -293,11 +292,11 @@ function openBrowserWindow( win.docShell.QueryInterface( Ci.nsILoadContext ).usePrivateBrowsing = true; - if (Services.prefs.getBoolPref(PRIVATE_WINDOW_SEPARATION_PREF)) { - // TODO: Changing this after the Window has been painted causes it to - // change Taskbar icons if the original one had a different AUMID. - // This must stay pref'ed off until this is resolved. - // https://bugzilla.mozilla.org/show_bug.cgi?id=1751010 + if ( + lazy.NimbusFeatures.majorRelease2022.getVariable( + "feltPrivacyWindowSeparation" + ) + ) { lazy.WinTaskbar.setGroupIdForWindow( win, lazy.WinTaskbar.defaultPrivateGroupId diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm index f2ea2b025b7f..63dab93da07c 100644 --- a/browser/components/BrowserGlue.jsm +++ b/browser/components/BrowserGlue.jsm @@ -143,8 +143,6 @@ const PRIVATE_BROWSING_BINARY = "private_browsing.exe"; // Index of Private Browsing icon in private_browsing.exe // Must line up with IDI_PBICON_PB_PB_EXE in nsNativeAppSupportWin.h. const PRIVATE_BROWSING_EXE_ICON_INDEX = 1; -const PREF_PRIVATE_WINDOW_SEPARATION = - "browser.privacySegmentation.windowSeparation.enabled"; const PREF_PRIVATE_BROWSING_SHORTCUT_CREATED = "browser.privacySegmentation.createdShortcut"; @@ -2536,7 +2534,9 @@ BrowserGlue.prototype = { // Pref'ed off until Private Browsing window separation is enabled by default // to avoid a situation where a user pins the Private Browsing shortcut to // the Taskbar, which will end up launching into a different Taskbar icon. - Services.prefs.getBoolPref(PREF_PRIVATE_WINDOW_SEPARATION, false) && + lazy.NimbusFeatures.majorRelease2022.getVariable( + "feltPrivacyWindowSeparation" + ) && // Private Browsing shortcuts for packaged builds come with the package, // if they exist at all. We shouldn't try to create our own. !Services.sysinfo.getProperty("hasWinPackageId") && diff --git a/toolkit/components/nimbus/FeatureManifest.yaml b/toolkit/components/nimbus/FeatureManifest.yaml index 7a949738c4de..91fec9781dfb 100644 --- a/toolkit/components/nimbus/FeatureManifest.yaml +++ b/toolkit/components/nimbus/FeatureManifest.yaml @@ -614,6 +614,10 @@ majorRelease2022: type: boolean fallbackPref: "browser.privacySegmentation.preferences.show" description: "Controls visibility of the privacy segmentation preferences section." + feltPrivacyWindowSeparation: + type: boolean + fallbackPref: "browser.privacySegmentation.windowSeparation.enabled" + description: "Whether or not private browsing windows use a separate icon in the Windows taskbar" colorwayCloset: type: boolean fallbackPref: "browser.theme.colorway-closet" diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index 615b671badaa..e1ddf7a6fa68 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -160,6 +160,7 @@ #include "mozilla/StaticPrefs_layout.h" #include "mozilla/StaticPrefs_widget.h" #include "nsNativeAppSupportWin.h" +#include "mozilla/browser/NimbusFeatures.h" #include "nsIGfxInfo.h" #include "nsUXThemeConstants.h" @@ -1112,8 +1113,8 @@ nsresult nsWindow::Create(nsIWidget* aParent, nsNativeWidget aNativeParent, } if (aInitData->mIsPrivate) { - if (Preferences::GetBool( - "browser.privacySegmentation.windowSeparation.enabled", false) && + if (NimbusFeatures::GetBool("majorRelease2022"_ns, + "feltPrivacyWindowSeparation"_ns, true) && // Although permanent Private Browsing mode is indeed Private Browsing, // we choose to make it look like regular Firefox in terms of the icon // it uses (which also means we shouldn't use the Private Browsing