| Index: extensions/renderer/api_bindings_system.cc
|
| diff --git a/extensions/renderer/api_bindings_system.cc b/extensions/renderer/api_bindings_system.cc
|
| index b90483bcb1ae33ed74a0142f002f31784b217c19..7382d71f0930284a9bfdd42bf2096a04baa1957a 100644
|
| --- a/extensions/renderer/api_bindings_system.cc
|
| +++ b/extensions/renderer/api_bindings_system.cc
|
| @@ -70,8 +70,10 @@ std::unique_ptr<APIBinding> APIBindingsSystem::CreateNewAPIBinding(
|
|
|
| return base::MakeUnique<APIBinding>(
|
| api_name, function_definitions, type_definitions, event_definitions,
|
| - property_definitions, std::move(hooks), &type_reference_map_,
|
| - &request_handler_, &event_handler_);
|
| + property_definitions,
|
| + base::Bind(&APIBindingsSystem::CreateCustomType, base::Unretained(this)),
|
| + std::move(hooks), &type_reference_map_, &request_handler_,
|
| + &event_handler_);
|
| }
|
|
|
| void APIBindingsSystem::InitializeType(const std::string& type_name) {
|
| @@ -115,4 +117,20 @@ APIBindingHooks* APIBindingsSystem::GetHooksForAPI(
|
| return hooks.get();
|
| }
|
|
|
| +void APIBindingsSystem::RegisterCustomType(const std::string& type_name,
|
| + const CustomTypeHandler& function) {
|
| + DCHECK(custom_types_.find(type_name) == custom_types_.end());
|
| + custom_types_[type_name] = function;
|
| +}
|
| +
|
| +v8::Local<v8::Object> APIBindingsSystem::CreateCustomType(
|
| + v8::Local<v8::Context> context,
|
| + const std::string& type_name,
|
| + const std::string& property_name) {
|
| + auto iter = custom_types_.find(type_name);
|
| + DCHECK(iter != custom_types_.end());
|
| + return iter->second.Run(context, property_name, &request_handler_,
|
| + &type_reference_map_);
|
| +}
|
| +
|
| } // namespace extensions
|
|
|