| Index: google_apis/gaia/gaia_auth_fetcher.cc
|
| diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc
|
| index a2f7aa0e3c9d1730f6466a2ff2dc66cda08c8771..a79a0fc8863c9c0ebe36ecfe5634d2dc54a0030e 100644
|
| --- a/google_apis/gaia/gaia_auth_fetcher.cc
|
| +++ b/google_apis/gaia/gaia_auth_fetcher.cc
|
| @@ -225,16 +225,15 @@ void GaiaAuthFetcher::CancelRequest() {
|
| }
|
|
|
| // static
|
| -net::URLFetcher* GaiaAuthFetcher::CreateGaiaFetcher(
|
| +scoped_ptr<net::URLFetcher> GaiaAuthFetcher::CreateGaiaFetcher(
|
| net::URLRequestContextGetter* getter,
|
| const std::string& body,
|
| const std::string& headers,
|
| const GURL& gaia_gurl,
|
| int load_flags,
|
| net::URLFetcherDelegate* delegate) {
|
| - net::URLFetcher* to_return = net::URLFetcher::Create(
|
| - 0, gaia_gurl,
|
| - body.empty() ? net::URLFetcher::GET : net::URLFetcher::POST,
|
| + scoped_ptr<net::URLFetcher> to_return = net::URLFetcher::Create(
|
| + 0, gaia_gurl, body.empty() ? net::URLFetcher::GET : net::URLFetcher::POST,
|
| delegate);
|
| to_return->SetRequestContext(getter);
|
| to_return->SetUploadData("application/x-www-form-urlencoded", body);
|
| @@ -593,12 +592,9 @@ void GaiaAuthFetcher::StartClientLogin(
|
| login_token,
|
| login_captcha,
|
| allow_hosted_accounts);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - client_login_gurl_,
|
| - kLoadFlagsIgnoreCookies,
|
| - this));
|
| + fetcher_ =
|
| + CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + client_login_gurl_, kLoadFlagsIgnoreCookies, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -611,12 +607,9 @@ void GaiaAuthFetcher::StartIssueAuthToken(const std::string& sid,
|
| DVLOG(1) << "Starting IssueAuthToken for: " << service;
|
| requested_service_ = service;
|
| request_body_ = MakeIssueAuthTokenBody(sid, lsid, service);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - issue_auth_token_gurl_,
|
| - kLoadFlagsIgnoreCookies,
|
| - this));
|
| + fetcher_ =
|
| + CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + issue_auth_token_gurl_, kLoadFlagsIgnoreCookies, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -630,12 +623,9 @@ void GaiaAuthFetcher::StartLsoForOAuthLoginTokenExchange(
|
| client_login_to_oauth2_gurl_ =
|
| GaiaUrls::GetInstance()->client_login_to_oauth2_url();
|
|
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - MakeGetAuthCodeHeader(auth_token),
|
| - client_login_to_oauth2_gurl_,
|
| - kLoadFlagsIgnoreCookies,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(
|
| + getter_, request_body_, MakeGetAuthCodeHeader(auth_token),
|
| + client_login_to_oauth2_gurl_, kLoadFlagsIgnoreCookies, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -645,12 +635,9 @@ void GaiaAuthFetcher::StartRevokeOAuth2Token(const std::string& auth_token) {
|
|
|
| DVLOG(1) << "Starting OAuth2 token revocation";
|
| request_body_ = MakeRevokeTokenBody(auth_token);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - oauth2_revoke_gurl_,
|
| - kLoadFlagsIgnoreCookies,
|
| - this));
|
| + fetcher_ =
|
| + CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + oauth2_revoke_gurl_, kLoadFlagsIgnoreCookies, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -682,12 +669,9 @@ void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchangeWithDeviceId(
|
| base::StringPrintf(kDeviceIdHeaderFormat, device_id.c_str());
|
| }
|
|
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - device_id_header,
|
| - client_login_to_oauth2_gurl_,
|
| - net::LOAD_NORMAL,
|
| - this));
|
| + fetcher_ =
|
| + CreateGaiaFetcher(getter_, request_body_, device_id_header,
|
| + client_login_to_oauth2_gurl_, net::LOAD_NORMAL, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -698,12 +682,9 @@ void GaiaAuthFetcher::StartAuthCodeForOAuth2TokenExchange(
|
|
|
| DVLOG(1) << "Starting OAuth token pair fetch";
|
| request_body_ = MakeGetTokenPairBody(auth_code);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - oauth2_token_gurl_,
|
| - kLoadFlagsIgnoreCookies,
|
| - this));
|
| + fetcher_ =
|
| + CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + oauth2_token_gurl_, kLoadFlagsIgnoreCookies, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -713,12 +694,9 @@ void GaiaAuthFetcher::StartGetUserInfo(const std::string& lsid) {
|
|
|
| DVLOG(1) << "Starting GetUserInfo for lsid=" << lsid;
|
| request_body_ = MakeGetUserInfoBody(lsid);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - get_user_info_gurl_,
|
| - kLoadFlagsIgnoreCookies,
|
| - this));
|
| + fetcher_ =
|
| + CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + get_user_info_gurl_, kLoadFlagsIgnoreCookies, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -740,12 +718,8 @@ void GaiaAuthFetcher::StartMergeSession(const std::string& uber_token,
|
| std::string continue_url("http://www.google.com");
|
| request_body_ = MakeMergeSessionBody(uber_token, external_cc_result,
|
| continue_url, source_);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - merge_session_gurl_,
|
| - net::LOAD_NORMAL,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + merge_session_gurl_, net::LOAD_NORMAL, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -758,12 +732,8 @@ void GaiaAuthFetcher::StartTokenFetchForUberAuthExchange(
|
| << access_token;
|
| std::string authentication_header =
|
| base::StringPrintf(kOAuthHeaderFormat, access_token.c_str());
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - std::string(),
|
| - authentication_header,
|
| - uberauth_token_gurl_,
|
| - net::LOAD_NORMAL,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(getter_, std::string(), authentication_header,
|
| + uberauth_token_gurl_, net::LOAD_NORMAL, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -775,12 +745,8 @@ void GaiaAuthFetcher::StartOAuthLogin(const std::string& access_token,
|
| request_body_ = MakeOAuthLoginBody(service, source_);
|
| std::string authentication_header =
|
| base::StringPrintf(kOAuth2BearerHeaderFormat, access_token.c_str());
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - authentication_header,
|
| - oauth_login_gurl_,
|
| - net::LOAD_NORMAL,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(getter_, request_body_, authentication_header,
|
| + oauth_login_gurl_, net::LOAD_NORMAL, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -788,12 +754,10 @@ void GaiaAuthFetcher::StartOAuthLogin(const std::string& access_token,
|
| void GaiaAuthFetcher::StartListAccounts() {
|
| DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
|
|
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - " ", // To force an HTTP POST.
|
| - "Origin: https://www.google.com",
|
| - list_accounts_gurl_,
|
| - net::LOAD_NORMAL,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(getter_,
|
| + " ", // To force an HTTP POST.
|
| + "Origin: https://www.google.com",
|
| + list_accounts_gurl_, net::LOAD_NORMAL, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -801,12 +765,9 @@ void GaiaAuthFetcher::StartListAccounts() {
|
| void GaiaAuthFetcher::StartGetCheckConnectionInfo() {
|
| DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
|
|
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - std::string(),
|
| - std::string(),
|
| - get_check_connection_info_url_,
|
| - kLoadFlagsIgnoreCookies,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(getter_, std::string(), std::string(),
|
| + get_check_connection_info_url_,
|
| + kLoadFlagsIgnoreCookies, this);
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| }
|
| @@ -816,12 +777,8 @@ void GaiaAuthFetcher::StartListIDPSessions(const std::string& scopes,
|
| DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
|
|
|
| request_body_ = MakeListIDPSessionsBody(scopes, domain);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - oauth2_iframe_url_,
|
| - net::LOAD_NORMAL,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + oauth2_iframe_url_, net::LOAD_NORMAL, this);
|
| requested_service_ = kListIdpServiceRequested;
|
| fetch_pending_ = true;
|
| fetcher_->Start();
|
| @@ -833,12 +790,8 @@ void GaiaAuthFetcher::StartGetTokenResponse(const std::string& scopes,
|
| DCHECK(!fetch_pending_) << "Tried to fetch two things at once!";
|
|
|
| request_body_ = MakeGetTokenResponseBody(scopes, domain, login_hint);
|
| - fetcher_.reset(CreateGaiaFetcher(getter_,
|
| - request_body_,
|
| - std::string(),
|
| - oauth2_iframe_url_,
|
| - net::LOAD_NORMAL,
|
| - this));
|
| + fetcher_ = CreateGaiaFetcher(getter_, request_body_, std::string(),
|
| + oauth2_iframe_url_, net::LOAD_NORMAL, this);
|
|
|
| requested_service_ = kGetTokenResponseRequested;
|
| fetch_pending_ = true;
|
|
|