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

Unified Diff: extensions/renderer/api_binding.h

Issue 2469593002: [Extensions Bindings] Add Events support (Closed)
Patch Set: . Created 4 years, 1 month 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/api_binding.h
diff --git a/extensions/renderer/api_binding.h b/extensions/renderer/api_binding.h
index a1f8706603d89dbf29799d2331eeb1130292fbe2..01be5b1561304b0b3a75471606569738d9202f1f 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.
@@ -50,17 +51,20 @@ 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();
// Returns a new v8::Object for the API this APIBinding represents.
v8::Local<v8::Object> CreateInstance(v8::Local<v8::Context> context,
- v8::Isolate* isolate);
+ v8::Isolate* isolate,
+ APIEventHandler* event_handler);
private:
using APISignature = std::vector<std::unique_ptr<ArgumentSpec>>;
@@ -87,6 +91,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_;

Powered by Google App Engine
This is Rietveld 408576698