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

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

Issue 1854983002: [Extensions] Add more bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 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
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",
- 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

Powered by Google App Engine
This is Rietveld 408576698