| 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_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 6 #define CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Sets the current refresh token. If |token| is non-empty, this will invoke | 75 // Sets the current refresh token. If |token| is non-empty, this will invoke |
| 76 // OnRefreshTokenAvailable() on all Observers, otherwise this will invoke | 76 // OnRefreshTokenAvailable() on all Observers, otherwise this will invoke |
| 77 // OnRefreshTokenRevoked(). | 77 // OnRefreshTokenRevoked(). |
| 78 void IssueRefreshToken(const std::string& token); | 78 void IssueRefreshToken(const std::string& token); |
| 79 | 79 |
| 80 // TODO(fgorski,rogerta): Merge with UpdateCredentials when this class fully | 80 // TODO(fgorski,rogerta): Merge with UpdateCredentials when this class fully |
| 81 // supports multiple accounts. | 81 // supports multiple accounts. |
| 82 void IssueRefreshTokenForUser(const std::string& account_id, | 82 void IssueRefreshTokenForUser(const std::string& account_id, |
| 83 const std::string& token); | 83 const std::string& token); |
| 84 | 84 |
| 85 // Fire OnRefreshTokensLoaded on all observers. |
| 86 void IssueAllRefreshTokensLoaded(); |
| 87 |
| 85 // Gets a list of active requests (can be used by tests to validate that the | 88 // Gets a list of active requests (can be used by tests to validate that the |
| 86 // correct request has been issued). | 89 // correct request has been issued). |
| 87 std::vector<PendingRequest> GetPendingRequests(); | 90 std::vector<PendingRequest> GetPendingRequests(); |
| 88 | 91 |
| 89 // Helper routines to issue tokens for pending requests. | 92 // Helper routines to issue tokens for pending requests. |
| 90 void IssueAllTokensForAccount(const std::string& account_id, | 93 void IssueAllTokensForAccount(const std::string& account_id, |
| 91 const std::string& access_token, | 94 const std::string& access_token, |
| 92 const base::Time& expiration); | 95 const base::Time& expiration); |
| 93 | 96 |
| 97 void IssueErrorForAllPendingRequestsForAccount( |
| 98 const std::string& account_id, |
| 99 const GoogleServiceAuthError& error); |
| 100 |
| 94 void IssueTokenForScope(const ScopeSet& scopes, | 101 void IssueTokenForScope(const ScopeSet& scopes, |
| 95 const std::string& access_token, | 102 const std::string& access_token, |
| 96 const base::Time& expiration); | 103 const base::Time& expiration); |
| 97 | 104 |
| 98 void IssueErrorForScope(const ScopeSet& scopes, | 105 void IssueErrorForScope(const ScopeSet& scopes, |
| 99 const GoogleServiceAuthError& error); | 106 const GoogleServiceAuthError& error); |
| 100 | 107 |
| 101 void IssueTokenForAllPendingRequests(const std::string& access_token, | 108 void IssueTokenForAllPendingRequests(const std::string& access_token, |
| 102 const base::Time& expiration); | 109 const base::Time& expiration); |
| 103 | 110 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // |FetchOAuth2Token| on the current run loop. There is no need to call | 159 // |FetchOAuth2Token| on the current run loop. There is no need to call |
| 153 // |IssueTokenForScope| in this case. | 160 // |IssueTokenForScope| in this case. |
| 154 bool auto_post_fetch_response_on_message_loop_; | 161 bool auto_post_fetch_response_on_message_loop_; |
| 155 | 162 |
| 156 base::WeakPtrFactory<FakeProfileOAuth2TokenService> weak_ptr_factory_; | 163 base::WeakPtrFactory<FakeProfileOAuth2TokenService> weak_ptr_factory_; |
| 157 | 164 |
| 158 DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenService); | 165 DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenService); |
| 159 }; | 166 }; |
| 160 | 167 |
| 161 #endif // CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 168 #endif // CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
| OLD | NEW |