Chromium Code Reviews| 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 c1afca4f4dc6e8a87a96f7f2086e488522811481..18a9e7402d3047037dc361f7480a7b9163cc2cf3 100644 |
| --- a/components/signin/core/common/profile_management_switches.cc |
| +++ b/components/signin/core/common/profile_management_switches.cc |
| @@ -17,7 +17,8 @@ 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 |
| }; |
| @@ -29,20 +30,28 @@ State GetProcessState() { |
| 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; |
| @@ -59,22 +68,25 @@ State GetProcessState() { |
| trial_type.clear(); |
| } |
| + // 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 (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; |
| } |
| #if defined(OS_ANDROID) |
| State state = STATE_ACCOUNT_CONSISTENCY; |
| #else |
| - State state = STATE_NONE; |
| + State state = STATE_NEW_AVATAR_MENU; |
| #endif |
| if (!trial_type.empty()) { |
| @@ -83,7 +95,7 @@ State GetProcessState() { |
| } else if (trial_type == "AccountConsistency") { |
| state = STATE_ACCOUNT_CONSISTENCY; |
| } else { |
| - state = STATE_NONE; |
| + state = STATE_NEW_AVATAR_MENU; |
| } |
| } |
| @@ -127,9 +139,7 @@ bool IsGoogleProfileInfo() { |
| } |
| 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 +152,7 @@ bool IsNewProfileManagementPreviewEnabled() { |
| } |
| void EnableNewAvatarMenuForTesting(base::CommandLine* command_line) { |
| - command_line->AppendSwitch(switches::kNewAvatarMenu); |
| + command_line->AppendSwitch(switches::kEnableNewAvatarMenu); |
| } |
|
Roger Tawa OOO till Jul 10th
2014/08/01 13:45:52
Add DCHECK that disable is not set, similar to the
|
| void EnableNewProfileManagementForTesting(base::CommandLine* command_line) { |