diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 04:21:50 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-06 04:21:50 +0000 |
commit | 2e9f432fdf535d68e00dc2e28e78503646f5ca45 (patch) | |
tree | b9cd55ff6081639277c387ab9c42b3654ebf0997 /chrome/common | |
parent | b6e1b31a1b5b7ed81d01581ea8e07d29a103f6cf (diff) | |
download | chromium_src-2e9f432fdf535d68e00dc2e28e78503646f5ca45.zip chromium_src-2e9f432fdf535d68e00dc2e28e78503646f5ca45.tar.gz chromium_src-2e9f432fdf535d68e00dc2e28e78503646f5ca45.tar.bz2 |
Second try for support removeRecursively and new copy/move behaviors added to the spec recently.
http://lists.w3.org/Archives/Public/public-webapps/2010JulSep/1101.html
> For a move/copy of a file on top of existing file, or a directory on
> top of an existing empty directory, you get an automatic overwrite.
> A move/copy of a file on top of an existing directory, or of a
> directory on top of an existing file, will always fail.
> A move/copy of a file or directory on top of an existing non-empty
> directory will always fail.
original issue: http://codereview.chromium.org/3567012
BUG=none
TEST=FileSystemOperationTest.*
TBR=ericu
Review URL: http://codereview.chromium.org/3531012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/file_system/file_system_dispatcher.cc | 4 | ||||
-rw-r--r-- | chrome/common/file_system/file_system_dispatcher.h | 1 | ||||
-rw-r--r-- | chrome/common/file_system/webfilesystem_impl.cc | 11 | ||||
-rw-r--r-- | chrome/common/file_system/webfilesystem_impl.h | 4 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 5 |
5 files changed, 20 insertions, 5 deletions
diff --git a/chrome/common/file_system/file_system_dispatcher.cc b/chrome/common/file_system/file_system_dispatcher.cc index a8761a2..bc52f3a 100644 --- a/chrome/common/file_system/file_system_dispatcher.cc +++ b/chrome/common/file_system/file_system_dispatcher.cc @@ -67,10 +67,11 @@ bool FileSystemDispatcher::Copy( bool FileSystemDispatcher::Remove( const FilePath& path, + bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher) { int request_id = dispatchers_.Add(dispatcher); return ChildThread::current()->Send( - new ViewHostMsg_FileSystem_Remove(request_id, path)); + new ViewHostMsg_FileSystem_Remove(request_id, path, recursive)); } bool FileSystemDispatcher::ReadMetadata( @@ -219,4 +220,3 @@ void FileSystemDispatcher::DidWrite( if (complete) dispatchers_.Remove(request_id); } - diff --git a/chrome/common/file_system/file_system_dispatcher.h b/chrome/common/file_system/file_system_dispatcher.h index 80443c4..8802c1e 100644 --- a/chrome/common/file_system/file_system_dispatcher.h +++ b/chrome/common/file_system/file_system_dispatcher.h @@ -43,6 +43,7 @@ class FileSystemDispatcher { const FilePath& dest_path, fileapi::FileSystemCallbackDispatcher* dispatcher); bool Remove(const FilePath& path, + bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher); bool ReadMetadata(const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher); diff --git a/chrome/common/file_system/webfilesystem_impl.cc b/chrome/common/file_system/webfilesystem_impl.cc index 9128cf1..5b180f6 100644 --- a/chrome/common/file_system/webfilesystem_impl.cc +++ b/chrome/common/file_system/webfilesystem_impl.cc @@ -47,6 +47,16 @@ void WebFileSystemImpl::remove(const WebString& path, FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); dispatcher->Remove(webkit_glue::WebStringToFilePath(path), + false /* recursive */, + new WebFileSystemCallbackDispatcher(callbacks)); +} + +void WebFileSystemImpl::removeRecursively(const WebString& path, + WebFileSystemCallbacks* callbacks) { + FileSystemDispatcher* dispatcher = + ChildThread::current()->file_system_dispatcher(); + dispatcher->Remove(webkit_glue::WebStringToFilePath(path), + true /* recursive */, new WebFileSystemCallbackDispatcher(callbacks)); } @@ -104,4 +114,3 @@ WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter( const WebString& path, WebKit::WebFileWriterClient* client) { return new WebFileWriterImpl(path, client); } - diff --git a/chrome/common/file_system/webfilesystem_impl.h b/chrome/common/file_system/webfilesystem_impl.h index 6892eac..fc051e0 100644 --- a/chrome/common/file_system/webfilesystem_impl.h +++ b/chrome/common/file_system/webfilesystem_impl.h @@ -32,6 +32,10 @@ class WebFileSystemImpl : public WebKit::WebFileSystem { const WebKit::WebString& path, WebKit::WebFileSystemCallbacks*); + virtual void removeRecursively( + const WebKit::WebString& path, + WebKit::WebFileSystemCallbacks*); + virtual void readMetadata( const WebKit::WebString& path, WebKit::WebFileSystemCallbacks*); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 38f6332..f5643af 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -2846,9 +2846,10 @@ IPC_BEGIN_MESSAGES(ViewHost) FilePath /* dest path */) // WebFileSystem::remove() message. - IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_Remove, + IPC_MESSAGE_CONTROL3(ViewHostMsg_FileSystem_Remove, int /* request_id */, - FilePath /* path */) + FilePath /* path */, + bool /* recursive */) // WebFileSystem::readMetadata() message. IPC_MESSAGE_CONTROL2(ViewHostMsg_FileSystem_ReadMetadata, |