summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/context_menus_custom_bindings.cc
diff options
context:
space:
mode:
authorkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 02:09:41 +0000
committerkoz@chromium.org <koz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-13 02:09:41 +0000
commit9fb990b32d4de5697fa848e03a6bf4d11fcd0417 (patch)
treec6dd811b2fd92bf95afe4107e3f78ae86e255319 /chrome/renderer/extensions/context_menus_custom_bindings.cc
parentaf885dd7caf0455a05f15aac48fa221191266706 (diff)
downloadchromium_src-9fb990b32d4de5697fa848e03a6bf4d11fcd0417.zip
chromium_src-9fb990b32d4de5697fa848e03a6bf4d11fcd0417.tar.gz
chromium_src-9fb990b32d4de5697fa848e03a6bf4d11fcd0417.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 Review URL: http://codereview.chromium.org/9386001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions/context_menus_custom_bindings.cc')
-rw-r--r--chrome/renderer/extensions/context_menus_custom_bindings.cc25
1 files changed, 8 insertions, 17 deletions
diff --git a/chrome/renderer/extensions/context_menus_custom_bindings.cc b/chrome/renderer/extensions/context_menus_custom_bindings.cc
index bfb6114..db3b3d9 100644
--- a/chrome/renderer/extensions/context_menus_custom_bindings.cc
+++ b/chrome/renderer/extensions/context_menus_custom_bindings.cc
@@ -7,19 +7,9 @@
#include "grit/renderer_resources.h"
#include "v8/include/v8.h"
-namespace extensions {
+namespace {
-ContextMenusCustomBindings::ContextMenusCustomBindings(
- int dependency_count,
- const char** dependencies)
- : ChromeV8Extension(
- "extensions/context_menus_custom_bindings.js",
- IDR_CONTEXT_MENUS_CUSTOM_BINDINGS_JS,
- dependency_count,
- dependencies,
- NULL) {}
-
-static v8::Handle<v8::Value> GetNextContextMenuId(const v8::Arguments& args) {
+v8::Handle<v8::Value> GetNextContextMenuId(const v8::Arguments& args) {
// Note: this works because contextMenus.create() only works in the
// extension process. If that API is opened up to content scripts, this
// will need to change. See crbug.com/77023
@@ -27,12 +17,13 @@ static v8::Handle<v8::Value> GetNextContextMenuId(const v8::Arguments& args) {
return v8::Integer::New(next_context_menu_id++);
}
-v8::Handle<v8::FunctionTemplate> ContextMenusCustomBindings::GetNativeFunction(
- v8::Handle<v8::String> name) {
- if (name->Equals(v8::String::New("GetNextContextMenuId")))
- return v8::FunctionTemplate::New(GetNextContextMenuId);
+} // namespace
+
+namespace extensions {
- return ChromeV8Extension::GetNativeFunction(name);
+ContextMenusCustomBindings::ContextMenusCustomBindings()
+ : ChromeV8Extension(NULL) {
+ RouteStaticFunction("GetNextContextMenuId", &GetNextContextMenuId);
}
} // extensions