OLD | NEW |
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 <iterator> | 7 #include <iterator> |
8 | 8 |
9 #include "base/debug/dump_without_crashing.h" | 9 #include "base/debug/dump_without_crashing.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/browser/appcache/appcache_navigation_handle.h" | 11 #include "content/browser/appcache/appcache_navigation_handle.h" |
12 #include "content/browser/appcache/appcache_service_impl.h" | 12 #include "content/browser/appcache/appcache_service_impl.h" |
13 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 13 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
14 #include "content/browser/child_process_security_policy_impl.h" | 14 #include "content/browser/child_process_security_policy_impl.h" |
15 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 15 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
16 #include "content/browser/frame_host/ancestor_throttle.h" | 16 #include "content/browser/frame_host/ancestor_throttle.h" |
17 #include "content/browser/frame_host/debug_urls.h" | 17 #include "content/browser/frame_host/debug_urls.h" |
18 #include "content/browser/frame_host/frame_tree_node.h" | 18 #include "content/browser/frame_host/frame_tree_node.h" |
| 19 #include "content/browser/frame_host/mixed_content_navigation_throttle.h" |
19 #include "content/browser/frame_host/navigation_controller_impl.h" | 20 #include "content/browser/frame_host/navigation_controller_impl.h" |
20 #include "content/browser/frame_host/navigation_entry_impl.h" | 21 #include "content/browser/frame_host/navigation_entry_impl.h" |
21 #include "content/browser/frame_host/navigator.h" | 22 #include "content/browser/frame_host/navigator.h" |
22 #include "content/browser/frame_host/navigator_delegate.h" | 23 #include "content/browser/frame_host/navigator_delegate.h" |
23 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 24 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
24 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 25 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
25 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 26 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
26 #include "content/common/frame_messages.h" | 27 #include "content/common/frame_messages.h" |
27 #include "content/common/resource_request_body_impl.h" | 28 #include "content/common/resource_request_body_impl.h" |
28 #include "content/common/site_isolation_policy.h" | 29 #include "content/common/site_isolation_policy.h" |
29 #include "content/public/browser/content_browser_client.h" | 30 #include "content/public/browser/content_browser_client.h" |
30 #include "content/public/browser/navigation_ui_data.h" | 31 #include "content/public/browser/navigation_ui_data.h" |
31 #include "content/public/browser/site_instance.h" | 32 #include "content/public/browser/site_instance.h" |
32 #include "content/public/common/browser_side_navigation_policy.h" | 33 #include "content/public/common/browser_side_navigation_policy.h" |
33 #include "content/public/common/content_client.h" | 34 #include "content/public/common/content_client.h" |
34 #include "content/public/common/url_constants.h" | 35 #include "content/public/common/url_constants.h" |
35 #include "net/base/net_errors.h" | 36 #include "net/base/net_errors.h" |
36 #include "net/url_request/redirect_info.h" | 37 #include "net/url_request/redirect_info.h" |
37 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" | |
38 #include "url/gurl.h" | 38 #include "url/gurl.h" |
39 #include "url/url_constants.h" | 39 #include "url/url_constants.h" |
40 | 40 |
41 namespace content { | 41 namespace content { |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 void UpdateThrottleCheckResult( | 45 void UpdateThrottleCheckResult( |
46 NavigationThrottle::ThrottleCheckResult* to_update, | 46 NavigationThrottle::ThrottleCheckResult* to_update, |
47 NavigationThrottle::ThrottleCheckResult result) { | 47 NavigationThrottle::ThrottleCheckResult result) { |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 | 853 |
854 if (!callback.is_null()) | 854 if (!callback.is_null()) |
855 callback.Run(result); | 855 callback.Run(result); |
856 | 856 |
857 // No code after running the callback, as it might have resulted in our | 857 // No code after running the callback, as it might have resulted in our |
858 // destruction. | 858 // destruction. |
859 } | 859 } |
860 | 860 |
861 void NavigationHandleImpl::RegisterNavigationThrottles() { | 861 void NavigationHandleImpl::RegisterNavigationThrottles() { |
862 // Register the navigation throttles. The vector returned by | 862 // Register the navigation throttles. The vector returned by |
863 // GetNavigationThrottles is not assigned to throttles_ directly because it | 863 // CreateThrottlesForNavigation is not assigned to throttles_ directly because |
864 // would overwrite any throttles previously added with | 864 // it would overwrite any throttles previously added with |
865 // RegisterThrottleForTesting. | 865 // RegisterThrottleForTesting. |
| 866 // TODO(carlosk, arthursonzogni): should simplify this to either use |
| 867 // |throttles_| directly (except for the case described above) or |
| 868 // |throttles_to_register| for registering all throttles. |
866 std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = | 869 std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = |
867 GetDelegate()->CreateThrottlesForNavigation(this); | 870 GetDelegate()->CreateThrottlesForNavigation(this); |
| 871 |
| 872 std::unique_ptr<NavigationThrottle> mixed_content_throttle = |
| 873 MixedContentNavigationThrottle::CreateThrottleForNavigation(this); |
| 874 if (mixed_content_throttle) |
| 875 throttles_to_register.push_back(std::move(mixed_content_throttle)); |
| 876 |
868 std::unique_ptr<NavigationThrottle> devtools_throttle = | 877 std::unique_ptr<NavigationThrottle> devtools_throttle = |
869 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); | 878 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); |
870 if (devtools_throttle) | 879 if (devtools_throttle) |
871 throttles_to_register.push_back(std::move(devtools_throttle)); | 880 throttles_to_register.push_back(std::move(devtools_throttle)); |
872 | 881 |
873 std::unique_ptr<NavigationThrottle> clear_site_data_throttle = | 882 std::unique_ptr<NavigationThrottle> clear_site_data_throttle = |
874 ClearSiteDataThrottle::CreateThrottleForNavigation(this); | 883 ClearSiteDataThrottle::CreateThrottleForNavigation(this); |
875 if (clear_site_data_throttle) | 884 if (clear_site_data_throttle) |
876 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 885 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
877 | 886 |
878 std::unique_ptr<content::NavigationThrottle> ancestor_throttle = | 887 std::unique_ptr<content::NavigationThrottle> ancestor_throttle = |
879 content::AncestorThrottle::MaybeCreateThrottleFor(this); | 888 content::AncestorThrottle::MaybeCreateThrottleFor(this); |
880 if (ancestor_throttle) | 889 if (ancestor_throttle) |
881 throttles_.push_back(std::move(ancestor_throttle)); | 890 throttles_.push_back(std::move(ancestor_throttle)); |
882 | 891 |
883 throttles_.insert(throttles_.begin(), | 892 throttles_.insert(throttles_.begin(), |
884 std::make_move_iterator(throttles_to_register.begin()), | 893 std::make_move_iterator(throttles_to_register.begin()), |
885 std::make_move_iterator(throttles_to_register.end())); | 894 std::make_move_iterator(throttles_to_register.end())); |
886 } | 895 } |
887 | 896 |
888 } // namespace content | 897 } // namespace content |
OLD | NEW |