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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Address jam@ comments; many minor code and comment updates. Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include "base/debug/dump_without_crashing.h" 7 #include "base/debug/dump_without_crashing.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "content/browser/appcache/appcache_navigation_handle.h" 9 #include "content/browser/appcache/appcache_navigation_handle.h"
10 #include "content/browser/appcache/appcache_service_impl.h" 10 #include "content/browser/appcache/appcache_service_impl.h"
11 #include "content/browser/browsing_data/clear_site_data_throttle.h" 11 #include "content/browser/browsing_data/clear_site_data_throttle.h"
12 #include "content/browser/child_process_security_policy_impl.h" 12 #include "content/browser/child_process_security_policy_impl.h"
13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 13 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
14 #include "content/browser/frame_host/ancestor_throttle.h" 14 #include "content/browser/frame_host/ancestor_throttle.h"
15 #include "content/browser/frame_host/debug_urls.h" 15 #include "content/browser/frame_host/debug_urls.h"
16 #include "content/browser/frame_host/frame_tree_node.h" 16 #include "content/browser/frame_host/frame_tree_node.h"
17 #include "content/browser/frame_host/mixed_content_navigation_throttle.h"
17 #include "content/browser/frame_host/navigator.h" 18 #include "content/browser/frame_host/navigator.h"
18 #include "content/browser/frame_host/navigator_delegate.h" 19 #include "content/browser/frame_host/navigator_delegate.h"
19 #include "content/browser/loader/resource_dispatcher_host_impl.h" 20 #include "content/browser/loader/resource_dispatcher_host_impl.h"
20 #include "content/browser/service_worker/service_worker_context_wrapper.h" 21 #include "content/browser/service_worker/service_worker_context_wrapper.h"
21 #include "content/browser/service_worker/service_worker_navigation_handle.h" 22 #include "content/browser/service_worker/service_worker_navigation_handle.h"
22 #include "content/common/frame_messages.h" 23 #include "content/common/frame_messages.h"
23 #include "content/common/resource_request_body_impl.h" 24 #include "content/common/resource_request_body_impl.h"
24 #include "content/common/site_isolation_policy.h" 25 #include "content/common/site_isolation_policy.h"
25 #include "content/public/browser/content_browser_client.h" 26 #include "content/public/browser/content_browser_client.h"
26 #include "content/public/browser/navigation_ui_data.h" 27 #include "content/public/browser/navigation_ui_data.h"
27 #include "content/public/browser/site_instance.h" 28 #include "content/public/browser/site_instance.h"
28 #include "content/public/common/browser_side_navigation_policy.h" 29 #include "content/public/common/browser_side_navigation_policy.h"
29 #include "content/public/common/content_client.h" 30 #include "content/public/common/content_client.h"
30 #include "content/public/common/url_constants.h" 31 #include "content/public/common/url_constants.h"
31 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
32 #include "net/url_request/redirect_info.h" 33 #include "net/url_request/redirect_info.h"
33 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h"
34 #include "url/gurl.h" 34 #include "url/gurl.h"
35 #include "url/url_constants.h" 35 #include "url/url_constants.h"
36 36
37 namespace content { 37 namespace content {
38 38
39 namespace { 39 namespace {
40 40
41 void UpdateThrottleCheckResult( 41 void UpdateThrottleCheckResult(
42 NavigationThrottle::ThrottleCheckResult* to_update, 42 NavigationThrottle::ThrottleCheckResult* to_update,
43 NavigationThrottle::ThrottleCheckResult result) { 43 NavigationThrottle::ThrottleCheckResult result) {
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 781
782 // No code after running the callback, as it might have resulted in our 782 // No code after running the callback, as it might have resulted in our
783 // destruction. 783 // destruction.
784 } 784 }
785 785
786 void NavigationHandleImpl::RegisterNavigationThrottles() { 786 void NavigationHandleImpl::RegisterNavigationThrottles() {
787 // Register the navigation throttles. The ScopedVector returned by 787 // Register the navigation throttles. The ScopedVector returned by
788 // GetNavigationThrottles is not assigned to throttles_ directly because it 788 // GetNavigationThrottles is not assigned to throttles_ directly because it
789 // would overwrite any throttle previously added with 789 // would overwrite any throttle previously added with
790 // RegisterThrottleForTesting. 790 // RegisterThrottleForTesting.
791 if (IsBrowserSideNavigationEnabled()) {
792 throttles_.insert(throttles_.end(),
793 new MixedContentNavigationThrottle(this));
nasko 2017/01/12 18:32:37 Does the ordering of when we add this matter? Woul
carlosk 2017/01/21 02:54:59 I don't know the answer for this. As this is a se
nasko 2017/01/23 22:32:37 Let's keep it first then, until we hear something
carlosk 2017/02/08 02:59:02 OK, I'm keeping as is but just reaffirming: trybot
nasko 2017/02/10 01:08:20 Acknowledged.
794 }
791 ScopedVector<NavigationThrottle> throttles_to_register = 795 ScopedVector<NavigationThrottle> throttles_to_register =
792 GetDelegate()->CreateThrottlesForNavigation(this); 796 GetDelegate()->CreateThrottlesForNavigation(this);
793 std::unique_ptr<NavigationThrottle> devtools_throttle = 797 std::unique_ptr<NavigationThrottle> devtools_throttle =
794 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); 798 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this);
795 if (devtools_throttle) 799 if (devtools_throttle)
796 throttles_to_register.push_back(std::move(devtools_throttle)); 800 throttles_to_register.push_back(std::move(devtools_throttle));
797 801
798 std::unique_ptr<NavigationThrottle> clear_site_data_throttle = 802 std::unique_ptr<NavigationThrottle> clear_site_data_throttle =
799 ClearSiteDataThrottle::CreateThrottleForNavigation(this); 803 ClearSiteDataThrottle::CreateThrottleForNavigation(this);
800 if (clear_site_data_throttle) 804 if (clear_site_data_throttle)
801 throttles_to_register.push_back(std::move(clear_site_data_throttle)); 805 throttles_to_register.push_back(std::move(clear_site_data_throttle));
802 806
803 std::unique_ptr<content::NavigationThrottle> ancestor_throttle = 807 std::unique_ptr<content::NavigationThrottle> ancestor_throttle =
804 content::AncestorThrottle::MaybeCreateThrottleFor(this); 808 content::AncestorThrottle::MaybeCreateThrottleFor(this);
805 if (ancestor_throttle) 809 if (ancestor_throttle)
806 throttles_.push_back(std::move(ancestor_throttle)); 810 throttles_.push_back(std::move(ancestor_throttle));
807 811
808 if (throttles_to_register.size() > 0) { 812 if (throttles_to_register.size() > 0) {
809 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), 813 throttles_.insert(throttles_.begin(), throttles_to_register.begin(),
810 throttles_to_register.end()); 814 throttles_to_register.end());
811 throttles_to_register.weak_clear(); 815 throttles_to_register.weak_clear();
812 } 816 }
813 } 817 }
814 818
815 } // namespace content 819 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698