Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/common/profile_management_switches.h" | 5 #include "chrome/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 "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 9 | 10 |
| 11 namespace { | |
| 12 | |
| 13 const char kNewProfileManagementFieldTrialName[] = "NewProfileManagement"; | |
| 14 | |
| 15 bool CheckProfileManagementFlag(std::string command_switch, bool negate) { | |
| 16 std::string trial_type = | |
| 17 base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName); | |
| 18 if (!trial_type.empty()) { | |
| 19 if (trial_type == "Enabled") | |
| 20 return true ^ negate; | |
| 21 if (trial_type == "Disabled") | |
| 22 return false ^ negate; | |
|
Roger Tawa OOO till Jul 10th
2014/01/07 17:01:54
Nit: since:
true^negate == !negate
false^negat
bcwhite
2014/01/07 21:23:20
Done.
| |
| 23 } | |
| 24 return CommandLine::ForCurrentProcess()->HasSwitch(command_switch); | |
| 25 } | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 10 namespace switches { | 29 namespace switches { |
| 11 | 30 |
| 12 bool IsEnableInlineSignin() { | 31 bool IsEnableWebBasedSignin() { |
| 13 return !CommandLine::ForCurrentProcess()->HasSwitch( | 32 return CheckProfileManagementFlag(switches::kEnableWebBasedSignin, true); |
| 14 switches::kEnableWebBasedSignin); | |
| 15 } | 33 } |
| 16 | 34 |
| 17 bool IsGoogleProfileInfo() { | 35 bool IsGoogleProfileInfo() { |
| 18 return CommandLine::ForCurrentProcess()->HasSwitch( | 36 return CheckProfileManagementFlag(switches::kGoogleProfileInfo, false); |
| 19 switches::kGoogleProfileInfo); | |
| 20 } | 37 } |
| 21 | 38 |
| 22 bool IsNewProfileManagement() { | 39 bool IsNewProfileManagement() { |
| 23 return CommandLine::ForCurrentProcess()->HasSwitch( | 40 return CheckProfileManagementFlag(switches::kNewProfileManagement, false); |
| 24 switches::kNewProfileManagement); | |
| 25 } | 41 } |
| 26 | 42 |
| 27 } // namespace switches | 43 } // namespace switches |
| OLD | NEW |