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

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

Issue 6894027: Initial refactoring complete Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed some tests that were broken by previous refactoring Created 9 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/signin_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/signin_manager.h
diff --git a/chrome/browser/sync/signin_manager.h b/chrome/browser/sync/signin_manager.h
index 603c323390fe32e5e3aaa0339a4b682033bf736b..51e72cbdda80cfdacf9b123a98fb872c6a4d0bb4 100644
--- a/chrome/browser/sync/signin_manager.h
+++ b/chrome/browser/sync/signin_manager.h
@@ -12,9 +12,11 @@
#pragma once
#include <string>
+
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
-#include "chrome/common/net/gaia/gaia_auth_consumer.h"
+#include "chrome/common/net/gaia/authentication_consumer.h"
+#include "chrome/common/net/gaia/authentication_fetcher.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
class GaiaAuthFetcher;
@@ -33,16 +35,22 @@ struct GoogleServiceSigninSuccessDetails {
std::string password;
};
-class SigninManager : public GaiaAuthConsumer {
+class SigninManager {
public:
- SigninManager();
+ static const char* kClientLoginVariant;
+ static const char* kOAuthVariant;
+
+ static SigninManager* CreateSigninManager();
+
+ static SigninManager* CreateSigninManager(const std::string& variant);
+
virtual ~SigninManager();
// Call to register our prefs.
static void RegisterUserPrefs(PrefService* user_prefs);
// If user was signed in, load tokens from DB if available.
- void Initialize(Profile* profile);
+ virtual void Initialize(Profile* profile) = 0;
// If a user is signed in, this will return their name.
// Otherwise, it will return an empty string.
@@ -54,28 +62,23 @@ class SigninManager : public GaiaAuthConsumer {
// Attempt to sign in this user. If successful, set a preference indicating
// the signed in user and send out a notification, then start fetching tokens
// for the user.
- void StartSignIn(const std::string& username,
- const std::string& password,
- const std::string& login_token,
- const std::string& login_captcha);
+ virtual void StartSignIn(const std::string& username,
+ const std::string& password,
+ const std::string& login_token,
+ const std::string& login_captcha) = 0;
// Used when a second factor access code was required to complete a signin
// attempt.
- void ProvideSecondFactorAccessCode(const std::string& access_code);
+ virtual void ProvideSecondFactorAccessCode(
+ const std::string& access_code) = 0;
// Sign a user out, removing the preference, erasing all keys
// associated with the user, and canceling all auth in progress.
- void SignOut();
+ virtual void SignOut() = 0;
- // GaiaAuthConsumer
- virtual void OnClientLoginSuccess(const ClientLoginResult& result);
- virtual void OnClientLoginFailure(const GoogleServiceAuthError& error);
- virtual void OnGetUserInfoSuccess(const std::string& key,
- const std::string& value);
- virtual void OnGetUserInfoKeyNotFound(const std::string& key);
- virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error);
+ protected:
+ SigninManager();
- private:
Profile* profile_;
std::string username_;
std::string password_; // This is kept empty whenever possible.
@@ -83,10 +86,10 @@ class SigninManager : public GaiaAuthConsumer {
// Result of the last client login, kept pending the lookup of the
// canonical email.
- ClientLoginResult last_result_;
+ scoped_ptr<AuthenticationConsumer::AuthenticationResult> last_result_;
- // Actual client login handler.
- scoped_ptr<GaiaAuthFetcher> client_login_;
+ // Actual authentication handler.
+ scoped_ptr<AuthenticationFetcher> fetcher_;
};
#endif // CHROME_BROWSER_SYNC_SIGNIN_MANAGER_H_
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/signin_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698