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
This commit is contained in:
Ben Hearsum 2022-09-08 13:09:10 +00:00
Родитель 5dca28c108
Коммит 83f4549190
5 изменённых файлов: 18 добавлений и 15 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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") &&

Просмотреть файл

@ -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"

Просмотреть файл

@ -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