| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 // Dispatch the results of a request. | 222 // Dispatch the results of a request. |
| 223 void DispatchFetchedRequest(const GURL& url, | 223 void DispatchFetchedRequest(const GURL& url, |
| 224 const std::string& data, | 224 const std::string& data, |
| 225 const net::ResponseCookies& cookies, | 225 const net::ResponseCookies& cookies, |
| 226 const net::URLRequestStatus& status, | 226 const net::URLRequestStatus& status, |
| 227 int response_code); | 227 int response_code); |
| 228 | 228 |
| 229 void SetPendingFetch(bool pending_fetch); | 229 void SetPendingFetch(bool pending_fetch); |
| 230 | 230 |
| 231 // Set the headers to use during the Logout call. |
| 232 void SetLogoutHeaders(const std::string& headers); |
| 233 |
| 231 private: | 234 private: |
| 232 // The format of the POST body for IssueAuthToken. | 235 // The format of the POST body for IssueAuthToken. |
| 233 static const char kIssueAuthTokenFormat[]; | 236 static const char kIssueAuthTokenFormat[]; |
| 234 // The format of the query string to get OAuth2 auth code from auth token. | 237 // The format of the query string to get OAuth2 auth code from auth token. |
| 235 static const char kClientLoginToOAuth2URLFormat[]; | 238 static const char kClientLoginToOAuth2URLFormat[]; |
| 236 // The format of the POST body to get OAuth2 token pair from auth code. | 239 // The format of the POST body to get OAuth2 token pair from auth code. |
| 237 static const char kOAuth2CodeToTokenPairBodyFormat[]; | 240 static const char kOAuth2CodeToTokenPairBodyFormat[]; |
| 238 // Additional param for the POST body to get OAuth2 token pair from auth code. | 241 // Additional param for the POST body to get OAuth2 token pair from auth code. |
| 239 static const char kOAuth2CodeToTokenPairDeviceIdParam[]; | 242 static const char kOAuth2CodeToTokenPairDeviceIdParam[]; |
| 240 // The format of the POST body to revoke an OAuth2 token. | 243 // The format of the POST body to revoke an OAuth2 token. |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 const GURL get_check_connection_info_url_; | 426 const GURL get_check_connection_info_url_; |
| 424 const GURL oauth2_iframe_url_; | 427 const GURL oauth2_iframe_url_; |
| 425 | 428 |
| 426 // While a fetch is going on: | 429 // While a fetch is going on: |
| 427 scoped_ptr<net::URLFetcher> fetcher_; | 430 scoped_ptr<net::URLFetcher> fetcher_; |
| 428 GURL client_login_to_oauth2_gurl_; | 431 GURL client_login_to_oauth2_gurl_; |
| 429 std::string request_body_; | 432 std::string request_body_; |
| 430 std::string requested_service_; | 433 std::string requested_service_; |
| 431 bool fetch_pending_; | 434 bool fetch_pending_; |
| 432 | 435 |
| 436 // Headers used during the Logout call. |
| 437 std::string logout_headers_; |
| 438 |
| 433 friend class GaiaAuthFetcherTest; | 439 friend class GaiaAuthFetcherTest; |
| 434 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); | 440 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); |
| 435 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); | 441 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDeletedError); |
| 436 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); | 442 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, AccountDisabledError); |
| 437 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); | 443 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, BadAuthenticationError); |
| 438 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); | 444 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, IncomprehensibleError); |
| 439 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); | 445 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ServiceUnavailableError); |
| 440 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); | 446 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckNormalErrorCode); |
| 441 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); | 447 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CheckTwoFactorResponse); |
| 442 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); | 448 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, LoginNetFailure); |
| 443 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, | 449 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, |
| 444 ParseClientLoginToOAuth2Response); | 450 ParseClientLoginToOAuth2Response); |
| 445 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 451 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
| 446 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 452 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
| 447 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 453 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
| 448 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 454 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
| 449 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 455 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
| 450 | 456 |
| 451 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 457 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
| 452 }; | 458 }; |
| 453 | 459 |
| 454 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 460 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
| OLD | NEW |