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

Side by Side Diff: components/signin/core/common/profile_management_switches.cc

Issue 872433006: Disconnect one click sign in code. The code itself will be removed in followup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge Created 5 years, 10 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 unified diff | Download patch
OLDNEW
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,
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 // Disables the new avatar menu if the web-based signin is turned on, because
28 // the new avatar menu always uses the inline signin, which may break some
29 // SAML users.
30 if (switches::IsEnableWebBasedSignin())
31 return STATE_OLD_AVATAR_MENU;
32
33 // Find the state of both command line args. 27 // Find the state of both command line args.
34 bool is_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch( 28 bool is_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch(
35 switches::kEnableNewAvatarMenu); 29 switches::kEnableNewAvatarMenu);
36 bool is_new_profile_management = 30 bool is_new_profile_management =
37 base::CommandLine::ForCurrentProcess()->HasSwitch( 31 base::CommandLine::ForCurrentProcess()->HasSwitch(
38 switches::kEnableNewProfileManagement); 32 switches::kEnableNewProfileManagement);
39 bool is_consistent_identity = 33 bool is_consistent_identity =
40 base::CommandLine::ForCurrentProcess()->HasSwitch( 34 base::CommandLine::ForCurrentProcess()->HasSwitch(
41 switches::kEnableAccountConsistency); 35 switches::kEnableAccountConsistency);
42 bool not_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch( 36 bool not_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 115 }
122 116
123 } // namespace 117 } // namespace
124 118
125 namespace switches { 119 namespace switches {
126 120
127 bool IsEnableAccountConsistency() { 121 bool IsEnableAccountConsistency() {
128 return GetProcessState() >= STATE_ACCOUNT_CONSISTENCY; 122 return GetProcessState() >= STATE_ACCOUNT_CONSISTENCY;
129 } 123 }
130 124
131 bool IsEnableWebBasedSignin() {
132 return base::CommandLine::ForCurrentProcess()->HasSwitch(
133 switches::kEnableWebBasedSignin) &&
134 !IsEnableWebviewBasedSignin();
135 }
136
137 bool IsEnableWebviewBasedSignin() { 125 bool IsEnableWebviewBasedSignin() {
138 // For now, the webview is enabled only for desktop. 126 // For now, the webview is enabled only for desktop.
139 #if defined(OS_CHROMEOS) 127 #if defined(OS_CHROMEOS)
140 return false; 128 return false;
141 #else 129 #else
142 return !base::CommandLine::ForCurrentProcess()->HasSwitch( 130 return !base::CommandLine::ForCurrentProcess()->HasSwitch(
143 switches::kEnableIframeBasedSignin); 131 switches::kEnableIframeBasedSignin);
144 #endif 132 #endif
145 } 133 }
146 134
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 command_line->AppendSwitch(switches::kEnableNewProfileManagement); 178 command_line->AppendSwitch(switches::kEnableNewProfileManagement);
191 DCHECK(!command_line->HasSwitch(switches::kDisableNewProfileManagement)); 179 DCHECK(!command_line->HasSwitch(switches::kDisableNewProfileManagement));
192 } 180 }
193 181
194 void EnableAccountConsistencyForTesting(base::CommandLine* command_line) { 182 void EnableAccountConsistencyForTesting(base::CommandLine* command_line) {
195 command_line->AppendSwitch(switches::kEnableAccountConsistency); 183 command_line->AppendSwitch(switches::kEnableAccountConsistency);
196 DCHECK(!command_line->HasSwitch(switches::kDisableAccountConsistency)); 184 DCHECK(!command_line->HasSwitch(switches::kDisableAccountConsistency));
197 } 185 }
198 186
199 } // namespace switches 187 } // namespace switches
OLDNEW
« no previous file with comments | « components/signin/core/common/profile_management_switches.h ('k') | components/signin/core/common/signin_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698