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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e5f50790d59abb40fdccbdbbb99d5a2e8743efe1
--- /dev/null
+++ b/chrome/browser/signin/signin_util.cc
@@ -0,0 +1,41 @@
+// 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 {
+namespace {
+
+enum ForceSigninPolicyCache {
+ NOT_CACHED = 0,
+ ENABLE,
+ DISABLE
+} g_is_force_signin_enabled_cache = NOT_CACHED;
+
+void SetForceSigninPolicy(bool enable) {
+ g_is_force_signin_enabled_cache = enable ? ENABLE : DISABLE;
+}
+
+} // namespace
+
+bool IsForceSigninEnabled() {
+ if (g_is_force_signin_enabled_cache == NOT_CACHED) {
+ PrefService* prefs = g_browser_process->local_state();
+ if (prefs)
+ SetForceSigninPolicy(prefs->GetBoolean(prefs::kForceBrowserSignin));
+ else
+ return false;
+ }
+ return (g_is_force_signin_enabled_cache == ENABLE);
+}
+
+void SetForceSigninForTesting(bool enable) {
+ SetForceSigninPolicy(enable);
+}
+
+} // namespace signin_util
« 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