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

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

Issue 2841933003: [subresource_filter] Remove some state from the driver factory (Closed)
Patch Set: no more dep branch Created 3 years, 8 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 32b679cf7c333a3fdf17b7100dbe00feb3ea5ba8..ed04110b2d1740a0ab0b3cf6e50c2b1d91d16b34 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
@@ -4,6 +4,8 @@
#include "components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
@@ -12,6 +14,7 @@
#include "components/subresource_filter/content/browser/page_load_statistics.h"
#include "components/subresource_filter/content/browser/subframe_navigation_filtering_throttle.h"
#include "components/subresource_filter/content/common/subresource_filter_messages.h"
+#include "components/subresource_filter/core/browser/subresource_filter_features.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/navigation_throttle.h"
#include "content/public/browser/render_frame_host.h"
@@ -71,13 +74,17 @@ ContentSubresourceFilterThrottleManager::
void ContentSubresourceFilterThrottleManager::NotifyPageActivationComputed(
content::NavigationHandle* navigation_handle,
- const ActivationState& activation_state) {
+ const ActivationState& activation_state,
+ ActivationDecision activation_decision) {
DCHECK(navigation_handle->IsInMainFrame());
DCHECK(!navigation_handle->HasCommitted());
auto it = ongoing_activation_throttles_.find(navigation_handle);
if (it != ongoing_activation_throttles_.end()) {
- it->second->NotifyPageActivationWithRuleset(EnsureRulesetHandle(),
- activation_state);
+ auto* ruleset = activation_decision == ActivationDecision::ACTIVATED
+ ? EnsureRulesetHandle()
+ : nullptr;
+ it->second->NotifyPageActivationWithRuleset(ruleset, activation_state,
+ activation_decision);
}
}
@@ -125,13 +132,17 @@ void ContentSubresourceFilterThrottleManager::DidFinishNavigation(
auto throttle = ongoing_activation_throttles_.find(navigation_handle);
std::unique_ptr<AsyncDocumentSubresourceFilter> filter;
+ ActivationDecision page_activation_decision = ActivationDecision::UNKNOWN;
if (throttle != ongoing_activation_throttles_.end()) {
filter = throttle->second->ReleaseFilter();
+ if (navigation_handle->IsInMainFrame())
+ page_activation_decision = throttle->second->GetPageActivationDecision();
ongoing_activation_throttles_.erase(throttle);
}
if (navigation_handle->IsInMainFrame()) {
current_committed_load_has_notified_disallowed_load_ = false;
+ activation_decision_ = page_activation_decision;
statistics_.reset();
if (filter) {
statistics_ =
@@ -258,6 +269,10 @@ ContentSubresourceFilterThrottleManager::GetParentFrameFilter(
void ContentSubresourceFilterThrottleManager::MaybeCallFirstDisallowedLoad() {
if (current_committed_load_has_notified_disallowed_load_)
return;
+
+ auto configurations = GetActiveConfigurations();
+ if (configurations->the_one_and_only().should_suppress_notifications)
+ return;
delegate_->OnFirstSubresourceLoadDisallowed();
current_committed_load_has_notified_disallowed_load_ = true;
}

Powered by Google App Engine
This is Rietveld 408576698