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

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: Merge from master Created 3 years, 9 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
« no previous file with comments | « chrome/browser/signin/signin_util.h ('k') | chrome/browser/signin/signin_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_util.h ('k') | chrome/browser/signin/signin_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698