Chromium Code Reviews| Index: chrome/browser/signin/fake_profile_oauth2_token_service_delegate.h |
| diff --git a/chrome/browser/signin/fake_profile_oauth2_token_service_delegate.h b/chrome/browser/signin/fake_profile_oauth2_token_service_delegate.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..174af3ff4e2b237e1192880c8730815de2998c41 |
| --- /dev/null |
| +++ b/chrome/browser/signin/fake_profile_oauth2_token_service_delegate.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ |
| +#define CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE__DELEGATE_H_ |
| + |
| +#include "google_apis/gaia/oauth2_token_service_delegate.h" |
| + |
| +class FakeProfileOAuth2TokenServiceDelegate |
| + : public OAuth2TokenServiceDelegate { |
|
Roger Tawa OOO till Jul 10th
2015/05/28 14:54:43
Why doesn't this derive from FakeOAuth2TokenServic
gogerald1
2015/06/03 18:12:58
Done.
|
| + public: |
| + FakeProfileOAuth2TokenServiceDelegate(); |
| + ~FakeProfileOAuth2TokenServiceDelegate() override; |
| + |
| + OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( |
| + const std::string& account_id, |
| + net::URLRequestContextGetter* getter, |
| + OAuth2AccessTokenConsumer* consumer) override; |
| + |
| + // Overriden to make sure it works on Android. |
| + bool RefreshTokenIsAvailable(const std::string& account_id) const override; |
| + std::string GetRefreshToken(const std::string& account_id) const override; |
| + void UpdateAuthError(const std::string& account_id, |
| + const GoogleServiceAuthError& error) override; |
| + |
| + std::vector<std::string> GetAccounts() override; |
| + void RevokeAllCredentials() override; |
| + |
| + // Overriden to make sure it works on iOS. |
| + void LoadCredentials(const std::string& primary_account_id) override; |
| + |
| + // Overriden to make sure it works on Android. Simply calls |
| + // IssueRefreshToken(). |
| + void UpdateCredentials(const std::string& account_id, |
| + const std::string& refresh_token) override; |
| + |
| + net::URLRequestContextGetter* GetRequestContext() const override; |
| + |
| + void IssueRefreshToken(const std::string& token); |
| + void IssueRefreshTokenForUser(const std::string& account_id, |
| + const std::string& token); |
| + void IssueAllRefreshTokensLoaded(); |
| + |
| + private: |
| + // Maps account ids to their refresh token strings. |
| + std::map<std::string, std::string> refresh_tokens_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenServiceDelegate); |
| +}; |
| + |
| +#endif |