Index: components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc |
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc |
index 6b57efe16887a80688b7642f60bcaca6b9c30edf..a5e011072bd32d91d7b7a92decf885ff1b06ea8b 100644 |
--- a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc |
+++ b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc |
@@ -20,6 +20,37 @@ |
namespace subresource_filter { |
+namespace { |
+ |
+// Used to forward calls to WillProcessResonse to the driver. |
+// TODO(https://crbug.com/708181): Remove this once the safe browsing navigation |
+// throttle is responsible for all activation decisions. |
+class ForwardingNavigationThrottle : public content::NavigationThrottle { |
+ public: |
+ ForwardingNavigationThrottle( |
+ content::NavigationHandle* handle, |
+ ContentSubresourceFilterThrottleManager::Delegate* delegate) |
+ : content::NavigationThrottle(handle), delegate_(delegate) {} |
+ ~ForwardingNavigationThrottle() override {} |
+ |
+ // content::NavigationThrottle: |
+ content::NavigationThrottle::ThrottleCheckResult WillProcessResponse() |
+ override { |
+ delegate_->WillProcessResponse(navigation_handle()); |
+ return content::NavigationThrottle::PROCEED; |
+ } |
+ const char* GetNameForLogging() override { |
+ return "ForwardingNavigationThrottle"; |
+ } |
+ |
+ private: |
+ ContentSubresourceFilterThrottleManager::Delegate* delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ForwardingNavigationThrottle); |
+}; |
+ |
+} // namespace |
+ |
ContentSubresourceFilterThrottleManager:: |
ContentSubresourceFilterThrottleManager( |
Delegate* delegate, |
@@ -143,6 +174,10 @@ |
content::NavigationHandle* navigation_handle, |
std::vector<std::unique_ptr<content::NavigationThrottle>>* throttles) { |
DCHECK(!navigation_handle->IsSameDocument()); |
+ if (navigation_handle->IsInMainFrame()) { |
+ throttles->push_back(base::MakeUnique<ForwardingNavigationThrottle>( |
+ navigation_handle, delegate_)); |
+ } |
if (!dealer_handle_) |
return; |
if (auto filtering_throttle = |