Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Side by Side Diff: chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fetcher.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe tcher.h" 5 #include "chrome/browser/supervised_user/legacy/supervised_user_refresh_token_fe tcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 const std::string& access_token, 149 const std::string& access_token,
150 const Time& expiration_time) { 150 const Time& expiration_time) {
151 DCHECK_EQ(access_token_request_.get(), request); 151 DCHECK_EQ(access_token_request_.get(), request);
152 access_token_ = access_token; 152 access_token_ = access_token;
153 153
154 GURL url(GaiaUrls::GetInstance()->oauth2_issue_token_url()); 154 GURL url(GaiaUrls::GetInstance()->oauth2_issue_token_url());
155 // GaiaOAuthClient uses id 0, so we use 1 to distinguish the requests in 155 // GaiaOAuthClient uses id 0, so we use 1 to distinguish the requests in
156 // unit tests. 156 // unit tests.
157 const int id = 1; 157 const int id = 1;
158 158
159 url_fetcher_.reset(URLFetcher::Create(id, url, URLFetcher::POST, this)); 159 url_fetcher_ = URLFetcher::Create(id, url, URLFetcher::POST, this);
160 160
161 url_fetcher_->SetRequestContext(context_); 161 url_fetcher_->SetRequestContext(context_);
162 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 162 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
163 net::LOAD_DO_NOT_SAVE_COOKIES); 163 net::LOAD_DO_NOT_SAVE_COOKIES);
164 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(kNumRetries); 164 url_fetcher_->SetAutomaticallyRetryOnNetworkChanges(kNumRetries);
165 url_fetcher_->AddExtraRequestHeader( 165 url_fetcher_->AddExtraRequestHeader(
166 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); 166 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str()));
167 167
168 std::string body = base::StringPrintf( 168 std::string body = base::StringPrintf(
169 kIssueTokenBodyFormat, 169 kIssueTokenBodyFormat,
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 URLRequestContextGetter* context) { 294 URLRequestContextGetter* context) {
295 scoped_ptr<SupervisedUserRefreshTokenFetcher> fetcher( 295 scoped_ptr<SupervisedUserRefreshTokenFetcher> fetcher(
296 new SupervisedUserRefreshTokenFetcherImpl(oauth2_token_service, 296 new SupervisedUserRefreshTokenFetcherImpl(oauth2_token_service,
297 account_id, 297 account_id,
298 device_id, 298 device_id,
299 context)); 299 context));
300 return fetcher.Pass(); 300 return fetcher.Pass();
301 } 301 }
302 302
303 SupervisedUserRefreshTokenFetcher::~SupervisedUserRefreshTokenFetcher() {} 303 SupervisedUserRefreshTokenFetcher::~SupervisedUserRefreshTokenFetcher() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698