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

Unified Diff: chrome/browser/chromeos/file_system_provider/provided_file_system.cc

Issue 284443002: [fsp] Add support for opening files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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/browser/chromeos/file_system_provider/provided_file_system.cc
diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system.cc
index 7b372f448577848c2d0a1b259434164c7f3cf9c4..72bdac4282bcaa9a1d0b0ba641a2720a2fc3b7c3 100644
--- a/chrome/browser/chromeos/file_system_provider/provided_file_system.cc
+++ b/chrome/browser/chromeos/file_system_provider/provided_file_system.cc
@@ -6,6 +6,7 @@
#include "base/files/file.h"
#include "chrome/browser/chromeos/file_system_provider/operations/get_metadata.h"
+#include "chrome/browser/chromeos/file_system_provider/operations/open_file.h"
#include "chrome/browser/chromeos/file_system_provider/operations/read_directory.h"
#include "chrome/browser/chromeos/file_system_provider/operations/unmount.h"
#include "chrome/browser/chromeos/file_system_provider/request_manager.h"
@@ -29,9 +30,8 @@ ProvidedFileSystem::~ProvidedFileSystem() {}
void ProvidedFileSystem::RequestUnmount(
const fileapi::AsyncFileUtil::StatusCallback& callback) {
if (!request_manager_.CreateRequest(
- make_scoped_ptr<RequestManager::HandlerInterface>(
- new operations::Unmount(
- event_router_, file_system_info_, callback)))) {
+ scoped_ptr<RequestManager::HandlerInterface>(new operations::Unmount(
+ event_router_, file_system_info_, callback)))) {
callback.Run(base::File::FILE_ERROR_SECURITY);
}
}
@@ -40,7 +40,7 @@ void ProvidedFileSystem::GetMetadata(
const base::FilePath& entry_path,
const fileapi::AsyncFileUtil::GetFileInfoCallback& callback) {
if (!request_manager_.CreateRequest(
- make_scoped_ptr<RequestManager::HandlerInterface>(
+ scoped_ptr<RequestManager::HandlerInterface>(
new operations::GetMetadata(
event_router_, file_system_info_, entry_path, callback)))) {
callback.Run(base::File::FILE_ERROR_SECURITY, base::File::Info());
@@ -50,7 +50,7 @@ void ProvidedFileSystem::GetMetadata(
void ProvidedFileSystem::ReadDirectory(
const base::FilePath& directory_path,
const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) {
- if (!request_manager_.CreateRequest(make_scoped_ptr<
+ if (!request_manager_.CreateRequest(scoped_ptr<
RequestManager::HandlerInterface>(new operations::ReadDirectory(
event_router_, file_system_info_, directory_path, callback)))) {
callback.Run(base::File::FILE_ERROR_SECURITY,
@@ -59,6 +59,30 @@ void ProvidedFileSystem::ReadDirectory(
}
}
+void ProvidedFileSystem::OpenFile(
+ const base::FilePath& file_path,
+ OpenFileMode mode,
+ bool create,
+ const fileapi::AsyncFileUtil::StatusCallback& callback) {
+ // Writing is not supported. Note, that this includes a situation, when a file
+ // exists, but |create| is set to true.
+ if (mode == OPEN_FILE_MODE_WRITE || create) {
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+ return;
+ }
+
+ if (!request_manager_.CreateRequest(
+ scoped_ptr<RequestManager::HandlerInterface>(
+ new operations::OpenFile(event_router_,
+ file_system_info_,
+ file_path,
+ mode,
+ create,
+ callback)))) {
+ callback.Run(base::File::FILE_ERROR_SECURITY);
+ }
+}
+
const ProvidedFileSystemInfo& ProvidedFileSystem::GetFileSystemInfo() const {
return file_system_info_;
}

Powered by Google App Engine
This is Rietveld 408576698