| Index: extensions/renderer/api_binding.h
|
| diff --git a/extensions/renderer/api_binding.h b/extensions/renderer/api_binding.h
|
| index 480877c98c72501eee7d22c5f73bc2fedb8b51b3..4a4663681e68df0875d22b5807b896d71a75d68a 100644
|
| --- a/extensions/renderer/api_binding.h
|
| +++ b/extensions/renderer/api_binding.h
|
| @@ -25,6 +25,7 @@ class Arguments;
|
| }
|
|
|
| namespace extensions {
|
| +class APIEventHandler;
|
|
|
| // A class that vends v8::Objects for extension APIs. These APIs have function
|
| // interceptors for all exposed methods, which call back into the APIBinding.
|
| @@ -54,10 +55,12 @@ class APIBinding {
|
| using HandlerCallback = base::Callback<void(gin::Arguments*)>;
|
|
|
| // The ArgumentSpec::RefMap is required to outlive this object.
|
| - // |type_definitions| may be null if the API does not specify any types.
|
| + // |type_definitions| and |event_definitions| may be null if the API does not
|
| + // specify any types or events.
|
| APIBinding(const std::string& name,
|
| const base::ListValue& function_definitions,
|
| const base::ListValue* type_definitions,
|
| + const base::ListValue* event_definitions,
|
| const APIMethodCallback& callback,
|
| ArgumentSpec::RefMap* type_refs);
|
| ~APIBinding();
|
| @@ -66,6 +69,7 @@ class APIBinding {
|
| v8::Local<v8::Object> CreateInstance(
|
| v8::Local<v8::Context> context,
|
| v8::Isolate* isolate,
|
| + APIEventHandler* event_handler,
|
| const AvailabilityCallback& is_available);
|
|
|
| private:
|
| @@ -93,6 +97,9 @@ class APIBinding {
|
| // A map from method name to expected signature.
|
| std::map<std::string, std::unique_ptr<APISignature>> signatures_;
|
|
|
| + // The names of all events associated with this API.
|
| + std::vector<std::string> event_names_;
|
| +
|
| // The callback to use when an API is invoked with valid arguments.
|
| APIMethodCallback method_callback_;
|
|
|
|
|