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

Side by Side Diff: content/browser/loader/resource_loader.cc

Issue 1271733002: [2/3 chromium] Support redirect option of Request and "opaqueredirect" response type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on 1272623002 Created 5 years, 4 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 (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
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 CompleteResponseStarted();
288 ResponseCompleted();
yhirano 2015/08/10 04:57:52 You need to read the response body.
horo 2015/08/10 06:45:18 We don't need to read the response body because th
yhirano 2015/08/10 07:03:07 A fetch API user cannot read the internal response
horo 2015/08/10 07:19:45 Which API can read the body? Opaque-redirect filt
yhirano 2015/08/10 07:41:20 I don't know a specific example, but the fetch spe
horo 2015/08/10 08:11:59 I see. I added TODO.
289 return;
290 }
291
283 delegate_->DidReceiveRedirect(this, redirect_info.new_url); 292 delegate_->DidReceiveRedirect(this, redirect_info.new_url);
284 293
285 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) { 294 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {
286 // The request is complete so we can remove it. 295 // The request is complete so we can remove it.
287 CancelAndIgnore(); 296 CancelAndIgnore();
288 return; 297 return;
289 } 298 }
290 299
291 scoped_refptr<ResourceResponse> response(new ResourceResponse()); 300 scoped_refptr<ResourceResponse> response(new ResourceResponse());
292 PopulateResourceResponse(info, request_.get(), response.get()); 301 PopulateResourceResponse(info, request_.get(), response.get());
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 case net::URLRequestStatus::FAILED: 773 case net::URLRequestStatus::FAILED:
765 status = STATUS_UNDEFINED; 774 status = STATUS_UNDEFINED;
766 break; 775 break;
767 } 776 }
768 777
769 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 778 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
770 } 779 }
771 } 780 }
772 781
773 } // namespace content 782 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698