Index: extensions/renderer/api_binding_js_util.h |
diff --git a/extensions/renderer/api_binding_js_util.h b/extensions/renderer/api_binding_js_util.h |
index 00198069dccb2ad3930a32f3d99d6c228e630e57..edd501556aa5705a515e50a4c5bddef2f6a035b3 100644 |
--- a/extensions/renderer/api_binding_js_util.h |
+++ b/extensions/renderer/api_binding_js_util.h |
@@ -8,6 +8,7 @@ |
#include <string> |
#include "base/macros.h" |
+#include "extensions/renderer/api_binding_types.h" |
#include "gin/wrappable.h" |
#include "v8/include/v8.h" |
@@ -27,7 +28,8 @@ class APIBindingJSUtil final : public gin::Wrappable<APIBindingJSUtil> { |
public: |
APIBindingJSUtil(const APITypeReferenceMap* type_refs, |
APIRequestHandler* request_handler, |
- APIEventHandler* event_handler); |
+ APIEventHandler* event_handler, |
+ const binding::RunJSFunction& run_js); |
~APIBindingJSUtil() override; |
static gin::WrapperInfo kWrapperInfo; |
@@ -62,6 +64,23 @@ class APIBindingJSUtil final : public gin::Wrappable<APIBindingJSUtil> { |
// being added. |
void InvalidateEvent(gin::Arguments* arguments, v8::Local<v8::Object> event); |
+ // Sets the last error in the context. |
+ void SetLastError(gin::Arguments* arguments, const std::string& error); |
+ |
+ // Clears the last error in the context. |
+ void ClearLastError(gin::Arguments* arguments); |
+ |
+ // Returns true if there is a set lastError in the given context. |
+ void HasLastError(gin::Arguments* arguments); |
+ |
+ // Sets the lastError in the given context, runs the provided callback with |
+ // the supplied arguments, and then clears the last error. |
+ void RunCallbackWithLastError( |
+ gin::Arguments* arguments, |
+ const std::string& error, |
+ v8::Local<v8::Function> callback, |
+ std::vector<v8::Local<v8::Value>> callback_args); |
jbroman
2017/03/20 20:14:49
Is it advantageous to provide the arguments separa
Devlin
2017/03/20 23:10:40
Nope - this was just for parity with the JS equiva
|
+ |
// Type references. Guaranteed to outlive this object. |
const APITypeReferenceMap* type_refs_; |
@@ -71,6 +90,8 @@ class APIBindingJSUtil final : public gin::Wrappable<APIBindingJSUtil> { |
// The event handler. Guaranteed to outlive this object. |
APIEventHandler* event_handler_; |
+ binding::RunJSFunction run_js_; |
+ |
DISALLOW_COPY_AND_ASSIGN(APIBindingJSUtil); |
}; |