Chromium Code Reviews| Index: chrome/browser/signin/account_reconcilor.h |
| diff --git a/chrome/browser/signin/account_reconcilor.h b/chrome/browser/signin/account_reconcilor.h |
| index 7454f36e60e4152c442f952a7c113f01d2c9580b..e89626c57bd8741bcddb99f357bb0111cbc3e8ca 100644 |
| --- a/chrome/browser/signin/account_reconcilor.h |
| +++ b/chrome/browser/signin/account_reconcilor.h |
| @@ -6,16 +6,21 @@ |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| +#include "google_apis/gaia/gaia_auth_consumer.h" |
| #include "google_apis/gaia/oauth2_token_service.h" |
| +class GaiaAuthFetcher; |
| class Profile; |
| struct ChromeCookieDetails; |
| class AccountReconcilor : public BrowserContextKeyedService, |
| content::NotificationObserver, |
| + GaiaAuthConsumer, |
| + OAuth2TokenService::Consumer, |
| OAuth2TokenService::Observer { |
| public: |
| explicit AccountReconcilor(Profile* profile); |
| @@ -39,32 +44,68 @@ class AccountReconcilor : public BrowserContextKeyedService, |
| void RegisterWithTokenService(); |
| void UnregisterWithTokenService(); |
| + bool IsProfileConnected(); |
| + |
| + void DeleteAccessTokenRequests(); |
| + |
|
acleung1
2013/11/05 00:04:28
Should this be a static method?
Roger Tawa OOO till Jul 10th
2013/11/05 21:33:28
Done.
|
| + std::vector<std::string> ParseListAccountsData(const std::string& data); |
|
acleung1
2013/11/05 00:04:28
Also, seems like it'be very quick to add a unit te
Roger Tawa OOO till Jul 10th
2013/11/05 21:33:28
Done.
|
| + |
| // Start and stop the periodic reconciliation. |
| void StartPeriodicReconciliation(); |
| void StopPeriodicReconciliation(); |
| void PeriodicReconciliation(); |
| - // The profile that this reconcilor belongs to. |
| - Profile* profile_; |
| - content::NotificationRegistrar registrar_; |
| - base::RepeatingTimer<AccountReconcilor> reconciliation_timer_; |
| - |
| void PerformMergeAction(const std::string& account_id); |
| void PerformRemoveAction(const std::string& account_id); |
| - void PerformReconcileAction(); |
| + void StartReconcileAction(); |
| + void FinishReconcileAction(); |
| + |
| + void GetAccountsFromCookie(); |
| + void ValidateAccountsFromTokenService(); |
| + |
| + void OnCookieChanged(ChromeCookieDetails* details); |
| // Overriden from content::NotificationObserver |
| virtual void Observe(int type, |
| const content::NotificationSource& source, |
| const content::NotificationDetails& details) OVERRIDE; |
| - void OnCookieChanged(ChromeCookieDetails* details); |
| + // Overriden from OAuth2TokenService::Consumer |
| + virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| + const std::string& access_token, |
| + const base::Time& expiration_time) OVERRIDE; |
| + virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| + const GoogleServiceAuthError& error) OVERRIDE; |
| // Overriden from OAuth2TokenService::Observer |
| virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; |
| virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE; |
| virtual void OnRefreshTokensLoaded() OVERRIDE; |
| + // Overriden from GaiaAuthConsumer |
| + virtual void OnListAccountsSuccess(const std::string& data) OVERRIDE; |
| + virtual void OnListAccountsFailure( |
| + const GoogleServiceAuthError& error) OVERRIDE; |
| + |
| + // The profile that this reconcilor belongs to. |
| + Profile* profile_; |
| + content::NotificationRegistrar registrar_; |
| + base::RepeatingTimer<AccountReconcilor> reconciliation_timer_; |
| + |
| + // Used during reconcile action. |
| + // These members are used used to validate the gaia cookie. |
| + scoped_ptr<GaiaAuthFetcher> gaia_fetcher_; |
| + bool are_gaia_accounts_set_; |
| + std::vector<std::string> gaia_accounts_; |
| + |
| + // Used during reconcile action. |
| + // These members are used to validate the tokens in OAuth2TokenService. |
| + std::string primary_account_; |
| + std::vector<std::string> chrome_accounts_; |
| + scoped_ptr<OAuth2TokenService::Request>* requests_; |
| + std::set<std::string> valid_chrome_accounts_; |
| + std::set<std::string> invalid_chrome_accounts_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); |
| }; |