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

Side by Side Diff: net/url_request/url_request.cc

Issue 903273002: Update from https://crrev.com/315085 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « net/url_request/url_request.h ('k') | net/url_request/url_request_ftp_job.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 "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 220 }
221 221
222 const UploadDataStream* URLRequest::get_upload() const { 222 const UploadDataStream* URLRequest::get_upload() const {
223 return upload_data_stream_.get(); 223 return upload_data_stream_.get();
224 } 224 }
225 225
226 bool URLRequest::has_upload() const { 226 bool URLRequest::has_upload() const {
227 return upload_data_stream_.get() != NULL; 227 return upload_data_stream_.get() != NULL;
228 } 228 }
229 229
230 void URLRequest::SetExtraRequestHeaderById(int id, const string& value,
231 bool overwrite) {
232 DCHECK(!is_pending_ || is_redirecting_);
233 NOTREACHED() << "implement me!";
234 }
235
236 void URLRequest::SetExtraRequestHeaderByName(const string& name, 230 void URLRequest::SetExtraRequestHeaderByName(const string& name,
237 const string& value, 231 const string& value,
238 bool overwrite) { 232 bool overwrite) {
239 DCHECK(!is_pending_ || is_redirecting_); 233 DCHECK(!is_pending_ || is_redirecting_);
240 if (overwrite) { 234 if (overwrite) {
241 extra_request_headers_.SetHeader(name, value); 235 extra_request_headers_.SetHeader(name, value);
242 } else { 236 } else {
243 extra_request_headers_.SetHeaderIfMissing(name, value); 237 extra_request_headers_.SetHeaderIfMissing(name, value);
244 } 238 }
245 } 239 }
(...skipping 20 matching lines...) Expand all
266 } 260 }
267 261
268 int64 URLRequest::GetTotalReceivedBytes() const { 262 int64 URLRequest::GetTotalReceivedBytes() const {
269 if (!job_.get()) 263 if (!job_.get())
270 return 0; 264 return 0;
271 265
272 return job_->GetTotalReceivedBytes(); 266 return job_->GetTotalReceivedBytes();
273 } 267 }
274 268
275 LoadStateWithParam URLRequest::GetLoadState() const { 269 LoadStateWithParam URLRequest::GetLoadState() const {
270 // TODO(pkasting): Remove ScopedTracker below once crbug.com/455952 is
271 // fixed.
272 tracked_objects::ScopedTracker tracking_profile(
273 FROM_HERE_WITH_EXPLICIT_FUNCTION("455952 URLRequest::GetLoadState"));
276 // The !blocked_by_.empty() check allows |this| to report it's blocked on a 274 // The !blocked_by_.empty() check allows |this| to report it's blocked on a
277 // delegate before it has been started. 275 // delegate before it has been started.
278 if (calling_delegate_ || !blocked_by_.empty()) { 276 if (calling_delegate_ || !blocked_by_.empty()) {
279 return LoadStateWithParam( 277 return LoadStateWithParam(
280 LOAD_STATE_WAITING_FOR_DELEGATE, 278 LOAD_STATE_WAITING_FOR_DELEGATE,
281 use_blocked_by_as_load_param_ ? base::UTF8ToUTF16(blocked_by_) : 279 use_blocked_by_as_load_param_ ? base::UTF8ToUTF16(blocked_by_) :
282 base::string16()); 280 base::string16());
283 } 281 }
284 return LoadStateWithParam(job_.get() ? job_->GetLoadState() : LOAD_STATE_IDLE, 282 return LoadStateWithParam(job_.get() ? job_->GetLoadState() : LOAD_STATE_IDLE,
285 base::string16()); 283 base::string16());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 369 }
372 if (final_upload_progress_.position()) { 370 if (final_upload_progress_.position()) {
373 // The first job completed and none of the subsequent series of 371 // The first job completed and none of the subsequent series of
374 // GETs when following redirects will upload anything, so we return the 372 // GETs when following redirects will upload anything, so we return the
375 // cached results from the initial job, the POST. 373 // cached results from the initial job, the POST.
376 return final_upload_progress_; 374 return final_upload_progress_;
377 } 375 }
378 return job_->GetUploadProgress(); 376 return job_->GetUploadProgress();
379 } 377 }
380 378
381 void URLRequest::GetResponseHeaderById(int id, string* value) {
382 DCHECK(job_.get());
383 NOTREACHED() << "implement me!";
384 }
385
386 void URLRequest::GetResponseHeaderByName(const string& name, string* value) { 379 void URLRequest::GetResponseHeaderByName(const string& name, string* value) {
387 DCHECK(value); 380 DCHECK(value);
388 if (response_info_.headers.get()) { 381 if (response_info_.headers.get()) {
389 response_info_.headers->GetNormalizedHeader(name, value); 382 response_info_.headers->GetNormalizedHeader(name, value);
390 } else { 383 } else {
391 value->clear(); 384 value->clear();
392 } 385 }
393 } 386 }
394 387
395 void URLRequest::GetAllResponseHeaders(string* headers) {
396 DCHECK(headers);
397 if (response_info_.headers.get()) {
398 response_info_.headers->GetNormalizedHeaders(headers);
399 } else {
400 headers->clear();
401 }
402 }
403
404 HostPortPair URLRequest::GetSocketAddress() const { 388 HostPortPair URLRequest::GetSocketAddress() const {
405 DCHECK(job_.get()); 389 DCHECK(job_.get());
406 return job_->GetSocketAddress(); 390 return job_->GetSocketAddress();
407 } 391 }
408 392
409 HttpResponseHeaders* URLRequest::response_headers() const { 393 HttpResponseHeaders* URLRequest::response_headers() const {
410 return response_info_.headers.get(); 394 return response_info_.headers.get();
411 } 395 }
412 396
413 void URLRequest::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { 397 void URLRequest::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const {
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 new base::debug::StackTrace(NULL, 0); 1218 new base::debug::StackTrace(NULL, 0);
1235 *stack_trace_copy = stack_trace; 1219 *stack_trace_copy = stack_trace;
1236 stack_trace_.reset(stack_trace_copy); 1220 stack_trace_.reset(stack_trace_copy);
1237 } 1221 }
1238 1222
1239 const base::debug::StackTrace* URLRequest::stack_trace() const { 1223 const base::debug::StackTrace* URLRequest::stack_trace() const {
1240 return stack_trace_.get(); 1224 return stack_trace_.get();
1241 } 1225 }
1242 1226
1243 } // namespace net 1227 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request.h ('k') | net/url_request/url_request_ftp_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698