Chromium Code Reviews| Index: chrome/browser/signin/signin_util.cc |
| diff --git a/chrome/browser/signin/signin_util.cc b/chrome/browser/signin/signin_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e418635e266dc12acd1521118c584ba6532f0801 |
| --- /dev/null |
| +++ b/chrome/browser/signin/signin_util.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/signin/signin_util.h" |
| + |
| +#include "chrome/browser/browser_process.h" |
| +#include "chrome/common/pref_names.h" |
| +#include "components/prefs/pref_service.h" |
| + |
| +namespace signin_util { |
| + |
| +bool* g_is_force_signin_enabled_cache = nullptr; |
|
Roger Tawa OOO till Jul 10th
2017/02/27 22:08:26
I don't understand why this is a pointer and why i
zmin
2017/03/07 20:06:42
Using enum instead of pointer here.
|
| + |
| +bool IsForceSigninEnabled() { |
| + if (!g_is_force_signin_enabled_cache) { |
| + PrefService* prefs = g_browser_process->local_state(); |
| + if (prefs) { |
| + g_is_force_signin_enabled_cache = |
| + new bool(prefs->GetBoolean(prefs::kForceBrowserSignin)); |
| + } else { |
| + return false; |
| + } |
| + } |
| + return *g_is_force_signin_enabled_cache; |
| +} |
| + |
| +void SetForceSigninForTesting(bool enable) { |
| + if (g_is_force_signin_enabled_cache) |
| + *g_is_force_signin_enabled_cache = enable; |
| + else |
| + g_is_force_signin_enabled_cache = new bool(enable); |
| +} |
| + |
| +} // namespace signin_util |