| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 const std::string& domain, | 217 const std::string& domain, |
| 218 const std::string& login_hint); | 218 const std::string& login_hint); |
| 219 | 219 |
| 220 // Implementation of net::URLFetcherDelegate | 220 // Implementation of net::URLFetcherDelegate |
| 221 void OnURLFetchComplete(const net::URLFetcher* source) override; | 221 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 222 | 222 |
| 223 // StartClientLogin been called && results not back yet? | 223 // StartClientLogin been called && results not back yet? |
| 224 bool HasPendingFetch(); | 224 bool HasPendingFetch(); |
| 225 | 225 |
| 226 // Stop any URL fetches in progress. | 226 // Stop any URL fetches in progress. |
| 227 void CancelRequest(); | 227 virtual void CancelRequest(); |
| 228 | 228 |
| 229 // From a URLFetcher result, generate an appropriate error. | 229 // From a URLFetcher result, generate an appropriate error. |
| 230 // From the API documentation, both IssueAuthToken and ClientLogin have | 230 // From the API documentation, both IssueAuthToken and ClientLogin have |
| 231 // the same error returns. | 231 // the same error returns. |
| 232 static GoogleServiceAuthError GenerateOAuthLoginError( | 232 static GoogleServiceAuthError GenerateOAuthLoginError( |
| 233 const std::string& data, | 233 const std::string& data, |
| 234 const net::URLRequestStatus& status); | 234 const net::URLRequestStatus& status); |
| 235 | 235 |
| 236 protected: | 236 protected: |
| 237 // Create and start |fetcher_|, used to make all Gaia request. |body| is | 237 // Create and start |fetcher_|, used to make all Gaia request. |body| is |
| (...skipping 10 matching lines...) Expand all Loading... |
| 248 const GURL& gaia_gurl, | 248 const GURL& gaia_gurl, |
| 249 int load_flags); | 249 int load_flags); |
| 250 | 250 |
| 251 // Dispatch the results of a request. | 251 // Dispatch the results of a request. |
| 252 void DispatchFetchedRequest(const GURL& url, | 252 void DispatchFetchedRequest(const GURL& url, |
| 253 const std::string& data, | 253 const std::string& data, |
| 254 const net::ResponseCookies& cookies, | 254 const net::ResponseCookies& cookies, |
| 255 const net::URLRequestStatus& status, | 255 const net::URLRequestStatus& status, |
| 256 int response_code); | 256 int response_code); |
| 257 | 257 |
| 258 void SetPendingFetch(bool pending_fetch); |
| 259 |
| 258 private: | 260 private: |
| 259 // ClientLogin body constants that don't change | 261 // ClientLogin body constants that don't change |
| 260 static const char kCookiePersistence[]; | 262 static const char kCookiePersistence[]; |
| 261 static const char kAccountTypeHostedOrGoogle[]; | 263 static const char kAccountTypeHostedOrGoogle[]; |
| 262 static const char kAccountTypeGoogle[]; | 264 static const char kAccountTypeGoogle[]; |
| 263 | 265 |
| 264 // The format of the POST body for ClientLogin. | 266 // The format of the POST body for ClientLogin. |
| 265 static const char kClientLoginFormat[]; | 267 static const char kClientLoginFormat[]; |
| 266 // The format of said POST body when CAPTCHA token & answer are specified. | 268 // The format of said POST body when CAPTCHA token & answer are specified. |
| 267 static const char kClientLoginCaptchaFormat[]; | 269 static const char kClientLoginCaptchaFormat[]; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 497 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
| 496 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 498 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
| 497 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 499 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
| 498 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 500 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
| 499 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 501 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
| 500 | 502 |
| 501 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 503 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
| 502 }; | 504 }; |
| 503 | 505 |
| 504 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 506 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
| OLD | NEW |