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

Side by Side Diff: chrome/renderer/extensions/media_galleries_custom_bindings.cc

Issue 149213003: Cleanup: Fix some lint/style errors in extensions code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 6 years, 10 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h" 5 #include "chrome/renderer/extensions/media_galleries_custom_bindings.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "chrome/common/extensions/extension_constants.h" 9 #include "chrome/common/extensions/extension_constants.h"
10 #include "third_party/WebKit/public/web/WebDocument.h" 10 #include "third_party/WebKit/public/web/WebDocument.h"
11 #include "third_party/WebKit/public/web/WebFrame.h" 11 #include "third_party/WebKit/public/web/WebFrame.h"
12 #include "v8/include/v8.h" 12 #include "v8/include/v8.h"
13 #include "webkit/common/fileapi/file_system_util.h" 13 #include "webkit/common/fileapi/file_system_util.h"
14 14
15 namespace extensions { 15 namespace extensions {
16 16
17 namespace { 17 namespace {
18 18
19 // FileSystemObject GetMediaFileSystem(string file_system_url): construct 19 // FileSystemObject GetMediaFileSystem(string file_system_url): construct
20 // a file system object from a file system url. 20 // a file system object from a file system url.
21 void GetMediaFileSystemObject(const v8::FunctionCallbackInfo<v8::Value>& args) { 21 void GetMediaFileSystemObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
22 if (args.Length() != 1) { 22 CHECK_EQ(1, args.Length());
23 NOTREACHED(); 23 CHECK(args[0]->IsString());
24 return;
25 }
26 if (!args[0]->IsString()) {
27 NOTREACHED();
28 return;
29 }
30 24
31 std::string fsid(*v8::String::Utf8Value(args[0])); 25 std::string fsid(*v8::String::Utf8Value(args[0]));
32 if (fsid.empty()) { 26 CHECK(!fsid.empty());
33 NOTREACHED();
34 return;
35 }
36 27
37 blink::WebFrame* webframe = blink::WebFrame::frameForCurrentContext(); 28 blink::WebFrame* webframe = blink::WebFrame::frameForCurrentContext();
38 const GURL origin = GURL(webframe->document().securityOrigin().toString()); 29 const GURL origin = GURL(webframe->document().securityOrigin().toString());
39 const std::string fs_name = fileapi::GetIsolatedFileSystemName(origin, fsid); 30 const std::string fs_name = fileapi::GetIsolatedFileSystemName(origin, fsid);
40 const std::string root_url = 31 const std::string root_url =
41 fileapi::GetIsolatedFileSystemRootURIString( 32 fileapi::GetIsolatedFileSystemRootURIString(
42 origin, fsid, extension_misc::kMediaFileSystemPathPart); 33 origin, fsid, extension_misc::kMediaFileSystemPathPart);
43 args.GetReturnValue().Set( 34 args.GetReturnValue().Set(
44 webframe->createFileSystem(blink::WebFileSystemTypeIsolated, 35 webframe->createFileSystem(blink::WebFileSystemTypeIsolated,
45 blink::WebString::fromUTF8(fs_name), 36 blink::WebString::fromUTF8(fs_name),
46 blink::WebString::fromUTF8(root_url))); 37 blink::WebString::fromUTF8(root_url)));
47 } 38 }
48 39
49 } // namespace 40 } // namespace
50 41
51 MediaGalleriesCustomBindings::MediaGalleriesCustomBindings( 42 MediaGalleriesCustomBindings::MediaGalleriesCustomBindings(
52 Dispatcher* dispatcher, ChromeV8Context* context) 43 Dispatcher* dispatcher, ChromeV8Context* context)
53 : ChromeV8Extension(dispatcher, context) { 44 : ChromeV8Extension(dispatcher, context) {
54 RouteFunction("GetMediaFileSystemObject", 45 RouteFunction("GetMediaFileSystemObject",
55 base::Bind(&GetMediaFileSystemObject)); 46 base::Bind(&GetMediaFileSystemObject));
56 } 47 }
57 48
58 } // namespace extensions 49 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/mime_types_handler.cc ('k') | chrome/renderer/extensions/send_request_natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698