Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Unified Diff: components/signin/core/common/profile_management_switches.cc

Issue 431083003: Change new-avatar-menu to an enable-disable flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Issue with the rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/signin/core/common/profile_management_switches.cc
diff --git a/components/signin/core/common/profile_management_switches.cc b/components/signin/core/common/profile_management_switches.cc
index d24145cf013f0c93de1291cc2205361536a11a03..c2cab31693ae6b5073cc1cee43acd41ba664d56f 100644
--- a/components/signin/core/common/profile_management_switches.cc
+++ b/components/signin/core/common/profile_management_switches.cc
@@ -17,32 +17,36 @@ const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement";
// below assumes the order of the values in this enum. That is, new profile
// management is included in consistent identity.
enum State {
- STATE_NONE,
+ STATE_OLD_AVATAR_MENU,
+ STATE_NEW_AVATAR_MENU,
STATE_NEW_PROFILE_MANAGEMENT,
- STATE_ACCOUNT_CONSISTENCY
+ STATE_ACCOUNT_CONSISTENCY,
};
State GetProcessState() {
- // Get the full name of the field trial so that the underlying mechanism
- // is properly initialized.
- std::string trial_type =
- base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
-
// Find the state of both command line args.
+ bool is_new_avatar_menu =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNewAvatarMenu);
bool is_new_profile_management =
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableNewProfileManagement);
bool is_consistent_identity =
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableAccountConsistency);
+ bool not_new_avatar_menu =
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableNewAvatarMenu);
bool not_new_profile_management =
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableNewProfileManagement);
bool not_consistent_identity =
CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableAccountConsistency);
- int count_args = (is_new_profile_management ? 1 : 0) +
+ int count_args = (is_new_avatar_menu ? 1 : 0) +
+ (is_new_profile_management ? 1 : 0) +
(is_consistent_identity ? 1 : 0) +
+ (not_new_avatar_menu ? 1 : 0) +
(not_new_profile_management ? 1 : 0) +
(not_consistent_identity ? 1 : 0);
bool invalid_commandline = count_args > 1;
@@ -50,6 +54,7 @@ State GetProcessState() {
// At most only one of the command line args should be specified, otherwise
// the finch group assignment is undefined. If this is the case, disable
// the field trial so that data is not collected in the wrong group.
+ std::string trial_type;
if (invalid_commandline) {
base::FieldTrial* field_trial =
base::FieldTrialList::Find(kNewProfileManagementFieldTrialName);
@@ -57,24 +62,35 @@ State GetProcessState() {
field_trial->Disable();
trial_type.clear();
+ } else {
+ // Since the experiment is not being disabled, get the full name of the
+ // field trial which will initialize the underlying mechanism.
+ trial_type =
+ base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
}
+ // Forcing the old avatar menu takes precedent over other args.
// Enable command line args take precedent over disable command line args.
// Consistent identity args take precedent over new profile management args.
- if (is_consistent_identity) {
+ if (not_new_avatar_menu) {
+ return STATE_OLD_AVATAR_MENU;
+ } else if (is_consistent_identity) {
return STATE_ACCOUNT_CONSISTENCY;
} else if (is_new_profile_management) {
return STATE_NEW_PROFILE_MANAGEMENT;
+ } else if (is_new_avatar_menu) {
+ return STATE_NEW_AVATAR_MENU;
} else if (not_new_profile_management) {
- return STATE_NONE;
+ return STATE_NEW_AVATAR_MENU;
} else if (not_consistent_identity) {
- return STATE_NEW_PROFILE_MANAGEMENT;
+ return STATE_NEW_AVATAR_MENU;
}
+ // Set the default state
#if defined(OS_ANDROID)
State state = STATE_ACCOUNT_CONSISTENCY;
#else
- State state = STATE_NONE;
+ State state = STATE_OLD_AVATAR_MENU;
#endif
if (!trial_type.empty()) {
@@ -83,7 +99,7 @@ State GetProcessState() {
} else if (trial_type == "AccountConsistency") {
state = STATE_ACCOUNT_CONSISTENCY;
} else {
- state = STATE_NONE;
+ state = STATE_OLD_AVATAR_MENU;
}
}
@@ -123,13 +139,11 @@ bool IsFastUserSwitching() {
bool IsGoogleProfileInfo() {
return IsNewAvatarMenu() ||
- CheckFlag(switches::kGoogleProfileInfo, STATE_NONE);
+ CheckFlag(switches::kGoogleProfileInfo, STATE_OLD_AVATAR_MENU);
}
bool IsNewAvatarMenu() {
- bool is_new_avatar_menu =
- CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewAvatarMenu);
- return is_new_avatar_menu || IsNewProfileManagement();
+ return GetProcessState() >= STATE_NEW_AVATAR_MENU;
}
bool IsNewProfileManagement() {
@@ -142,7 +156,8 @@ bool IsNewProfileManagementPreviewEnabled() {
}
void EnableNewAvatarMenuForTesting(base::CommandLine* command_line) {
- command_line->AppendSwitch(switches::kNewAvatarMenu);
+ command_line->AppendSwitch(switches::kEnableNewAvatarMenu);
+ DCHECK(!command_line->HasSwitch(switches::kDisableNewAvatarMenu));
}
void EnableNewProfileManagementForTesting(base::CommandLine* command_line) {
« no previous file with comments | « components/signin/core/browser/about_signin_internals.cc ('k') | components/signin/core/common/signin_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698