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

Unified Diff: chrome/renderer/extensions/media_gallery_custom_bindings.cc

Issue 9621021: DO NOT COMMIT (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix 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/extensions/media_gallery_custom_bindings.h ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/media_gallery_custom_bindings.cc
diff --git a/chrome/renderer/extensions/media_gallery_custom_bindings.cc b/chrome/renderer/extensions/media_gallery_custom_bindings.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f842564139364911b8de0367513528c0dc8cfae6
--- /dev/null
+++ b/chrome/renderer/extensions/media_gallery_custom_bindings.cc
@@ -0,0 +1,40 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/renderer/extensions/media_gallery_custom_bindings.h"
+
+#include "content/public/renderer/render_view.h"
+#include "grit/renderer_resources.h"
+#include "v8/include/v8.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
+
+namespace extensions {
+
+MediaGalleryCustomBindings::MediaGalleryCustomBindings()
+ : ChromeV8Extension(NULL) {
+ RouteStaticFunction("CreateMediaGalleryObject", &CreateMediaGalleryObject);
+}
+
+// static
+v8::Handle<v8::Value> MediaGalleryCustomBindings::CreateMediaGalleryObject(
+ const v8::Arguments& args) {
+ if (args.Length() != 3 || !args[0]->IsUint32() || args[1]->IsNull() ||
+ !args[1]->IsString() || !args[2]->IsUint32()) {
+ NOTREACHED() << "Bad arguments";
+ return v8::Undefined();
+ }
+
+ int id = args[0]->Uint32Value();
+ std::string name;
+ name = *v8::String::Utf8Value(args[1]->ToString());
+ if (name.empty())
+ return v8::Undefined();
+ int flags = args[2]->Uint32Value();
+
+ return WebKit::WebFrame::frameForCurrentContext()->createMediaGallery(
+ id, WebKit::WebString::fromUTF8(name.c_str()), flags);
+}
+
+} // namespace extensions
« no previous file with comments | « chrome/renderer/extensions/media_gallery_custom_bindings.h ('k') | chrome/renderer/renderer_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698