Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: chrome/browser/signin/signin_util.cc

Issue 2712883005: Sign out profile when local_state file has been changed. (Closed)
Patch Set: fixup Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
13 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.
14
15 bool IsForceSigninEnabled() {
16 if (!g_is_force_signin_enabled_cache) {
17 PrefService* prefs = g_browser_process->local_state();
18 if (prefs) {
19 g_is_force_signin_enabled_cache =
20 new bool(prefs->GetBoolean(prefs::kForceBrowserSignin));
21 } else {
22 return false;
23 }
24 }
25 return *g_is_force_signin_enabled_cache;
26 }
27
28 void SetForceSigninForTesting(bool enable) {
29 if (g_is_force_signin_enabled_cache)
30 *g_is_force_signin_enabled_cache = enable;
31 else
32 g_is_force_signin_enabled_cache = new bool(enable);
33 }
34
35 } // namespace signin_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698