diff options
24 files changed, 84 insertions, 49 deletions
diff --git a/base/platform_file.h b/base/platform_file.h index 71adcac..1d04ac0 100644 --- a/base/platform_file.h +++ b/base/platform_file.h @@ -92,10 +92,6 @@ struct BASE_API PlatformFileInfo { // The creation time of a file. base::Time creation_time; - - // The full path of a file. Currently only used by FileSystemFileUtil during - // a GetMetadata operation. - FilePath path; }; // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc index 6acfde6..9701295 100644 --- a/chrome/browser/extensions/extension_file_browser_private_api.cc +++ b/chrome/browser/extensions/extension_file_browser_private_api.cc @@ -24,7 +24,8 @@ class LocalFileSystemCallbackDispatcher virtual void DidSucceed() OVERRIDE { NOTREACHED(); } - virtual void DidReadMetadata(const base::PlatformFileInfo& info) OVERRIDE { + virtual void DidReadMetadata(const base::PlatformFileInfo& info, + const FilePath& unused) OVERRIDE { NOTREACHED(); } virtual void DidReadDirectory( diff --git a/content/browser/file_system/file_system_dispatcher_host.cc b/content/browser/file_system/file_system_dispatcher_host.cc index 1811ece..704a32e 100644 --- a/content/browser/file_system/file_system_dispatcher_host.cc +++ b/content/browser/file_system/file_system_dispatcher_host.cc @@ -45,9 +45,11 @@ class BrowserFileSystemCallbackDispatcher dispatcher_host_->Send(new FileSystemMsg_DidSucceed(request_id_)); } - virtual void DidReadMetadata(const base::PlatformFileInfo& info) { + virtual void DidReadMetadata( + const base::PlatformFileInfo& info, + const FilePath& platform_path) { dispatcher_host_->Send(new FileSystemMsg_DidReadMetadata( - request_id_, info)); + request_id_, info, platform_path)); } virtual void DidReadDirectory( diff --git a/content/common/common_param_traits.cc b/content/common/common_param_traits.cc index 1b77e71..8694bb2 100644 --- a/content/common/common_param_traits.cc +++ b/content/common/common_param_traits.cc @@ -510,7 +510,6 @@ void ParamTraits<base::PlatformFileInfo>::Write( WriteParam(m, p.last_modified.ToDoubleT()); WriteParam(m, p.last_accessed.ToDoubleT()); WriteParam(m, p.creation_time.ToDoubleT()); - WriteParam(m, p.path); } bool ParamTraits<base::PlatformFileInfo>::Read( @@ -523,8 +522,7 @@ bool ParamTraits<base::PlatformFileInfo>::Read( ReadParam(m, iter, &p->is_directory) && ReadParam(m, iter, &last_modified) && ReadParam(m, iter, &last_accessed) && - ReadParam(m, iter, &creation_time) && - ReadParam(m, iter, &p->path); + ReadParam(m, iter, &creation_time); if (result) { p->last_modified = base::Time::FromDoubleT(last_modified); p->last_accessed = base::Time::FromDoubleT(last_accessed); @@ -545,8 +543,6 @@ void ParamTraits<base::PlatformFileInfo>::Log( LogParam(p.last_accessed.ToDoubleT(), l); l->append(","); LogParam(p.creation_time.ToDoubleT(), l); - l->append(","); - LogParam(p.path, l); l->append(")"); } diff --git a/content/common/file_system/file_system_dispatcher.cc b/content/common/file_system/file_system_dispatcher.cc index c614300..d95a5b7 100644 --- a/content/common/file_system/file_system_dispatcher.cc +++ b/content/common/file_system/file_system_dispatcher.cc @@ -235,11 +235,12 @@ void FileSystemDispatcher::OnDidSucceed(int request_id) { } void FileSystemDispatcher::OnDidReadMetadata( - int request_id, const base::PlatformFileInfo& file_info) { + int request_id, const base::PlatformFileInfo& file_info, + const FilePath& platform_path) { fileapi::FileSystemCallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); DCHECK(dispatcher); - dispatcher->DidReadMetadata(file_info); + dispatcher->DidReadMetadata(file_info, platform_path); dispatchers_.Remove(request_id); } diff --git a/content/common/file_system/file_system_dispatcher.h b/content/common/file_system/file_system_dispatcher.h index 6481cbc..e61a518 100644 --- a/content/common/file_system/file_system_dispatcher.h +++ b/content/common/file_system/file_system_dispatcher.h @@ -84,7 +84,8 @@ class FileSystemDispatcher : public IPC::Channel::Listener { const FilePath& root_path); void OnDidSucceed(int request_id); void OnDidReadMetadata(int request_id, - const base::PlatformFileInfo& file_info); + const base::PlatformFileInfo& file_info, + const FilePath& platform_path); void OnDidReadDirectory( int request_id, const std::vector<base::FileUtilProxy::Entry>& entries, diff --git a/content/common/file_system/webfilesystem_callback_dispatcher.cc b/content/common/file_system/webfilesystem_callback_dispatcher.cc index 57bb9bf..6903f4c 100644 --- a/content/common/file_system/webfilesystem_callback_dispatcher.cc +++ b/content/common/file_system/webfilesystem_callback_dispatcher.cc @@ -33,7 +33,7 @@ void WebFileSystemCallbackDispatcher::DidSucceed() { } void WebFileSystemCallbackDispatcher::DidReadMetadata( - const base::PlatformFileInfo& file_info) { + const base::PlatformFileInfo& file_info, const FilePath& platform_path) { WebFileInfo web_file_info; web_file_info.modificationTime = file_info.last_modified.ToDoubleT(); web_file_info.length = file_info.size; @@ -42,7 +42,7 @@ void WebFileSystemCallbackDispatcher::DidReadMetadata( else web_file_info.type = WebFileInfo::TypeFile; web_file_info.platformPath = - webkit_glue::FilePathToWebString(file_info.path); + webkit_glue::FilePathToWebString(platform_path); callbacks_->didReadMetadata(web_file_info); } diff --git a/content/common/file_system/webfilesystem_callback_dispatcher.h b/content/common/file_system/webfilesystem_callback_dispatcher.h index 4699c69..80bd183 100644 --- a/content/common/file_system/webfilesystem_callback_dispatcher.h +++ b/content/common/file_system/webfilesystem_callback_dispatcher.h @@ -21,7 +21,9 @@ class WebFileSystemCallbackDispatcher // FileSystemCallbackDispatcher implementation virtual void DidSucceed(); - virtual void DidReadMetadata(const base::PlatformFileInfo& file_info); + virtual void DidReadMetadata( + const base::PlatformFileInfo& file_info, + const FilePath& platform_path); virtual void DidReadDirectory( const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); diff --git a/content/common/file_system/webfilewriter_impl.cc b/content/common/file_system/webfilewriter_impl.cc index 45e9d5b..196b9ec 100644 --- a/content/common/file_system/webfilewriter_impl.cc +++ b/content/common/file_system/webfilewriter_impl.cc @@ -23,7 +23,7 @@ class WebFileWriterImpl::CallbackDispatcher virtual ~CallbackDispatcher() { } - virtual void DidReadMetadata(const base::PlatformFileInfo&) { + virtual void DidReadMetadata(const base::PlatformFileInfo&, const FilePath&) { NOTREACHED(); } virtual void DidReadDirectory( diff --git a/content/common/file_system_messages.h b/content/common/file_system_messages.h index 6965abe..173a885 100644 --- a/content/common/file_system_messages.h +++ b/content/common/file_system_messages.h @@ -30,9 +30,10 @@ IPC_MESSAGE_CONTROL4(FileSystemMsg_OpenComplete, // WebFileSystem response messages. IPC_MESSAGE_CONTROL1(FileSystemMsg_DidSucceed, int /* request_id */) -IPC_MESSAGE_CONTROL2(FileSystemMsg_DidReadMetadata, +IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadMetadata, int /* request_id */, - base::PlatformFileInfo) + base::PlatformFileInfo, + FilePath /* true platform path, where possible */) IPC_MESSAGE_CONTROL3(FileSystemMsg_DidReadDirectory, int /* request_id */, std::vector<base::FileUtilProxy::Entry> /* entries */, diff --git a/webkit/fileapi/file_system_callback_dispatcher.h b/webkit/fileapi/file_system_callback_dispatcher.h index e5265bd..2bffe54 100644 --- a/webkit/fileapi/file_system_callback_dispatcher.h +++ b/webkit/fileapi/file_system_callback_dispatcher.h @@ -22,7 +22,9 @@ class FileSystemCallbackDispatcher { virtual void DidSucceed() = 0; // Callback to report information for a file. - virtual void DidReadMetadata(const base::PlatformFileInfo& file_info) = 0; + virtual void DidReadMetadata( + const base::PlatformFileInfo& file_info, + const FilePath& platform_path) = 0; // Callback to report the contents of a directory. If the contents of // the given directory are reported in one batch, then |entries| will have diff --git a/webkit/fileapi/file_system_file_util.cc b/webkit/fileapi/file_system_file_util.cc index 10af22f..1dceed2 100644 --- a/webkit/fileapi/file_system_file_util.cc +++ b/webkit/fileapi/file_system_file_util.cc @@ -61,12 +61,13 @@ PlatformFileError FileSystemFileUtil::EnsureFileExists( PlatformFileError FileSystemFileUtil::GetFileInfo( FileSystemOperationContext* unused, const FilePath& file_path, - base::PlatformFileInfo* file_info) { + base::PlatformFileInfo* file_info, + FilePath* platform_file_path) { if (!file_util::PathExists(file_path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (!file_util::GetFileInfo(file_path, file_info)) return base::PLATFORM_FILE_ERROR_FAILED; - file_info->path = file_path; + *platform_file_path = file_path; return base::PLATFORM_FILE_OK; } diff --git a/webkit/fileapi/file_system_file_util.h b/webkit/fileapi/file_system_file_util.h index 620ff09..a208ae4 100644 --- a/webkit/fileapi/file_system_file_util.h +++ b/webkit/fileapi/file_system_file_util.h @@ -68,7 +68,9 @@ class FileSystemFileUtil { // callback. virtual PlatformFileError GetFileInfo( FileSystemOperationContext* context, - const FilePath& file_, base::PlatformFileInfo* file_info); + const FilePath& file_, + base::PlatformFileInfo* file_info, + FilePath* platform_path); virtual PlatformFileError ReadDirectory( FileSystemOperationContext* context, diff --git a/webkit/fileapi/file_system_file_util_proxy.cc b/webkit/fileapi/file_system_file_util_proxy.cc index faf3d4a..0f88ff0 100644 --- a/webkit/fileapi/file_system_file_util_proxy.cc +++ b/webkit/fileapi/file_system_file_util_proxy.cc @@ -208,11 +208,11 @@ class RelayGetFileInfo : public MessageLoopRelay { virtual void RunWork() { set_error_code( file_system_file_util()->GetFileInfo( - context(), file_path_, &file_info_)); + context(), file_path_, &file_info_, &platform_path_)); } virtual void RunCallback() { - callback_->Run(error_code(), file_info_); + callback_->Run(error_code(), file_info_, platform_path_); delete callback_; } @@ -220,6 +220,7 @@ class RelayGetFileInfo : public MessageLoopRelay { fileapi::FileSystemFileUtilProxy::GetFileInfoCallback* callback_; FilePath file_path_; base::PlatformFileInfo file_info_; + FilePath platform_path_; }; class RelayReadDirectory : public MessageLoopRelay { diff --git a/webkit/fileapi/file_system_file_util_proxy.h b/webkit/fileapi/file_system_file_util_proxy.h index 288d4cf..de4b320 100644 --- a/webkit/fileapi/file_system_file_util_proxy.h +++ b/webkit/fileapi/file_system_file_util_proxy.h @@ -25,6 +25,8 @@ class FileSystemOperationContext; using base::MessageLoopProxy; using base::PlatformFile; +using base::PlatformFileError; +using base::PlatformFileInfo; // This class provides asynchronous access to common file routines for the // FileSystem API. @@ -34,7 +36,10 @@ class FileSystemFileUtilProxy { typedef base::FileUtilProxy::CreateOrOpenCallback CreateOrOpenCallback; typedef base::FileUtilProxy::EnsureFileExistsCallback EnsureFileExistsCallback; - typedef base::FileUtilProxy::GetFileInfoCallback GetFileInfoCallback; + typedef Callback3<PlatformFileError /* error code */, + const PlatformFileInfo& /* file_info */, + const FilePath& /* platform_path, where possible */ + >::Type GetFileInfoCallback; typedef base::FileUtilProxy::ReadDirectoryCallback ReadDirectoryCallback; // Creates or opens a file with the given flags. It is invalid to pass NULL diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc index 1555cd7..4ddfd0c 100644 --- a/webkit/fileapi/file_system_operation.cc +++ b/webkit/fileapi/file_system_operation.cc @@ -454,7 +454,8 @@ void FileSystemOperation::DidFinishFileOperation( void FileSystemOperation::DidDirectoryExists( base::PlatformFileError rv, - const base::PlatformFileInfo& file_info) { + const base::PlatformFileInfo& file_info, + const FilePath& unused) { if (rv == base::PLATFORM_FILE_OK) { if (file_info.is_directory) dispatcher_->DidSucceed(); @@ -468,7 +469,8 @@ void FileSystemOperation::DidDirectoryExists( void FileSystemOperation::DidFileExists( base::PlatformFileError rv, - const base::PlatformFileInfo& file_info) { + const base::PlatformFileInfo& file_info, + const FilePath& unused) { if (rv == base::PLATFORM_FILE_OK) { if (file_info.is_directory) dispatcher_->DidFail(base::PLATFORM_FILE_ERROR_NOT_A_FILE); @@ -482,9 +484,10 @@ void FileSystemOperation::DidFileExists( void FileSystemOperation::DidGetMetadata( base::PlatformFileError rv, - const base::PlatformFileInfo& file_info) { + const base::PlatformFileInfo& file_info, + const FilePath& platform_path) { if (rv == base::PLATFORM_FILE_OK) - dispatcher_->DidReadMetadata(file_info); + dispatcher_->DidReadMetadata(file_info, platform_path); else dispatcher_->DidFail(rv); delete this; diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h index 719ac8e..f6d2016 100644 --- a/webkit/fileapi/file_system_operation.h +++ b/webkit/fileapi/file_system_operation.h @@ -112,11 +112,14 @@ class FileSystemOperation { void DidFinishFileOperation(base::PlatformFileError rv); void DidDirectoryExists(base::PlatformFileError rv, - const base::PlatformFileInfo& file_info); + const base::PlatformFileInfo& file_info, + const FilePath& unused); void DidFileExists(base::PlatformFileError rv, - const base::PlatformFileInfo& file_info); + const base::PlatformFileInfo& file_info, + const FilePath& unused); void DidGetMetadata(base::PlatformFileError rv, - const base::PlatformFileInfo& file_info); + const base::PlatformFileInfo& file_info, + const FilePath& platform_path); void DidReadDirectory( base::PlatformFileError rv, const std::vector<base::FileUtilProxy::Entry>& entries); diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index 5641923..9cd128c 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -43,6 +43,8 @@ class FileSystemOperationTest : public testing::Test { int status() const { return status_; } void set_info(const base::PlatformFileInfo& info) { info_ = info; } const base::PlatformFileInfo& info() const { return info_; } + void set_path(const FilePath& path) { path_ = path; } + const FilePath& path() const { return path_; } void set_entries(const std::vector<base::FileUtilProxy::Entry>& entries) { entries_ = entries; } @@ -57,6 +59,7 @@ class FileSystemOperationTest : public testing::Test { // For post-operation status. int status_; base::PlatformFileInfo info_; + FilePath path_; std::vector<base::FileUtilProxy::Entry> entries_; DISALLOW_COPY_AND_ASSIGN(FileSystemOperationTest); @@ -74,8 +77,11 @@ class MockDispatcher : public FileSystemCallbackDispatcher { test_->set_status(kFileOperationSucceeded); } - virtual void DidReadMetadata(const base::PlatformFileInfo& info) { + virtual void DidReadMetadata( + const base::PlatformFileInfo& info, + const FilePath& platform_path) { test_->set_info(info); + test_->set_path(platform_path); test_->set_status(kFileOperationSucceeded); } @@ -564,6 +570,7 @@ TEST_F(FileSystemOperationTest, TestExistsAndMetadataSuccess) { MessageLoop::current()->RunAllPending(); EXPECT_EQ(kFileOperationSucceeded, status()); EXPECT_TRUE(info().is_directory); + EXPECT_EQ(dir.path(), path()); FilePath file; file_util::CreateTemporaryFileInDir(dir.path(), &file); @@ -575,6 +582,7 @@ TEST_F(FileSystemOperationTest, TestExistsAndMetadataSuccess) { MessageLoop::current()->RunAllPending(); EXPECT_EQ(kFileOperationSucceeded, status()); EXPECT_FALSE(info().is_directory); + EXPECT_EQ(file, path()); } TEST_F(FileSystemOperationTest, TestTypeMismatchErrors) { @@ -592,9 +600,9 @@ TEST_F(FileSystemOperationTest, TestTypeMismatchErrors) { } TEST_F(FileSystemOperationTest, TestReadDirFailure) { - // Path doesn't exists - FilePath nonexisting_dir_path(base_.path().Append( - FILE_PATH_LITERAL("NonExistingDir"))); + // Path doesn't exist + FilePath nonexisting_dir_path(base_.path().Append( + FILE_PATH_LITERAL("NonExistingDir"))); file_util::EnsureEndsWithSeparator(&nonexisting_dir_path); operation()->ReadDirectory(nonexisting_dir_path); MessageLoop::current()->RunAllPending(); diff --git a/webkit/fileapi/local_file_system_file_util.cc b/webkit/fileapi/local_file_system_file_util.cc index 8def3f6..068a052 100644 --- a/webkit/fileapi/local_file_system_file_util.cc +++ b/webkit/fileapi/local_file_system_file_util.cc @@ -47,14 +47,15 @@ PlatformFileError LocalFileSystemFileUtil::EnsureFileExists( PlatformFileError LocalFileSystemFileUtil::GetFileInfo( FileSystemOperationContext* context, const FilePath& file_path, - base::PlatformFileInfo* file_info) { + base::PlatformFileInfo* file_info, + FilePath* platform_file_path) { FilePath local_path = GetLocalPath(context, context->src_origin_url(), context->src_type(), file_path); if (local_path.empty()) return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; return FileSystemFileUtil::GetInstance()->GetFileInfo( - context, local_path, file_info); + context, local_path, file_info, platform_file_path); } PlatformFileError LocalFileSystemFileUtil::ReadDirectory( diff --git a/webkit/fileapi/local_file_system_file_util.h b/webkit/fileapi/local_file_system_file_util.h index 428b157..3e5855a 100644 --- a/webkit/fileapi/local_file_system_file_util.h +++ b/webkit/fileapi/local_file_system_file_util.h @@ -51,7 +51,9 @@ class LocalFileSystemFileUtil : public FileSystemFileUtil { virtual PlatformFileError GetFileInfo( FileSystemOperationContext* context, - const FilePath& file_, base::PlatformFileInfo* file_info); + const FilePath& file_, + base::PlatformFileInfo* file_info, + FilePath* platform_file); virtual PlatformFileError ReadDirectory( FileSystemOperationContext* context, diff --git a/webkit/plugins/ppapi/file_callbacks.cc b/webkit/plugins/ppapi/file_callbacks.cc index 4c57f33..92d443b 100644 --- a/webkit/plugins/ppapi/file_callbacks.cc +++ b/webkit/plugins/ppapi/file_callbacks.cc @@ -44,7 +44,8 @@ void FileCallbacks::DidSucceed() { } void FileCallbacks::DidReadMetadata( - const base::PlatformFileInfo& file_info) { + const base::PlatformFileInfo& file_info, + const FilePath& unused) { if (callback_->completed()) return; diff --git a/webkit/plugins/ppapi/file_callbacks.h b/webkit/plugins/ppapi/file_callbacks.h index 284ff61..e0a129f 100644 --- a/webkit/plugins/ppapi/file_callbacks.h +++ b/webkit/plugins/ppapi/file_callbacks.h @@ -39,7 +39,9 @@ class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { // FileSystemCallbackDispatcher implementation. virtual void DidSucceed(); - virtual void DidReadMetadata(const base::PlatformFileInfo& file_info); + virtual void DidReadMetadata( + const base::PlatformFileInfo& file_info, + const FilePath& unused); virtual void DidReadDirectory( const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); virtual void DidOpenFileSystem(const std::string&, diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc index 8fbc101..ecbc6d5 100644 --- a/webkit/tools/test_shell/simple_file_system.cc +++ b/webkit/tools/test_shell/simple_file_system.cc @@ -64,7 +64,8 @@ class SimpleFileSystemCallbackDispatcher callbacks_->didSucceed(); } - virtual void DidReadMetadata(const base::PlatformFileInfo& info) { + virtual void DidReadMetadata(const base::PlatformFileInfo& info, + const FilePath& platform_path) { DCHECK(file_system_); WebFileInfo web_file_info; web_file_info.length = info.size; @@ -72,7 +73,7 @@ class SimpleFileSystemCallbackDispatcher web_file_info.type = info.is_directory ? WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; web_file_info.platformPath = - webkit_glue::FilePathToWebString(info.path); + webkit_glue::FilePathToWebString(platform_path); callbacks_->didReadMetadata(web_file_info); } diff --git a/webkit/tools/test_shell/simple_file_writer.cc b/webkit/tools/test_shell/simple_file_writer.cc index e245b63..9304978 100644 --- a/webkit/tools/test_shell/simple_file_writer.cc +++ b/webkit/tools/test_shell/simple_file_writer.cc @@ -104,7 +104,9 @@ class SimpleFileWriter::IOThreadProxy proxy_->DidWrite(bytes, complete); } - virtual void DidReadMetadata(const base::PlatformFileInfo&) { + virtual void DidReadMetadata( + const base::PlatformFileInfo&, + const FilePath&) { NOTREACHED(); } @@ -114,8 +116,9 @@ class SimpleFileWriter::IOThreadProxy NOTREACHED(); } - virtual void DidOpenFileSystem(const std::string& name, - const FilePath& root_path) { + virtual void DidOpenFileSystem( + const std::string& name, + const FilePath& root_path) { NOTREACHED(); } |