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

Unified Diff: chrome/renderer/extensions/file_manager_private_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_manager_private_custom_bindings.cc
diff --git a/chrome/renderer/extensions/file_manager_private_custom_bindings.cc b/chrome/renderer/extensions/file_manager_private_custom_bindings.cc
index 3bd97a8867c8634b75ce6138fd3020443c82986f..f5e022bd18758f56df46346a5f267e5c7d561542 100644
--- a/chrome/renderer/extensions/file_manager_private_custom_bindings.cc
+++ b/chrome/renderer/extensions/file_manager_private_custom_bindings.cc
@@ -7,7 +7,9 @@
#include <string>
#include "base/logging.h"
+#include "chrome/renderer/extensions/file_browser_handler_custom_bindings.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"
@@ -17,10 +19,16 @@ namespace extensions {
FileManagerPrivateCustomBindings::FileManagerPrivateCustomBindings(
ScriptContext* context)
: ObjectBackedNativeHandler(context) {
+ RouteFunction("GetFileSystem", "fileManagerPrivate",
+ base::Bind(&FileManagerPrivateCustomBindings::GetFileSystem,
+ base::Unretained(this)));
RouteFunction(
- "GetFileSystem",
- base::Bind(&FileManagerPrivateCustomBindings::GetFileSystem,
- base::Unretained(this)));
+ "GetExternalFileEntry", "fileManagerPrivate",
+ base::Bind(&FileManagerPrivateCustomBindings::GetExternalFileEntry,
+ base::Unretained(this)));
+ RouteFunction("GetEntryURL", "fileManagerPrivate",
+ base::Bind(&FileManagerPrivateCustomBindings::GetEntryURL,
+ base::Unretained(this)));
}
void FileManagerPrivateCustomBindings::GetFileSystem(
@@ -42,4 +50,19 @@ void FileManagerPrivateCustomBindings::GetFileSystem(
.toV8Value(context()->v8_context()->Global(), args.GetIsolate()));
}
+void FileManagerPrivateCustomBindings::GetExternalFileEntry(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ FileBrowserHandlerCustomBindings::GetExternalFileEntry(args, context());
+}
+
+void FileManagerPrivateCustomBindings::GetEntryURL(
+ 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()));
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698