Add account consistency flag for Desktop Identity Consistency.
This CL changes the account consistency flag to allow 2 options (Mirror
and Dice).
As Mirror is still an experimental feature that never launched on Desktop,
this CL simply removes the switch used to enable Mirror ("--enable-account-consistency")
and replaces it with ("--account-consistency") with 2 possible values ("mirror"
or "dice"). This avoid issues on startup when for users that have turned on Mirror
in chrome://flags.
TBR=pkasting,scottbyer,yhirano
BUG=728651
Review-Url: https://codereview.chromium.org/2916113002
Cr-Commit-Position: refs/heads/master@{#476673}
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index e185ebc1..99636416 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -303,6 +303,16 @@
{flag_descriptions::kDefaultTileHeightVenti, switches::kDefaultTileHeight,
"1024"}};
+#if !defined(OS_ANDROID)
+const FeatureEntry::Choice kAccountConsistencyChoices[] = {
+ {flags_ui::kGenericExperimentChoiceDefault, "", ""},
+ {flag_descriptions::kAccountConsistencyChoiceMirror,
+ switches::kAccountConsistency, switches ::kAccountConsistencyMirror},
+ {flag_descriptions::kAccountConsistencyChoiceDice,
+ switches::kAccountConsistency, switches::kAccountConsistencyDice},
+};
+#endif
+
const FeatureEntry::Choice kSimpleCacheBackendChoices[] = {
{flags_ui::kGenericExperimentChoiceDefault, "", ""},
{flags_ui::kGenericExperimentChoiceDisabled,
@@ -1672,8 +1682,8 @@
SINGLE_VALUE_TYPE(switches::kEnableWebGLDraftExtensions)},
#if !defined(OS_ANDROID)
{"enable-account-consistency", flag_descriptions::kAccountConsistencyName,
- flag_descriptions::kAccountConsistencyDescription, kOsDesktop,
- SINGLE_VALUE_TYPE(switches::kEnableAccountConsistency)},
+ flag_descriptions::kAccountConsistencyDescription,
+ kOsWin | kOsLinux | kOsMac, MULTI_VALUE_TYPE(kAccountConsistencyChoices)},
#endif
#if BUILDFLAG(ENABLE_APP_LIST)
{"reset-app-list-install-state",
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index 81d4b8e3..381a31ee 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -1725,13 +1725,6 @@
"Enable custom layouts for Web Notifications. They will have subtle "
"layout improvements that are otherwise not possible.";
-const char kAccountConsistencyName[] =
- "Identity consistency between browser and cookie jar";
-
-const char kAccountConsistencyDescription[] =
- "When enabled, the browser manages signing in and out of Google "
- "accounts.";
-
const char kGoogleProfileInfoName[] = "Google profile name and icon";
const char kGoogleProfileInfoDescription[] =
@@ -3203,6 +3196,16 @@
#if !defined(OS_ANDROID) && !defined(OS_IOS)
+const char kAccountConsistencyName[] =
+ "Identity consistency between browser and cookie jar";
+
+const char kAccountConsistencyDescription[] =
+ "When enabled, the browser manages signing in and out of Google "
+ "accounts.";
+
+const char kAccountConsistencyChoiceMirror[] = "Mirror";
+const char kAccountConsistencyChoiceDice[] = "Dice";
+
const char kUseGoogleLocalNtpName[] = "Enable using the Google local NTP";
const char kUseGoogleLocalNtpDescription[] =
"Use the local New Tab page if Google is the default search engine.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index a6f9845..2f609a6 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -34,9 +34,6 @@
extern const char kAcceleratedVideoDecodeName[];
extern const char kAcceleratedVideoDecodeDescription[];
-extern const char kAccountConsistencyName[];
-extern const char kAccountConsistencyDescription[];
-
extern const char kAddToShelfName[];
extern const char kAddToShelfDescription[];
@@ -1400,6 +1397,13 @@
extern const char kUseGoogleLocalNtpName[];
extern const char kUseGoogleLocalNtpDescription[];
+extern const char kAccountConsistencyName[];
+extern const char kAccountConsistencyDescription[];
+
+// Choices for enable account consistency flag
+extern const char kAccountConsistencyChoiceMirror[];
+extern const char kAccountConsistencyChoiceDice[];
+
#endif
// Random platform combinations -----------------------------------------------
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate_browsertest.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate_browsertest.cc
index 412147f..33601bb 100644
--- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate_browsertest.cc
+++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate_browsertest.cc
@@ -482,7 +482,7 @@
MirrorRequestHeader) {
// Enable account consistency so that mirror actually sets the
// X-Chrome-Connected header in requests to Google.
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
browser()->profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index caefbf2..c01239d 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -71,7 +71,7 @@
bool add_account,
const base::Closure& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- if (switches::IsEnableAccountConsistency() &&
+ if (switches::IsAccountConsistencyMirrorEnabled() &&
!browser->profile()->IsOffTheRecord()) {
browser->window()->ShowAvatarBubbleFromAvatarButton(
add_account ? BrowserWindow::AVATAR_BUBBLE_MODE_ADD_ACCOUNT
diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc
index 77e10c2..11ea969 100644
--- a/chrome/browser/signin/chrome_signin_client.cc
+++ b/chrome/browser/signin/chrome_signin_client.cc
@@ -197,7 +197,7 @@
}
bool ChromeSigninClient::ShouldMergeSigninCredentialsIntoCookieJar() {
- return !switches::IsEnableAccountConsistency();
+ return !switches::IsAccountConsistencyMirrorEnabled();
}
std::string ChromeSigninClient::GetProductVersion() {
diff --git a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
index 9528395..a0144c8 100644
--- a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
+++ b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc
@@ -428,7 +428,7 @@
}
// Only load secondary accounts when account consistency is enabled.
- if (switches::IsEnableAccountConsistency() ||
+ if (switches::IsAccountConsistencyMirrorEnabled() ||
account_id == loading_primary_account_id_) {
refresh_tokens_[account_id].reset(new AccountStatus(
signin_error_controller_, account_id, refresh_token));
diff --git a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc
index 88e0f13..a1d51a5 100644
--- a/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc
+++ b/chrome/browser/signin/mutable_profile_oauth2_token_service_delegate_unittest.cc
@@ -181,7 +181,7 @@
AddAuthTokenManually(GaiaConstants::kGaiaOAuth2LoginRefreshToken,
main_refresh_token);
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
// Force LoadCredentials.
@@ -296,7 +296,7 @@
TEST_F(MutableProfileOAuth2TokenServiceDelegateTest,
PersistenceLoadCredentials) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
// Ensure DB is clean.
@@ -505,7 +505,7 @@
tokens["[email protected]"] = "refresh_token";
tokens["AccountId-12345"] = "refresh_token";
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
oauth2_service_delegate_->LoadAllCredentialsIntoMemory(tokens);
@@ -522,7 +522,7 @@
tokens["[email protected]"] = "bad_token";
tokens["[email protected]"] = "good_token";
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
oauth2_service_delegate_->LoadAllCredentialsIntoMemory(tokens);
@@ -535,7 +535,7 @@
}
TEST_F(MutableProfileOAuth2TokenServiceDelegateTest, ShutdownService) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
EXPECT_TRUE(oauth2_service_delegate_->GetAccounts().empty());
oauth2_service_delegate_->UpdateCredentials("account_id1", "refresh_token1");
@@ -558,7 +558,7 @@
std::string email = "[email protected]";
std::string gaia_id = "foo's gaia id";
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
pref_service_.SetInteger(prefs::kAccountIdMigrationState,
AccountTrackerService::MIGRATION_NOT_STARTED);
@@ -617,7 +617,7 @@
std::string email2 = "[email protected]";
std::string gaia_id2 = "bar's gaia id";
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
pref_service_.SetInteger(prefs::kAccountIdMigrationState,
AccountTrackerService::MIGRATION_NOT_STARTED);
@@ -704,7 +704,7 @@
ResetObserverCounts();
AddAuthTokenManually("AccountId-" + primary_account, "refresh_token");
AddAuthTokenManually("AccountId-" + secondary_account, "refresh_token");
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
oauth2_service_delegate_->LoadCredentials(primary_account);
base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/signin/signin_promo.cc b/chrome/browser/signin/signin_promo.cc
index ceb20549..cfbc4eb 100644
--- a/chrome/browser/signin/signin_promo.cc
+++ b/chrome/browser/signin/signin_promo.cc
@@ -317,7 +317,7 @@
url, kSignInPromoQueryKeyShowAccountManagement, &value)) {
int enabled = 0;
if (base::StringToInt(value, &enabled) && enabled == 1)
- return switches::IsEnableAccountConsistency();
+ return switches::IsAccountConsistencyMirrorEnabled();
}
return false;
}
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
index 462bca4..91dabc8 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -369,9 +369,9 @@
viewMode == profiles::BUBBLE_VIEW_MODE_GAIA_ADD_ACCOUNT ||
viewMode == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) {
[controller_ initMenuContentsWithView:
- switches::IsEnableAccountConsistency() ?
- profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
- profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER];
+ switches::IsAccountConsistencyMirrorEnabled()
+ ? profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT
+ : profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER];
}
}
@@ -844,8 +844,8 @@
- (IBAction)navigateBackFromSigninPage:(id)sender {
std::string primaryAccount = SigninManagerFactory::GetForProfile(
browser_->profile())->GetAuthenticatedAccountId();
- bool hasAccountManagement = !primaryAccount.empty() &&
- switches::IsEnableAccountConsistency();
+ bool hasAccountManagement =
+ !primaryAccount.empty() && switches::IsAccountConsistencyMirrorEnabled();
[self initMenuContentsWithView:hasAccountManagement ?
profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER];
@@ -992,9 +992,9 @@
// ACCOUNT_MANAGEMENT mode.
if (viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER &&
HasAuthError(browser_->profile()) &&
- switches::IsEnableAccountConsistency() &&
- avatarMenu_->GetItemAt(avatarMenu_->GetActiveProfileIndex()).
- signed_in) {
+ switches::IsAccountConsistencyMirrorEnabled() &&
+ avatarMenu_->GetItemAt(avatarMenu_->GetActiveProfileIndex())
+ .signed_in) {
viewMode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
}
@@ -1309,7 +1309,7 @@
SigninManagerBase* signinManager = SigninManagerFactory::GetForProfile(
browser_->profile()->GetOriginalProfile());
NSRect profileLinksBound = NSZeroRect;
- if (item.signed_in && switches::IsEnableAccountConsistency()) {
+ if (item.signed_in && switches::IsAccountConsistencyMirrorEnabled()) {
profileLinksBound = NSMakeRect(0, 0, kFixedMenuWidth, kVerticalSpacing);
} else if (!item.signed_in && signinManager->IsSigninAllowed()) {
profileLinksBound = NSMakeRect(xOffset, kRelatedControllVerticalSpacing,
@@ -1409,7 +1409,7 @@
// Username, aligned to the leading edge of the profile icon and
// below the profile name.
- if (item.signed_in && !switches::IsEnableAccountConsistency()) {
+ if (item.signed_in && !switches::IsAccountConsistencyMirrorEnabled()) {
// Adjust the y-position of profile name to leave space for username.
cardYOffset += kMdImageSide / 2 - [profileName frame].size.height;
[profileName setFrameOrigin:NSMakePoint(xOffset, cardYOffset)];
@@ -1443,7 +1443,7 @@
// here.
SigninManagerBase* signinManager = SigninManagerFactory::GetForProfile(
browser_->profile()->GetOriginalProfile());
- DCHECK((item.signed_in && switches::IsEnableAccountConsistency()) ||
+ DCHECK((item.signed_in && switches::IsAccountConsistencyMirrorEnabled()) ||
(!item.signed_in && signinManager->IsSigninAllowed()));
base::scoped_nsobject<NSView> container([[NSView alloc] initWithFrame:rect]);
@@ -1458,7 +1458,7 @@
// The available links depend on the type of profile that is active.
if (item.signed_in) {
NSButton* link = nil;
- if (switches::IsEnableAccountConsistency()) {
+ if (switches::IsAccountConsistencyMirrorEnabled()) {
NSString* linkTitle = l10n_util::GetNSString(
viewMode_ == profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER ?
IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON :
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
index 0f74dcee..c939857 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
@@ -217,7 +217,7 @@
TEST_F(ProfileChooserControllerTest,
SignedInProfileActiveCardLinksWithAccountConsistency) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
SignInFirstProfile();
@@ -261,7 +261,7 @@
}
TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
SignInFirstProfile();
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
index ba4f2141..918acaa 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -611,11 +611,10 @@
// If view mode is PROFILE_CHOOSER but there is an auth error, force
// ACCOUNT_MANAGEMENT mode.
- if (IsProfileChooser(view_mode_) &&
- HasAuthError(browser_->profile()) &&
- switches::IsEnableAccountConsistency() &&
- avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex()).
- signed_in) {
+ if (IsProfileChooser(view_mode_) && HasAuthError(browser_->profile()) &&
+ switches::IsAccountConsistencyMirrorEnabled() &&
+ avatar_menu_->GetItemAt(avatar_menu_->GetActiveProfileIndex())
+ .signed_in) {
view_mode_ = profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT;
}
@@ -656,9 +655,9 @@
view_mode_ == profiles::BUBBLE_VIEW_MODE_GAIA_REAUTH) {
// The account management UI is only available through the
// --enable-account-consistency flag.
- ShowViewFromMode(switches::IsEnableAccountConsistency() ?
- profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
- profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER);
+ ShowViewFromMode(switches::IsAccountConsistencyMirrorEnabled()
+ ? profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT
+ : profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER);
}
}
@@ -674,7 +673,7 @@
// The account management view should only be displayed if the active profile
// is signed in.
if (view_to_display == profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT) {
- DCHECK(switches::IsEnableAccountConsistency());
+ DCHECK(switches::IsAccountConsistencyMirrorEnabled());
const AvatarMenu::Item& active_item = avatar_menu->GetItemAt(
avatar_menu->GetActiveProfileIndex());
if (!active_item.signed_in) {
@@ -833,9 +832,9 @@
// The account management view is only available with the
// --enable-account-consistency flag.
bool account_management_available =
- SigninManagerFactory::GetForProfile(browser_->profile())->
- IsAuthenticated() &&
- switches::IsEnableAccountConsistency();
+ SigninManagerFactory::GetForProfile(browser_->profile())
+ ->IsAuthenticated() &&
+ switches::IsAccountConsistencyMirrorEnabled();
ShowViewFromMode(account_management_available ?
profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT :
profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER);
@@ -1108,8 +1107,9 @@
views::GridLayout::USE_PREF, 0, 0);
grid_layout->AddPaddingRow(0, 0);
const int num_labels =
- (avatar_item.signed_in && !switches::IsEnableAccountConsistency()) ? 2
- : 1;
+ (avatar_item.signed_in && !switches::IsAccountConsistencyMirrorEnabled())
+ ? 2
+ : 1;
int profile_card_height =
kImageSide + 2 * (kBadgeSpacing + vertical_spacing_small);
const int line_height = profile_card_height / num_labels;
@@ -1153,7 +1153,7 @@
// The available links depend on the type of profile that is active.
if (avatar_item.signed_in) {
- if (switches::IsEnableAccountConsistency()) {
+ if (switches::IsAccountConsistencyMirrorEnabled()) {
base::string16 button_text = l10n_util::GetStringUTF16(
IsProfileChooser(view_mode_)
? IDS_PROFILES_PROFILE_MANAGE_ACCOUNTS_BUTTON
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
index 710dcd91..a499f47 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
@@ -1783,7 +1783,8 @@
void PrintPreviewHandler::RegisterForGaiaCookieChanges() {
DCHECK(!gaia_cookie_manager_service_);
Profile* profile = Profile::FromWebUI(web_ui());
- if (switches::IsEnableAccountConsistency() && !profile->IsOffTheRecord()) {
+ if (switches::IsAccountConsistencyMirrorEnabled() &&
+ !profile->IsOffTheRecord()) {
gaia_cookie_manager_service_ =
GaiaCookieManagerServiceFactory::GetForProfile(profile);
if (gaia_cookie_manager_service_)
diff --git a/components/signin/core/browser/about_signin_internals.cc b/components/signin/core/browser/about_signin_internals.cc
index cdd9a4cf..ade203bf 100644
--- a/components/signin/core/browser/about_signin_internals.cc
+++ b/components/signin/core/browser/about_signin_internals.cc
@@ -533,8 +533,9 @@
base::ListValue* basic_info =
AddSection(signin_info.get(), "Basic Information");
AddSectionEntry(basic_info, "Chrome Version", product_version);
- AddSectionEntry(basic_info, "Account Consistency?",
- switches::IsEnableAccountConsistency() == true ? "On" : "Off");
+ AddSectionEntry(
+ basic_info, "Account Consistency?",
+ switches::IsAccountConsistencyMirrorEnabled() == true ? "On" : "Off");
AddSectionEntry(basic_info, "Signin Status",
signin_manager->IsAuthenticated() ? "Signed In" : "Not Signed In");
OAuth2TokenServiceDelegate::LoadCredentialsState load_tokens_state =
diff --git a/components/signin/core/browser/account_reconcilor.cc b/components/signin/core/browser/account_reconcilor.cc
index 5a0170e..34731af 100644
--- a/components/signin/core/browser/account_reconcilor.cc
+++ b/components/signin/core/browser/account_reconcilor.cc
@@ -241,7 +241,7 @@
}
void AccountReconcilor::PerformMergeAction(const std::string& account_id) {
- if (!switches::IsEnableAccountConsistency()) {
+ if (!switches::IsAccountConsistencyMirrorEnabled()) {
MarkAccountAsAddedToCookie(account_id);
return;
}
@@ -250,7 +250,7 @@
}
void AccountReconcilor::PerformLogoutAllAccountsAction() {
- if (!switches::IsEnableAccountConsistency())
+ if (!switches::IsAccountConsistencyMirrorEnabled())
return;
VLOG(1) << "AccountReconcilor::PerformLogoutAllAccountsAction";
cookie_manager_service_->LogOutAllAccounts(kSource);
diff --git a/components/signin/core/browser/signin_header_helper.cc b/components/signin/core/browser/signin_header_helper.cc
index c4faffb2..8fdfcd6 100644
--- a/components/signin/core/browser/signin_header_helper.cc
+++ b/components/signin/core/browser/signin_header_helper.cc
@@ -121,7 +121,8 @@
return false;
GURL origin(url.GetOrigin());
- bool is_enable_account_consistency = switches::IsEnableAccountConsistency();
+ bool is_enable_account_consistency =
+ switches::IsAccountConsistencyMirrorEnabled();
bool is_google_url = is_enable_account_consistency &&
(google_util::IsGoogleDomainUrl(
url, google_util::ALLOW_SUBDOMAIN,
@@ -169,7 +170,7 @@
base::IntToString(profile_mode_mask).c_str()));
parts.push_back(base::StringPrintf(
"%s=%s", kEnableAccountConsistencyAttrName,
- switches::IsEnableAccountConsistency() ? "true" : "false"));
+ switches::IsAccountConsistencyMirrorEnabled() ? "true" : "false"));
return base::JoinString(parts, is_header_request ? "," : ":");
}
@@ -283,7 +284,7 @@
return empty_params;
}
- DCHECK(switches::IsEnableAccountConsistency() && !is_off_the_record);
+ DCHECK(switches::IsAccountConsistencyMirrorEnabled() && !is_off_the_record);
return BuildManageAccountsParams(header_value);
}
diff --git a/components/signin/core/browser/signin_header_helper_unittest.cc b/components/signin/core/browser/signin_header_helper_unittest.cc
index 2d07047..92f4f29 100644
--- a/components/signin/core/browser/signin_header_helper_unittest.cc
+++ b/components/signin/core/browser/signin_header_helper_unittest.cc
@@ -71,7 +71,7 @@
// Tests that no Mirror request is returned when the user is not signed in (no
// account id).
TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestNoAccountId) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "", "");
CheckMirrorCookieRequest(GURL("https://docs.google.com"), "", "");
@@ -80,7 +80,7 @@
// Tests that no Mirror request is returned when the cookies aren't allowed to
// be set.
TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestCookieSettingBlocked) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
cookie_settings_->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "0123456789", "");
@@ -89,7 +89,7 @@
// Tests that no Mirror request is returned when the target is a non-Google URL.
TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestExternalURL) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
CheckMirrorHeaderRequest(GURL("https://foo.com"), "0123456789", "");
CheckMirrorCookieRequest(GURL("https://foo.com"), "0123456789", "");
@@ -98,7 +98,7 @@
// Tests that the Mirror request is returned without the GAIA Id when the target
// is a google TLD domain.
TEST_F(SigninHeaderHelperTest, TestMirrorRequestGoogleTLD) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
CheckMirrorHeaderRequest(GURL("https://google.fr"), "0123456789",
"mode=0,enable_account_consistency=true");
@@ -109,7 +109,7 @@
// Tests that the Mirror request is returned when the target is the domain
// google.com, and that the GAIA Id is only attached for the cookie.
TEST_F(SigninHeaderHelperTest, TestMirrorRequestGoogleCom) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
CheckMirrorHeaderRequest(GURL("https://www.google.com"), "0123456789",
"mode=0,enable_account_consistency=true");
@@ -125,7 +125,7 @@
// only relevant on Desktop.
#if !defined(OS_ANDROID) && !defined(OS_IOS)
TEST_F(SigninHeaderHelperTest, TestMirrorRequestDrive) {
- DCHECK(!switches::IsEnableAccountConsistency());
+ DCHECK(!switches::IsAccountConsistencyMirrorEnabled());
CheckMirrorHeaderRequest(
GURL("https://docs.google.com/document"), "0123456789",
"id=0123456789,mode=0,enable_account_consistency=false");
@@ -134,7 +134,7 @@
"id=0123456789:mode=0:enable_account_consistency=false");
// Enable Account Consistency will override the disable.
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
CheckMirrorHeaderRequest(
GURL("https://docs.google.com/document"), "0123456789",
@@ -148,7 +148,7 @@
// Tests that the Mirror header request is returned normally when the redirect
// URL is eligible.
TEST_F(SigninHeaderHelperTest, TestMirrorHeaderEligibleRedirectURL) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
const GURL url("https://docs.google.com/document");
const GURL redirect_url("https://www.google.com");
@@ -166,7 +166,7 @@
// Tests that the Mirror header request is stripped when the redirect URL is not
// eligible.
TEST_F(SigninHeaderHelperTest, TestMirrorHeaderNonEligibleRedirectURL) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
const GURL url("https://docs.google.com/document");
const GURL redirect_url("http://www.foo.com");
@@ -184,7 +184,7 @@
// Tests that the Mirror header, whatever its value is, is untouched when both
// the current and the redirect URL are non-eligible.
TEST_F(SigninHeaderHelperTest, TestIgnoreMirrorHeaderNonEligibleURLs) {
- switches::EnableAccountConsistencyForTesting(
+ switches::EnableAccountConsistencyMirrorForTesting(
base::CommandLine::ForCurrentProcess());
const GURL url("https://www.bar.com");
const GURL redirect_url("http://www.foo.com");
diff --git a/components/signin/core/common/profile_management_switches.cc b/components/signin/core/common/profile_management_switches.cc
index 4b14f6c0..80d025b1 100644
--- a/components/signin/core/common/profile_management_switches.cc
+++ b/components/signin/core/common/profile_management_switches.cc
@@ -14,13 +14,14 @@
namespace switches {
-bool IsEnableAccountConsistency() {
+bool IsAccountConsistencyMirrorEnabled() {
#if defined(OS_ANDROID) || defined(OS_IOS)
// Account consistency is enabled on Android and iOS.
return true;
#else
- return base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAccountConsistency);
+ base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
+ return cmd->GetSwitchValueASCII(switches::kAccountConsistency) ==
+ switches::kAccountConsistencyMirror;
#endif // defined(OS_ANDROID) || defined(OS_IOS)
}
@@ -33,12 +34,13 @@
return base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kExtensionsMultiAccount) ||
- IsEnableAccountConsistency();
+ IsAccountConsistencyMirrorEnabled();
}
-void EnableAccountConsistencyForTesting(base::CommandLine* command_line) {
+void EnableAccountConsistencyMirrorForTesting(base::CommandLine* command_line) {
#if !defined(OS_ANDROID) && !defined(OS_IOS)
- command_line->AppendSwitch(switches::kEnableAccountConsistency);
+ command_line->AppendSwitchASCII(switches::kAccountConsistency,
+ switches::kAccountConsistencyMirror);
#endif
}
diff --git a/components/signin/core/common/profile_management_switches.h b/components/signin/core/common/profile_management_switches.h
index b3080e9..765cfa4 100644
--- a/components/signin/core/common/profile_management_switches.h
+++ b/components/signin/core/common/profile_management_switches.h
@@ -15,15 +15,15 @@
namespace switches {
-// Checks whether account consistency is enabled. If enabled, the account
+// Checks whether Mirror account consistency is enabled. If enabled, the account
// management UI is available in the avatar bubble.
-bool IsEnableAccountConsistency();
+bool IsAccountConsistencyMirrorEnabled();
// Whether the chrome.identity API should be multi-account.
bool IsExtensionsMultiAccount();
-// Called in tests to force enable account consistency.
-void EnableAccountConsistencyForTesting(base::CommandLine* command_line);
+// Called in tests to force enable Mirror account consistency.
+void EnableAccountConsistencyMirrorForTesting(base::CommandLine* command_line);
} // namespace switches
diff --git a/components/signin/core/common/signin_switches.cc b/components/signin/core/common/signin_switches.cc
index ef1d865..1ed3686 100644
--- a/components/signin/core/common/signin_switches.cc
+++ b/components/signin/core/common/signin_switches.cc
@@ -17,8 +17,16 @@
const char kDisableSigninScopedDeviceId[] = "disable-signin-scoped-device-id";
#if !defined(OS_ANDROID) && !defined(OS_IOS)
-// Enables consistent identity features.
-const char kEnableAccountConsistency[] = "enable-account-consistency";
+// Command line flag for enabling account consistency. Default mode is disabled.
+// Mirror is a legacy mode in which Google accounts are always addded to Chrome,
+// and Chrome then adds them to the Google authentication cookies.
+// Dice is a new experiment in which Chrome is aware of the accounts in the
+// Google authentication cookies.
+const char kAccountConsistency[] = "account-consistency";
+
+// Values for the kAccountConsistency flag.
+const char kAccountConsistencyMirror[] = "mirror";
+const char kAccountConsistencyDice[] = "dice";
#endif
// Enables sending EnableRefreshTokenAnnotationRequest.
diff --git a/components/signin/core/common/signin_switches.h b/components/signin/core/common/signin_switches.h
index 8c0ecc2d..e08490a 100644
--- a/components/signin/core/common/signin_switches.h
+++ b/components/signin/core/common/signin_switches.h
@@ -23,9 +23,11 @@
extern const char kExtensionsMultiAccount[];
#if !defined(OS_ANDROID) && !defined(OS_IOS)
-// Note: Account consistency is already enabled on mobile platforms, so this
-// switch only exist on desktop platforms.
-extern const char kEnableAccountConsistency[];
+// Note: Account consistency (Mirror) is already enabled on mobile platforms, so
+// this switch only exist on desktop platforms.
+extern const char kAccountConsistency[];
+extern const char kAccountConsistencyMirror[];
+extern const char kAccountConsistencyDice[];
#endif
} // namespace switches
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index ac69312..0fcf89a 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -22295,6 +22295,7 @@
<int value="385969127" label="disable-win32k-lockdown"/>
<int value="387178525" label="VideoFullscreenOrientationLock:enabled"/>
<int value="388996324" label="CustomContextMenu:disabled"/>
+ <int value="393704200" label="account-consistency"/>
<int value="400322063" label="ash-disable-screen-orientation-lock"/>
<int value="401983950" label="enable-spdy4"/>
<int value="402143634" label="enable-search-button-in-omnibox-always"/>