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

Unified Diff: extensions/renderer/api_binding_js_util.h

Issue 2947463002: [Extensions Bindings] Add a bindings/ subdirectory under renderer (Closed)
Patch Set: . Created 3 years, 6 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/api_binding_hooks_test_delegate.cc ('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
deleted file mode 100644
index 9963c82245e71a3b6427be703f2c4b1492b77744..0000000000000000000000000000000000000000
--- a/extensions/renderer/api_binding_js_util.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_
-#define EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_
-
-#include <string>
-
-#include "base/macros.h"
-#include "extensions/renderer/api_binding_types.h"
-#include "gin/wrappable.h"
-#include "v8/include/v8.h"
-
-namespace gin {
-class Arguments;
-}
-
-namespace extensions {
-class APIEventHandler;
-class APIRequestHandler;
-class APITypeReferenceMap;
-
-// An object that exposes utility methods to the existing JS bindings, such as
-// sendRequest and registering event argument massagers. If/when we get rid of
-// some of our JS bindings, we can reduce or remove this class.
-class APIBindingJSUtil final : public gin::Wrappable<APIBindingJSUtil> {
- public:
- APIBindingJSUtil(APITypeReferenceMap* type_refs,
- APIRequestHandler* request_handler,
- APIEventHandler* event_handler,
- const binding::RunJSFunction& run_js);
- ~APIBindingJSUtil() override;
-
- static gin::WrapperInfo kWrapperInfo;
-
- // gin::Wrappable:
- gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
- v8::Isolate* isolate) final;
-
- private:
- // A handler to initiate an API request through the APIRequestHandler. A
- // replacement for custom bindings that utilize require('sendRequest').
- void SendRequest(gin::Arguments* arguments,
- const std::string& name,
- const std::vector<v8::Local<v8::Value>>& request_args,
- v8::Local<v8::Value> schemas_unused,
- v8::Local<v8::Value> options);
-
- // A handler to register an argument massager for a specific event.
- // Replacement for event_bindings.registerArgumentMassager.
- void RegisterEventArgumentMassager(gin::Arguments* arguments,
- const std::string& event_name,
- v8::Local<v8::Function> massager);
-
- // A handler to allow custom bindings to create custom extension API event
- // objects (e.g. foo.onBar).
- // TODO(devlin): Currently, we ignore schema. We may want to take it into
- // account.
- void CreateCustomEvent(gin::Arguments* arguments,
- v8::Local<v8::Value> v8_event_name,
- v8::Local<v8::Value> unused_schema,
- bool supports_filters);
-
- // Creates a new declarative event.
- void CreateCustomDeclarativeEvent(
- gin::Arguments* arguments,
- const std::string& event_name,
- const std::vector<std::string>& actions_list,
- const std::vector<std::string>& conditions_list,
- int webview_instance_id);
-
- // Invalidates an event, removing its listeners and preventing any more from
- // 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.
- APITypeReferenceMap* type_refs_;
-
- // The request handler. Guaranteed to outlive this object.
- APIRequestHandler* request_handler_;
-
- // The event handler. Guaranteed to outlive this object.
- APIEventHandler* event_handler_;
-
- binding::RunJSFunction run_js_;
-
- DISALLOW_COPY_AND_ASSIGN(APIBindingJSUtil);
-};
-
-} // namespace extensions
-
-#endif // EXTENSIONS_RENDERER_API_BINDING_JS_UTIL_H_
« no previous file with comments | « extensions/renderer/api_binding_hooks_test_delegate.cc ('k') | extensions/renderer/api_binding_js_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698