| Index: extensions/renderer/api_binding.cc
|
| diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc
|
| index e16bef1472d75bd955cad24d18260e2a29192ae8..648e8a7279598b9654968c4214b3fecc153d9912 100644
|
| --- a/extensions/renderer/api_binding.cc
|
| +++ b/extensions/renderer/api_binding.cc
|
| @@ -90,15 +90,19 @@ struct APIBinding::MethodData {
|
| struct APIBinding::EventData {
|
| EventData(std::string exposed_name,
|
| std::string full_name,
|
| + bool supports_filters,
|
| APIEventHandler* event_handler)
|
| : exposed_name(std::move(exposed_name)),
|
| full_name(std::move(full_name)),
|
| + supports_filters(supports_filters),
|
| event_handler(event_handler) {}
|
|
|
| // The name of the event on the API object (e.g. onCreated).
|
| std::string exposed_name;
|
| // The fully-specified name of the event (e.g. tabs.onCreated).
|
| std::string full_name;
|
| + // Whether the event supports filters.
|
| + bool supports_filters;
|
| // The associated event handler. This raw pointer is safe because the
|
| // EventData is only accessed from the callbacks associated with the
|
| // APIBinding, and both the APIBinding and APIEventHandler are owned by the
|
| @@ -214,8 +218,12 @@ APIBinding::APIBinding(const std::string& api_name,
|
| CHECK(event_dict->GetString("name", &name));
|
| std::string full_name =
|
| base::StringPrintf("%s.%s", api_name_.c_str(), name.c_str());
|
| - events_.push_back(base::MakeUnique<EventData>(
|
| - std::move(name), std::move(full_name), event_handler));
|
| + const base::ListValue* filters = nullptr;
|
| + bool supports_filters =
|
| + event_dict->GetList("filters", &filters) && !filters->empty();
|
| + events_.push_back(
|
| + base::MakeUnique<EventData>(std::move(name), std::move(full_name),
|
| + supports_filters, event_handler));
|
| }
|
| }
|
| }
|
| @@ -375,7 +383,7 @@ void APIBinding::GetEventObject(
|
| auto* event_data =
|
| static_cast<EventData*>(info.Data().As<v8::External>()->Value());
|
| info.GetReturnValue().Set(event_data->event_handler->CreateEventInstance(
|
| - event_data->full_name, context));
|
| + event_data->full_name, event_data->supports_filters, context));
|
| }
|
|
|
| void APIBinding::GetCustomPropertyObject(
|
|
|