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

Unified Diff: extensions/renderer/api_binding_hooks.h

Issue 2609553003: [Extensions Bindings] Allow custom hooks to return values, throw (Closed)
Patch Set: woot Created 4 years 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_hooks.h
diff --git a/extensions/renderer/api_binding_hooks.h b/extensions/renderer/api_binding_hooks.h
index d6620275017e656fc0182af51f7fdc2d69d78c12..8abe227661b86f1f8dd390db90e842bfc428f1a1 100644
--- a/extensions/renderer/api_binding_hooks.h
+++ b/extensions/renderer/api_binding_hooks.h
@@ -49,7 +49,8 @@ class APIBindingHooks {
base::Callback<RequestResult(const APISignature*,
v8::Local<v8::Context> context,
std::vector<v8::Local<v8::Value>>*,
- const ArgumentSpec::RefMap&)>;
+ const ArgumentSpec::RefMap&,
+ v8::Local<v8::Value>* return_value)>;
explicit APIBindingHooks(const binding::RunJSFunctionSync& run_js);
~APIBindingHooks();
@@ -68,14 +69,15 @@ class APIBindingHooks {
const std::string& api_name);
// Looks for a custom hook to handle the given request and, if one exists,
- // runs it. Returns the result of trying to run the hook, or NOT_HANDLED if no
- // hook was found.
+ // runs it. Returns the result of running the hook, if any. Populates
+ // |return_value| with a value to return, if any.
RequestResult HandleRequest(const std::string& api_name,
const std::string& method_name,
v8::Local<v8::Context> context,
const APISignature* signature,
std::vector<v8::Local<v8::Value>>* arguments,
- const ArgumentSpec::RefMap& type_refs);
+ const ArgumentSpec::RefMap& type_refs,
+ v8::Local<v8::Value>* return_value);
jbroman 2017/01/02 20:05:46 nit: This argument list is getting a little long.
Devlin 2017/01/04 18:38:07 Hmm... it makes it seem a little more verbose to m
// Returns a JS interface that can be used to register hooks.
v8::Local<v8::Object> GetJSHookInterface(const std::string& api_name,

Powered by Google App Engine
This is Rietveld 408576698