| 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_
|
|
|