Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1034)

Side by Side Diff: google_apis/gaia/fake_oauth2_token_service_delegate.h

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: debug Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
6 #define CHROME_BROWSER_SIGNIN_FAKE_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
7
8 #include "google_apis/gaia/oauth2_token_service_delegate.h"
9 #include "net/url_request/url_request_context_getter.h"
10
11 class FakeOAuth2TokenServiceDelegate : public OAuth2TokenServiceDelegate {
12 public:
13 FakeOAuth2TokenServiceDelegate(net::URLRequestContextGetter* request_context);
14 ~FakeOAuth2TokenServiceDelegate() override;
15
16 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher(
17 const std::string& account_id,
18 net::URLRequestContextGetter* getter,
19 OAuth2AccessTokenConsumer* consumer) override;
20
21 // Overriden to make sure it works on Android.
22 bool RefreshTokenIsAvailable(const std::string& account_id) const override;
23
24 std::vector<std::string> GetAccounts() override;
25 void RevokeAllCredentials() override;
26
27 void LoadCredentials(const std::string& primary_account_id) override;
28
29 void UpdateCredentials(const std::string& account_id,
30 const std::string& refresh_token) override;
31 void RevokeCredentials(const std::string& account_id) override;
32
33 net::URLRequestContextGetter* GetRequestContext() const override;
34
35 void set_request_context(net::URLRequestContextGetter* request_context) {
36 request_context_ = request_context;
37 }
38
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;
43
44 // Maps account ids to their refresh token strings.
45 std::map<std::string, std::string> refresh_tokens_;
46
47 scoped_refptr<net::URLRequestContextGetter> request_context_;
48
49 DISALLOW_COPY_AND_ASSIGN(FakeOAuth2TokenServiceDelegate);
50 };
51 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698