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

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

Issue 14630003: signin: move SigninManagerBase::Signout to SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 c207cca2690ace330d3ce27baa61846a1b897a41..6bf4b5c6b0805c85e1c11d5fd4db0441d416f353 100644
--- a/chrome/browser/signin/signin_manager.h
+++ b/chrome/browser/signin/signin_manager.h
@@ -70,6 +70,10 @@ class SigninManager : public SigninManagerBase,
SigninManager();
virtual ~SigninManager();
+ // Returns true if the username is allowed based on the policy string.
+ static bool IsUsernameAllowedByPolicy(const std::string& username,
+ const std::string& policy);
+
// Attempt to sign in this user with ClientLogin. If successful, set a
// preference indicating the signed in user and send out a notification,
// then start fetching tokens for the user.
@@ -94,11 +98,22 @@ class SigninManager : public SigninManagerBase,
// Sign a user out, removing the preference, erasing all keys
// associated with the user, and canceling all auth in progress.
- virtual void SignOut() OVERRIDE;
+ virtual void SignOut();
+
+ // On platforms where SigninManager is responsible for dealing with
+ // invalid username policy updates, we need to check this during
+ // initialization and sign the user out.
+ virtual void Initialize(Profile* profile) OVERRIDE;
// Returns true if there's a signin in progress.
virtual bool AuthInProgress() const OVERRIDE;
+ virtual bool IsSigninAllowed() const OVERRIDE;
+
+ // Returns true if the passed username is allowed by policy. Virtual for
+ // mocking in tests.
+ virtual bool IsAllowedUsername(const std::string& username) const;
+
// If an authentication is in progress, return the username being
// authenticated. Returns an empty string if no auth is in progress.
const std::string& GetUsernameForAuthInProgress() const;
@@ -141,6 +156,11 @@ class SigninManager : public SigninManagerBase,
// ignored).
bool IsSignoutProhibited() 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);
+
// Allows the SigninManager to track the privileged signin process
// identified by |process_id| so that we can later ask (via IsSigninProcess)
// if it is safe to sign the user in from the current context (see
@@ -234,6 +254,9 @@ class SigninManager : public SigninManagerBase,
// Invoked once policy has been loaded to complete user signin.
void CompleteSigninAfterPolicyLoad();
+ void OnSigninAllowedPrefChanged();
+ void OnGoogleServicesUsernamePatternChanged();
+
// ClientLogin identity.
std::string possibly_invalid_username_;
std::string password_; // This is kept empty whenever possible.
@@ -279,6 +302,13 @@ class SigninManager : public SigninManagerBase,
scoped_ptr<policy::CloudPolicyClient> policy_client_;
#endif
+ // Helper object to listen for changes to signin preferences stored in non-
+ // 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_;
+
DISALLOW_COPY_AND_ASSIGN(SigninManager);
};

Powered by Google App Engine
This is Rietveld 408576698