| 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  857  |  857  | 
|  858   if (!callback.is_null()) |  858   if (!callback.is_null()) | 
|  859     callback.Run(result); |  859     callback.Run(result); | 
|  860  |  860  | 
|  861   // No code after running the callback, as it might have resulted in our |  861   // No code after running the callback, as it might have resulted in our | 
|  862   // destruction. |  862   // destruction. | 
|  863 } |  863 } | 
|  864  |  864  | 
|  865 void NavigationHandleImpl::RegisterNavigationThrottles() { |  865 void NavigationHandleImpl::RegisterNavigationThrottles() { | 
|  866   // Register the navigation throttles. The vector returned by |  866   // Register the navigation throttles. The vector returned by | 
|  867   // GetNavigationThrottles is not assigned to throttles_ directly because it |  867   // CreateThrottlesForNavigation is not assigned to throttles_ directly because | 
|  868   // would overwrite any throttles previously added with |  868   // it would overwrite any throttles previously added with | 
|  869   // RegisterThrottleForTesting. |  869   // RegisterThrottleForTesting. | 
 |  870   // TODO(carlosk, arthursonzogni): should simplify this to either use | 
 |  871   // |throttles_| directly (except for the case described above) or | 
 |  872   // |throttles_to_register| for registering all throttles. | 
|  870   std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = |  873   std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = | 
|  871       GetDelegate()->CreateThrottlesForNavigation(this); |  874       GetDelegate()->CreateThrottlesForNavigation(this); | 
 |  875  | 
 |  876   std::unique_ptr<NavigationThrottle> mixed_content_throttle = | 
 |  877       MixedContentNavigationThrottle::CreateThrottleForNavigation(this); | 
 |  878   if (mixed_content_throttle) | 
 |  879     throttles_to_register.push_back(std::move(mixed_content_throttle)); | 
 |  880  | 
|  872   std::unique_ptr<NavigationThrottle> devtools_throttle = |  881   std::unique_ptr<NavigationThrottle> devtools_throttle = | 
|  873       RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); |  882       RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); | 
|  874   if (devtools_throttle) |  883   if (devtools_throttle) | 
|  875     throttles_to_register.push_back(std::move(devtools_throttle)); |  884     throttles_to_register.push_back(std::move(devtools_throttle)); | 
|  876  |  885  | 
|  877   std::unique_ptr<NavigationThrottle> clear_site_data_throttle = |  886   std::unique_ptr<NavigationThrottle> clear_site_data_throttle = | 
|  878       ClearSiteDataThrottle::CreateThrottleForNavigation(this); |  887       ClearSiteDataThrottle::CreateThrottleForNavigation(this); | 
|  879   if (clear_site_data_throttle) |  888   if (clear_site_data_throttle) | 
|  880     throttles_to_register.push_back(std::move(clear_site_data_throttle)); |  889     throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 
|  881  |  890  | 
|  882   std::unique_ptr<content::NavigationThrottle> ancestor_throttle = |  891   std::unique_ptr<content::NavigationThrottle> ancestor_throttle = | 
|  883       content::AncestorThrottle::MaybeCreateThrottleFor(this); |  892       content::AncestorThrottle::MaybeCreateThrottleFor(this); | 
|  884   if (ancestor_throttle) |  893   if (ancestor_throttle) | 
|  885     throttles_.push_back(std::move(ancestor_throttle)); |  894     throttles_.push_back(std::move(ancestor_throttle)); | 
|  886  |  895  | 
|  887   throttles_.insert(throttles_.begin(), |  896   throttles_.insert(throttles_.begin(), | 
|  888                     std::make_move_iterator(throttles_to_register.begin()), |  897                     std::make_move_iterator(throttles_to_register.begin()), | 
|  889                     std::make_move_iterator(throttles_to_register.end())); |  898                     std::make_move_iterator(throttles_to_register.end())); | 
|  890 } |  899 } | 
|  891  |  900  | 
|  892 }  // namespace content |  901 }  // namespace content | 
| OLD | NEW |