OLD | NEW |
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 MakeRangeHeader(byte_range_start_, byte_range_end_)); | 144 MakeRangeHeader(byte_range_start_, byte_range_end_)); |
145 } | 145 } |
146 | 146 |
147 if (make_response_file_) { | 147 if (make_response_file_) { |
148 url_fetcher_->SaveResponseToTemporaryFile( | 148 url_fetcher_->SaveResponseToTemporaryFile( |
149 content::BrowserThread::GetMessageLoopProxyForThread( | 149 content::BrowserThread::GetMessageLoopProxyForThread( |
150 content::BrowserThread::FILE)); | 150 content::BrowserThread::FILE)); |
151 } | 151 } |
152 | 152 |
153 // URLFetcher requires us to set upload data for POST requests. | 153 // URLFetcher requires us to set upload data for POST requests. |
154 if (request_type_ == net::URLFetcher::POST) { | 154 if (request_type_ == net::URLFetcher::POST || |
| 155 request_type_ == net::URLFetcher::PUT) { |
155 if (!upload_file_path_.empty()) { | 156 if (!upload_file_path_.empty()) { |
156 url_fetcher_->SetUploadFilePath( | 157 url_fetcher_->SetUploadFilePath( |
157 upload_content_type_, | 158 upload_content_type_, |
158 upload_file_path_, | 159 upload_file_path_, |
159 0 /*offset*/, | 160 0 /*offset*/, |
160 kuint64max /*length*/, | 161 kuint64max /*length*/, |
161 content::BrowserThread::GetMessageLoopProxyForThread( | 162 content::BrowserThread::GetMessageLoopProxyForThread( |
162 content::BrowserThread::FILE)); | 163 content::BrowserThread::FILE)); |
163 } else { | 164 } else { |
164 url_fetcher_->SetUploadData(upload_content_type_, upload_data_); | 165 url_fetcher_->SetUploadData(upload_content_type_, upload_data_); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 337 } |
337 } | 338 } |
338 | 339 |
339 bool PrivetURLFetcher::PrivetErrorTransient(const std::string& error) { | 340 bool PrivetURLFetcher::PrivetErrorTransient(const std::string& error) { |
340 return (error == kPrivetErrorDeviceBusy) || | 341 return (error == kPrivetErrorDeviceBusy) || |
341 (error == kPrivetErrorPendingUserAction) || | 342 (error == kPrivetErrorPendingUserAction) || |
342 (error == kPrivetErrorPrinterBusy); | 343 (error == kPrivetErrorPrinterBusy); |
343 } | 344 } |
344 | 345 |
345 } // namespace local_discovery | 346 } // namespace local_discovery |
OLD | NEW |