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

Side by Side Diff: chrome/common/profile_management_switches.cc

Issue 235813002: Add profile-switches to signin-internals; move switches to component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 8 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
« no previous file with comments | « chrome/common/profile_management_switches.h ('k') | chrome/renderer/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/profile_management_switches.h"
6
7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
9 #include "chrome/common/chrome_switches.h"
10
11 namespace {
12
13 const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement";
14
15 bool CheckProfileManagementFlag(std::string command_switch, bool active_state) {
16 // Individiual flag settings take precedence.
17 if (CommandLine::ForCurrentProcess()->HasSwitch(command_switch)) {
18 return true;
19 }
20
21 // --new-profile-management flag always affects all switches.
22 if (CommandLine::ForCurrentProcess()->HasSwitch(
23 switches::kNewProfileManagement)) {
24 return active_state;
25 }
26
27 // NewProfileManagement experiment acts like above flag.
28 std::string trial_type =
29 base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
30 if (!trial_type.empty()) {
31 if (trial_type == "Enabled")
32 return active_state;
33 if (trial_type == "Disabled")
34 return !active_state;
35 }
36
37 return false;
38 }
39
40 } // namespace
41
42 namespace switches {
43
44 bool IsEnableWebBasedSignin() {
45 return CheckProfileManagementFlag(switches::kEnableWebBasedSignin, false);
46 }
47
48 bool IsGoogleProfileInfo() {
49 return CheckProfileManagementFlag(switches::kGoogleProfileInfo, true);
50 }
51
52 bool IsNewProfileManagement() {
53 return CheckProfileManagementFlag(switches::kNewProfileManagement, true);
54 }
55
56 bool IsNewAvatarMenu() {
57 bool is_new_avatar_menu =
58 CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewAvatarMenu);
59 return is_new_avatar_menu || IsNewProfileManagement();
60 }
61
62 bool IsNewProfileManagementPreviewEnabled() {
63 bool is_new_avatar_menu =
64 CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewAvatarMenu);
65 return is_new_avatar_menu && IsNewProfileManagement();
66 }
67
68 bool IsFastUserSwitching() {
69 return CommandLine::ForCurrentProcess()->HasSwitch(
70 switches::kFastUserSwitching);
71 }
72
73 } // namespace switches
OLDNEW
« no previous file with comments | « chrome/common/profile_management_switches.h ('k') | chrome/renderer/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698