summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/native_handler.cc
diff options
context:
space:
mode:
authorkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 06:25:31 +0000
committerkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-16 06:25:31 +0000
commitecde19149c12c30c87da1d4e8efc1bd557eb8fd3 (patch)
tree1677f153dda66caaabdd13114f580e7f2ddcf907 /chrome/renderer/native_handler.cc
parent15cd4a04f9fe6717560b0e08253eb9800c359c63 (diff)
downloadchromium_src-ecde19149c12c30c87da1d4e8efc1bd557eb8fd3.zip
chromium_src-ecde19149c12c30c87da1d4e8efc1bd557eb8fd3.tar.gz
chromium_src-ecde19149c12c30c87da1d4e8efc1bd557eb8fd3.tar.bz2
Implement a module system for the extension bindings JS.
BUG=104100 TEST=existing browser tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=125132 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=125801 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=126306 Review URL: http://codereview.chromium.org/9386001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@127117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/native_handler.cc')
-rw-r--r--chrome/renderer/native_handler.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/renderer/native_handler.cc b/chrome/renderer/native_handler.cc
index 614df08..afa21ff 100644
--- a/chrome/renderer/native_handler.cc
+++ b/chrome/renderer/native_handler.cc
@@ -28,9 +28,18 @@ v8::Handle<v8::Value> NativeHandler::Router(const v8::Arguments& args) {
void NativeHandler::RouteFunction(const std::string& name,
const HandlerFunction& handler_function) {
linked_ptr<HandlerFunction> function(new HandlerFunction(handler_function));
+ // TODO(koz): Investigate using v8's MakeWeak() function instead of holding
+ // on to these pointers here.
handler_functions_.push_back(function);
v8::Handle<v8::FunctionTemplate> function_template =
v8::FunctionTemplate::New(Router,
v8::External::New(function.get()));
object_template_->Set(name.c_str(), function_template);
}
+
+void NativeHandler::RouteStaticFunction(const std::string& name,
+ const HandlerFunc handler_func) {
+ v8::Handle<v8::FunctionTemplate> function_template =
+ v8::FunctionTemplate::New(handler_func, v8::External::New(this));
+ object_template_->Set(name.c_str(), function_template);
+}