| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "chrome/browser/signin/ubertoken_fetcher.h" | 10 #include "chrome/browser/signin/ubertoken_fetcher.h" |
| 11 #include "google_apis/gaia/gaia_auth_consumer.h" | 11 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 12 | 12 |
| 13 class GaiaAuthFetcher; | 13 class GaiaAuthFetcher; |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 // Logs in the current signed in user into Google services. Populates the cookie | 16 // Logs in the current signed in user into Google services. Populates the cookie |
| 17 // jar with Google credentials of the signed in user. | 17 // jar with Google credentials of the signed in user. |
| 18 class GoogleAutoLoginHelper : public GaiaAuthConsumer, | 18 class GoogleAutoLoginHelper : public GaiaAuthConsumer, |
| 19 public UbertokenConsumer { | 19 public UbertokenConsumer { |
| 20 public: | 20 public: |
| 21 explicit GoogleAutoLoginHelper(Profile* profile); | 21 explicit GoogleAutoLoginHelper(Profile* profile); |
| 22 virtual ~GoogleAutoLoginHelper(); | 22 virtual ~GoogleAutoLoginHelper(); |
| 23 | 23 |
| 24 void LogIn(); | |
| 25 void LogIn(const std::string& account_id); | 24 void LogIn(const std::string& account_id); |
| 26 | 25 |
| 27 // Overridden from GaiaAuthConsumer. | 26 // Overridden from GaiaAuthConsumer. |
| 28 virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE; | 27 virtual void OnMergeSessionSuccess(const std::string& data) OVERRIDE; |
| 29 virtual void OnMergeSessionFailure(const GoogleServiceAuthError& error) | 28 virtual void OnMergeSessionFailure(const GoogleServiceAuthError& error) |
| 30 OVERRIDE; | 29 OVERRIDE; |
| 31 | 30 |
| 32 // Overridden from UbertokenConsumer. | 31 // Overridden from UbertokenConsumer. |
| 33 virtual void OnUbertokenSuccess(const std::string& token) OVERRIDE; | 32 virtual void OnUbertokenSuccess(const std::string& token) OVERRIDE; |
| 34 virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE; | 33 virtual void OnUbertokenFailure(const GoogleServiceAuthError& error) OVERRIDE; |
| 35 | 34 |
| 36 // For testing. | 35 // For testing. |
| 37 virtual UbertokenFetcher* CreateNewUbertokenFetcher(); | 36 virtual UbertokenFetcher* CreateNewUbertokenFetcher(); |
| 38 virtual GaiaAuthFetcher* CreateNewGaiaAuthFetcher(); | 37 virtual GaiaAuthFetcher* CreateNewGaiaAuthFetcher(); |
| 39 | 38 |
| 40 private: | 39 private: |
| 41 Profile* profile_; | 40 Profile* profile_; |
| 42 scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; | 41 scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; |
| 43 scoped_ptr<UbertokenFetcher> uber_token_fetcher_; | 42 scoped_ptr<UbertokenFetcher> uber_token_fetcher_; |
| 44 std::deque<std::string> accounts_; | 43 std::deque<std::string> accounts_; |
| 45 | 44 |
| 46 DISALLOW_COPY_AND_ASSIGN(GoogleAutoLoginHelper); | 45 DISALLOW_COPY_AND_ASSIGN(GoogleAutoLoginHelper); |
| 47 }; | 46 }; |
| 48 | 47 |
| 49 #endif // CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_ | 48 #endif // CHROME_BROWSER_ANDROID_SIGNIN_GOOGLE_AUTO_LOGIN_HELPER_H_ |
| OLD | NEW |