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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/extensions/media_gallery_custom_bindings.h"
6
7 #include "content/public/renderer/render_view.h"
8 #include "grit/renderer_resources.h"
9 #include "v8/include/v8.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
12
13 namespace extensions {
14
15 MediaGalleryCustomBindings::MediaGalleryCustomBindings()
16 : ChromeV8Extension(NULL) {
17 RouteStaticFunction("CreateMediaGalleryObject", &CreateMediaGalleryObject);
18 }
19
20 // static
21 v8::Handle<v8::Value> MediaGalleryCustomBindings::CreateMediaGalleryObject(
22 const v8::Arguments& args) {
23 if (args.Length() != 3 || !args[0]->IsUint32() || args[1]->IsNull() ||
24 !args[1]->IsString() || !args[2]->IsUint32()) {
25 NOTREACHED() << "Bad arguments";
26 return v8::Undefined();
27 }
28
29 int id = args[0]->Uint32Value();
30 std::string name;
31 name = *v8::String::Utf8Value(args[1]->ToString());
32 if (name.empty())
33 return v8::Undefined();
34 int flags = args[2]->Uint32Value();
35
36 return WebKit::WebFrame::frameForCurrentContext()->createMediaGallery(
37 id, WebKit::WebString::fromUTF8(name.c_str()), flags);
38 }
39
40 } // namespace extensions
OLDNEW
« 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