Chromium Code Reviews| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| 11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 12 #include "build/build_config.h" | |
| 13 #include "components/signin/core/common/signin_switches.h" | 12 #include "components/signin/core/common/signin_switches.h" |
| 14 | 13 |
| 15 namespace switches { | 14 namespace switches { |
| 16 | 15 |
| 17 bool IsAccountConsistencyMirrorEnabled() { | 16 AccountConsistencyMethod GetAccountConsistencyMethod() { |
| 18 #if defined(OS_ANDROID) || defined(OS_IOS) | 17 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 19 // Account consistency is enabled on Android and iOS. | 18 // Mirror is enabled on Android and iOS. |
| 20 return true; | 19 return AccountConsistencyMethod::kMirror; |
| 21 #else | 20 #else |
| 22 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 21 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 23 return cmd->GetSwitchValueASCII(switches::kAccountConsistency) == | 22 std::string method = cmd->GetSwitchValueASCII(switches::kAccountConsistency); |
| 24 switches::kAccountConsistencyMirror; | 23 if (method == switches::kAccountConsistencyMirror) |
| 24 return AccountConsistencyMethod::kMirror; | |
| 25 if (method == switches::kAccountConsistencyDice) | |
| 26 return AccountConsistencyMethod::kDice; | |
| 27 return AccountConsistencyMethod::kDisabled; | |
| 25 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 28 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| 26 } | 29 } |
| 27 | 30 |
| 31 bool IsAccountConsistencyMirrorEnabled() { | |
| 32 return GetAccountConsistencyMethod() == AccountConsistencyMethod::kMirror; | |
| 33 } | |
| 34 | |
| 28 bool IsExtensionsMultiAccount() { | 35 bool IsExtensionsMultiAccount() { |
| 29 #if defined(OS_ANDROID) || defined(OS_IOS) | 36 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 30 NOTREACHED() << "Extensions are not enabled on Android or iOS"; | 37 NOTREACHED() << "Extensions are not enabled on Android or iOS"; |
| 31 // Account consistency is enabled on Android and iOS. | 38 // Account consistency is enabled on Android and iOS. |
| 32 return false; | 39 return false; |
| 33 #endif | 40 #endif |
| 34 | 41 |
| 35 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 42 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 36 switches::kExtensionsMultiAccount) || | 43 switches::kExtensionsMultiAccount) || |
| 37 IsAccountConsistencyMirrorEnabled(); | 44 GetAccountConsistencyMethod() == AccountConsistencyMethod::kMirror || |
| 45 GetAccountConsistencyMethod() == AccountConsistencyMethod::kDice; | |
|
msarda
2017/06/07 13:06:31
Let's not enable yet multi-account extension for D
droger
2017/06/08 13:58:10
Ok. Filed crbug.com/731066 to track this.
| |
| 38 } | 46 } |
| 39 | 47 |
| 40 void EnableAccountConsistencyMirrorForTesting(base::CommandLine* command_line) { | 48 void EnableAccountConsistencyMirrorForTesting(base::CommandLine* command_line) { |
| 41 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 49 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 42 command_line->AppendSwitchASCII(switches::kAccountConsistency, | 50 command_line->AppendSwitchASCII(switches::kAccountConsistency, |
| 43 switches::kAccountConsistencyMirror); | 51 switches::kAccountConsistencyMirror); |
| 44 #endif | 52 #endif |
| 45 } | 53 } |
| 46 | 54 |
| 55 #if !defined(OS_ANDROID) && !defined(OS_IOS) | |
| 56 void EnableAccountConsistencyDiceForTesting(base::CommandLine* command_line) { | |
| 57 command_line->AppendSwitchASCII(switches::kAccountConsistency, | |
| 58 switches::kAccountConsistencyDice); | |
| 59 } | |
| 60 #endif | |
| 61 | |
| 47 } // namespace switches | 62 } // namespace switches |
| OLD | NEW |