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

Side by Side Diff: chrome/browser/local_discovery/privet_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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/local_discovery/privet_url_fetcher.h" 5 #include "chrome/browser/local_discovery/privet_url_fetcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 void PrivetURLFetcher::SetByteRange(int start, int end) { 139 void PrivetURLFetcher::SetByteRange(int start, int end) {
140 DCHECK(tries_ == 0); 140 DCHECK(tries_ == 0);
141 byte_range_start_ = start; 141 byte_range_start_ = start;
142 byte_range_end_ = end; 142 byte_range_end_ = end;
143 has_byte_range_ = true; 143 has_byte_range_ = true;
144 } 144 }
145 145
146 void PrivetURLFetcher::Try() { 146 void PrivetURLFetcher::Try() {
147 tries_++; 147 tries_++;
148 if (tries_ < kPrivetMaxRetries) { 148 if (tries_ < kPrivetMaxRetries) {
149 149 url_fetcher_ = net::URLFetcher::Create(url_, request_type_, this);
150
151 url_fetcher_.reset(net::URLFetcher::Create(url_, request_type_, this));
152 // Privet requests are relevant to hosts on local network only. 150 // Privet requests are relevant to hosts on local network only.
153 url_fetcher_->SetLoadFlags(url_fetcher_->GetLoadFlags() | 151 url_fetcher_->SetLoadFlags(url_fetcher_->GetLoadFlags() |
154 net::LOAD_BYPASS_PROXY | 152 net::LOAD_BYPASS_PROXY |
155 net::LOAD_DISABLE_CACHE); 153 net::LOAD_DISABLE_CACHE);
156 url_fetcher_->SetRequestContext(request_context_.get()); 154 url_fetcher_->SetRequestContext(request_context_.get());
157 155
158 if (v3_mode_) { 156 if (v3_mode_) {
159 url_fetcher_->AddExtraRequestHeader( 157 url_fetcher_->AddExtraRequestHeader(
160 std::string(kPrivetV3AuthTokenHeaderPrefix) + 158 std::string(kPrivetV3AuthTokenHeaderPrefix) +
161 delegate_->GetAuthToken()); 159 delegate_->GetAuthToken());
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 374 }
377 375
378 bool PrivetURLFetcher::PrivetErrorTransient(const std::string& error) { 376 bool PrivetURLFetcher::PrivetErrorTransient(const std::string& error) {
379 return (error == kPrivetErrorDeviceBusy) || 377 return (error == kPrivetErrorDeviceBusy) ||
380 (error == kPrivetV3ErrorDeviceBusy) || 378 (error == kPrivetV3ErrorDeviceBusy) ||
381 (error == kPrivetErrorPendingUserAction) || 379 (error == kPrivetErrorPendingUserAction) ||
382 (error == kPrivetErrorPrinterBusy); 380 (error == kPrivetErrorPrinterBusy);
383 } 381 }
384 382
385 } // namespace local_discovery 383 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/local_discovery/gcd_api_flow_impl.cc ('k') | chrome/browser/media/webrtc_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698