Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / google_apis / gaia / fake_oauth2_token_service_delegate.h
blobd75a22f57286d0025e1d0a5f41eb86f931c67f32
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 CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
6 #define CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
8 #include "google_apis/gaia/oauth2_token_service_delegate.h"
9 #include "net/url_request/url_request_context_getter.h"
11 class FakeOAuth2TokenServiceDelegate : public OAuth2TokenServiceDelegate {
12 public:
13 FakeOAuth2TokenServiceDelegate(net::URLRequestContextGetter* request_context);
14 ~FakeOAuth2TokenServiceDelegate() override;
16 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher(
17 const std::string& account_id,
18 net::URLRequestContextGetter* getter,
19 OAuth2AccessTokenConsumer* consumer) override;
21 // Overriden to make sure it works on Android.
22 bool RefreshTokenIsAvailable(const std::string& account_id) const override;
24 std::vector<std::string> GetAccounts() override;
25 void RevokeAllCredentials() override;
27 void LoadCredentials(const std::string& primary_account_id) override;
29 void UpdateCredentials(const std::string& account_id,
30 const std::string& refresh_token) override;
31 void RevokeCredentials(const std::string& account_id) override;
33 net::URLRequestContextGetter* GetRequestContext() const override;
35 void set_request_context(net::URLRequestContextGetter* request_context) {
36 request_context_ = request_context;
39 private:
40 void IssueRefreshTokenForUser(const std::string& account_id,
41 const std::string& token);
42 std::string GetRefreshToken(const std::string& account_id) const;
44 // Maps account ids to their refresh token strings.
45 std::map<std::string, std::string> refresh_tokens_;
47 scoped_refptr<net::URLRequestContextGetter> request_context_;
49 DISALLOW_COPY_AND_ASSIGN(FakeOAuth2TokenServiceDelegate);
51 #endif