Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / signin / ios / browser / fake_profile_oauth2_token_service_ios_delegate.h
blobf4d6894f34431c3f793dc147d6a8f43ffa153121
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SIGNIN_IOS_BROWSER_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_DELEGATE_H_
6 #define COMPONENTS_SIGNIN_IOS_BROWSER_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_DELEGATE_H_
8 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
10 class FakeProfileOAuth2TokenServiceIOSDelegate
11 : public ProfileOAuth2TokenServiceIOSDelegate {
12 public:
13 FakeProfileOAuth2TokenServiceIOSDelegate(
14 SigninClient* client,
15 ProfileOAuth2TokenServiceIOSProvider* provider,
16 AccountTrackerService* account_tracker_service,
17 SigninErrorController* signin_error_controller);
18 ~FakeProfileOAuth2TokenServiceIOSDelegate() override;
20 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher(
21 const std::string& account_id,
22 net::URLRequestContextGetter* getter,
23 OAuth2AccessTokenConsumer* consumer) override;
25 bool RefreshTokenIsAvailable(const std::string& account_id) const override;
27 std::vector<std::string> GetAccounts() override;
28 void RevokeAllCredentials() override;
30 void LoadCredentials(const std::string& primary_account_id) override;
32 void UpdateCredentials(const std::string& account_id,
33 const std::string& refresh_token) override;
34 void RevokeCredentials(const std::string& account_id) override;
35 void AddOrUpdateAccount(const std::string& account_id) override;
36 void RemoveAccount(const std::string& account_id) override;
38 private:
39 void IssueRefreshTokenForUser(const std::string& account_id,
40 const std::string& token);
41 std::string GetRefreshToken(const std::string& account_id) const;
43 // Maps account ids to their refresh token strings.
44 std::map<std::string, std::string> refresh_tokens_;
46 DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenServiceIOSDelegate);
49 #endif // COMPONENTS_SIGNIN_IOS_BROWSER_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_DELEGATE_H_