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

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

Issue 2894813003: [subresource_filter] Add observer interface for page activation (Closed)
Patch Set: use another method 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_throttle_manager.h
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h
index a877e1a96d8a95db0f7ba0d7a7fb4964019227ff..4240c57946b277fb18df2ff0eb309d328c4a5cb5 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h
+++ b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager.h
@@ -11,7 +11,10 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
+#include "components/subresource_filter/content/browser/subresource_filter_observer.h"
#include "components/subresource_filter/content/browser/verified_ruleset_dealer.h"
+#include "components/subresource_filter/core/common/activation_decision.h"
#include "components/subresource_filter/core/common/activation_state.h"
#include "content/public/browser/web_contents_observer.h"
@@ -30,6 +33,7 @@ namespace subresource_filter {
class AsyncDocumentSubresourceFilter;
class ActivationStateComputingNavigationThrottle;
class SubframeNavigationFilteringThrottle;
+class SubresourceFilterObserverManager;
class PageLoadStatistics;
struct DocumentLoadStatistics;
@@ -43,7 +47,8 @@ struct DocumentLoadStatistics;
// will be notified of the first disallowed subresource load for a top level
// navgation, and has veto power for frame activation.
class ContentSubresourceFilterThrottleManager
- : public content::WebContentsObserver {
+ : public content::WebContentsObserver,
+ public SubresourceFilterObserver {
public:
// It is expected that the Delegate outlives |this|, and manages the lifetime
// of this class.
@@ -60,17 +65,6 @@ class ContentSubresourceFilterThrottleManager
content::WebContents* web_contents);
~ContentSubresourceFilterThrottleManager() override;
- // Sets the desired page-level |activation_state| for the currently ongoing
- // page load, identified by its main-frame |navigation_handle|. To be called
- // by the embedder at the latest in the WillProcessResponse stage from a
- // NavigationThrottle that was registered before the throttles created by this
- // manager in MaybeAppendNavigationThrottles(). If this method is not called
- // for a main-frame navigation, the default behavior is no activation for that
- // page load.
- void NotifyPageActivationComputed(
- content::NavigationHandle* navigation_handle,
- const ActivationState& activation_state);
-
// This method inspects |navigation_handle| and attaches navigation throttles
// appropriately, based on the current state of frame activation.
//
@@ -104,6 +98,13 @@ class ContentSubresourceFilterThrottleManager
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) override;
+ // SubresourceFilterObserver:
+ void OnSubresourceFilterGoingAway() override;
+ void OnPageActivationComputed(
+ content::NavigationHandle* navigation_handle,
+ ActivationDecision activation_decision,
+ const ActivationState& activation_state) override;
+
private:
std::unique_ptr<SubframeNavigationFilteringThrottle>
MaybeCreateSubframeNavigationFilteringThrottle(
@@ -139,6 +140,9 @@ class ContentSubresourceFilterThrottleManager
ActivationStateComputingNavigationThrottle*>
ongoing_activation_throttles_;
+ ScopedObserver<SubresourceFilterObserverManager, SubresourceFilterObserver>
+ scoped_observer_;
+
// Lazily instantiated in EnsureRulesetHandle when the first page level
// activation is triggered. Will go away when there are no more activated
// RenderFrameHosts (i.e. activated_frame_hosts_ is empty).

Powered by Google App Engine
This is Rietveld 408576698