OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_OAUTH2_TOKEN_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ |
6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ | 6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // Informs |consumer_| that this request is completed. | 141 // Informs |consumer_| that this request is completed. |
142 void InformConsumer(const GoogleServiceAuthError& error, | 142 void InformConsumer(const GoogleServiceAuthError& error, |
143 const std::string& access_token, | 143 const std::string& access_token, |
144 const base::Time& expiration_date); | 144 const base::Time& expiration_date); |
145 | 145 |
146 private: | 146 private: |
147 // |consumer_| to call back when this request completes. | 147 // |consumer_| to call back when this request completes. |
148 Consumer* const consumer_; | 148 Consumer* const consumer_; |
149 }; | 149 }; |
150 | 150 |
151 // Informs the consumer of |request| fetch results. | |
152 static void InformConsumer(base::WeakPtr<RequestImpl> request, | |
153 const GoogleServiceAuthError& error, | |
154 const std::string& access_token, | |
155 const base::Time& expiration_date); | |
156 | |
157 private: | 151 private: |
158 // Class that fetches an OAuth2 access token for a given set of scopes and | 152 // Class that fetches an OAuth2 access token for a given set of scopes and |
159 // OAuth2 refresh token. | 153 // OAuth2 refresh token. |
160 class Fetcher; | 154 class Fetcher; |
161 friend class Fetcher; | 155 friend class Fetcher; |
162 | 156 |
163 // Struct that contains the information of an OAuth2 access token. | 157 // Struct that contains the information of an OAuth2 access token. |
164 struct CacheEntry { | 158 struct CacheEntry { |
165 std::string access_token; | 159 std::string access_token; |
166 base::Time expiration_date; | 160 base::Time expiration_date; |
(...skipping 26 matching lines...) Expand all Loading... |
193 // token. | 187 // token. |
194 typedef std::pair<std::string, ScopeSet> FetchParameters; | 188 typedef std::pair<std::string, ScopeSet> FetchParameters; |
195 // A map from fetch parameters to a fetcher that is fetching an OAuth2 access | 189 // A map from fetch parameters to a fetcher that is fetching an OAuth2 access |
196 // token using these parameters. | 190 // token using these parameters. |
197 std::map<FetchParameters, Fetcher*> pending_fetchers_; | 191 std::map<FetchParameters, Fetcher*> pending_fetchers_; |
198 | 192 |
199 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenService); | 193 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenService); |
200 }; | 194 }; |
201 | 195 |
202 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ | 196 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ |
OLD | NEW |