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 "chrome/browser/signin/profile_oauth2_token_service.h" | 8 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 virtual void Shutdown() OVERRIDE; | 77 virtual void Shutdown() OVERRIDE; |
78 | 78 |
79 // Helper function to be used with | 79 // Helper function to be used with |
80 // BrowserContextKeyedService::SetTestingFactory(). | 80 // BrowserContextKeyedService::SetTestingFactory(). |
81 static BrowserContextKeyedService* Build(content::BrowserContext* profile); | 81 static BrowserContextKeyedService* Build(content::BrowserContext* profile); |
82 | 82 |
83 protected: | 83 protected: |
84 // OAuth2TokenService overrides. | 84 // OAuth2TokenService overrides. |
85 virtual void FetchOAuth2Token(RequestImpl* request, | 85 virtual void FetchOAuth2Token(RequestImpl* request, |
| 86 const std::string& account_id, |
86 net::URLRequestContextGetter* getter, | 87 net::URLRequestContextGetter* getter, |
87 const std::string& client_id, | 88 const std::string& client_id, |
88 const std::string& client_secret, | 89 const std::string& client_secret, |
89 const ScopeSet& scopes) OVERRIDE; | 90 const ScopeSet& scopes) OVERRIDE; |
90 | 91 |
91 virtual std::string GetRefreshToken() OVERRIDE; | 92 virtual std::string GetRefreshToken(const std::string& account_id) OVERRIDE; |
92 | 93 |
93 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; | 94 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE; |
94 | 95 |
95 private: | 96 private: |
96 // Helper function to complete pending requests - if |all_scopes| is true, | 97 // Helper function to complete pending requests - if |all_scopes| is true, |
97 // then all pending requests are completed, otherwise, only those requests | 98 // then all pending requests are completed, otherwise, only those requests |
98 // matching |scopes| are completed. | 99 // matching |scopes| are completed. |
99 void CompleteRequests(bool all_scopes, | 100 void CompleteRequests(bool all_scopes, |
100 const ScopeSet& scopes, | 101 const ScopeSet& scopes, |
101 const GoogleServiceAuthError& error, | 102 const GoogleServiceAuthError& error, |
102 const std::string& access_token, | 103 const std::string& access_token, |
103 const base::Time& expiration); | 104 const base::Time& expiration); |
104 | 105 |
105 std::vector<PendingRequest> pending_requests_; | 106 std::vector<PendingRequest> pending_requests_; |
106 std::string refresh_token_; | 107 std::string refresh_token_; |
107 | 108 |
108 DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenService); | 109 DISALLOW_COPY_AND_ASSIGN(FakeProfileOAuth2TokenService); |
109 }; | 110 }; |
110 | 111 |
111 #endif // CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ | 112 #endif // CHROME_BROWSER_SIGNIN_FAKE_PROFILE_OAUTH2_TOKEN_SERVICE_H_ |
OLD | NEW |