| 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 #ifndef CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ | 4 #ifndef CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ |
| 5 #define CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ | 5 #define CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ |
| 6 | 6 |
| 7 #include <deque> |
| 8 |
| 7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 12 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
| 11 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 13 #include "google_apis/gaia/gaia_auth_consumer.h" | 15 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 14 #include "google_apis/gaia/oauth2_token_service.h" | 16 #include "google_apis/gaia/oauth2_token_service.h" |
| 15 | 17 |
| 16 class GaiaAuthFetcher; | 18 class GaiaAuthFetcher; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 55 |
| 54 static std::vector<std::string> ParseListAccountsData( | 56 static std::vector<std::string> ParseListAccountsData( |
| 55 const std::string& data); | 57 const std::string& data); |
| 56 | 58 |
| 57 // Start and stop the periodic reconciliation. | 59 // Start and stop the periodic reconciliation. |
| 58 void StartPeriodicReconciliation(); | 60 void StartPeriodicReconciliation(); |
| 59 void StopPeriodicReconciliation(); | 61 void StopPeriodicReconciliation(); |
| 60 void PeriodicReconciliation(); | 62 void PeriodicReconciliation(); |
| 61 | 63 |
| 62 void PerformMergeAction(const std::string& account_id); | 64 void PerformMergeAction(const std::string& account_id); |
| 65 void PerformMergeAction(const std::deque<std::string>& account_ids); |
| 63 void PerformRemoveAction(const std::string& account_id); | 66 void PerformRemoveAction(const std::string& account_id); |
| 64 void StartReconcileAction(); | 67 void StartReconcileAction(); |
| 65 void FinishReconcileAction(); | 68 void FinishReconcileAction(); |
| 66 | 69 |
| 67 void GetAccountsFromCookie(); | 70 void GetAccountsFromCookie(); |
| 68 void ValidateAccountsFromTokenService(); | 71 void ValidateAccountsFromTokenService(); |
| 69 | 72 |
| 70 void OnCookieChanged(ChromeCookieDetails* details); | 73 void OnCookieChanged(ChromeCookieDetails* details); |
| 71 | 74 |
| 72 // Overriden from content::NotificationObserver | 75 // Overriden from content::NotificationObserver |
| 73 virtual void Observe(int type, | 76 virtual void Observe(int type, |
| 74 const content::NotificationSource& source, | 77 const content::NotificationSource& source, |
| 75 const content::NotificationDetails& details) OVERRIDE; | 78 const content::NotificationDetails& details) OVERRIDE; |
| 76 | 79 |
| 77 // Overriden from OAuth2TokenService::Consumer | 80 // Overriden from OAuth2TokenService::Consumer |
| 78 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 81 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 79 const std::string& access_token, | 82 const std::string& access_token, |
| 80 const base::Time& expiration_time) OVERRIDE; | 83 const base::Time& expiration_time) OVERRIDE; |
| 81 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 84 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 82 const GoogleServiceAuthError& error) OVERRIDE; | 85 const GoogleServiceAuthError& error) OVERRIDE; |
| 83 | 86 |
| 84 // Overriden from OAuth2TokenService::Observer | 87 // Overriden from OAuth2TokenService::Observer |
| 85 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; | 88 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; |
| 89 virtual void OnRefreshTokenAvailable( |
| 90 const std::deque<std::string>& account_ids) OVERRIDE; |
| 86 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE; | 91 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE; |
| 87 virtual void OnRefreshTokensLoaded() OVERRIDE; | 92 virtual void OnRefreshTokensLoaded() OVERRIDE; |
| 88 | 93 |
| 89 // Overriden from GaiaAuthConsumer | 94 // Overriden from GaiaAuthConsumer |
| 90 virtual void OnListAccountsSuccess(const std::string& data) OVERRIDE; | 95 virtual void OnListAccountsSuccess(const std::string& data) OVERRIDE; |
| 91 virtual void OnListAccountsFailure( | 96 virtual void OnListAccountsFailure( |
| 92 const GoogleServiceAuthError& error) OVERRIDE; | 97 const GoogleServiceAuthError& error) OVERRIDE; |
| 93 | 98 |
| 94 // The profile that this reconcilor belongs to. | 99 // The profile that this reconcilor belongs to. |
| 95 Profile* profile_; | 100 Profile* profile_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 107 std::string primary_account_; | 112 std::string primary_account_; |
| 108 std::vector<std::string> chrome_accounts_; | 113 std::vector<std::string> chrome_accounts_; |
| 109 scoped_ptr<OAuth2TokenService::Request>* requests_; | 114 scoped_ptr<OAuth2TokenService::Request>* requests_; |
| 110 std::set<std::string> valid_chrome_accounts_; | 115 std::set<std::string> valid_chrome_accounts_; |
| 111 std::set<std::string> invalid_chrome_accounts_; | 116 std::set<std::string> invalid_chrome_accounts_; |
| 112 | 117 |
| 113 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); | 118 DISALLOW_COPY_AND_ASSIGN(AccountReconcilor); |
| 114 }; | 119 }; |
| 115 | 120 |
| 116 #endif // CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ | 121 #endif // CHROME_BROWSER_SIGNIN_ACCOUNT_RECONCILOR_H_ |
| OLD | NEW |