From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 9 May 2020 08:33:15 +0200 Subject: Add a flag to allow screenshots in Incognito mode See also: * https://github.com/bromite/bromite/issues/551 * https://bugs.chromium.org/p/chromium/issues/detail?id=920762 --- chrome/browser/about_flags.cc | 6 ++++++ chrome/browser/flag_descriptions.cc | 5 +++++ chrome/browser/flag_descriptions.h | 3 +++ .../flags/android/java_templates/ChromeSwitches.java.tmpl | 4 ---- chrome/common/chrome_switches.cc | 3 +++ chrome/common/chrome_switches.h | 1 + 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -5188,6 +5188,12 @@ const FeatureEntry kFeatureEntries[] = { SINGLE_VALUE_TYPE(switches::kEnableGPUServiceLogging)}, #if !defined(OS_ANDROID) +#if defined(OS_ANDROID) + {switches::kEnableIncognitoSnapshotsInAndroidRecents, flag_descriptions::kEnableIncognitoSnapshotsInAndroidRecentsName, + flag_descriptions::kEnableIncognitoSnapshotsInAndroidRecentsDescription, kOsAndroid, + SINGLE_VALUE_TYPE(switches::kEnableIncognitoSnapshotsInAndroidRecents)}, +#endif + {"hardware-media-key-handling", flag_descriptions::kHardwareMediaKeyHandling, flag_descriptions::kHardwareMediaKeyHandlingDescription, kOsDesktop, diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc @@ -522,6 +522,11 @@ const char kEnableAutofillCreditCardAuthenticationDescription[] = "authenticator (if available) to verify card ownership when retrieving " "credit cards from Google Payments."; +const char kEnableIncognitoSnapshotsInAndroidRecentsName[] = + "Enable Incognito snapshots in Android Recents"; +const char kEnableIncognitoSnapshotsInAndroidRecentsDescription[] = + "Enable the secure flag for Incognito tabs which prevent taking screenshots and seeing snapshots in Android Recents."; + const char kEnableAutofillInfoBarAccountIndicationFooterForSingleAccountUsersName[] = "Display InfoBar footers with account indication information for " diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h @@ -321,6 +321,9 @@ extern const char kEnableAutofillCacheServerCardInfoDescription[]; extern const char kEnableAutofillCreditCardAblationExperimentDisplayName[]; extern const char kEnableAutofillCreditCardAblationExperimentDescription[]; +extern const char kEnableIncognitoSnapshotsInAndroidRecentsName[]; +extern const char kEnableIncognitoSnapshotsInAndroidRecentsDescription[]; + extern const char kEnableAutofillCreditCardAuthenticationName[]; extern const char kEnableAutofillCreditCardAuthenticationDescription[]; diff --git a/chrome/browser/flags/android/java_templates/ChromeSwitches.java.tmpl b/chrome/browser/flags/android/java_templates/ChromeSwitches.java.tmpl --- a/chrome/browser/flags/android/java_templates/ChromeSwitches.java.tmpl +++ b/chrome/browser/flags/android/java_templates/ChromeSwitches.java.tmpl @@ -144,10 +144,6 @@ public abstract class ChromeSwitches {{ /** Switch for enabling the Chrome Survey. */ public static final String CHROME_FORCE_ENABLE_SURVEY = "force-enable-chrome-survey"; - /** Switch to enable incognito tabs to be seen in Android Recents. */ - public static final String ENABLE_INCOGNITO_SNAPSHOTS_IN_ANDROID_RECENTS = - "enable-incognito-snapshots-in-android-recents"; - /** Open all custom tabs in a new task. Used only for experimental purposes. */ public static final String OPEN_CUSTOM_TABS_IN_NEW_TASK = "open-custom-tabs-in-new-task"; diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -324,6 +324,9 @@ const char kHomePage[] = "homepage"; // Causes the browser to launch directly in incognito mode. const char kIncognito[] = "incognito"; +// Allows incognito tabs to be seen in Android Recents and thus user screenshots. +const char kEnableIncognitoSnapshotsInAndroidRecents[] = "enable-incognito-snapshots-in-android-recents"; + // Installs an autogenerated theme based on the given RGB value. // The format is "r,g,b", where r, g, b are a numeric values from 0 to 255. const char kInstallAutogeneratedTheme[] = "install-autogenerated-theme"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -108,6 +108,7 @@ extern const char kForceFirstRun[]; extern const char kForceStackedTabStripLayout[]; extern const char kHomePage[]; extern const char kIncognito[]; +extern const char kEnableIncognitoSnapshotsInAndroidRecents[]; extern const char kInstallAutogeneratedTheme[]; extern const char kInstallChromeApp[]; extern const char kInstallSupervisedUserAllowlists[]; -- 2.17.1