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

Unified Diff: chrome/renderer/extensions/experimental.socket_custom_bindings.cc

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
Index: chrome/renderer/extensions/experimental.socket_custom_bindings.cc
diff --git a/chrome/renderer/extensions/experimental.socket_custom_bindings.cc b/chrome/renderer/extensions/experimental.socket_custom_bindings.cc
index 11d34bb4717fc1b378d693cce08411a7bb9f06bb..8dd096bc22ba491f34e066ee864cd10cdbd24019 100644
--- a/chrome/renderer/extensions/experimental.socket_custom_bindings.cc
+++ b/chrome/renderer/extensions/experimental.socket_custom_bindings.cc
@@ -11,32 +11,22 @@
#include "grit/renderer_resources.h"
#include "v8/include/v8.h"
-namespace extensions {
+namespace {
-ExperimentalSocketCustomBindings::ExperimentalSocketCustomBindings(
- int dependency_count,
- const char** dependencies)
- : ChromeV8Extension(
- "extensions/experimental.socket_custom_bindings.js",
- IDR_EXPERIMENTAL_SOCKET_CUSTOM_BINDINGS_JS,
- dependency_count,
- dependencies,
- NULL) {}
-
-static v8::Handle<v8::Value> GetNextSocketEventId(const v8::Arguments& args) {
+v8::Handle<v8::Value> GetNextSocketEventId(const v8::Arguments& args) {
// Note: this works because the socket API only works in the extension
// process, not content scripts.
static int next_event_id = 1;
return v8::Integer::New(next_event_id++);
}
-v8::Handle<v8::FunctionTemplate>
-ExperimentalSocketCustomBindings::GetNativeFunction(
- v8::Handle<v8::String> name) {
- if (name->Equals(v8::String::New("GetNextSocketEventId")))
- return v8::FunctionTemplate::New(GetNextSocketEventId);
+} // namespace
+
+namespace extensions {
- return ChromeV8Extension::GetNativeFunction(name);
+ExperimentalSocketCustomBindings::ExperimentalSocketCustomBindings()
+ : ChromeV8Extension(NULL) {
+ RouteStaticFunction("GetNextSocketEventId", &GetNextSocketEventId);
}
} // extensions

Powered by Google App Engine
This is Rietveld 408576698