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

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

Issue 2691423006: Introduce the ThrottleManager (Closed)
Patch Set: engedy initial comments Created 3 years, 10 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 e300a20d1df0cf40948b8455492991dffa9e8259..9ea36959ab15b71f32b08c1d651e77303817dec0 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
@@ -21,7 +21,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
@@ -29,23 +30,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::
@@ -54,7 +60,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_);
@@ -64,6 +71,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
@@ -88,14 +96,12 @@ ActivationStateComputingNavigationThrottle::WillProcessResponse() {
->GetParent()
->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