| Index: components/filesystem/directory_impl.cc
|
| diff --git a/components/filesystem/directory_impl.cc b/components/filesystem/directory_impl.cc
|
| index d6430710db0e45f73821420e5949f8a2225d8a67..bd2e09c3f79287f507b00c79f5a63b386523744b 100644
|
| --- a/components/filesystem/directory_impl.cc
|
| +++ b/components/filesystem/directory_impl.cc
|
| @@ -123,6 +123,62 @@ void DirectoryImpl::OpenFileHandle(const mojo::String& raw_path,
|
| callback.Run(FileError::OK, ScopedHandle(mojo::Handle(mojo_handle)));
|
| }
|
|
|
| +void DirectoryImpl::OpenFileHandles(mojo::Array<FileOpenDetailsPtr> details,
|
| + const OpenFileHandlesCallback& callback) {
|
| + /*
|
| + mojo::Array<FileOpenResultPtr> results(
|
| + mojo::Array<FileOpenResultPtr>::New(details.size()));
|
| + size_t i = 0;
|
| + for (const auto& detail : details) {
|
| + FileOpenResultPtr result(FileOpenResult::New());
|
| + result->path = detail->path;
|
| +
|
| + base::FilePath path;
|
| + FileError error = ValidatePath(detail->path, directory_path_, &path);
|
| + if (error != FileError::OK) {
|
| + result->error = error;
|
| + result->file_handle = ScopedHandle();
|
| + results[i] = std::move(result);
|
| + continue;
|
| + }
|
| +
|
| + if (base::DirectoryExists(path)) {
|
| + // We must not return directories as files. In the file abstraction, we can
|
| + // fetch raw file descriptors over mojo pipes, and passing a file
|
| + // descriptor to a directory is a sandbox escape on Windows.
|
| + result->error = FileError::NOT_A_FILE;
|
| + result->file_handle = ScopedHandle();
|
| + results[i] = std::move(result);
|
| + continue;
|
| + }
|
| +
|
| + base::File base_file(path, detail->open_flags);
|
| + if (!base_file.IsValid()) {
|
| + result->error = GetError(base_file);
|
| + result->file_handle = ScopedHandle();
|
| + results[i] = std::move(result);
|
| + continue;
|
| + }
|
| +
|
| + MojoHandle mojo_handle;
|
| + MojoResult create_result = MojoCreatePlatformHandleWrapper(
|
| + base_file.TakePlatformFile(), &mojo_handle);
|
| + if (create_result != MOJO_RESULT_OK) {
|
| + result->error = FileError::FAILED;
|
| + result->file_handle = ScopedHandle();
|
| + results[i] = std::move(result);
|
| + continue;
|
| + }
|
| +
|
| + result->error = FileError::OK;
|
| + result->file_handle = ScopedHandle(mojo::Handle(mojo_handle));
|
| + results[i] = std::move(result);
|
| + }
|
| + callback.Run(std::move(results));
|
| + */
|
| + callback.Run();
|
| +}
|
| +
|
| void DirectoryImpl::OpenDirectory(const mojo::String& raw_path,
|
| mojo::InterfaceRequest<Directory> directory,
|
| uint32_t open_flags,
|
|
|