Chromium Code Reviews| Index: chrome/renderer/extensions/file_browser_handler_custom_bindings.cc |
| diff --git a/chrome/renderer/extensions/file_browser_handler_custom_bindings.cc b/chrome/renderer/extensions/file_browser_handler_custom_bindings.cc |
| index c892e6a7fd5d732e326b9f3790943ba265198108..e24fe4c0d8ab8035cf13ccdbf31529eaed990c12 100644 |
| --- a/chrome/renderer/extensions/file_browser_handler_custom_bindings.cc |
| +++ b/chrome/renderer/extensions/file_browser_handler_custom_bindings.cc |
| @@ -9,7 +9,6 @@ |
| #include "base/logging.h" |
| #include "build/build_config.h" |
| #include "extensions/renderer/script_context.h" |
| -#include "extensions/renderer/v8_helpers.h" |
| #include "third_party/WebKit/public/platform/WebString.h" |
| #include "third_party/WebKit/public/web/WebDOMFileSystem.h" |
| #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| @@ -20,18 +19,17 @@ FileBrowserHandlerCustomBindings::FileBrowserHandlerCustomBindings( |
| ScriptContext* context) |
| : ObjectBackedNativeHandler(context) { |
| RouteFunction( |
| - "GetExternalFileEntry", |
| - base::Bind(&FileBrowserHandlerCustomBindings::GetExternalFileEntry, |
| - base::Unretained(this))); |
| - RouteFunction("GetEntryURL", |
|
Devlin
2016/04/05 00:17:33
This was only used in fileManagerPrivate bindings,
|
| - base::Bind(&FileBrowserHandlerCustomBindings::GetEntryURL, |
| - base::Unretained(this))); |
| + "GetExternalFileEntry", "fileBrowserHandler", |
| + base::Bind( |
| + &FileBrowserHandlerCustomBindings::GetExternalFileEntryCallback, |
| + base::Unretained(this))); |
| } |
| void FileBrowserHandlerCustomBindings::GetExternalFileEntry( |
| - const v8::FunctionCallbackInfo<v8::Value>& args) { |
| - // TODO(zelidrag): Make this magic work on other platforms when file browser |
| - // matures enough on ChromeOS. |
| + const v8::FunctionCallbackInfo<v8::Value>& args, |
| + ScriptContext* context) { |
| +// TODO(zelidrag): Make this magic work on other platforms when file browser |
| +// matures enough on ChromeOS. |
| #if defined(OS_CHROMEOS) |
| CHECK(args.Length() == 1); |
| CHECK(args[0]->IsObject()); |
| @@ -51,7 +49,7 @@ void FileBrowserHandlerCustomBindings::GetExternalFileEntry( |
| is_directory ? blink::WebDOMFileSystem::EntryTypeDirectory |
| : blink::WebDOMFileSystem::EntryTypeFile; |
| blink::WebLocalFrame* webframe = |
| - blink::WebLocalFrame::frameForContext(context()->v8_context()); |
| + blink::WebLocalFrame::frameForContext(context->v8_context()); |
| args.GetReturnValue().Set( |
| blink::WebDOMFileSystem::create( |
| webframe, |
| @@ -65,14 +63,9 @@ void FileBrowserHandlerCustomBindings::GetExternalFileEntry( |
| #endif |
| } |
| -void FileBrowserHandlerCustomBindings::GetEntryURL( |
| +void FileBrowserHandlerCustomBindings::GetExternalFileEntryCallback( |
| const v8::FunctionCallbackInfo<v8::Value>& args) { |
| - CHECK(args.Length() == 1); |
| - CHECK(args[0]->IsObject()); |
| - const blink::WebURL& url = |
| - blink::WebDOMFileSystem::createFileSystemURL(args[0]); |
| - args.GetReturnValue().Set(v8_helpers::ToV8StringUnsafe( |
| - args.GetIsolate(), url.string().utf8().c_str())); |
| + GetExternalFileEntry(args, context()); |
| } |
| } // namespace extensions |