diff options
author | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-11 02:21:54 +0000 |
---|---|---|
committer | tkent@chromium.org <tkent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-11 02:21:54 +0000 |
commit | 6ac99518a9481ab6c13f0d7408f3fb8aab1242a6 (patch) | |
tree | e53574e0c71f3ea5d4e1c0632057aaff418014fe /content/common/file_system | |
parent | bc78d4db680894f3bf2eaa0d6ee713e9aec5eebb (diff) | |
download | chromium_src-6ac99518a9481ab6c13f0d7408f3fb8aab1242a6.zip chromium_src-6ac99518a9481ab6c13f0d7408f3fb8aab1242a6.tar.gz chromium_src-6ac99518a9481ab6c13f0d7408f3fb8aab1242a6.tar.bz2 |
Revert 81028 - It broke LayoutTests/ fast/filesystem/op-copy.html on Windows Release and Debug.
More filesystem cleanup: convert URL-encoded-as-FilePath to actual URL, where possible without WebKit API changes. The WebKit changes will happen in another CL. This is a resubmit of http://codereview.chromium.org/6767010/, which bounced dueto a recent checkin that required a merge. There are a few changes here thatweren't there [in file_system_operation_write_unittest.cc andfile_system_operation.cc], but they're pretty trivial build/test fixes.BUG=none TEST=noneReview URL: http://codereview.chromium.org/6813066
TBR=ericu@google.com
Review URL: http://codereview.chromium.org/6813072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81065 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/file_system')
7 files changed, 54 insertions, 57 deletions
diff --git a/content/common/file_system/file_system_dispatcher.cc b/content/common/file_system/file_system_dispatcher.cc index c4fe701..d95a5b7 100644 --- a/content/common/file_system/file_system_dispatcher.cc +++ b/content/common/file_system/file_system_dispatcher.cc @@ -52,8 +52,8 @@ bool FileSystemDispatcher::OpenFileSystem( } bool FileSystemDispatcher::Move( - const GURL& src_path, - const GURL& dest_path, + const FilePath& src_path, + const FilePath& dest_path, fileapi::FileSystemCallbackDispatcher* dispatcher) { int request_id = dispatchers_.Add(dispatcher); if (!ChildThread::current()->Send(new FileSystemHostMsg_Move( @@ -66,8 +66,8 @@ bool FileSystemDispatcher::Move( } bool FileSystemDispatcher::Copy( - const GURL& src_path, - const GURL& dest_path, + const FilePath& src_path, + const FilePath& dest_path, fileapi::FileSystemCallbackDispatcher* dispatcher) { int request_id = dispatchers_.Add(dispatcher); if (!ChildThread::current()->Send(new FileSystemHostMsg_Copy( @@ -80,7 +80,7 @@ bool FileSystemDispatcher::Copy( } bool FileSystemDispatcher::Remove( - const GURL& path, + const FilePath& path, bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher) { int request_id = dispatchers_.Add(dispatcher); @@ -94,7 +94,7 @@ bool FileSystemDispatcher::Remove( } bool FileSystemDispatcher::ReadMetadata( - const GURL& path, + const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher) { int request_id = dispatchers_.Add(dispatcher); if (!ChildThread::current()->Send( @@ -107,7 +107,7 @@ bool FileSystemDispatcher::ReadMetadata( } bool FileSystemDispatcher::Create( - const GURL& path, + const FilePath& path, bool exclusive, bool is_directory, bool recursive, @@ -123,7 +123,7 @@ bool FileSystemDispatcher::Create( } bool FileSystemDispatcher::Exists( - const GURL& path, + const FilePath& path, bool is_directory, fileapi::FileSystemCallbackDispatcher* dispatcher) { int request_id = dispatchers_.Add(dispatcher); @@ -137,7 +137,7 @@ bool FileSystemDispatcher::Exists( } bool FileSystemDispatcher::ReadDirectory( - const GURL& path, + const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher) { int request_id = dispatchers_.Add(dispatcher); if (!ChildThread::current()->Send( @@ -150,7 +150,7 @@ bool FileSystemDispatcher::ReadDirectory( } bool FileSystemDispatcher::Truncate( - const GURL& path, + const FilePath& path, int64 offset, int* request_id_out, fileapi::FileSystemCallbackDispatcher* dispatcher) { @@ -167,7 +167,7 @@ bool FileSystemDispatcher::Truncate( } bool FileSystemDispatcher::Write( - const GURL& path, + const FilePath& path, const GURL& blob_url, int64 offset, int* request_id_out, @@ -198,7 +198,7 @@ bool FileSystemDispatcher::Cancel( } bool FileSystemDispatcher::TouchFile( - const GURL& path, + const FilePath& path, const base::Time& last_access_time, const base::Time& last_modified_time, fileapi::FileSystemCallbackDispatcher* dispatcher) { @@ -215,12 +215,12 @@ bool FileSystemDispatcher::TouchFile( void FileSystemDispatcher::OnOpenComplete( int request_id, bool accepted, const std::string& name, - const GURL& root) { + const FilePath& root_path) { fileapi::FileSystemCallbackDispatcher* dispatcher = dispatchers_.Lookup(request_id); DCHECK(dispatcher); if (accepted) - dispatcher->DidOpenFileSystem(name, root); + dispatcher->DidOpenFileSystem(name, root_path); else dispatcher->DidFail(base::PLATFORM_FILE_ERROR_SECURITY); 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 b898eae..e61a518 100644 --- a/content/common/file_system/file_system_dispatcher.h +++ b/content/common/file_system/file_system_dispatcher.h @@ -38,39 +38,39 @@ class FileSystemDispatcher : public IPC::Channel::Listener { long long size, bool create, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool Move(const GURL& src_path, - const GURL& dest_path, + bool Move(const FilePath& src_path, + const FilePath& dest_path, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool Copy(const GURL& src_path, - const GURL& dest_path, + bool Copy(const FilePath& src_path, + const FilePath& dest_path, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool Remove(const GURL& path, + bool Remove(const FilePath& path, bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool ReadMetadata(const GURL& path, + bool ReadMetadata(const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool Create(const GURL& path, + bool Create(const FilePath& path, bool exclusive, bool is_directory, bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool Exists(const GURL& path, + bool Exists(const FilePath& path, bool for_directory, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool ReadDirectory(const GURL& path, + bool ReadDirectory(const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool Truncate(const GURL& path, + bool Truncate(const FilePath& path, int64 offset, int* request_id_out, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool Write(const GURL& path, + bool Write(const FilePath& path, const GURL& blob_url, int64 offset, int* request_id_out, fileapi::FileSystemCallbackDispatcher* dispatcher); bool Cancel(int request_id_to_cancel, fileapi::FileSystemCallbackDispatcher* dispatcher); - bool TouchFile(const GURL& file_path, + bool TouchFile(const FilePath& file_path, const base::Time& last_access_time, const base::Time& last_modified_time, fileapi::FileSystemCallbackDispatcher* dispatcher); @@ -81,7 +81,7 @@ class FileSystemDispatcher : public IPC::Channel::Listener { int request_id, bool accepted, const std::string& name, - const GURL& root); + const FilePath& root_path); void OnDidSucceed(int request_id); void OnDidReadMetadata(int request_id, const base::PlatformFileInfo& file_info, diff --git a/content/common/file_system/webfilesystem_callback_dispatcher.cc b/content/common/file_system/webfilesystem_callback_dispatcher.cc index c59e377..6903f4c 100644 --- a/content/common/file_system/webfilesystem_callback_dispatcher.cc +++ b/content/common/file_system/webfilesystem_callback_dispatcher.cc @@ -10,7 +10,6 @@ #include "base/file_util_proxy.h" #include "base/logging.h" #include "base/utf_string_conversions.h" -#include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileInfo.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystem.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFileSystemCallbacks.h" @@ -59,9 +58,9 @@ void WebFileSystemCallbackDispatcher::DidReadDirectory( } void WebFileSystemCallbackDispatcher::DidOpenFileSystem( - const std::string& name, const GURL& root) { - callbacks_->didOpenFileSystem( - UTF8ToUTF16(name), UTF8ToUTF16(root.spec())); + const std::string& name, const FilePath& root_path) { + callbacks_->didOpenFileSystem(UTF8ToUTF16(name), + webkit_glue::FilePathToWebString(root_path)); } void WebFileSystemCallbackDispatcher::DidFail( diff --git a/content/common/file_system/webfilesystem_callback_dispatcher.h b/content/common/file_system/webfilesystem_callback_dispatcher.h index b8c1aac..80bd183 100644 --- a/content/common/file_system/webfilesystem_callback_dispatcher.h +++ b/content/common/file_system/webfilesystem_callback_dispatcher.h @@ -9,8 +9,6 @@ #include "base/platform_file.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" -class GURL; - namespace WebKit { class WebFileSystemCallbacks; } @@ -30,7 +28,7 @@ class WebFileSystemCallbackDispatcher const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); virtual void DidOpenFileSystem(const std::string&, - const GURL&); + const FilePath&); virtual void DidFail(base::PlatformFileError); virtual void DidWrite(int64 bytes, bool complete); diff --git a/content/common/file_system/webfilesystem_impl.cc b/content/common/file_system/webfilesystem_impl.cc index 38f1d2a..43b78f3 100644 --- a/content/common/file_system/webfilesystem_impl.cc +++ b/content/common/file_system/webfilesystem_impl.cc @@ -27,8 +27,8 @@ void WebFileSystemImpl::move(const WebString& src_path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Move(GURL(src_path), - GURL(dest_path), + dispatcher->Move(webkit_glue::WebStringToFilePath(src_path), + webkit_glue::WebStringToFilePath(dest_path), new WebFileSystemCallbackDispatcher(callbacks)); } @@ -37,8 +37,8 @@ void WebFileSystemImpl::copy(const WebString& src_path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Copy(GURL(src_path), - GURL(dest_path), + dispatcher->Copy(webkit_glue::WebStringToFilePath(src_path), + webkit_glue::WebStringToFilePath(dest_path), new WebFileSystemCallbackDispatcher(callbacks)); } @@ -46,7 +46,7 @@ void WebFileSystemImpl::remove(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Remove(GURL(path), + dispatcher->Remove(webkit_glue::WebStringToFilePath(path), false /* recursive */, new WebFileSystemCallbackDispatcher(callbacks)); } @@ -55,7 +55,7 @@ void WebFileSystemImpl::removeRecursively(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Remove(GURL(path), + dispatcher->Remove(webkit_glue::WebStringToFilePath(path), true /* recursive */, new WebFileSystemCallbackDispatcher(callbacks)); } @@ -64,7 +64,7 @@ void WebFileSystemImpl::readMetadata(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->ReadMetadata(GURL(path), + dispatcher->ReadMetadata(webkit_glue::WebStringToFilePath(path), new WebFileSystemCallbackDispatcher(callbacks)); } @@ -73,7 +73,7 @@ void WebFileSystemImpl::createFile(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Create(GURL(path), exclusive, false, + dispatcher->Create(webkit_glue::WebStringToFilePath(path), exclusive, false, false, new WebFileSystemCallbackDispatcher(callbacks)); } @@ -82,7 +82,7 @@ void WebFileSystemImpl::createDirectory(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Create(GURL(path), exclusive, true, + dispatcher->Create(webkit_glue::WebStringToFilePath(path), exclusive, true, false, new WebFileSystemCallbackDispatcher(callbacks)); } @@ -90,7 +90,7 @@ void WebFileSystemImpl::fileExists(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Exists(GURL(path), false, + dispatcher->Exists(webkit_glue::WebStringToFilePath(path), false, new WebFileSystemCallbackDispatcher(callbacks)); } @@ -98,7 +98,7 @@ void WebFileSystemImpl::directoryExists(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->Exists(GURL(path), true, + dispatcher->Exists(webkit_glue::WebStringToFilePath(path), true, new WebFileSystemCallbackDispatcher(callbacks)); } @@ -106,11 +106,11 @@ void WebFileSystemImpl::readDirectory(const WebString& path, WebFileSystemCallbacks* callbacks) { FileSystemDispatcher* dispatcher = ChildThread::current()->file_system_dispatcher(); - dispatcher->ReadDirectory(GURL(path), + dispatcher->ReadDirectory(webkit_glue::WebStringToFilePath(path), new WebFileSystemCallbackDispatcher(callbacks)); } WebKit::WebFileWriter* WebFileSystemImpl::createFileWriter( const WebString& path, WebKit::WebFileWriterClient* client) { - return new WebFileWriterImpl(GURL(path), client); + return new WebFileWriterImpl(path, client); } diff --git a/content/common/file_system/webfilewriter_impl.cc b/content/common/file_system/webfilewriter_impl.cc index d42caa5..196b9ec 100644 --- a/content/common/file_system/webfilewriter_impl.cc +++ b/content/common/file_system/webfilewriter_impl.cc @@ -32,7 +32,7 @@ class WebFileWriterImpl::CallbackDispatcher NOTREACHED(); } virtual void DidOpenFileSystem(const std::string& name, - const GURL& root) { + const FilePath& root_path) { NOTREACHED(); } virtual void DidSucceed() { @@ -53,7 +53,7 @@ class WebFileWriterImpl::CallbackDispatcher }; WebFileWriterImpl::WebFileWriterImpl( - const GURL& path, WebKit::WebFileWriterClient* client) + const WebKit::WebString& path, WebKit::WebFileWriterClient* client) : WebFileWriterBase(path, client), request_id_(0) { } @@ -61,17 +61,16 @@ WebFileWriterImpl::WebFileWriterImpl( WebFileWriterImpl::~WebFileWriterImpl() { } -void WebFileWriterImpl::DoTruncate(const GURL& path, int64 offset) { +void WebFileWriterImpl::DoTruncate(const FilePath& path, int64 offset) { // The FileSystemDispatcher takes ownership of the CallbackDispatcher. GetFileSystemDispatcher()->Truncate(path, offset, &request_id_, new CallbackDispatcher(AsWeakPtr())); } void WebFileWriterImpl::DoWrite( - const GURL& path, const GURL& blob_url, int64 offset) { - GetFileSystemDispatcher()->Write( - path, blob_url, offset, &request_id_, - new CallbackDispatcher(AsWeakPtr())); + const FilePath& path, const GURL& blob_url, int64 offset) { + GetFileSystemDispatcher()->Write(path, blob_url, offset, &request_id_, + new CallbackDispatcher(AsWeakPtr())); } void WebFileWriterImpl::DoCancel() { diff --git a/content/common/file_system/webfilewriter_impl.h b/content/common/file_system/webfilewriter_impl.h index 792926e..fa34eaf 100644 --- a/content/common/file_system/webfilewriter_impl.h +++ b/content/common/file_system/webfilewriter_impl.h @@ -15,13 +15,14 @@ class FileSystemDispatcher; class WebFileWriterImpl : public fileapi::WebFileWriterBase, public base::SupportsWeakPtr<WebFileWriterImpl> { public: - WebFileWriterImpl(const GURL& path, WebKit::WebFileWriterClient* client); + WebFileWriterImpl( + const WebKit::WebString& path, WebKit::WebFileWriterClient* client); virtual ~WebFileWriterImpl(); protected: // WebFileWriterBase overrides - virtual void DoTruncate(const GURL& path, int64 offset); - virtual void DoWrite(const GURL& path, const GURL& blob_url, + virtual void DoTruncate(const FilePath& path, int64 offset); + virtual void DoWrite(const FilePath& path, const GURL& blob_url, int64 offset); virtual void DoCancel(); |