| Index: extensions/renderer/api_bindings_system.h
|
| diff --git a/extensions/renderer/api_bindings_system.h b/extensions/renderer/api_bindings_system.h
|
| index a21da2e1443bda3065f43decda18feb0d197de84..032a700d27d1d72bc357477d52360af558b6a8fb 100644
|
| --- a/extensions/renderer/api_bindings_system.h
|
| +++ b/extensions/renderer/api_bindings_system.h
|
| @@ -33,6 +33,11 @@ class APIBindingsSystem {
|
| public:
|
| using GetAPISchemaMethod =
|
| base::Callback<const base::DictionaryValue&(const std::string&)>;
|
| + using CustomTypeHandler =
|
| + base::Callback<v8::Local<v8::Object>(v8::Local<v8::Context> context,
|
| + const std::string& property_name,
|
| + APIRequestHandler* request_handler,
|
| + APITypeReferenceMap* type_refs)>;
|
|
|
| APIBindingsSystem(const binding::RunJSFunction& call_js,
|
| const binding::RunJSFunctionSync& call_js_sync,
|
| @@ -72,6 +77,11 @@ class APIBindingsSystem {
|
| // efficient to register multiple hooks for the same API.
|
| APIBindingHooks* GetHooksForAPI(const std::string& api_name);
|
|
|
| + // Registers the handler for creating a custom type with the given
|
| + // |type_name|.
|
| + void RegisterCustomType(const std::string& type_name,
|
| + const CustomTypeHandler& function);
|
| +
|
| private:
|
| // Creates a new APIBinding for the given |api_name|.
|
| std::unique_ptr<APIBinding> CreateNewAPIBinding(const std::string& api_name);
|
| @@ -80,6 +90,11 @@ class APIBindingsSystem {
|
| // type.
|
| void InitializeType(const std::string& name);
|
|
|
| + // Handles creating the type for the specified property.
|
| + v8::Local<v8::Object> CreateCustomType(v8::Local<v8::Context> context,
|
| + const std::string& type_name,
|
| + const std::string& property_name);
|
| +
|
| // The map of cached API reference types.
|
| APITypeReferenceMap type_reference_map_;
|
|
|
| @@ -98,6 +113,8 @@ class APIBindingsSystem {
|
| // performance concern?
|
| std::map<std::string, std::unique_ptr<APIBindingHooks>> binding_hooks_;
|
|
|
| + std::map<std::string, CustomTypeHandler> custom_types_;
|
| +
|
| binding::RunJSFunction call_js_;
|
|
|
| binding::RunJSFunctionSync call_js_sync_;
|
|
|