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

Side by Side Diff: content/browser/frame_host/navigation_request.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
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_host_browsertest.cc ('k') | content/browser/loader/DEPS » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "content/browser/child_process_security_policy_impl.h"
9 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 10 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
10 #include "content/browser/frame_host/frame_tree.h" 11 #include "content/browser/frame_host/frame_tree.h"
11 #include "content/browser/frame_host/frame_tree_node.h" 12 #include "content/browser/frame_host/frame_tree_node.h"
12 #include "content/browser/frame_host/navigation_controller_impl.h" 13 #include "content/browser/frame_host/navigation_controller_impl.h"
13 #include "content/browser/frame_host/navigation_handle_impl.h" 14 #include "content/browser/frame_host/navigation_handle_impl.h"
14 #include "content/browser/frame_host/navigation_request_info.h" 15 #include "content/browser/frame_host/navigation_request_info.h"
15 #include "content/browser/frame_host/navigator.h" 16 #include "content/browser/frame_host/navigator.h"
16 #include "content/browser/frame_host/navigator_impl.h" 17 #include "content/browser/frame_host/navigator_impl.h"
17 #include "content/browser/loader/navigation_url_loader.h" 18 #include "content/browser/loader/navigation_url_loader.h"
19 #include "content/browser/renderer_host/render_process_host_impl.h"
18 #include "content/browser/service_worker/service_worker_context_wrapper.h" 20 #include "content/browser/service_worker/service_worker_context_wrapper.h"
19 #include "content/browser/service_worker/service_worker_navigation_handle.h" 21 #include "content/browser/service_worker/service_worker_navigation_handle.h"
20 #include "content/browser/site_instance_impl.h" 22 #include "content/browser/site_instance_impl.h"
21 #include "content/common/resource_request_body_impl.h" 23 #include "content/common/resource_request_body_impl.h"
22 #include "content/public/browser/browser_context.h" 24 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/content_browser_client.h" 25 #include "content/public/browser/content_browser_client.h"
24 #include "content/public/browser/navigation_controller.h" 26 #include "content/public/browser/navigation_controller.h"
25 #include "content/public/browser/navigation_data.h" 27 #include "content/public/browser/navigation_data.h"
26 #include "content/public/browser/navigation_ui_data.h" 28 #include "content/public/browser/navigation_ui_data.h"
27 #include "content/public/browser/storage_partition.h" 29 #include "content/public/browser/storage_partition.h"
28 #include "content/public/browser/stream_handle.h" 30 #include "content/public/browser/stream_handle.h"
29 #include "content/public/common/content_client.h" 31 #include "content/public/common/content_client.h"
30 #include "content/public/common/request_context_type.h" 32 #include "content/public/common/request_context_type.h"
31 #include "content/public/common/resource_response.h" 33 #include "content/public/common/resource_response.h"
34 #include "content/public/common/url_constants.h"
32 #include "net/base/load_flags.h" 35 #include "net/base/load_flags.h"
33 #include "net/base/url_util.h" 36 #include "net/base/url_util.h"
34 #include "net/http/http_request_headers.h" 37 #include "net/http/http_request_headers.h"
35 #include "net/url_request/redirect_info.h" 38 #include "net/url_request/redirect_info.h"
36 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 39 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
37 40
38 namespace content { 41 namespace content {
39 42
40 namespace { 43 namespace {
41 44
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 request_params_.navigation_timing.redirect_end = base::TimeTicks::Now(); 328 request_params_.navigation_timing.redirect_end = base::TimeTicks::Now();
326 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now(); 329 request_params_.navigation_timing.fetch_start = base::TimeTicks::Now();
327 330
328 request_params_.redirect_response.push_back(response->head); 331 request_params_.redirect_response.push_back(response->head);
329 332
330 request_params_.redirects.push_back(common_params_.url); 333 request_params_.redirects.push_back(common_params_.url);
331 common_params_.url = redirect_info.new_url; 334 common_params_.url = redirect_info.new_url;
332 common_params_.method = redirect_info.new_method; 335 common_params_.method = redirect_info.new_method;
333 common_params_.referrer.url = GURL(redirect_info.new_referrer); 336 common_params_.referrer.url = GURL(redirect_info.new_referrer);
334 337
335 // TODO(clamy): Have CSP + security upgrade checks here. 338 // For non browser initiated navigations we need to check if the source has
339 // access to the URL. We always allow browser initiated requests.
336 // TODO(clamy): Kill the renderer if FilterURL fails? 340 // TODO(clamy): Kill the renderer if FilterURL fails?
341 GURL url = common_params_.url;
342 if (!browser_initiated_ && source_site_instance()) {
343 source_site_instance()->GetProcess()->FilterURL(false, &url);
344 // FilterURL sets the URL to about:blank if the CSP checks prevent the
345 // renderer from accessing it.
346 if ((url == url::kAboutBlankURL) && (url != common_params_.url)) {
347 NavigationRequest::OnRedirectChecksComplete(NavigationThrottle::CANCEL);
jam 2016/10/25 00:17:08 why not just call frame_tree_node_->ResetNavigatio
ananta 2016/10/25 03:37:03 Done.
348 return;
349 }
350 }
337 351
338 // It's safe to use base::Unretained because this NavigationRequest owns the 352 // It's safe to use base::Unretained because this NavigationRequest owns the
339 // NavigationHandle where the callback will be stored. 353 // NavigationHandle where the callback will be stored.
340 // TODO(clamy): pass the real value for |is_external_protocol| if needed. 354 // TODO(clamy): pass the real value for |is_external_protocol| if needed.
341 navigation_handle_->WillRedirectRequest( 355 navigation_handle_->WillRedirectRequest(
342 common_params_.url, common_params_.method, common_params_.referrer.url, 356 common_params_.url, common_params_.method, common_params_.referrer.url,
343 false, response->head.headers, 357 false, response->head.headers,
344 base::Bind(&NavigationRequest::OnRedirectChecksComplete, 358 base::Bind(&NavigationRequest::OnRedirectChecksComplete,
345 base::Unretained(this))); 359 base::Unretained(this)));
346 } 360 }
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); 575 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture);
562 576
563 render_frame_host->CommitNavigation(response_.get(), std::move(body_), 577 render_frame_host->CommitNavigation(response_.get(), std::move(body_),
564 common_params_, request_params_, 578 common_params_, request_params_,
565 is_view_source_); 579 is_view_source_);
566 580
567 frame_tree_node_->ResetNavigationRequest(true); 581 frame_tree_node_->ResetNavigationRequest(true);
568 } 582 }
569 583
570 } // namespace content 584 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_host_browsertest.cc ('k') | content/browser/loader/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698