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

Unified Diff: extensions/renderer/api_binding_hooks.h

Issue 2831453002: [Extensions Bindings] Move custom handling to APIBindingHooksDelegate (Closed)
Patch Set: . Created 3 years, 8 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_hooks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/api_binding_hooks.h
diff --git a/extensions/renderer/api_binding_hooks.h b/extensions/renderer/api_binding_hooks.h
index 1c667e2a7d71dbed32acb2b1f661b65732481a26..54c3bfc058bfe73630fc63433613b153df5eb78e 100644
--- a/extensions/renderer/api_binding_hooks.h
+++ b/extensions/renderer/api_binding_hooks.h
@@ -5,22 +5,16 @@
#ifndef EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_
#define EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_
-#include <map>
#include <memory>
#include <string>
-#include "base/callback.h"
#include "base/macros.h"
#include "extensions/renderer/api_binding_types.h"
-#include "extensions/renderer/argument_spec.h"
#include "v8/include/v8.h"
-namespace gin {
-class Arguments;
-}
-
namespace extensions {
class APIBindingHooksDelegate;
+class APITypeReferenceMap;
class APISignature;
// A class to register custom hooks for given API calls that need different
@@ -51,29 +45,10 @@ class APIBindingHooks {
v8::Local<v8::Value> return_value; // Only valid if code == HANDLED.
};
- // The callback to handle an API method. We pass in the expected signature
- // (so the caller can verify arguments, optionally after modifying/"massaging"
- // them) and the passed arguments. The handler is responsible for returning,
- // which depending on the API could mean either returning synchronously
- // through gin::Arguments::Return or asynchronously through a passed callback.
- // TODO(devlin): As we continue expanding the hooks interface, we should allow
- // handlers to register a request so that they don't have to maintain a
- // reference to the callback themselves.
- using HandleRequestHook =
- base::Callback<RequestResult(const APISignature*,
- v8::Local<v8::Context> context,
- std::vector<v8::Local<v8::Value>>*,
- const APITypeReferenceMap&)>;
-
APIBindingHooks(const std::string& api_name,
const binding::RunJSFunctionSync& run_js);
~APIBindingHooks();
- // Register a custom binding to handle requests.
- // TODO(devlin): Remove this in favor of a method on APIBindingHooksDelegate.
- void RegisterHandleRequest(const std::string& method_name,
- const HandleRequestHook& hook);
-
// Looks for any custom hooks associated with the given request, and, if any
// are found, runs them. Returns the result of running the hooks, if any.
RequestResult RunHooks(const std::string& method_name,
@@ -104,12 +79,6 @@ class APIBindingHooks {
v8::Local<v8::Context> context,
std::vector<v8::Local<v8::Value>>* arguments);
- // Whether we've tried to use any hooks associated with this object.
- bool hooks_used_ = false;
-
- // All registered request handlers.
- std::map<std::string, HandleRequestHook> request_hooks_;
-
// The name of the associated API.
std::string api_name_;
« no previous file with comments | « extensions/renderer/BUILD.gn ('k') | extensions/renderer/api_binding_hooks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698