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

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

Issue 2691423006: Introduce the ThrottleManager (Closed)
Patch Set: rebase Created 3 years, 9 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/activation_state_computing_navigation_throttle.cc
diff --git a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
index 5b1204fbcb145991ebc8a455bdb04cf400de05b0..3585f988ec0c7d90d6c5e6bd5c9a9fd4ac275b26 100644
--- a/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
+++ b/components/subresource_filter/content/browser/activation_state_computing_navigation_throttle.cc
@@ -22,7 +22,8 @@ ActivationStateComputingNavigationThrottle::CreateForMainFrame(
content::NavigationHandle* navigation_handle) {
DCHECK(navigation_handle->IsInMainFrame());
return base::WrapUnique(new ActivationStateComputingNavigationThrottle(
- navigation_handle, base::Optional<ActivationState>(), nullptr));
+ navigation_handle, base::Optional<ActivationState>(), nullptr,
+ base::OnceClosure()));
}
// static
@@ -30,23 +31,28 @@ std::unique_ptr<ActivationStateComputingNavigationThrottle>
ActivationStateComputingNavigationThrottle::CreateForSubframe(
content::NavigationHandle* navigation_handle,
VerifiedRuleset::Handle* ruleset_handle,
- const ActivationState& parent_activation_state) {
+ const ActivationState& parent_activation_state,
+ base::OnceClosure first_disallowed_load_callback) {
DCHECK(!navigation_handle->IsInMainFrame());
DCHECK_NE(ActivationLevel::DISABLED,
parent_activation_state.activation_level);
DCHECK(ruleset_handle);
return base::WrapUnique(new ActivationStateComputingNavigationThrottle(
- navigation_handle, parent_activation_state, ruleset_handle));
+ navigation_handle, parent_activation_state, ruleset_handle,
+ std::move(first_disallowed_load_callback)));
}
ActivationStateComputingNavigationThrottle::
ActivationStateComputingNavigationThrottle(
content::NavigationHandle* navigation_handle,
const base::Optional<ActivationState> parent_activation_state,
- VerifiedRuleset::Handle* ruleset_handle)
+ VerifiedRuleset::Handle* ruleset_handle,
+ base::OnceClosure first_disallowed_load_callback)
: content::NavigationThrottle(navigation_handle),
parent_activation_state_(parent_activation_state),
ruleset_handle_(ruleset_handle),
+ first_disallowed_load_callback_(
+ std::move(first_disallowed_load_callback)),
weak_ptr_factory_(this) {}
ActivationStateComputingNavigationThrottle::
@@ -55,7 +61,8 @@ ActivationStateComputingNavigationThrottle::
void ActivationStateComputingNavigationThrottle::
NotifyPageActivationWithRuleset(
VerifiedRuleset::Handle* ruleset_handle,
- const ActivationState& page_activation_state) {
+ const ActivationState& page_activation_state,
+ base::OnceClosure first_disallowed_load_callback) {
DCHECK(navigation_handle()->IsInMainFrame());
DCHECK(!parent_activation_state_);
DCHECK(!activation_state_);
@@ -65,6 +72,7 @@ void ActivationStateComputingNavigationThrottle::
!ruleset_handle);
parent_activation_state_.emplace(page_activation_state);
ruleset_handle_ = ruleset_handle;
+ first_disallowed_load_callback_ = std::move(first_disallowed_load_callback);
}
content::NavigationThrottle::ThrottleCheckResult
@@ -90,14 +98,12 @@ ActivationStateComputingNavigationThrottle::WillProcessResponse() {
DCHECK(parent);
params.parent_document_origin = parent->GetLastCommittedOrigin();
}
- // TODO(csharrison): Replace the empty OnceClosure with a UI-triggering
- // callback.
async_filter_ = base::MakeUnique<AsyncDocumentSubresourceFilter>(
ruleset_handle_, std::move(params),
base::Bind(&ActivationStateComputingNavigationThrottle::
SetActivationStateAndResume,
weak_ptr_factory_.GetWeakPtr()),
- base::OnceClosure());
+ std::move(first_disallowed_load_callback_));
return content::NavigationThrottle::ThrottleCheckResult::DEFER;
}

Powered by Google App Engine
This is Rietveld 408576698