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

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

Issue 2894023002: [subresource_filter] Move activation computation to the SB throttle (Closed)
Patch Set: shivanisha review 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/subresource_filter_safe_browsing_activation_throttle.h
diff --git a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
index 8faa26c2b514a49863d179e6c73e33deed763d97..885e4e3e953224f4248f09dfe2c9c5ed22e0ef48 100644
--- a/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
+++ b/components/subresource_filter/content/browser/subresource_filter_safe_browsing_activation_throttle.h
@@ -17,11 +17,19 @@
#include "base/time/time.h"
#include "components/safe_browsing_db/database_manager.h"
#include "components/subresource_filter/content/browser/subresource_filter_safe_browsing_client.h"
+#include "components/subresource_filter/core/browser/subresource_filter_features.h"
+#include "components/subresource_filter/core/common/activation_decision.h"
#include "components/subresource_filter/core/common/activation_list.h"
#include "content/public/browser/navigation_throttle.h"
+namespace base {
+class GURL;
+} // namespace base
+
namespace subresource_filter {
+class SubresourceFilterClient;
+
// Navigation throttle responsible for activating subresource filtering on page
// loads that match the SUBRESOURCE_FILTER Safe Browsing list.
class SubresourceFilterSafeBrowsingActivationThrottle
@@ -31,12 +39,17 @@ class SubresourceFilterSafeBrowsingActivationThrottle
public:
SubresourceFilterSafeBrowsingActivationThrottle(
content::NavigationHandle* handle,
+ SubresourceFilterClient* client,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>
database_manager);
~SubresourceFilterSafeBrowsingActivationThrottle() override;
+ // Returns whether the navigation handle is a page reload, based on the
+ // transition type and referrer.
+ static bool NavigationIsPageReload(content::NavigationHandle* handle);
+
// content::NavigationThrottle:
content::NavigationThrottle::ThrottleCheckResult WillStartRequest() override;
content::NavigationThrottle::ThrottleCheckResult WillRedirectRequest()
@@ -52,6 +65,17 @@ class SubresourceFilterSafeBrowsingActivationThrottle
void CheckCurrentUrl();
void NotifyResult();
+ ActivationDecision ComputeActivation(
+ Configuration::ActivationOptions* options);
+
+ // Returns whether a main-frame navigation to the given |url| satisfies the
+ // activation |conditions| of a given configuration, except for |priority|.
+ bool DoesMainFrameURLSatisfyActivationConditions(
+ const GURL& url,
+ bool scheme_is_http_or_https,
+ const Configuration::ActivationConditions& conditions,
+ ActivationList matched_list) const;
+
void RecordRedirectChainMatchPatternForList(ActivationList activation_list);
std::vector<SubresourceFilterSafeBrowsingClient::CheckResult> check_results_;
@@ -63,6 +87,9 @@ class SubresourceFilterSafeBrowsingActivationThrottle
base::OnTaskRunnerDeleter>
database_client_;
+ // Must outlive this class.
+ SubresourceFilterClient* client_;
+
// Set to TimeTicks::Now() when the navigation is deferred in
// WillProcessResponse. If deferral was not necessary, will remain null.
base::TimeTicks defer_time_;

Powered by Google App Engine
This is Rietveld 408576698