Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / common / profile_management_switches.cc
bloba33d62a657566e9109c92ebd2eccd5f6105169cd
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.
5 #include "chrome/common/profile_management_switches.h"
7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h"
9 #include "chrome/common/chrome_switches.h"
11 namespace {
13 const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement";
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;
21 // --new-profile-management flag always affects all switches.
22 if (CommandLine::ForCurrentProcess()->HasSwitch(
23 switches::kNewProfileManagement)) {
24 return active_state;
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;
37 return false;
40 } // namespace
42 namespace switches {
44 bool IsEnableWebBasedSignin() {
45 return CheckProfileManagementFlag(switches::kEnableWebBasedSignin, false);
48 bool IsGoogleProfileInfo() {
49 return CheckProfileManagementFlag(switches::kGoogleProfileInfo, true);
52 bool IsNewProfileManagement() {
53 return CheckProfileManagementFlag(switches::kNewProfileManagement, true);
56 } // namespace switches