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

Unified Diff: chrome/renderer/native_handler.h

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 | « chrome/renderer/module_system_unittest.cc ('k') | chrome/renderer/native_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/native_handler.h
diff --git a/chrome/renderer/native_handler.h b/chrome/renderer/native_handler.h
index b4d3078ef1ea96fa16a9409d73c4c9c70a59e42c..f595a0de0be09586213e267106d6c63bd93c8a4f 100644
--- a/chrome/renderer/native_handler.h
+++ b/chrome/renderer/native_handler.h
@@ -16,6 +16,12 @@
// A NativeHandler is a factory for JS objects with functions on them that map
// to native C++ functions. Subclasses should call RouteFunction() in their
// constructor to define functions on the created JS objects.
+//
+// NativeHandlers are intended to be used with a ModuleSystem. The ModuleSystem
+// will assume ownership of the NativeHandler, and as a ModuleSystem is tied to
+// a single v8::Context, this implies that NativeHandlers will also be tied to
+// a single v8::context.
+// TODO(koz): Rename this to NativeJavaScriptModule.
class NativeHandler {
public:
explicit NativeHandler();
@@ -26,6 +32,7 @@ class NativeHandler {
v8::Handle<v8::Object> NewInstance();
protected:
+ typedef v8::Handle<v8::Value> (*HandlerFunc)(const v8::Arguments&);
typedef base::Callback<v8::Handle<v8::Value>(const v8::Arguments&)>
HandlerFunction;
@@ -35,6 +42,9 @@ class NativeHandler {
void RouteFunction(const std::string& name,
const HandlerFunction& handler_function);
+ void RouteStaticFunction(const std::string& name,
+ const HandlerFunc handler_func);
+
private:
static v8::Handle<v8::Value> Router(const v8::Arguments& args);
« no previous file with comments | « chrome/renderer/module_system_unittest.cc ('k') | chrome/renderer/native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698