| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "google_apis/gaia/gaia_auth_consumer.h" | 14 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 15 #include "google_apis/gaia/google_service_auth_error.h" | 15 #include "google_apis/gaia/google_service_auth_error.h" |
| 16 #include "net/traffic_annotation/network_traffic_annotation.h" |
| 16 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
| 17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 18 | 19 |
| 19 // Authenticate a user against the Google Accounts ClientLogin API | 20 // Authenticate a user against the Google Accounts ClientLogin API |
| 20 // with various capabilities and return results to a GaiaAuthConsumer. | 21 // with various capabilities and return results to a GaiaAuthConsumer. |
| 21 // | 22 // |
| 22 // In the future, we will also issue auth tokens from this class. | 23 // In the future, we will also issue auth tokens from this class. |
| 23 // This class should be used on a single thread, but it can be whichever thread | 24 // This class should be used on a single thread, but it can be whichever thread |
| 24 // that you like. | 25 // that you like. |
| 25 // | 26 // |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 protected: | 230 protected: |
| 230 // Create and start |fetcher_|, used to make all Gaia request. |body| is | 231 // Create and start |fetcher_|, used to make all Gaia request. |body| is |
| 231 // used as the body of the POST request sent to GAIA. Any strings listed in | 232 // used as the body of the POST request sent to GAIA. Any strings listed in |
| 232 // |headers| are added as extra HTTP headers in the request. | 233 // |headers| are added as extra HTTP headers in the request. |
| 233 // | 234 // |
| 234 // |load_flags| are passed to directly to net::URLFetcher::Create() when | 235 // |load_flags| are passed to directly to net::URLFetcher::Create() when |
| 235 // creating the URL fetcher. | 236 // creating the URL fetcher. |
| 236 // | 237 // |
| 237 // HasPendingFetch() should return false before calling this method, and will | 238 // HasPendingFetch() should return false before calling this method, and will |
| 238 // return true afterwards. | 239 // return true afterwards. |
| 239 virtual void CreateAndStartGaiaFetcher(const std::string& body, | 240 virtual void CreateAndStartGaiaFetcher( |
| 240 const std::string& headers, | 241 const std::string& body, |
| 241 const GURL& gaia_gurl, | 242 const std::string& headers, |
| 242 int load_flags); | 243 const GURL& gaia_gurl, |
| 244 int load_flags, |
| 245 const net::NetworkTrafficAnnotationTag& traffic_annotation); |
| 243 | 246 |
| 244 // Dispatch the results of a request. | 247 // Dispatch the results of a request. |
| 245 void DispatchFetchedRequest(const GURL& url, | 248 void DispatchFetchedRequest(const GURL& url, |
| 246 const std::string& data, | 249 const std::string& data, |
| 247 const net::ResponseCookies& cookies, | 250 const net::ResponseCookies& cookies, |
| 248 const net::URLRequestStatus& status, | 251 const net::URLRequestStatus& status, |
| 249 int response_code); | 252 int response_code); |
| 250 | 253 |
| 251 void SetPendingFetch(bool pending_fetch); | 254 void SetPendingFetch(bool pending_fetch); |
| 252 | 255 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); | 477 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ParseOAuth2TokenPairResponse); |
| 475 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); | 478 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthSuccess); |
| 476 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); | 479 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthWithQuote); |
| 477 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); | 480 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeSuccess); |
| 478 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); | 481 FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, ClientOAuthChallengeQuote); |
| 479 | 482 |
| 480 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); | 483 DISALLOW_COPY_AND_ASSIGN(GaiaAuthFetcher); |
| 481 }; | 484 }; |
| 482 | 485 |
| 483 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ | 486 #endif // GOOGLE_APIS_GAIA_GAIA_AUTH_FETCHER_H_ |
| OLD | NEW |