Index: extensions/renderer/api_binding.cc |
diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc |
index 1c1c0f902f30601f3441c36042dff11b714e7905..1f97775fff666ce4b72d1e41ee91a821e0d0900f 100644 |
--- a/extensions/renderer/api_binding.cc |
+++ b/extensions/renderer/api_binding.cc |
@@ -198,12 +198,10 @@ void APIBinding::HandleCall(const std::string& name, |
{ |
v8::TryCatch try_catch(isolate); |
APIBindingHooks::RequestResult hooks_result = |
- APIBindingHooks::RequestResult::NOT_HANDLED; |
- hooks_result = binding_hooks_->HandleRequest(api_name_, name, context, |
- signature, &argument_list, |
- *type_refs_); |
+ binding_hooks_->HandleRequest(api_name_, name, context, |
+ signature, &argument_list, *type_refs_); |
- switch (hooks_result) { |
+ switch (hooks_result.code) { |
case APIBindingHooks::RequestResult::INVALID_INVOCATION: |
invalid_invocation = true; |
// Throw a type error below so that it's not caught by our try-catch. |
@@ -213,6 +211,8 @@ void APIBinding::HandleCall(const std::string& name, |
try_catch.ReThrow(); |
return; |
case APIBindingHooks::RequestResult::HANDLED: |
+ if (!hooks_result.return_value.IsEmpty()) |
+ arguments->Return(hooks_result.return_value); |
return; // Our work here is done. |
case APIBindingHooks::RequestResult::NOT_HANDLED: |
break; // Handle in the default manner. |