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

Unified Diff: components/subresource_filter/content/browser/subresource_filter_navigation_throttle.h

Issue 2060313002: Navigation throttle for the Safe Browsing Subresource Filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pre-tab-activation
Patch Set: adressing engedy@ comments Created 4 years, 5 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/subresource_filter_navigation_throttle.h
diff --git a/components/subresource_filter/content/browser/subresource_filter_navigation_throttle.h b/components/subresource_filter/content/browser/subresource_filter_navigation_throttle.h
new file mode 100644
index 0000000000000000000000000000000000000000..15816fc22f43702ef77995097212d1cb606d48d7
--- /dev/null
+++ b/components/subresource_filter/content/browser/subresource_filter_navigation_throttle.h
@@ -0,0 +1,51 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_NAVIGATION_THROTTLE_
+#define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_NAVIGATION_THROTTLE_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "content/public/browser/navigation_throttle.h"
+#include "url/gurl.h"
+
+namespace content {
+class NavigationHandle;
+} // content
+
+namespace subresource_filter {
+
+// This class has two resposibilities:
+// * it tracks the redirects that happen after Safe Browsing detects that the
+// page being loaded contains deceptive embedded content. If such a redirect
+// happens and leads to new domains, these are also put on the activation list
+// of the tab.
+// * it creates a ContentSubresourceFilterDriver for the tab when the final site
+// of a (potentially empty) redirect chain is reached and any URL of the
+// redirect chain was on the activation list.
+// This throttle is active only for main frame http or https navigations and
+// doesn't act on subframe navigations or subresource loads.
+class SubresourceFilterNavigationThrottle : public content::NavigationThrottle {
+ public:
+ static std::unique_ptr<content::NavigationThrottle> Create(
+ content::NavigationHandle* handle);
+ ~SubresourceFilterNavigationThrottle() override;
+
+ // content::NavigationThrottle implementation:
+ ThrottleCheckResult WillRedirectRequest() override;
+ ThrottleCheckResult WillProcessResponse() override;
+
+ private:
+ explicit SubresourceFilterNavigationThrottle(
+ content::NavigationHandle* navigation_handle);
+
+ GURL initial_url_;
+
+ DISALLOW_COPY_AND_ASSIGN(SubresourceFilterNavigationThrottle);
+};
+
+} // namespace subresource_filter
+
+#endif // COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_SUBRESOURCE_FILTER_NAVIGATION_THROTTLE_

Powered by Google App Engine
This is Rietveld 408576698