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

Side by Side Diff: chrome/service/cloud_print/cloud_print_url_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
« no previous file with comments | « chrome/browser/ui/webui/devtools_ui.cc ('k') | chrome/test/chromedriver/net/net_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h" 5 #include "chrome/service/cloud_print/cloud_print_url_fetcher.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/cloud_print/cloud_print_constants.h" 10 #include "chrome/common/cloud_print/cloud_print_constants.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 int max_retries, 256 int max_retries,
257 const std::string& post_data_mime_type, 257 const std::string& post_data_mime_type,
258 const std::string& post_data, 258 const std::string& post_data,
259 const std::string& additional_headers) { 259 const std::string& additional_headers) {
260 DCHECK(delegate); 260 DCHECK(delegate);
261 type_ = type; 261 type_ = type;
262 UMA_HISTOGRAM_ENUMERATION("CloudPrint.UrlFetcherRequestType", type, 262 UMA_HISTOGRAM_ENUMERATION("CloudPrint.UrlFetcherRequestType", type,
263 REQUEST_MAX); 263 REQUEST_MAX);
264 // Persist the additional headers in case we need to retry the request. 264 // Persist the additional headers in case we need to retry the request.
265 additional_headers_ = additional_headers; 265 additional_headers_ = additional_headers;
266 request_.reset(net::URLFetcher::Create(0, url, request_type, this)); 266 request_ = net::URLFetcher::Create(0, url, request_type, this);
267 request_->SetRequestContext(GetRequestContextGetter()); 267 request_->SetRequestContext(GetRequestContextGetter());
268 // Since we implement our own retry logic, disable the retry in URLFetcher. 268 // Since we implement our own retry logic, disable the retry in URLFetcher.
269 request_->SetAutomaticallyRetryOn5xx(false); 269 request_->SetAutomaticallyRetryOn5xx(false);
270 request_->SetMaxRetriesOn5xx(max_retries); 270 request_->SetMaxRetriesOn5xx(max_retries);
271 delegate_ = delegate; 271 delegate_ = delegate;
272 SetupRequestHeaders(); 272 SetupRequestHeaders();
273 request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | 273 request_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES |
274 net::LOAD_DO_NOT_SAVE_COOKIES); 274 net::LOAD_DO_NOT_SAVE_COOKIES);
275 if (request_type == net::URLFetcher::POST) { 275 if (request_type == net::URLFetcher::POST) {
276 request_->SetUploadData(post_data_mime_type, post_data); 276 request_->SetUploadData(post_data_mime_type, post_data);
(...skipping 21 matching lines...) Expand all
298 ServiceURLRequestContextGetter* getter = 298 ServiceURLRequestContextGetter* getter =
299 g_service_process->GetServiceURLRequestContextGetter(); 299 g_service_process->GetServiceURLRequestContextGetter();
300 // Now set up the user agent for cloudprint. 300 // Now set up the user agent for cloudprint.
301 std::string user_agent = getter->user_agent(); 301 std::string user_agent = getter->user_agent();
302 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent); 302 base::StringAppendF(&user_agent, " %s", kCloudPrintUserAgent);
303 getter->set_user_agent(user_agent); 303 getter->set_user_agent(user_agent);
304 return getter; 304 return getter;
305 } 305 }
306 306
307 } // namespace cloud_print 307 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/devtools_ui.cc ('k') | chrome/test/chromedriver/net/net_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698