| 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> |
| 8 |
| 7 #include "base/debug/dump_without_crashing.h" | 9 #include "base/debug/dump_without_crashing.h" |
| 8 #include "base/logging.h" | 10 #include "base/logging.h" |
| 9 #include "content/browser/appcache/appcache_navigation_handle.h" | 11 #include "content/browser/appcache/appcache_navigation_handle.h" |
| 10 #include "content/browser/appcache/appcache_service_impl.h" | 12 #include "content/browser/appcache/appcache_service_impl.h" |
| 11 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 13 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
| 12 #include "content/browser/child_process_security_policy_impl.h" | 14 #include "content/browser/child_process_security_policy_impl.h" |
| 13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 15 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 14 #include "content/browser/frame_host/ancestor_throttle.h" | 16 #include "content/browser/frame_host/ancestor_throttle.h" |
| 15 #include "content/browser/frame_host/debug_urls.h" | 17 #include "content/browser/frame_host/debug_urls.h" |
| 16 #include "content/browser/frame_host/frame_tree_node.h" | 18 #include "content/browser/frame_host/frame_tree_node.h" |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 complete_callback_.Reset(); | 779 complete_callback_.Reset(); |
| 778 | 780 |
| 779 if (!callback.is_null()) | 781 if (!callback.is_null()) |
| 780 callback.Run(result); | 782 callback.Run(result); |
| 781 | 783 |
| 782 // No code after running the callback, as it might have resulted in our | 784 // No code after running the callback, as it might have resulted in our |
| 783 // destruction. | 785 // destruction. |
| 784 } | 786 } |
| 785 | 787 |
| 786 void NavigationHandleImpl::RegisterNavigationThrottles() { | 788 void NavigationHandleImpl::RegisterNavigationThrottles() { |
| 787 // Register the navigation throttles. The ScopedVector returned by | 789 // Register the navigation throttles. The vector returned by |
| 788 // GetNavigationThrottles is not assigned to throttles_ directly because it | 790 // GetNavigationThrottles is not assigned to throttles_ directly because it |
| 789 // would overwrite any throttle previously added with | 791 // would overwrite any throttles previously added with |
| 790 // RegisterThrottleForTesting. | 792 // RegisterThrottleForTesting. |
| 791 ScopedVector<NavigationThrottle> throttles_to_register = | 793 std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = |
| 792 GetDelegate()->CreateThrottlesForNavigation(this); | 794 GetDelegate()->CreateThrottlesForNavigation(this); |
| 793 std::unique_ptr<NavigationThrottle> devtools_throttle = | 795 std::unique_ptr<NavigationThrottle> devtools_throttle = |
| 794 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); | 796 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); |
| 795 if (devtools_throttle) | 797 if (devtools_throttle) |
| 796 throttles_to_register.push_back(std::move(devtools_throttle)); | 798 throttles_to_register.push_back(std::move(devtools_throttle)); |
| 797 | 799 |
| 798 std::unique_ptr<NavigationThrottle> clear_site_data_throttle = | 800 std::unique_ptr<NavigationThrottle> clear_site_data_throttle = |
| 799 ClearSiteDataThrottle::CreateThrottleForNavigation(this); | 801 ClearSiteDataThrottle::CreateThrottleForNavigation(this); |
| 800 if (clear_site_data_throttle) | 802 if (clear_site_data_throttle) |
| 801 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 803 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 802 | 804 |
| 803 std::unique_ptr<content::NavigationThrottle> ancestor_throttle = | 805 std::unique_ptr<content::NavigationThrottle> ancestor_throttle = |
| 804 content::AncestorThrottle::MaybeCreateThrottleFor(this); | 806 content::AncestorThrottle::MaybeCreateThrottleFor(this); |
| 805 if (ancestor_throttle) | 807 if (ancestor_throttle) |
| 806 throttles_.push_back(std::move(ancestor_throttle)); | 808 throttles_.push_back(std::move(ancestor_throttle)); |
| 807 | 809 |
| 808 if (throttles_to_register.size() > 0) { | 810 throttles_.insert(throttles_.begin(), |
| 809 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 811 std::make_move_iterator(throttles_to_register.begin()), |
| 810 throttles_to_register.end()); | 812 std::make_move_iterator(throttles_to_register.end())); |
| 811 throttles_to_register.weak_clear(); | |
| 812 } | |
| 813 } | 813 } |
| 814 | 814 |
| 815 } // namespace content | 815 } // namespace content |
| OLD | NEW |