X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fchromeos%2Fextensions%2Ffile_system_provider%2Ffile_system_provider_api.cc;h=f8753a9724a77df1a84d17b90206e3c4ca01f69f;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=5bd2b0a8ea3473ffba0c01f8013334b05400eb82;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc b/src/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc index 5bd2b0a..f8753a9 100644 --- a/src/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc +++ b/src/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc @@ -6,6 +6,7 @@ #include +#include "base/debug/trace_event.h" #include "base/memory/scoped_ptr.h" #include "base/values.h" #include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h" @@ -51,7 +52,8 @@ bool FileSystemProviderMountFunction::RunSync() { // TODO(mtomasz): Pass more detailed errors, rather than just a bool. if (!service->MountFileSystem(extension_id(), params->options.file_system_id, - params->options.display_name)) { + params->options.display_name, + params->options.writable)) { base::ListValue* result = new base::ListValue(); result->Append(CreateError(kSecurityErrorName, kMountFailedErrorMessage)); SetResult(result); @@ -74,7 +76,8 @@ bool FileSystemProviderUnmountFunction::RunSync() { return false; if (!service->UnmountFileSystem(extension_id(), - params->options.file_system_id)) { + params->options.file_system_id, + Service::UNMOUNT_REASON_USER)) { // TODO(mtomasz): Pass more detailed errors, rather than just a bool. base::ListValue* result = new base::ListValue(); result->Append(CreateError(kSecurityErrorName, kUnmountFailedErrorMessage)); @@ -97,15 +100,6 @@ bool FileSystemProviderInternalUnmountRequestedSuccessFunction::RunWhenValid() { return true; } -bool FileSystemProviderInternalUnmountRequestedErrorFunction::RunWhenValid() { - using api::file_system_provider_internal::UnmountRequestedError::Params; - const scoped_ptr params(Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params); - - RejectRequest(ProviderErrorToFileError(params->error)); - return true; -} - bool FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() { using api::file_system_provider_internal::GetMetadataRequestedSuccess::Params; @@ -117,16 +111,6 @@ FileSystemProviderInternalGetMetadataRequestedSuccessFunction::RunWhenValid() { return true; } -bool -FileSystemProviderInternalGetMetadataRequestedErrorFunction::RunWhenValid() { - using api::file_system_provider_internal::GetMetadataRequestedError::Params; - const scoped_ptr params(Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params); - - RejectRequest(ProviderErrorToFileError(params->error)); - return true; -} - bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction:: RunWhenValid() { using api::file_system_provider_internal::ReadDirectoryRequestedSuccess:: @@ -141,73 +125,38 @@ bool FileSystemProviderInternalReadDirectoryRequestedSuccessFunction:: } bool -FileSystemProviderInternalReadDirectoryRequestedErrorFunction::RunWhenValid() { - using api::file_system_provider_internal::ReadDirectoryRequestedError::Params; - const scoped_ptr params(Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params); - - RejectRequest(ProviderErrorToFileError(params->error)); - return true; -} +FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() { + TRACE_EVENT0("file_system_provider", "ReadFileRequestedSuccess"); + using api::file_system_provider_internal::ReadFileRequestedSuccess::Params; -bool -FileSystemProviderInternalOpenFileRequestedSuccessFunction::RunWhenValid() { - using api::file_system_provider_internal::OpenFileRequestedSuccess::Params; scoped_ptr params(Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params); - FulfillRequest(scoped_ptr(new RequestValue()), - false /* has_more */); - return true; -} - -bool FileSystemProviderInternalOpenFileRequestedErrorFunction::RunWhenValid() { - using api::file_system_provider_internal::OpenFileRequestedError::Params; - const scoped_ptr params(Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params); - - RejectRequest(ProviderErrorToFileError(params->error)); + const bool has_more = params->has_more; + FulfillRequest(RequestValue::CreateForReadFileSuccess(params.Pass()), + has_more); return true; } bool -FileSystemProviderInternalCloseFileRequestedSuccessFunction::RunWhenValid() { - using api::file_system_provider_internal::CloseFileRequestedSuccess::Params; +FileSystemProviderInternalOperationRequestedSuccessFunction::RunWhenValid() { + using api::file_system_provider_internal::OperationRequestedSuccess::Params; scoped_ptr params(Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params); - FulfillRequest(scoped_ptr(new RequestValue()), + FulfillRequest(scoped_ptr( + RequestValue::CreateForOperationSuccess(params.Pass())), false /* has_more */); return true; } -bool FileSystemProviderInternalCloseFileRequestedErrorFunction::RunWhenValid() { - using api::file_system_provider_internal::CloseFileRequestedError::Params; - const scoped_ptr params(Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params); - - RejectRequest(ProviderErrorToFileError(params->error)); - return true; -} - -bool -FileSystemProviderInternalReadFileRequestedSuccessFunction::RunWhenValid() { - using api::file_system_provider_internal::ReadFileRequestedSuccess::Params; +bool FileSystemProviderInternalOperationRequestedErrorFunction::RunWhenValid() { + using api::file_system_provider_internal::OperationRequestedError::Params; scoped_ptr params(Params::Create(*args_)); EXTENSION_FUNCTION_VALIDATE(params); - const bool has_more = params->has_more; - FulfillRequest(RequestValue::CreateForReadFileSuccess(params.Pass()), - has_more); - return true; -} - -bool FileSystemProviderInternalReadFileRequestedErrorFunction::RunWhenValid() { - using api::file_system_provider_internal::ReadFileRequestedError::Params; - const scoped_ptr params(Params::Create(*args_)); - EXTENSION_FUNCTION_VALIDATE(params); - - RejectRequest(ProviderErrorToFileError(params->error)); + const base::File::Error error = ProviderErrorToFileError(params->error); + RejectRequest(RequestValue::CreateForOperationError(params.Pass()), error); return true; }