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

Side by Side Diff: chrome/browser/chromeos/policy/upload_job.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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/chromeos/policy/upload_job.h" 5 #include "chrome/browser/chromeos/policy/upload_job.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return true; 307 return true;
308 } 308 }
309 309
310 void UploadJob::CreateAndStartURLFetcher(const std::string& access_token) { 310 void UploadJob::CreateAndStartURLFetcher(const std::string& access_token) {
311 // Ensure that the content has been prepared and the upload url is valid. 311 // Ensure that the content has been prepared and the upload url is valid.
312 DCHECK_EQ(PREPARING_CONTENT, state_); 312 DCHECK_EQ(PREPARING_CONTENT, state_);
313 313
314 std::string content_type = kUploadContentType; 314 std::string content_type = kUploadContentType;
315 content_type.append("; boundary="); 315 content_type.append("; boundary=");
316 content_type.append(*mime_boundary_.get()); 316 content_type.append(*mime_boundary_.get());
317 upload_fetcher_.reset( 317 upload_fetcher_ =
318 net::URLFetcher::Create(upload_url_, net::URLFetcher::POST, this)); 318 net::URLFetcher::Create(upload_url_, net::URLFetcher::POST, this);
319 upload_fetcher_->SetRequestContext(url_context_getter_.get()); 319 upload_fetcher_->SetRequestContext(url_context_getter_.get());
320 upload_fetcher_->SetUploadData(content_type, *post_data_); 320 upload_fetcher_->SetUploadData(content_type, *post_data_);
321 upload_fetcher_->AddExtraRequestHeader( 321 upload_fetcher_->AddExtraRequestHeader(
322 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str())); 322 base::StringPrintf(kAuthorizationHeaderFormat, access_token.c_str()));
323 upload_fetcher_->Start(); 323 upload_fetcher_->Start();
324 } 324 }
325 325
326 void UploadJob::StartUpload(const std::string& access_token) { 326 void UploadJob::StartUpload(const std::string& access_token) {
327 if (!SetUpMultipart()) { 327 if (!SetUpMultipart()) {
328 LOG(ERROR) << "Multipart message assembly failed."; 328 LOG(ERROR) << "Multipart message assembly failed.";
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 upload_fetcher_.reset(); 391 upload_fetcher_.reset();
392 state_ = SUCCESS; 392 state_ = SUCCESS;
393 post_data_.reset(); 393 post_data_.reset();
394 if (success) 394 if (success)
395 delegate_->OnSuccess(); 395 delegate_->OnSuccess();
396 else 396 else
397 delegate_->OnFailure(SERVER_ERROR); 397 delegate_->OnFailure(SERVER_ERROR);
398 } 398 }
399 399
400 } // namespace policy 400 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698