OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/signin/core/common/profile_management_switches.h" | 5 #include "components/signin/core/common/profile_management_switches.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "components/signin/core/common/signin_switches.h" | 10 #include "components/signin/core/common/signin_switches.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement"; | 14 const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement"; |
15 | 15 |
16 // Different state of new profile management/identity consistency. The code | 16 // Different state of new profile management/identity consistency. The code |
17 // below assumes the order of the values in this enum. That is, new profile | 17 // below assumes the order of the values in this enum. That is, new profile |
18 // management is included in consistent identity. | 18 // management is included in consistent identity. |
19 enum State { | 19 enum State { |
20 STATE_OLD_AVATAR_MENU, | 20 STATE_OLD_AVATAR_MENU, |
Mike Lerman
2015/09/28 15:23:01
I think we can remove this state now?
anthonyvd
2015/09/29 20:23:16
Done.
| |
21 STATE_NEW_AVATAR_MENU, | 21 STATE_NEW_AVATAR_MENU, |
22 STATE_NEW_PROFILE_MANAGEMENT, | 22 STATE_NEW_PROFILE_MANAGEMENT, |
23 STATE_ACCOUNT_CONSISTENCY, | 23 STATE_ACCOUNT_CONSISTENCY, |
24 }; | 24 }; |
25 | 25 |
26 State GetProcessState() { | 26 State GetProcessState() { |
27 // Find the state of both command line args. | 27 // Find the state of both command line args. |
28 bool is_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch( | 28 bool is_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch( |
Mike Lerman
2015/09/28 15:23:01
remove this bool... and remove switches::kEnableNe
anthonyvd
2015/09/29 20:23:16
Done.
| |
29 switches::kEnableNewAvatarMenu); | 29 switches::kEnableNewAvatarMenu); |
30 bool is_new_profile_management = | 30 bool is_new_profile_management = |
31 base::CommandLine::ForCurrentProcess()->HasSwitch( | 31 base::CommandLine::ForCurrentProcess()->HasSwitch( |
32 switches::kEnableNewProfileManagement); | 32 switches::kEnableNewProfileManagement); |
33 bool is_consistent_identity = | 33 bool is_consistent_identity = |
34 base::CommandLine::ForCurrentProcess()->HasSwitch( | 34 base::CommandLine::ForCurrentProcess()->HasSwitch( |
35 switches::kEnableAccountConsistency); | 35 switches::kEnableAccountConsistency); |
36 bool not_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch( | 36 bool not_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch( |
37 switches::kDisableNewAvatarMenu); | 37 switches::kDisableNewAvatarMenu); |
38 bool not_new_profile_management = | 38 bool not_new_profile_management = |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 | 139 |
140 bool IsGoogleProfileInfo() { | 140 bool IsGoogleProfileInfo() { |
141 return CheckFlag(switches::kGoogleProfileInfo, STATE_NEW_AVATAR_MENU); | 141 return CheckFlag(switches::kGoogleProfileInfo, STATE_NEW_AVATAR_MENU); |
142 } | 142 } |
143 | 143 |
144 bool IsNewAvatarMenu() { | 144 bool IsNewAvatarMenu() { |
145 // NewAvatarMenu is only available on desktop. | 145 // NewAvatarMenu is only available on desktop. |
146 #if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_CHROMEOS) | 146 #if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_CHROMEOS) |
147 return false; | 147 return false; |
148 #else | 148 #else |
149 return GetProcessState() >= STATE_NEW_AVATAR_MENU; | 149 return true; |
150 #endif | 150 #endif |
151 } | 151 } |
152 | 152 |
153 bool IsNewProfileManagement() { | 153 bool IsNewProfileManagement() { |
154 return GetProcessState() >= STATE_NEW_PROFILE_MANAGEMENT; | 154 return GetProcessState() >= STATE_NEW_PROFILE_MANAGEMENT; |
155 } | 155 } |
156 | 156 |
157 bool IsNewProfileManagementPreviewEnabled() { | 157 bool IsNewProfileManagementPreviewEnabled() { |
158 // No promotion to Enable Account Consistency. | 158 // No promotion to Enable Account Consistency. |
159 return false; | 159 return false; |
(...skipping 13 matching lines...) Expand all Loading... | |
173 command_line->AppendSwitch(switches::kEnableNewProfileManagement); | 173 command_line->AppendSwitch(switches::kEnableNewProfileManagement); |
174 DCHECK(!command_line->HasSwitch(switches::kDisableNewProfileManagement)); | 174 DCHECK(!command_line->HasSwitch(switches::kDisableNewProfileManagement)); |
175 } | 175 } |
176 | 176 |
177 void EnableAccountConsistencyForTesting(base::CommandLine* command_line) { | 177 void EnableAccountConsistencyForTesting(base::CommandLine* command_line) { |
178 command_line->AppendSwitch(switches::kEnableAccountConsistency); | 178 command_line->AppendSwitch(switches::kEnableAccountConsistency); |
179 DCHECK(!command_line->HasSwitch(switches::kDisableAccountConsistency)); | 179 DCHECK(!command_line->HasSwitch(switches::kDisableAccountConsistency)); |
180 } | 180 } |
181 | 181 |
182 } // namespace switches | 182 } // namespace switches |
OLD | NEW |