diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 00:49:40 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 00:49:40 +0000 |
commit | 073a04f0599beb27670d8a6738fcbbc22fa97bcf (patch) | |
tree | d7393b3cd3463dbfaf4bbdc02fdd0a4de0c83995 /webkit/tools | |
parent | 6bcd5f36cd94649887eff0c87df4f4496001984a (diff) | |
download | chromium_src-073a04f0599beb27670d8a6738fcbbc22fa97bcf.zip chromium_src-073a04f0599beb27670d8a6738fcbbc22fa97bcf.tar.gz chromium_src-073a04f0599beb27670d8a6738fcbbc22fa97bcf.tar.bz2 |
Stop returning the true root path of each filesystem from openFileSystem.
Instead, return the FileSystem URI of the root. This will make it easier
to swap in different filesystem implementations.
BUG=71635
TEST=Just a couple in FileSystemUtilTests, but a bunch of existing ones [this doesn't add much new functionality].
Review URL: http://codereview.chromium.org/6603034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools')
-rw-r--r-- | webkit/tools/test_shell/simple_file_system.cc | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/simple_file_writer.cc | 23 | ||||
-rw-r--r-- | webkit/tools/test_shell/simple_file_writer.h | 8 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gypi | 1 |
4 files changed, 31 insertions, 9 deletions
diff --git a/webkit/tools/test_shell/simple_file_system.cc b/webkit/tools/test_shell/simple_file_system.cc index c0e3731..77b0834 100644 --- a/webkit/tools/test_shell/simple_file_system.cc +++ b/webkit/tools/test_shell/simple_file_system.cc @@ -19,6 +19,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" #include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_operation.h" #include "webkit/fileapi/file_system_path_manager.h" #include "webkit/fileapi/file_system_types.h" @@ -40,6 +41,7 @@ using WebKit::WebVector; using fileapi::FileSystemCallbackDispatcher; using fileapi::FileSystemContext; +using fileapi::FileSystemFileUtil; using fileapi::FileSystemOperation; namespace { @@ -69,6 +71,8 @@ class SimpleFileSystemCallbackDispatcher web_file_info.modificationTime = info.last_modified.ToDoubleT(); web_file_info.type = info.is_directory ? WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; + web_file_info.platformPath = + webkit_glue::FilePathToWebString(info.path); callbacks_->didReadMetadata(web_file_info); } @@ -236,7 +240,7 @@ void SimpleFileSystem::readDirectory( WebFileWriter* SimpleFileSystem::createFileWriter( const WebString& path, WebFileWriterClient* client) { - return new SimpleFileWriter(path, client); + return new SimpleFileWriter(path, client, file_system_context_.get()); } FileSystemOperation* SimpleFileSystem::GetNewOperation( @@ -245,6 +249,6 @@ FileSystemOperation* SimpleFileSystem::GetNewOperation( new SimpleFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); FileSystemOperation* operation = new FileSystemOperation( dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), - file_system_context_.get()); + file_system_context_.get(), NULL); return operation; } diff --git a/webkit/tools/test_shell/simple_file_writer.cc b/webkit/tools/test_shell/simple_file_writer.cc index e7b6859..e245b63 100644 --- a/webkit/tools/test_shell/simple_file_writer.cc +++ b/webkit/tools/test_shell/simple_file_writer.cc @@ -8,12 +8,16 @@ #include "base/message_loop_proxy.h" #include "net/url_request/url_request_context.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" +#include "webkit/fileapi/file_system_context.h" +#include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_operation.h" #include "webkit/glue/webkit_glue.h" #include "webkit/tools/test_shell/simple_resource_loader_bridge.h" -using fileapi::FileSystemOperation; using fileapi::FileSystemCallbackDispatcher; +using fileapi::FileSystemContext; +using fileapi::FileSystemFileUtil; +using fileapi::FileSystemOperation; using fileapi::WebFileWriterBase; using WebKit::WebFileWriterClient; using WebKit::WebString; @@ -27,9 +31,11 @@ net::URLRequestContext* SimpleFileWriter::request_context_ = NULL; class SimpleFileWriter::IOThreadProxy : public base::RefCountedThreadSafe<SimpleFileWriter::IOThreadProxy> { public: - explicit IOThreadProxy(const base::WeakPtr<SimpleFileWriter>& simple_writer) + explicit IOThreadProxy(const base::WeakPtr<SimpleFileWriter>& simple_writer, + FileSystemContext* file_system_context) : simple_writer_(simple_writer), - operation_(NULL) { + operation_(NULL), + file_system_context_(file_system_context) { // The IO thread needs to be running for this class to work. SimpleResourceLoaderBridge::EnsureIOThread(); io_thread_ = SimpleResourceLoaderBridge::GetIoThread(); @@ -119,7 +125,8 @@ class SimpleFileWriter::IOThreadProxy FileSystemOperation* GetNewOperation() { // The FileSystemOperation takes ownership of the CallbackDispatcher. return new FileSystemOperation(new CallbackDispatcher(this), - io_thread_, NULL); + io_thread_, file_system_context_.get(), + NULL); } void DidSucceed() { @@ -165,13 +172,17 @@ class SimpleFileWriter::IOThreadProxy // Only used on the io thread. FileSystemOperation* operation_; + + scoped_refptr<FileSystemContext> file_system_context_; }; SimpleFileWriter::SimpleFileWriter( - const WebString& path, WebFileWriterClient* client) + const WebString& path, + WebFileWriterClient* client, + FileSystemContext* file_system_context) : WebFileWriterBase(path, client), - io_thread_proxy_(new IOThreadProxy(AsWeakPtr())) { + io_thread_proxy_(new IOThreadProxy(AsWeakPtr(), file_system_context)) { } SimpleFileWriter::~SimpleFileWriter() { diff --git a/webkit/tools/test_shell/simple_file_writer.h b/webkit/tools/test_shell/simple_file_writer.h index 238546e..83b5f0c 100644 --- a/webkit/tools/test_shell/simple_file_writer.h +++ b/webkit/tools/test_shell/simple_file_writer.h @@ -13,12 +13,18 @@ namespace net { class URLRequestContext; } // namespace net +namespace fileapi { +class FileSystemContext; +} + // An implementation of WebFileWriter for use in test_shell and DRT. class SimpleFileWriter : public fileapi::WebFileWriterBase, public base::SupportsWeakPtr<SimpleFileWriter> { public: SimpleFileWriter( - const WebKit::WebString& path, WebKit::WebFileWriterClient* client); + const WebKit::WebString& path, + WebKit::WebFileWriterClient* client, + fileapi::FileSystemContext* file_system_context); virtual ~SimpleFileWriter(); // Called by SimpleResourceLoaderBridge when the context is diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index 377d3d4..43fc227 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -380,6 +380,7 @@ '../../fileapi/file_system_usage_cache_unittest.cc', '../../fileapi/file_system_usage_tracker_unittest.cc', '../../fileapi/file_system_util_unittest.cc', + '../../fileapi/sandbox_mount_point_provider_unittest.cc', '../../fileapi/webfilewriter_base_unittest.cc', '../../glue/bookmarklet_unittest.cc', '../../glue/context_menu_unittest.cc', |