Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6387)

Unified Diff: components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.cc

Issue 2897613002: Revert of [subresource_filter] Remove Forwarding NavigationThrottles (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 =

Powered by Google App Engine
This is Rietveld 408576698