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

Unified Diff: extensions/renderer/api_event_handler.h

Issue 2768093002: [Reland][Extensions Bindings] Add support for filtered events (Closed)
Patch Set: Fix 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
« no previous file with comments | « extensions/renderer/api_bindings_system_unittest.cc ('k') | extensions/renderer/api_event_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_event_handler.h
diff --git a/extensions/renderer/api_event_handler.h b/extensions/renderer/api_event_handler.h
index a0ba36416a610fabbf3250830d01e52ecc4579c3..33e6d8a155f8c46986679eebb7621118d8a675a7 100644
--- a/extensions/renderer/api_event_handler.h
+++ b/extensions/renderer/api_event_handler.h
@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/macros.h"
+#include "extensions/common/event_filter.h"
#include "extensions/renderer/api_binding_types.h"
#include "extensions/renderer/event_emitter.h"
#include "v8/include/v8.h"
@@ -18,6 +19,7 @@ class ListValue;
}
namespace extensions {
+class EventFilteringInfo;
// The object to handle API events. This includes vending v8::Objects for the
// event; handling adding, removing, and querying listeners; and firing events
@@ -28,6 +30,7 @@ class APIEventHandler {
using EventListenersChangedMethod =
base::Callback<void(const std::string& event_name,
binding::EventListenersChanged,
+ const base::DictionaryValue* filter,
v8::Local<v8::Context>)>;
APIEventHandler(const binding::RunJSFunction& call_js,
@@ -36,6 +39,7 @@ class APIEventHandler {
// Returns a new v8::Object for an event with the given |event_name|.
v8::Local<v8::Object> CreateEventInstance(const std::string& event_name,
+ bool supports_filters,
v8::Local<v8::Context> context);
// Creates a new event without any name. This is used by custom bindings when
@@ -53,7 +57,8 @@ class APIEventHandler {
// specified |context|, sending the included |arguments|.
void FireEventInContext(const std::string& event_name,
v8::Local<v8::Context> context,
- const base::ListValue& arguments);
+ const base::ListValue& arguments,
+ const EventFilteringInfo& filter);
// Registers a |function| to serve as an "argument massager" for the given
// |event_name|, mutating the original arguments.
@@ -80,6 +85,9 @@ class APIEventHandler {
EventListenersChangedMethod listeners_changed_;
+ // The associated EventFilter; shared across all contexts and events.
+ EventFilter event_filter_;
+
DISALLOW_COPY_AND_ASSIGN(APIEventHandler);
};
« no previous file with comments | « extensions/renderer/api_bindings_system_unittest.cc ('k') | extensions/renderer/api_event_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698