summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/page_capture_custom_bindings.cc
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-09 07:55:14 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-09 07:55:14 +0000
commit65f8fbbd988207a470e2a399379baa70f4abb282 (patch)
tree9f91f7a50a48af285b12cb406f45fc8d00b38127 /chrome/renderer/extensions/page_capture_custom_bindings.cc
parentc7f74e7ca7e2b2428fb7434b0ef0b7a9b4bfbff8 (diff)
downloadchromium_src-65f8fbbd988207a470e2a399379baa70f4abb282.zip
chromium_src-65f8fbbd988207a470e2a399379baa70f4abb282.tar.gz
chromium_src-65f8fbbd988207a470e2a399379baa70f4abb282.tar.bz2
Revert 125801 - 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 Review URL: http://codereview.chromium.org/9386001 TBR=koz@chromium.org Review URL: https://chromiumcodereview.appspot.com/9657026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions/page_capture_custom_bindings.cc')
-rw-r--r--chrome/renderer/extensions/page_capture_custom_bindings.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/chrome/renderer/extensions/page_capture_custom_bindings.cc b/chrome/renderer/extensions/page_capture_custom_bindings.cc
index c7e41ea..e37cdab 100644
--- a/chrome/renderer/extensions/page_capture_custom_bindings.cc
+++ b/chrome/renderer/extensions/page_capture_custom_bindings.cc
@@ -13,15 +13,18 @@
namespace extensions {
-PageCaptureCustomBindings::PageCaptureCustomBindings()
- : ChromeV8Extension(NULL) {
- RouteStaticFunction("CreateBlob", &CreateBlob);
- RouteStaticFunction("SendResponseAck", &SendResponseAck);
-}
-
-// static
-v8::Handle<v8::Value> PageCaptureCustomBindings::CreateBlob(
- const v8::Arguments& args) {
+PageCaptureCustomBindings::PageCaptureCustomBindings(
+ int dependency_count,
+ const char** dependencies)
+ : ChromeV8Extension(
+ "extensions/page_capture_custom_bindings.js",
+ IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS,
+ dependency_count,
+ dependencies,
+ NULL) {}
+
+// Creates a Blob with the content of the specified file.
+static v8::Handle<v8::Value> CreateBlob(const v8::Arguments& args) {
CHECK(args.Length() == 2);
CHECK(args[0]->IsString());
CHECK(args[1]->IsInt32());
@@ -45,4 +48,15 @@ v8::Handle<v8::Value> PageCaptureCustomBindings::SendResponseAck(
return v8::Undefined();
}
+v8::Handle<v8::FunctionTemplate> PageCaptureCustomBindings::GetNativeFunction(
+ v8::Handle<v8::String> name) {
+ if (name->Equals(v8::String::New("CreateBlob"))) {
+ return v8::FunctionTemplate::New(CreateBlob, v8::External::New(this));
+ } else if (name->Equals(v8::String::New("SendResponseAck"))) {
+ return v8::FunctionTemplate::New(SendResponseAck, v8::External::New(this));
+ }
+
+ return ChromeV8Extension::GetNativeFunction(name);
+}
+
} // namespace extensions