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

Side by Side Diff: extensions/renderer/api_binding_hooks.h

Issue 2617423003: [Extensions Bindings] Add support for updateArgumentsPostValidate (Closed)
Patch Set: rebase Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « extensions/renderer/api_binding.cc ('k') | extensions/renderer/api_binding_hooks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_ 5 #ifndef EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_
6 #define EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_ 6 #define EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // Registers a JS script to be compiled and run in order to initialize any JS 71 // Registers a JS script to be compiled and run in order to initialize any JS
72 // hooks within a v8 context. 72 // hooks within a v8 context.
73 void RegisterJsSource(v8::Global<v8::String> source, 73 void RegisterJsSource(v8::Global<v8::String> source,
74 v8::Global<v8::String> resource_name); 74 v8::Global<v8::String> resource_name);
75 75
76 // Initializes JS hooks within a context. 76 // Initializes JS hooks within a context.
77 void InitializeInContext(v8::Local<v8::Context> context, 77 void InitializeInContext(v8::Local<v8::Context> context,
78 const std::string& api_name); 78 const std::string& api_name);
79 79
80 // Looks for a custom hook to handle the given request and, if one exists, 80 // Looks for any custom hooks associated with the given request, and, if any
81 // runs it. Returns the result of running the hook, if any. 81 // are found, runs them. Returns the result of running the hooks, if any.
82 RequestResult HandleRequest(const std::string& api_name, 82 RequestResult RunHooks(const std::string& api_name,
83 const std::string& method_name, 83 const std::string& method_name,
84 v8::Local<v8::Context> context, 84 v8::Local<v8::Context> context,
85 const APISignature* signature, 85 const APISignature* signature,
86 std::vector<v8::Local<v8::Value>>* arguments, 86 std::vector<v8::Local<v8::Value>>* arguments,
87 const ArgumentSpec::RefMap& type_refs); 87 const ArgumentSpec::RefMap& type_refs);
88 88
89 // Returns a JS interface that can be used to register hooks. 89 // Returns a JS interface that can be used to register hooks.
90 v8::Local<v8::Object> GetJSHookInterface(const std::string& api_name, 90 v8::Local<v8::Object> GetJSHookInterface(const std::string& api_name,
91 v8::Local<v8::Context> context); 91 v8::Local<v8::Context> context);
92 92
93 private: 93 private:
94 // Updates the |arguments| by running |function| and settings arguments to the 94 // Updates the |arguments| by running |function| and settings arguments to the
95 // returned result. 95 // returned result.
96 bool UpdateArguments(v8::Local<v8::Function> function, 96 bool UpdateArguments(v8::Local<v8::Function> function,
97 v8::Local<v8::Context> context, 97 v8::Local<v8::Context> context,
(...skipping 16 matching lines...) Expand all
114 // it's in direct response to JS calling in. There should be no reason that 114 // it's in direct response to JS calling in. There should be no reason that
115 // script is disabled. 115 // script is disabled.
116 binding::RunJSFunctionSync run_js_; 116 binding::RunJSFunctionSync run_js_;
117 117
118 DISALLOW_COPY_AND_ASSIGN(APIBindingHooks); 118 DISALLOW_COPY_AND_ASSIGN(APIBindingHooks);
119 }; 119 };
120 120
121 } // namespace extensions 121 } // namespace extensions
122 122
123 #endif // EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_ 123 #endif // EXTENSIONS_RENDERER_API_BINDING_HOOKS_H_
OLDNEW
« no previous file with comments | « extensions/renderer/api_binding.cc ('k') | extensions/renderer/api_binding_hooks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698