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

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

Issue 2436253002: PlzNavigate: Fix the FindInPageControllerTest.SearchWithinSpecialURL browser test. (Closed)
Patch Set: Address creis review comments Created 4 years, 1 month 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 <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/profiler/scoped_tracker.h" 13 #include "base/profiler/scoped_tracker.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "content/browser/appcache/appcache_interceptor.h" 18 #include "content/browser/appcache/appcache_interceptor.h"
19 #include "content/browser/child_process_security_policy_impl.h" 19 #include "content/browser/child_process_security_policy_impl.h"
20 #include "content/browser/loader/detachable_resource_handler.h" 20 #include "content/browser/loader/detachable_resource_handler.h"
21 #include "content/browser/loader/resource_loader_delegate.h" 21 #include "content/browser/loader/resource_loader_delegate.h"
22 #include "content/browser/loader/resource_request_info_impl.h" 22 #include "content/browser/loader/resource_request_info_impl.h"
23 #include "content/browser/service_worker/service_worker_request_handler.h" 23 #include "content/browser/service_worker/service_worker_request_handler.h"
24 #include "content/browser/service_worker/service_worker_response_info.h" 24 #include "content/browser/service_worker/service_worker_response_info.h"
25 #include "content/browser/ssl/ssl_client_auth_handler.h" 25 #include "content/browser/ssl/ssl_client_auth_handler.h"
26 #include "content/browser/ssl/ssl_manager.h" 26 #include "content/browser/ssl/ssl_manager.h"
27 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" 27 #include "content/public/browser/resource_dispatcher_host_login_delegate.h"
28 #include "content/public/common/browser_side_navigation_policy.h"
28 #include "content/public/common/content_client.h" 29 #include "content/public/common/content_client.h"
29 #include "content/public/common/content_switches.h" 30 #include "content/public/common/content_switches.h"
30 #include "content/public/common/process_type.h" 31 #include "content/public/common/process_type.h"
31 #include "content/public/common/resource_response.h" 32 #include "content/public/common/resource_response.h"
32 #include "content/public/common/resource_type.h" 33 #include "content/public/common/resource_type.h"
33 #include "net/base/io_buffer.h" 34 #include "net/base/io_buffer.h"
34 #include "net/base/load_flags.h" 35 #include "net/base/load_flags.h"
35 #include "net/http/http_response_headers.h" 36 #include "net/http/http_response_headers.h"
36 #include "net/nqe/effective_connection_type.h" 37 #include "net/nqe/effective_connection_type.h"
37 #include "net/nqe/network_quality_estimator.h" 38 #include "net/nqe/network_quality_estimator.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 bool* defer) { 250 bool* defer) {
250 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"), 251 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"),
251 "ResourceLoader::OnReceivedRedirect"); 252 "ResourceLoader::OnReceivedRedirect");
252 DCHECK_EQ(request_.get(), unused); 253 DCHECK_EQ(request_.get(), unused);
253 254
254 DVLOG(1) << "OnReceivedRedirect: " << request_->url().spec(); 255 DVLOG(1) << "OnReceivedRedirect: " << request_->url().spec();
255 DCHECK(request_->status().is_success()); 256 DCHECK(request_->status().is_success());
256 257
257 ResourceRequestInfoImpl* info = GetRequestInfo(); 258 ResourceRequestInfoImpl* info = GetRequestInfo();
258 259
259 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( 260 // With PlzNavigate for frame navigations this check is done in the
260 info->GetChildID(), redirect_info.new_url)) { 261 // NavigationRequest::OnReceivedRedirect() function.
261 DVLOG(1) << "Denied unauthorized request for " 262 bool check_handled_elsewhere = IsBrowserSideNavigationEnabled() &&
262 << redirect_info.new_url.possibly_invalid_spec(); 263 IsResourceTypeFrame(info->GetResourceType());
263 264
264 // Tell the renderer that this request was disallowed. 265 if (!check_handled_elsewhere) {
265 Cancel(); 266 if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL(
266 return; 267 info->GetChildID(), redirect_info.new_url)) {
268 DVLOG(1) << "Denied unauthorized request for "
269 << redirect_info.new_url.possibly_invalid_spec();
270
271 // Tell the renderer that this request was disallowed.
272 Cancel();
273 return;
274 }
267 } 275 }
268 276
269 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) { 277 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {
270 // The request is complete so we can remove it. 278 // The request is complete so we can remove it.
271 CancelAndIgnore(); 279 CancelAndIgnore();
272 return; 280 return;
273 } 281 }
274 282
275 scoped_refptr<ResourceResponse> response = new ResourceResponse(); 283 scoped_refptr<ResourceResponse> response = new ResourceResponse();
276 PopulateResourceResponse(info, request_.get(), response.get()); 284 PopulateResourceResponse(info, request_.get(), response.get());
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 721 }
714 722
715 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 723 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
716 } else if (request_->response_info().unused_since_prefetch) { 724 } else if (request_->response_info().unused_since_prefetch) {
717 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); 725 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
718 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); 726 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time);
719 } 727 }
720 } 728 }
721 729
722 } // namespace content 730 } // namespace content
OLDNEW
« content/browser/frame_host/navigation_request.cc ('K') | « content/browser/loader/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698