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

Unified Diff: chrome/browser/signin/signin_manager.h

Issue 12088040: Add a SigninAllowed policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Some bugfixes. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/signin_manager.h
diff --git a/chrome/browser/signin/signin_manager.h b/chrome/browser/signin/signin_manager.h
index 43a50254bbf99c26977e797f7d8f8bcc78bf4d84..f19cf43bd540e615dccd62f5d3b3c61c3559bac2 100644
--- a/chrome/browser/signin/signin_manager.h
+++ b/chrome/browser/signin/signin_manager.h
@@ -25,8 +25,10 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/prefs/public/pref_change_registrar.h"
+#include "base/prefs/public/pref_member.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
#include "chrome/browser/signin/signin_internals_util.h"
+#include "chrome/browser/signin/signin_pref_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
@@ -36,6 +38,7 @@
class CookieSettings;
class GaiaAuthFetcher;
class Profile;
+class ProfileIOData;
class PrefService;
class SigninGlobalError;
@@ -68,6 +71,10 @@ class SigninManager : public GaiaAuthConsumer,
void RemoveSigninDiagnosticsObserver(
signin_internals_util::SigninDiagnosticsObserver* observer);
+ // Functions for adding and removing SigninPrefObservers.
+ void AddSigninPrefObserver(SigninPrefObserver* signin_pref_observer);
+ void RemoveSigninPrefObserver(SigninPrefObserver* signin_pref_observer);
+
// Returns true if the cookie policy for the given profile allows cookies
// for the Google signin domain.
static bool AreSigninCookiesAllowed(Profile* profile);
@@ -88,6 +95,14 @@ class SigninManager : public GaiaAuthConsumer,
// mocking in tests.
virtual bool IsAllowedUsername(const std::string& username) const;
+ // Returns true if a signin to Chrome is allowed (by policy or pref).
+ bool IsSigninAllowed() const;
+
+ // Checks if signin is allowed for the profile that owns |io_data|. This must
+ // be invoked on the IO thread, and can be used to check if signin is enabled
+ // on that thread.
+ static bool IsSigninAllowedOnIOThread(ProfileIOData* io_data);
+
// If a user has previously established a username and SignOut has not been
// called, this will return the username.
// Otherwise, it will return an empty string.
@@ -241,6 +256,8 @@ class SigninManager : public GaiaAuthConsumer,
void OnGoogleServicesUsernamePatternChanged();
+ void OnSigninAllowedPrefChanged();
+
// Helper methods to notify all registered diagnostics observers with.
void NotifyDiagnosticsObservers(
const signin_internals_util::UntimedSigninStatusField& field,
@@ -263,6 +280,9 @@ class SigninManager : public GaiaAuthConsumer,
// profile-specific local prefs (like kGoogleServicesUsernamePattern).
PrefChangeRegistrar local_state_pref_registrar_;
+ // Helper object to listen for changes to the signin allowed preference.
+ BooleanPrefMember signin_allowed_;
+
// Actual username after successful authentication.
std::string authenticated_username_;
@@ -280,6 +300,9 @@ class SigninManager : public GaiaAuthConsumer,
ObserverList<signin_internals_util::SigninDiagnosticsObserver, true>
signin_diagnostics_observers_;
+ // List of SigninPrefObservers.
+ ObserverList<SigninPrefObserver> signin_pref_observers_;
+
base::WeakPtrFactory<SigninManager> weak_pointer_factory_;
DISALLOW_COPY_AND_ASSIGN(SigninManager);

Powered by Google App Engine
This is Rietveld 408576698