| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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/browser/signin/signin_util.h" |
| 6 |
| 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/common/pref_names.h" |
| 9 #include "components/prefs/pref_service.h" |
| 10 |
| 11 namespace signin_util { |
| 12 namespace { |
| 13 |
| 14 enum ForceSigninPolicyCache { |
| 15 NOT_CACHED = 0, |
| 16 ENABLE, |
| 17 DISABLE |
| 18 } g_is_force_signin_enabled_cache = NOT_CACHED; |
| 19 |
| 20 void SetForceSigninPolicy(bool enable) { |
| 21 g_is_force_signin_enabled_cache = enable ? ENABLE : DISABLE; |
| 22 } |
| 23 |
| 24 } // namespace |
| 25 |
| 26 bool IsForceSigninEnabled() { |
| 27 if (g_is_force_signin_enabled_cache == NOT_CACHED) { |
| 28 PrefService* prefs = g_browser_process->local_state(); |
| 29 if (prefs) |
| 30 SetForceSigninPolicy(prefs->GetBoolean(prefs::kForceBrowserSignin)); |
| 31 else |
| 32 return false; |
| 33 } |
| 34 return (g_is_force_signin_enabled_cache == ENABLE); |
| 35 } |
| 36 |
| 37 void SetForceSigninForTesting(bool enable) { |
| 38 SetForceSigninPolicy(enable); |
| 39 } |
| 40 |
| 41 } // namespace signin_util |
| OLD | NEW |