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

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

Issue 2874663002: [subresource_filter] s/ShouldSuppressActivation/OnPageActivationComputed (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_driver_factory.cc
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
index 7e856982e755f5a489d1c12440472a77a01a678b..c6052e11c19b741f8d7e8657fd7648cb46c44e4f 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
@@ -126,12 +126,6 @@ void ContentSubresourceFilterDriverFactory::
return;
}
- if (client_->ShouldSuppressActivation(navigation_handle)) {
- activation_decision_ = ActivationDecision::URL_WHITELISTED;
- activation_options_ = Configuration::ActivationOptions();
- return;
- }
-
activation_options_ = highest_priority_activated_config->activation_options;
activation_decision_ =
activation_options_.activation_level == ActivationLevel::DISABLED
@@ -202,6 +196,19 @@ void ContentSubresourceFilterDriverFactory::WillProcessResponse(
ComputeActivationForMainFrameNavigation(navigation_handle);
DCHECK_NE(activation_decision_, ActivationDecision::UNKNOWN);
+
+ // Check for whitelisted status last, so that the client gets an accurate
engedy 2017/05/11 09:13:14 follow up nit: Any reason to not do this block of
Charlie Harrison 2017/05/11 12:07:15 I chose to do this here so that we can continue to
+ // indication of whether there would be activation otherwise.
+ bool whitelisted = client_->OnPageActivationComputed(
+ navigation_handle,
+ activation_options_.activation_level == ActivationLevel::ENABLED);
+
+ // Only reset the activation decision reason if we would have activated.
+ if (whitelisted && activation_decision_ == ActivationDecision::ACTIVATED) {
+ activation_decision_ = ActivationDecision::URL_WHITELISTED;
+ activation_options_ = Configuration::ActivationOptions();
+ }
+
if (activation_decision_ != ActivationDecision::ACTIVATED) {
DCHECK_EQ(activation_options_.activation_level, ActivationLevel::DISABLED);
return;

Powered by Google App Engine
This is Rietveld 408576698