diff options
author | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 23:03:29 +0000 |
---|---|---|
committer | ericu@google.com <ericu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-12 23:03:29 +0000 |
commit | 4520c1ef61642fc8130f1cd9de26db892c3da684 (patch) | |
tree | 11140eca636e129f8b21f56fd9504ff33f2ec458 /webkit/plugins | |
parent | 3e0c664682b788f3093e0528a772b51c72e95a1f (diff) | |
download | chromium_src-4520c1ef61642fc8130f1cd9de26db892c3da684.zip chromium_src-4520c1ef61642fc8130f1cd9de26db892c3da684.tar.gz chromium_src-4520c1ef61642fc8130f1cd9de26db892c3da684.tar.bz2 |
Revert 81319 - 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/ [third try lucky,fourth try persistent?], which bounced most recently due to bugs manifestingonly on XP. There are a few changes here that weren't there [infile_system_operation_write_unittest.cc and file_system_operation.cc], butthey're pretty trivial build/test fixes.BUG=none TEST=noneReview URL: http://codereview.chromium.org/6821065
TBR=ericu@google.com
Review URL: http://codereview.chromium.org/6836002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/file_callbacks.cc | 7 | ||||
-rw-r--r-- | webkit/plugins/ppapi/file_callbacks.h | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 14 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 14 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 14 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_directory_reader_impl.cc | 2 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_ref_impl.cc | 43 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_ref_impl.h | 6 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_file_system_impl.h | 10 |
9 files changed, 52 insertions, 60 deletions
diff --git a/webkit/plugins/ppapi/file_callbacks.cc b/webkit/plugins/ppapi/file_callbacks.cc index 6706d47..92d443b 100644 --- a/webkit/plugins/ppapi/file_callbacks.cc +++ b/webkit/plugins/ppapi/file_callbacks.cc @@ -1,9 +1,10 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "webkit/plugins/ppapi/file_callbacks.h" +#include "base/file_path.h" #include "base/logging.h" #include "ppapi/c/dev/ppb_file_system_dev.h" #include "ppapi/c/dev/pp_file_info_dev.h" @@ -75,12 +76,12 @@ void FileCallbacks::DidReadDirectory( } void FileCallbacks::DidOpenFileSystem(const std::string&, - const GURL& root_url) { + const FilePath& root_path) { if (callback_->completed()) return; DCHECK(file_system_); - file_system_->set_root_url(root_url); + file_system_->set_root_path(root_path); file_system_->set_opened(true); callback_->Run(PP_OK); diff --git a/webkit/plugins/ppapi/file_callbacks.h b/webkit/plugins/ppapi/file_callbacks.h index 4bdaa1d..e0a129f 100644 --- a/webkit/plugins/ppapi/file_callbacks.h +++ b/webkit/plugins/ppapi/file_callbacks.h @@ -45,7 +45,7 @@ class FileCallbacks : public fileapi::FileSystemCallbackDispatcher { virtual void DidReadDirectory( const std::vector<base::FileUtilProxy::Entry>& entries, bool has_more); virtual void DidOpenFileSystem(const std::string&, - const GURL& root_url); + const FilePath& root_path); virtual void DidFail(base::PlatformFileError error_code); virtual void DidWrite(int64 bytes, bool complete); diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index 32a25c0..388b6af 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -87,20 +87,20 @@ bool MockPluginDelegate::OpenFileSystem( } bool MockPluginDelegate::MakeDirectory( - const GURL& path, + const FilePath& path, bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher) { return false; } bool MockPluginDelegate::Query( - const GURL& path, + const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher) { return false; } bool MockPluginDelegate::Touch( - const GURL& path, + const FilePath& path, const base::Time& last_access_time, const base::Time& last_modified_time, fileapi::FileSystemCallbackDispatcher* dispatcher) { @@ -108,20 +108,20 @@ bool MockPluginDelegate::Touch( } bool MockPluginDelegate::Delete( - const GURL& path, + const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher) { return false; } bool MockPluginDelegate::Rename( - const GURL& file_path, - const GURL& new_file_path, + const FilePath& file_path, + const FilePath& new_file_path, fileapi::FileSystemCallbackDispatcher* dispatcher) { return false; } bool MockPluginDelegate::ReadDirectory( - const GURL& directory_path, + const FilePath& directory_path, fileapi::FileSystemCallbackDispatcher* dispatcher) { return false; } diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index 0b8fd6f..ce172a0 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -44,22 +44,22 @@ class MockPluginDelegate : public PluginDelegate { long long size, fileapi::FileSystemCallbackDispatcher* dispatcher); virtual bool MakeDirectory( - const GURL& path, + const FilePath& path, bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher); - virtual bool Query(const GURL& path, + virtual bool Query(const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher); - virtual bool Touch(const GURL& path, + virtual bool Touch(const FilePath& path, const base::Time& last_access_time, const base::Time& last_modified_time, fileapi::FileSystemCallbackDispatcher* dispatcher); - virtual bool Delete(const GURL& path, + virtual bool Delete(const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher); - virtual bool Rename(const GURL& file_path, - const GURL& new_file_path, + virtual bool Rename(const FilePath& file_path, + const FilePath& new_file_path, fileapi::FileSystemCallbackDispatcher* dispatcher); virtual bool ReadDirectory( - const GURL& directory_path, + const FilePath& directory_path, fileapi::FileSystemCallbackDispatcher* dispatcher); virtual base::PlatformFileError OpenFile(const PepperFilePath& path, int flags, diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index d22cf17..62ad9c1 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -284,22 +284,22 @@ class PluginDelegate { long long size, fileapi::FileSystemCallbackDispatcher* dispatcher) = 0; virtual bool MakeDirectory( - const GURL& path, + const FilePath& path, bool recursive, fileapi::FileSystemCallbackDispatcher* dispatcher) = 0; - virtual bool Query(const GURL& path, + virtual bool Query(const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher) = 0; - virtual bool Touch(const GURL& path, + virtual bool Touch(const FilePath& path, const base::Time& last_access_time, const base::Time& last_modified_time, fileapi::FileSystemCallbackDispatcher* dispatcher) = 0; - virtual bool Delete(const GURL& path, + virtual bool Delete(const FilePath& path, fileapi::FileSystemCallbackDispatcher* dispatcher) = 0; - virtual bool Rename(const GURL& file_path, - const GURL& new_file_path, + virtual bool Rename(const FilePath& file_path, + const FilePath& new_file_path, fileapi::FileSystemCallbackDispatcher* dispatcher) = 0; virtual bool ReadDirectory( - const GURL& directory_path, + const FilePath& directory_path, fileapi::FileSystemCallbackDispatcher* dispatcher) = 0; virtual base::PlatformFileError OpenFile(const PepperFilePath& path, diff --git a/webkit/plugins/ppapi/ppb_directory_reader_impl.cc b/webkit/plugins/ppapi/ppb_directory_reader_impl.cc index 77935cf..e704b3f 100644 --- a/webkit/plugins/ppapi/ppb_directory_reader_impl.cc +++ b/webkit/plugins/ppapi/ppb_directory_reader_impl.cc @@ -113,7 +113,7 @@ int32_t PPB_DirectoryReader_Impl::GetNextEntry( PP_Resource resource_id = GetReferenceNoAddRef(); DCHECK(resource_id != 0); if (!instance->delegate()->ReadDirectory( - directory_ref_->GetFileSystemURL(), + directory_ref_->GetSystemPath(), new FileCallbacks(instance->module()->AsWeakPtr(), resource_id, callback, NULL, NULL, this))) diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.cc b/webkit/plugins/ppapi/ppb_file_ref_impl.cc index b048caf..c2ec5b2 100644 --- a/webkit/plugins/ppapi/ppb_file_ref_impl.cc +++ b/webkit/plugins/ppapi/ppb_file_ref_impl.cc @@ -6,7 +6,6 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" -#include "googleurl/src/gurl.h" #include "ppapi/c/pp_errors.h" #include "webkit/plugins/ppapi/common.h" #include "webkit/plugins/ppapi/file_callbacks.h" @@ -127,7 +126,7 @@ int32_t MakeDirectory(PP_Resource directory_ref_id, PluginInstance* instance = file_system->instance(); if (!instance->delegate()->MakeDirectory( - directory_ref->GetFileSystemURL(), PPBoolToBool(make_ancestors), + directory_ref->GetSystemPath(), PPBoolToBool(make_ancestors), new FileCallbacks(instance->module()->AsWeakPtr(), directory_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; @@ -151,8 +150,7 @@ int32_t Touch(PP_Resource file_ref_id, PluginInstance* instance = file_system->instance(); if (!instance->delegate()->Touch( - file_ref->GetFileSystemURL(), - base::Time::FromDoubleT(last_access_time), + file_ref->GetSystemPath(), base::Time::FromDoubleT(last_access_time), base::Time::FromDoubleT(last_modified_time), new FileCallbacks(instance->module()->AsWeakPtr(), file_ref_id, callback, NULL, NULL, NULL))) @@ -175,7 +173,7 @@ int32_t Delete(PP_Resource file_ref_id, PluginInstance* instance = file_system->instance(); if (!instance->delegate()->Delete( - file_ref->GetFileSystemURL(), + file_ref->GetSystemPath(), new FileCallbacks(instance->module()->AsWeakPtr(), file_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; @@ -206,7 +204,7 @@ int32_t Rename(PP_Resource file_ref_id, // http://crbug.com/67624 PluginInstance* instance = file_system->instance(); if (!instance->delegate()->Rename( - file_ref->GetFileSystemURL(), new_file_ref->GetFileSystemURL(), + file_ref->GetSystemPath(), new_file_ref->GetSystemPath(), new FileCallbacks(instance->module()->AsWeakPtr(), file_ref_id, callback, NULL, NULL, NULL))) return PP_ERROR_FAILED; @@ -322,25 +320,22 @@ std::string PPB_FileRef_Impl::GetPath() const { } FilePath PPB_FileRef_Impl::GetSystemPath() const { - if (GetFileSystemType() != PP_FILESYSTEMTYPE_EXTERNAL) { - NOTREACHED(); - return FilePath(); - } - return system_path_; -} + if (GetFileSystemType() == PP_FILESYSTEMTYPE_EXTERNAL) + return system_path_; -GURL PPB_FileRef_Impl::GetFileSystemURL() const { - if (GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALPERSISTENT && - GetFileSystemType() != PP_FILESYSTEMTYPE_LOCALTEMPORARY) { - NOTREACHED(); - return GURL(); - } - if (!virtual_path_.size()) - return file_system_->root_url(); - // Since |virtual_path_| starts with a '/', it looks like an absolute path. - // We need to trim off the '/' before calling Resolve, as FileSystem URLs - // start with a storage type identifier that looks like a path segment. - return file_system_->root_url().Resolve(virtual_path_.substr(1)); + // Since |virtual_path_| starts with a '/', it is considered an absolute path + // on POSIX systems. We need to remove the '/' before calling Append() or we + // will run into a DCHECK. + FilePath virtual_file_path( +#if defined(OS_WIN) + UTF8ToWide(virtual_path_.substr(1)) +#elif defined(OS_POSIX) + virtual_path_.substr(1) +#else +#error "Unsupported platform." +#endif + ); + return file_system_->root_path().Append(virtual_file_path); } } // namespace ppapi diff --git a/webkit/plugins/ppapi/ppb_file_ref_impl.h b/webkit/plugins/ppapi/ppb_file_ref_impl.h index 234e150..f006991 100644 --- a/webkit/plugins/ppapi/ppb_file_ref_impl.h +++ b/webkit/plugins/ppapi/ppb_file_ref_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,7 +8,6 @@ #include <string> #include "base/file_path.h" -#include "googleurl/src/gurl.h" #include "ppapi/c/dev/ppb_file_ref_dev.h" #include "webkit/plugins/ppapi/resource.h" @@ -53,9 +52,6 @@ class PPB_FileRef_Impl : public Resource { // Returns the system path corresponding to this file. FilePath GetSystemPath() const; - // Returns the FileSystem API URL corresponding to this file. - GURL GetFileSystemURL() const; - private: scoped_refptr<PPB_FileSystem_Impl> file_system_; std::string virtual_path_; // UTF-8 encoded diff --git a/webkit/plugins/ppapi/ppb_file_system_impl.h b/webkit/plugins/ppapi/ppb_file_system_impl.h index b381f56..3ee3756 100644 --- a/webkit/plugins/ppapi/ppb_file_system_impl.h +++ b/webkit/plugins/ppapi/ppb_file_system_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,7 +6,7 @@ #define WEBKIT_PLUGINS_PPAPI_PPB_FILE_SYSTEM_IMPL_H_ #include "base/basictypes.h" -#include "googleurl/src/gurl.h" +#include "base/file_path.h" #include "ppapi/c/dev/pp_file_info_dev.h" #include "webkit/plugins/ppapi/resource.h" @@ -28,8 +28,8 @@ class PPB_FileSystem_Impl : public Resource { PluginInstance* instance() { return instance_; } PP_FileSystemType_Dev type() { return type_; } - const GURL& root_url() const { return root_url_; } - void set_root_url(const GURL& root_url) { root_url_ = root_url; } + const FilePath& root_path() const { return root_path_; } + void set_root_path(const FilePath& root_path) { root_path_ = root_path; } bool opened() const { return opened_; } void set_opened(bool opened) { opened_ = opened; } bool called_open() const { return called_open_; } @@ -38,7 +38,7 @@ class PPB_FileSystem_Impl : public Resource { private: PluginInstance* instance_; PP_FileSystemType_Dev type_; - GURL root_url_; + FilePath root_path_; bool opened_; bool called_open_; |