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

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

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
« no previous file with comments | « components/subresource_filter/content/browser/subresource_filter_observer_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/subresource_filter/content/browser/subresource_filter_observer_manager.cc
diff --git a/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc b/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f3b891c7aeef168ad2e10398a2edf4e1d13672ec
--- /dev/null
+++ b/components/subresource_filter/content/browser/subresource_filter_observer_manager.cc
@@ -0,0 +1,42 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/subresource_filter/content/browser/subresource_filter_observer_manager.h"
+
+#include "components/subresource_filter/core/common/activation_state.h"
+
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(
+ subresource_filter::SubresourceFilterObserverManager);
+
+namespace subresource_filter {
+
+SubresourceFilterObserverManager::SubresourceFilterObserverManager(
+ content::WebContents* web_contents) {}
+
+SubresourceFilterObserverManager::~SubresourceFilterObserverManager() {
+ for (auto& observer : observers_)
+ observer.OnSubresourceFilterGoingAway();
+}
+
+void SubresourceFilterObserverManager::AddObserver(
+ SubresourceFilterObserver* observer) {
+ observers_.AddObserver(observer);
+}
+
+void SubresourceFilterObserverManager::RemoveObserver(
+ SubresourceFilterObserver* observer) {
+ observers_.RemoveObserver(observer);
+}
+
+void SubresourceFilterObserverManager::NotifyPageActivationComputed(
+ content::NavigationHandle* navigation_handle,
+ ActivationDecision activation_decision,
+ const ActivationState& activation_state) {
+ for (auto& observer : observers_) {
+ observer.OnPageActivationComputed(navigation_handle, activation_decision,
+ activation_state);
+ }
+}
+
+} // namespace subresource_filter
« no previous file with comments | « components/subresource_filter/content/browser/subresource_filter_observer_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698