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

Unified Diff: extensions/renderer/api_binding_js_util.h

Issue 2762623003: [Extensions Bindings] Add lastError utilities to APIBindingJSUtil (Closed)
Patch Set: Rebase Created 3 years, 9 months 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
« no previous file with comments | « extensions/renderer/BUILD.gn ('k') | extensions/renderer/api_binding_js_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a02b07e33adf4ef093b32022cf970b99e46dd0ab..08f0bcb16586859c7d1f2053975e37ef0299ae85 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;
@@ -64,6 +66,21 @@ 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, and
+ // then clears the last error.
+ void RunCallbackWithLastError(gin::Arguments* arguments,
+ const std::string& error,
+ v8::Local<v8::Function> callback);
+
// Type references. Guaranteed to outlive this object.
const APITypeReferenceMap* type_refs_;
@@ -73,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);
};
« no previous file with comments | « extensions/renderer/BUILD.gn ('k') | extensions/renderer/api_binding_js_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698