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

Unified Diff: extensions/renderer/native_extension_bindings_system.cc

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
Index: extensions/renderer/native_extension_bindings_system.cc
diff --git a/extensions/renderer/native_extension_bindings_system.cc b/extensions/renderer/native_extension_bindings_system.cc
index 0e65f4703110c25278612ed894b6caebd4eb95bf..c777890f1493869d0a1cfebe2d60e39deb68487d 100644
--- a/extensions/renderer/native_extension_bindings_system.cc
+++ b/extensions/renderer/native_extension_bindings_system.cc
@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h"
#include "content/public/common/content_switches.h"
#include "extensions/common/constants.h"
+#include "extensions/common/event_filtering_info.h"
#include "extensions/common/extension_api.h"
#include "extensions/common/extension_messages.h"
#include "extensions/common/features/feature_provider.h"
@@ -446,13 +447,15 @@ void NativeExtensionBindingsSystem::UpdateBindingsForContext(
void NativeExtensionBindingsSystem::DispatchEventInContext(
const std::string& event_name,
const base::ListValue* event_args,
- const base::DictionaryValue* filtering_info,
+ const base::DictionaryValue* filtering_info_dict,
ScriptContext* context) {
v8::HandleScope handle_scope(context->isolate());
v8::Context::Scope context_scope(context->v8_context());
- // TODO(devlin): Take into account |filtering_info|.
- api_system_.FireEventInContext(event_name, context->v8_context(),
- *event_args);
+ EventFilteringInfo filter;
+ if (filtering_info_dict)
+ filter = EventFilteringInfo(*filtering_info_dict);
+ api_system_.FireEventInContext(event_name, context->v8_context(), *event_args,
+ filter);
}
void NativeExtensionBindingsSystem::HandleResponse(
@@ -634,9 +637,11 @@ void NativeExtensionBindingsSystem::SendRequest(
void NativeExtensionBindingsSystem::OnEventListenerChanged(
const std::string& event_name,
binding::EventListenersChanged change,
+ const base::DictionaryValue* filter,
v8::Local<v8::Context> context) {
- send_event_listener_ipc_.Run(
- change, ScriptContextSet::GetContextByV8Context(context), event_name);
+ send_event_listener_ipc_.Run(change,
+ ScriptContextSet::GetContextByV8Context(context),
+ event_name, filter);
}
void NativeExtensionBindingsSystem::GetJSBindingUtil(

Powered by Google App Engine
This is Rietveld 408576698