| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ |
| 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ | 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 void Start(); | 74 void Start(); |
| 75 // Stops tracking accounts. Cancels all of the pending token requests. | 75 // Stops tracking accounts. Cancels all of the pending token requests. |
| 76 void Stop(); | 76 void Stop(); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 // Maps account keys to account states. Keyed by account_ids as used by | 79 // Maps account keys to account states. Keyed by account_ids as used by |
| 80 // OAuth2TokenService. | 80 // OAuth2TokenService. |
| 81 typedef std::map<std::string, AccountInfo> AccountInfos; | 81 typedef std::map<std::string, AccountInfo> AccountInfos; |
| 82 | 82 |
| 83 // AccountTracker::Observer overrides. | 83 // AccountTracker::Observer overrides. |
| 84 virtual void OnAccountAdded(const gaia::AccountIds& ids) OVERRIDE; | 84 virtual void OnAccountAdded(const gaia::AccountIds& ids) override; |
| 85 virtual void OnAccountRemoved(const gaia::AccountIds& ids) OVERRIDE; | 85 virtual void OnAccountRemoved(const gaia::AccountIds& ids) override; |
| 86 virtual void OnAccountSignInChanged(const gaia::AccountIds& ids, | 86 virtual void OnAccountSignInChanged(const gaia::AccountIds& ids, |
| 87 bool is_signed_in) OVERRIDE; | 87 bool is_signed_in) override; |
| 88 | 88 |
| 89 // OAuth2TokenService::Consumer overrides. | 89 // OAuth2TokenService::Consumer overrides. |
| 90 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 90 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 91 const std::string& access_token, | 91 const std::string& access_token, |
| 92 const base::Time& expiration_time) OVERRIDE; | 92 const base::Time& expiration_time) override; |
| 93 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 93 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 94 const GoogleServiceAuthError& error) OVERRIDE; | 94 const GoogleServiceAuthError& error) override; |
| 95 | 95 |
| 96 // Report the list of accounts with OAuth2 tokens back using the |callback_| | 96 // Report the list of accounts with OAuth2 tokens back using the |callback_| |
| 97 // function. If there are token requests in progress, do nothing. | 97 // function. If there are token requests in progress, do nothing. |
| 98 void CompleteCollectingTokens(); | 98 void CompleteCollectingTokens(); |
| 99 // Deletes a token request. Should be called from OnGetTokenSuccess(..) or | 99 // Deletes a token request. Should be called from OnGetTokenSuccess(..) or |
| 100 // OnGetTokenFailure(..). | 100 // OnGetTokenFailure(..). |
| 101 void DeleteTokenRequest(const OAuth2TokenService::Request* request); | 101 void DeleteTokenRequest(const OAuth2TokenService::Request* request); |
| 102 // Checks on all known accounts, and calls GetToken(..) for those with | 102 // Checks on all known accounts, and calls GetToken(..) for those with |
| 103 // |state == TOKEN_NEEDED|. | 103 // |state == TOKEN_NEEDED|. |
| 104 void GetAllNeededTokens(); | 104 void GetAllNeededTokens(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 125 bool shutdown_called_; | 125 bool shutdown_called_; |
| 126 | 126 |
| 127 ScopedVector<OAuth2TokenService::Request> pending_token_requests_; | 127 ScopedVector<OAuth2TokenService::Request> pending_token_requests_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker); | 129 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 } // namespace gcm | 132 } // namespace gcm |
| 133 | 133 |
| 134 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ | 134 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ |
| OLD | NEW |