Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "content/browser/loader/resource_loader.h" | 5 #include "content/browser/loader/resource_loader.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 !ChildProcessSecurityPolicyImpl::GetInstance()-> | 273 !ChildProcessSecurityPolicyImpl::GetInstance()-> |
| 274 CanRequestURL(info->GetChildID(), redirect_info.new_url)) { | 274 CanRequestURL(info->GetChildID(), redirect_info.new_url)) { |
| 275 DVLOG(1) << "Denied unauthorized request for " | 275 DVLOG(1) << "Denied unauthorized request for " |
| 276 << redirect_info.new_url.possibly_invalid_spec(); | 276 << redirect_info.new_url.possibly_invalid_spec(); |
| 277 | 277 |
| 278 // Tell the renderer that this request was disallowed. | 278 // Tell the renderer that this request was disallowed. |
| 279 Cancel(); | 279 Cancel(); |
| 280 return; | 280 return; |
| 281 } | 281 } |
| 282 | 282 |
| 283 if (info->fetch_redirect_mode() == FETCH_REDIRECT_MODE_ERROR) { | |
| 284 Cancel(); | |
| 285 return; | |
| 286 } else if (info->fetch_redirect_mode() == FETCH_REDIRECT_MODE_MANUAL) { | |
| 287 // TODO(horo): If we will support upload progress events for Fetch API, we | |
|
mmenke
2015/08/11 16:06:14
nit: will -> "are going to" (Or just remove "wil
horo
2015/08/11 16:43:55
Done.
| |
| 288 // will have to call ReportUploadProgress(). | |
| 289 DCHECK(!GetRequestInfo()->is_upload_progress_enabled()); | |
| 290 | |
| 291 CompleteResponseStarted(); | |
| 292 DCHECK(!is_deferred()); | |
|
mmenke
2015/08/11 16:06:14
Oh...I completely misunderstood this deferred stuf
horo
2015/08/11 16:43:55
I added is_redirect_response argument to CompleteR
| |
| 293 | |
| 294 // There is no need to read the response body here because there is no way | |
| 295 // to read the body of opaque-redirect filtered response's internal | |
| 296 // response. | |
| 297 // TODO(horo): If we will support any API which expose the internal body, | |
|
mmenke
2015/08/11 16:06:14
nit: will -> "are going to" (Or just remove "wil
horo
2015/08/11 16:43:55
Done.
| |
| 298 // we will have to read the body before calling ResponseCompleted(). And | |
| 299 // also Cache changes will be needed because it doesn't store the body of | |
| 300 // redirect responses. | |
| 301 ResponseCompleted(); | |
| 302 return; | |
| 303 } | |
| 304 | |
| 283 delegate_->DidReceiveRedirect(this, redirect_info.new_url); | 305 delegate_->DidReceiveRedirect(this, redirect_info.new_url); |
| 284 | 306 |
| 285 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) { | 307 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) { |
| 286 // The request is complete so we can remove it. | 308 // The request is complete so we can remove it. |
| 287 CancelAndIgnore(); | 309 CancelAndIgnore(); |
| 288 return; | 310 return; |
| 289 } | 311 } |
| 290 | 312 |
| 291 scoped_refptr<ResourceResponse> response(new ResourceResponse()); | 313 scoped_refptr<ResourceResponse> response(new ResourceResponse()); |
| 292 PopulateResourceResponse(info, request_.get(), response.get()); | 314 PopulateResourceResponse(info, request_.get(), response.get()); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 case net::URLRequestStatus::FAILED: | 786 case net::URLRequestStatus::FAILED: |
| 765 status = STATUS_UNDEFINED; | 787 status = STATUS_UNDEFINED; |
| 766 break; | 788 break; |
| 767 } | 789 } |
| 768 | 790 |
| 769 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); | 791 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); |
| 770 } | 792 } |
| 771 } | 793 } |
| 772 | 794 |
| 773 } // namespace content | 795 } // namespace content |
| OLD | NEW |