Chromium Code Reviews| 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 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 772 complete_callback_.Reset(); | 774 complete_callback_.Reset(); |
| 773 | 775 |
| 774 if (!callback.is_null()) | 776 if (!callback.is_null()) |
| 775 callback.Run(result); | 777 callback.Run(result); |
| 776 | 778 |
| 777 // No code after running the callback, as it might have resulted in our | 779 // No code after running the callback, as it might have resulted in our |
| 778 // destruction. | 780 // destruction. |
| 779 } | 781 } |
| 780 | 782 |
| 781 void NavigationHandleImpl::RegisterNavigationThrottles() { | 783 void NavigationHandleImpl::RegisterNavigationThrottles() { |
| 782 // Register the navigation throttles. The ScopedVector returned by | 784 // Register the navigation throttles. The vector returned by |
| 783 // GetNavigationThrottles is not assigned to throttles_ directly because it | 785 // GetNavigationThrottles is not assigned to throttles_ directly because it |
| 784 // would overwrite any throttle previously added with | 786 // would overwrite any throttles previously added with |
| 785 // RegisterThrottleForTesting. | 787 // RegisterThrottleForTesting. |
| 786 ScopedVector<NavigationThrottle> throttles_to_register = | 788 std::vector<std::unique_ptr<NavigationThrottle>> throttles_to_register = |
| 787 GetDelegate()->CreateThrottlesForNavigation(this); | 789 GetDelegate()->CreateThrottlesForNavigation(this); |
| 788 std::unique_ptr<NavigationThrottle> devtools_throttle = | 790 std::unique_ptr<NavigationThrottle> devtools_throttle = |
| 789 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); | 791 RenderFrameDevToolsAgentHost::CreateThrottleForNavigation(this); |
| 790 if (devtools_throttle) | 792 if (devtools_throttle) |
| 791 throttles_to_register.push_back(std::move(devtools_throttle)); | 793 throttles_to_register.push_back(std::move(devtools_throttle)); |
| 792 | 794 |
| 793 std::unique_ptr<NavigationThrottle> clear_site_data_throttle = | 795 std::unique_ptr<NavigationThrottle> clear_site_data_throttle = |
| 794 ClearSiteDataThrottle::CreateThrottleForNavigation(this); | 796 ClearSiteDataThrottle::CreateThrottleForNavigation(this); |
| 795 if (clear_site_data_throttle) | 797 if (clear_site_data_throttle) |
| 796 throttles_to_register.push_back(std::move(clear_site_data_throttle)); | 798 throttles_to_register.push_back(std::move(clear_site_data_throttle)); |
| 797 | 799 |
| 798 std::unique_ptr<content::NavigationThrottle> ancestor_throttle = | 800 std::unique_ptr<content::NavigationThrottle> ancestor_throttle = |
| 799 content::AncestorThrottle::MaybeCreateThrottleFor(this); | 801 content::AncestorThrottle::MaybeCreateThrottleFor(this); |
| 800 if (ancestor_throttle) | 802 if (ancestor_throttle) |
| 801 throttles_.push_back(std::move(ancestor_throttle)); | 803 throttles_.push_back(std::move(ancestor_throttle)); |
| 802 | 804 |
| 803 if (throttles_to_register.size() > 0) { | 805 throttles_.insert(throttles_.begin(), |
| 804 throttles_.insert(throttles_.begin(), throttles_to_register.begin(), | 806 std::make_move_iterator(throttles_to_register.begin()), |
| 805 throttles_to_register.end()); | 807 std::make_move_iterator(throttles_to_register.end())); |
|
Nico
2017/01/12 16:55:23
nice
Avi (use Gerrit)
2017/01/12 19:05:37
Thank you! Props to leon.han@intel who taught it t
| |
| 806 throttles_to_register.weak_clear(); | |
| 807 } | |
| 808 } | 808 } |
| 809 | 809 |
| 810 } // namespace content | 810 } // namespace content |
| OLD | NEW |