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..e53b632c57499c50d774eef38123425b099ddf7d 100644 |
--- a/extensions/renderer/api_binding_hooks.h |
+++ b/extensions/renderer/api_binding_hooks.h |
@@ -30,11 +30,21 @@ class APISignature; |
class APIBindingHooks { |
public: |
// The result of checking for hooks to handle a request. |
- enum class RequestResult { |
- HANDLED, // A custom hook handled the request. |
- THROWN, // An exception was thrown during parsing or handling. |
- INVALID_INVOCATION, // The request was called with invalid arguments. |
- NOT_HANDLED, // The request was not handled. |
+ struct RequestResult { |
+ enum ResultCode { |
+ HANDLED, // A custom hook handled the request. |
+ THROWN, // An exception was thrown during parsing or |
+ // handling. |
+ INVALID_INVOCATION, // The request was called with invalid arguments. |
+ NOT_HANDLED, // The request was not handled. |
+ }; |
+ |
+ explicit RequestResult(ResultCode code); |
+ RequestResult(const RequestResult& other); |
+ ~RequestResult(); |
jbroman
2017/01/04 21:57:49
Is the [chromium-style] plugin forcing these to be
Devlin
2017/01/04 23:29:29
Yeah, this was the result of being bullied by [chr
|
+ |
+ ResultCode code; |
+ v8::Local<v8::Value> return_value; // Only valid if code == HANDLED. |
}; |
// The callback to handle an API method. We pass in the expected signature |
@@ -68,8 +78,8 @@ 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 |
jbroman
2017/01/04 21:57:49
If the |return_value| argument is removed, then th
Devlin
2017/01/04 23:29:29
Whoops, done.
|
+ // |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, |