OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 5 #ifndef GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
6 #define GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 6 #define GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // ClientLogin-style service tokens. The response to this request is the | 151 // ClientLogin-style service tokens. The response to this request is the |
152 // same as the response to a ClientLogin request, except that captcha | 152 // same as the response to a ClientLogin request, except that captcha |
153 // challenges are never issued. | 153 // challenges are never issued. |
154 // | 154 // |
155 // Either OnClientLoginSuccess or OnClientLoginFailure will be | 155 // Either OnClientLoginSuccess or OnClientLoginFailure will be |
156 // called on the consumer on the original thread. If |service| is empty, | 156 // called on the consumer on the original thread. If |service| is empty, |
157 // the call will attempt to fetch uber auth token. | 157 // the call will attempt to fetch uber auth token. |
158 void StartOAuthLogin(const std::string& access_token, | 158 void StartOAuthLogin(const std::string& access_token, |
159 const std::string& service); | 159 const std::string& service); |
160 | 160 |
| 161 // Starts a request to list the accounts in the GAIA cookie. |
| 162 void StartListAccounts(); |
| 163 |
161 // Implementation of net::URLFetcherDelegate | 164 // Implementation of net::URLFetcherDelegate |
162 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 165 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
163 | 166 |
164 // StartClientLogin been called && results not back yet? | 167 // StartClientLogin been called && results not back yet? |
165 bool HasPendingFetch(); | 168 bool HasPendingFetch(); |
166 | 169 |
167 // Stop any URL fetches in progress. | 170 // Stop any URL fetches in progress. |
168 void CancelRequest(); | 171 void CancelRequest(); |
169 | 172 |
170 // From a URLFetcher result, generate an appropriate error. | 173 // From a URLFetcher result, generate an appropriate error. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 int response_code); | 249 int response_code); |
247 | 250 |
248 void OnOAuth2TokenPairFetched(const std::string& data, | 251 void OnOAuth2TokenPairFetched(const std::string& data, |
249 const net::URLRequestStatus& status, | 252 const net::URLRequestStatus& status, |
250 int response_code); | 253 int response_code); |
251 | 254 |
252 void OnOAuth2RevokeTokenFetched(const std::string& data, | 255 void OnOAuth2RevokeTokenFetched(const std::string& data, |
253 const net::URLRequestStatus& status, | 256 const net::URLRequestStatus& status, |
254 int response_code); | 257 int response_code); |
255 | 258 |
| 259 void OnListAccountsFetched(const std::string& data, |
| 260 const net::URLRequestStatus& status, |
| 261 int response_code); |
| 262 |
256 void OnGetUserInfoFetched(const std::string& data, | 263 void OnGetUserInfoFetched(const std::string& data, |
257 const net::URLRequestStatus& status, | 264 const net::URLRequestStatus& status, |
258 int response_code); | 265 int response_code); |
259 | 266 |
260 void OnMergeSessionFetched(const std::string& data, | 267 void OnMergeSessionFetched(const std::string& data, |
261 const net::URLRequestStatus& status, | 268 const net::URLRequestStatus& status, |
262 int response_code); | 269 int response_code); |
263 | 270 |
264 void OnUberAuthTokenFetch(const std::string& data, | 271 void OnUberAuthTokenFetch(const std::string& data, |
265 const net::URLRequestStatus& status, | 272 const net::URLRequestStatus& status, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 net::URLRequestContextGetter* const getter_; | 359 net::URLRequestContextGetter* const getter_; |
353 std::string source_; | 360 std::string source_; |
354 const GURL client_login_gurl_; | 361 const GURL client_login_gurl_; |
355 const GURL issue_auth_token_gurl_; | 362 const GURL issue_auth_token_gurl_; |
356 const GURL oauth2_token_gurl_; | 363 const GURL oauth2_token_gurl_; |
357 const GURL oauth2_revoke_gurl_; | 364 const GURL oauth2_revoke_gurl_; |
358 const GURL get_user_info_gurl_; | 365 const GURL get_user_info_gurl_; |
359 const GURL merge_session_gurl_; | 366 const GURL merge_session_gurl_; |
360 const GURL uberauth_token_gurl_; | 367 const GURL uberauth_token_gurl_; |
361 const GURL oauth_login_gurl_; | 368 const GURL oauth_login_gurl_; |
| 369 const GURL list_accounts_gurl_; |
362 | 370 |
363 // While a fetch is going on: | 371 // While a fetch is going on: |
364 scoped_ptr<net::URLFetcher> fetcher_; | 372 scoped_ptr<net::URLFetcher> fetcher_; |
365 GURL client_login_to_oauth2_gurl_; | 373 GURL client_login_to_oauth2_gurl_; |
366 std::string request_body_; | 374 std::string request_body_; |
367 std::string requested_service_; // Currently tracked for IssueAuthToken only. | 375 std::string requested_service_; // Currently tracked for IssueAuthToken only. |
368 bool fetch_pending_; | 376 bool fetch_pending_; |
369 | 377 |
370 friend class GaiaAuthFetcherTest; | 378 friend class GaiaAuthFetcherTest; |
371 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); | 379 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); |
(...skipping 10 matching lines...) Expand all Loading... |
382 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 390 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
383 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 391 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
384 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 392 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
385 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 393 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
386 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 394 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
387 | 395 |
388 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 396 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
389 }; | 397 }; |
390 | 398 |
391 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 399 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
OLD | NEW |