diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-02 05:12:33 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-02 05:12:33 +0000 |
commit | a3ef4830d5b5fdc52e5d7d0cb33dae8844f0961e (patch) | |
tree | bdd4dac76e6034ef6cf33450e203269a715ea0e6 /webkit/fileapi | |
parent | 8bc574c57115e9ffd0169f33131c0865997dcb35 (diff) | |
download | chromium_src-a3ef4830d5b5fdc52e5d7d0cb33dae8844f0961e.zip chromium_src-a3ef4830d5b5fdc52e5d7d0cb33dae8844f0961e.tar.gz chromium_src-a3ef4830d5b5fdc52e5d7d0cb33dae8844f0961e.tar.bz2 |
Add FilePath to base namespace.
This updates headers that forward-declare it and a few random places to use the namespace explicitly. There us a using declaration in file_path.h that makes the rest compile, which we can do in future passes.
Review URL: https://codereview.chromium.org/12163003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180245 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi')
113 files changed, 1172 insertions, 1158 deletions
diff --git a/webkit/fileapi/async_file_util.h b/webkit/fileapi/async_file_util.h index 651d0a51..d00dc82 100644 --- a/webkit/fileapi/async_file_util.h +++ b/webkit/fileapi/async_file_util.h @@ -42,7 +42,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil { typedef base::Callback< void(base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path)> GetFileInfoCallback; + const base::FilePath& platform_path)> GetFileInfoCallback; typedef base::FileUtilProxy::Entry Entry; typedef std::vector<base::FileUtilProxy::Entry> EntryList; @@ -54,7 +54,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil { typedef base::Callback< void(base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, SnapshotFilePolicy policy)> CreateSnapshotFileCallback; AsyncFileUtil() {} @@ -243,7 +243,7 @@ class WEBKIT_STORAGE_EXPORT AsyncFileUtil { // virtual bool CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url, const StatusCallback& callback) = 0; diff --git a/webkit/fileapi/async_file_util_adapter.cc b/webkit/fileapi/async_file_util_adapter.cc index 4c6dca1..0b9f2c8 100644 --- a/webkit/fileapi/async_file_util_adapter.cc +++ b/webkit/fileapi/async_file_util_adapter.cc @@ -78,7 +78,7 @@ class GetFileInfoHelper { private: base::PlatformFileError error_; base::PlatformFileInfo file_info_; - FilePath platform_path_; + base::FilePath platform_path_; SnapshotFilePolicy snapshot_policy_; DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); }; @@ -91,7 +91,7 @@ class ReadDirectoryHelper { FileSystemOperationContext* context, const FileSystemURL& url) { base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; PlatformFileError error = file_util->GetFileInfo( context, url, &file_info, &platform_path); if (error != base::PLATFORM_FILE_OK) { @@ -106,7 +106,7 @@ class ReadDirectoryHelper { scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( file_util->CreateFileEnumerator(context, url, false /* recursive */)); - FilePath current; + base::FilePath current; while (!(current = file_enum->Next()).empty()) { AsyncFileUtil::Entry entry; entry.is_directory = file_enum->IsDirectory(); @@ -257,7 +257,7 @@ bool AsyncFileUtilAdapter::MoveFileLocal( bool AsyncFileUtilAdapter::CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url, const StatusCallback& callback) { return base::PostTaskAndReplyWithResult( diff --git a/webkit/fileapi/async_file_util_adapter.h b/webkit/fileapi/async_file_util_adapter.h index da8bb4c..065354d 100644 --- a/webkit/fileapi/async_file_util_adapter.h +++ b/webkit/fileapi/async_file_util_adapter.h @@ -82,7 +82,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE AsyncFileUtilAdapter const StatusCallback& callback) OVERRIDE; virtual bool CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url, const StatusCallback& callback) OVERRIDE; virtual bool DeleteFile( diff --git a/webkit/fileapi/cross_operation_delegate.cc b/webkit/fileapi/cross_operation_delegate.cc index 86868e2..28bd6da 100644 --- a/webkit/fileapi/cross_operation_delegate.cc +++ b/webkit/fileapi/cross_operation_delegate.cc @@ -169,7 +169,7 @@ void CrossOperationDelegate::DidCreateSnapshot( const StatusCallback& callback, base::PlatformFileError error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { if (error != base::PLATFORM_FILE_OK) { callback.Run(error); @@ -222,7 +222,7 @@ FileSystemURL CrossOperationDelegate::CreateDestURL( DCHECK_EQ(src_root_.type(), src_url.type()); DCHECK_EQ(src_root_.origin(), src_url.origin()); - FilePath path = dest_root_.path(); + base::FilePath path = dest_root_.path(); src_root_.path().AppendRelativePath(src_url.path(), &path); return dest_root_.WithPath(path); } diff --git a/webkit/fileapi/cross_operation_delegate.h b/webkit/fileapi/cross_operation_delegate.h index 1b169f7..3be003a 100644 --- a/webkit/fileapi/cross_operation_delegate.h +++ b/webkit/fileapi/cross_operation_delegate.h @@ -55,7 +55,7 @@ class CrossOperationDelegate const StatusCallback& callback, base::PlatformFileError error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); void DidFinishCopy( const FileSystemURL& src, diff --git a/webkit/fileapi/external_mount_points.cc b/webkit/fileapi/external_mount_points.cc index bca5b2b..b129911 100644 --- a/webkit/fileapi/external_mount_points.cc +++ b/webkit/fileapi/external_mount_points.cc @@ -20,15 +20,15 @@ namespace { // For example, /a/b/c(1)/d would be erroneously resolved as c/d if the // following mount points were registered: "/a/b/c", "/a/b/c(1)". (Note: // "/a/b/c" < "/a/b/c(1)" < "/a/b/c/"). -FilePath NormalizeFilePath(const FilePath& path) { +base::FilePath NormalizeFilePath(const base::FilePath& path) { if (path.empty()) return path; - FilePath::StringType path_str = path.StripTrailingSeparators().value(); - if (!FilePath::IsSeparator(path_str[path_str.length() - 1])) + base::FilePath::StringType path_str = path.StripTrailingSeparators().value(); + if (!base::FilePath::IsSeparator(path_str[path_str.length() - 1])) path_str.append(FILE_PATH_LITERAL("/")); - return FilePath(path_str).NormalizePathSeparators(); + return base::FilePath(path_str).NormalizePathSeparators(); } // Wrapper around ref-counted ExternalMountPoints that will be used to lazily @@ -53,15 +53,15 @@ class SystemMountPointsLazyWrapper { system_mount_points_->RegisterFileSystem( "archive", fileapi::kFileSystemTypeNativeLocal, - FilePath(FILE_PATH_LITERAL("/media/archive"))); + base::FilePath(FILE_PATH_LITERAL("/media/archive"))); system_mount_points_->RegisterFileSystem( "removable", fileapi::kFileSystemTypeNativeLocal, - FilePath(FILE_PATH_LITERAL("/media/removable"))); + base::FilePath(FILE_PATH_LITERAL("/media/removable"))); system_mount_points_->RegisterFileSystem( "oem", fileapi::kFileSystemTypeRestrictedNativeLocal, - FilePath(FILE_PATH_LITERAL("/usr/share/oem"))); + base::FilePath(FILE_PATH_LITERAL("/usr/share/oem"))); #endif // defined(OS_CHROMEOS) } @@ -78,20 +78,20 @@ namespace fileapi { class ExternalMountPoints::Instance { public: Instance(FileSystemType type, - const FilePath& path, + const base::FilePath& path, RemoteFileSystemProxyInterface* remote_proxy); ~Instance(); FileSystemType type() const { return type_; } - const FilePath& path() const { return path_; } + const base::FilePath& path() const { return path_; } RemoteFileSystemProxyInterface* remote_proxy() const { return remote_proxy_.get(); } private: const FileSystemType type_; - const FilePath path_; + const base::FilePath path_; // For file systems that have a remote file system proxy. scoped_refptr<RemoteFileSystemProxyInterface> remote_proxy_; @@ -100,7 +100,7 @@ class ExternalMountPoints::Instance { }; ExternalMountPoints::Instance::Instance(FileSystemType type, - const FilePath& path, + const base::FilePath& path, RemoteFileSystemProxyInterface* proxy) : type_(type), path_(path.StripTrailingSeparators()), @@ -125,7 +125,7 @@ scoped_refptr<ExternalMountPoints> ExternalMountPoints::CreateRefCounted() { bool ExternalMountPoints::RegisterFileSystem( const std::string& mount_name, FileSystemType type, - const FilePath& path) { + const base::FilePath& path) { return RegisterRemoteFileSystem(mount_name, type, NULL, path); } @@ -133,10 +133,10 @@ bool ExternalMountPoints::RegisterRemoteFileSystem( const std::string& mount_name, FileSystemType type, RemoteFileSystemProxyInterface* remote_proxy, - const FilePath& path_in) { + const base::FilePath& path_in) { base::AutoLock locker(lock_); - FilePath path = NormalizeFilePath(path_in); + base::FilePath path = NormalizeFilePath(path_in); if (!ValidateNewMountPoint(mount_name, path)) return false; @@ -164,7 +164,7 @@ bool ExternalMountPoints::RevokeFileSystem(const std::string& mount_name) { } bool ExternalMountPoints::GetRegisteredPath( - const std::string& filesystem_id, FilePath* path) const { + const std::string& filesystem_id, base::FilePath* path) const { DCHECK(path); base::AutoLock locker(lock_); NameToInstance::const_iterator found = instance_map_.find(filesystem_id); @@ -174,10 +174,10 @@ bool ExternalMountPoints::GetRegisteredPath( return true; } -bool ExternalMountPoints::CrackVirtualPath(const FilePath& virtual_path, +bool ExternalMountPoints::CrackVirtualPath(const base::FilePath& virtual_path, std::string* mount_name, FileSystemType* type, - FilePath* path) const { + base::FilePath* path) const { DCHECK(mount_name); DCHECK(path); @@ -186,18 +186,18 @@ bool ExternalMountPoints::CrackVirtualPath(const FilePath& virtual_path, return false; // The virtual_path should comprise of <mount_name> and <relative_path> parts. - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; virtual_path.GetComponents(&components); if (components.size() < 1) return false; - std::vector<FilePath::StringType>::iterator component_iter = + std::vector<base::FilePath::StringType>::iterator component_iter = components.begin(); - std::string maybe_mount_name = FilePath(*component_iter++).MaybeAsASCII(); + std::string maybe_mount_name = base::FilePath(*component_iter++).MaybeAsASCII(); if (maybe_mount_name.empty()) return false; - FilePath cracked_path; + base::FilePath cracked_path; { base::AutoLock locker(lock_); NameToInstance::const_iterator found_instance = @@ -230,13 +230,13 @@ FileSystemURL ExternalMountPoints::CrackURL(const GURL& url) const { FileSystemURL ExternalMountPoints::CreateCrackedFileSystemURL( const GURL& origin, FileSystemType type, - const FilePath& path) const { + const base::FilePath& path) const { if (!HandlesFileSystemMountType(type)) return FileSystemURL(); std::string mount_name; FileSystemType cracked_type; - FilePath cracked_path; + base::FilePath cracked_path; if (!CrackVirtualPath(path, &mount_name, &cracked_type, &cracked_path)) return FileSystemURL(); @@ -263,14 +263,14 @@ void ExternalMountPoints::AddMountPointInfosTo( } } -bool ExternalMountPoints::GetVirtualPath(const FilePath& path_in, - FilePath* virtual_path) { +bool ExternalMountPoints::GetVirtualPath(const base::FilePath& path_in, + base::FilePath* virtual_path) { DCHECK(virtual_path); base::AutoLock locker(lock_); - FilePath path = NormalizeFilePath(path_in); - std::map<FilePath, std::string>::reverse_iterator iter( + base::FilePath path = NormalizeFilePath(path_in); + std::map<base::FilePath, std::string>::reverse_iterator iter( path_to_name_map_.upper_bound(path)); if (iter == path_to_name_map_.rend()) return false; @@ -281,9 +281,9 @@ bool ExternalMountPoints::GetVirtualPath(const FilePath& path_in, return iter->first.AppendRelativePath(path, virtual_path); } -FilePath ExternalMountPoints::CreateVirtualRootPath( +base::FilePath ExternalMountPoints::CreateVirtualRootPath( const std::string& mount_name) const { - return FilePath().AppendASCII(mount_name); + return base::FilePath().AppendASCII(mount_name); } ExternalMountPoints::ExternalMountPoints() {} @@ -294,7 +294,7 @@ ExternalMountPoints::~ExternalMountPoints() { } bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name, - const FilePath& path) { + const base::FilePath& path) { lock_.AssertAcquired(); // Mount name must not be empty. @@ -315,7 +315,7 @@ bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name, return false; // Check there the new path does not overlap with one of the existing ones. - std::map<FilePath, std::string>::reverse_iterator potential_parent( + std::map<base::FilePath, std::string>::reverse_iterator potential_parent( path_to_name_map_.upper_bound(path)); if (potential_parent != path_to_name_map_.rend()) { if (potential_parent->first == path || @@ -324,7 +324,7 @@ bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name, } } - std::map<FilePath, std::string>::iterator potential_child = + std::map<base::FilePath, std::string>::iterator potential_child = path_to_name_map_.upper_bound(path); if (potential_child == path_to_name_map_.end()) return true; @@ -335,13 +335,13 @@ bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name, ScopedExternalFileSystem::ScopedExternalFileSystem( const std::string& mount_name, FileSystemType type, - const FilePath& path) + const base::FilePath& path) : mount_name_(mount_name) { ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( mount_name, type, path); } -FilePath ScopedExternalFileSystem::GetVirtualRootPath() const { +base::FilePath ScopedExternalFileSystem::GetVirtualRootPath() const { return ExternalMountPoints::GetSystemInstance()-> CreateVirtualRootPath(mount_name_); } diff --git a/webkit/fileapi/external_mount_points.h b/webkit/fileapi/external_mount_points.h index f2d8e29..a2660c2 100644 --- a/webkit/fileapi/external_mount_points.h +++ b/webkit/fileapi/external_mount_points.h @@ -15,7 +15,9 @@ #include "webkit/fileapi/mount_points.h" #include "webkit/storage/webkit_storage_export.h" +namespace base { class FilePath; +} namespace fileapi { class FileSystemURL; @@ -60,29 +62,29 @@ class WEBKIT_STORAGE_EXPORT ExternalMountPoints // by calling RevokeFileSystem with |mount_name|. bool RegisterFileSystem(const std::string& mount_name, FileSystemType type, - const FilePath& path); + const base::FilePath& path); // Same as |RegisterExternalFileSystem|, but also registers a remote file // system proxy for the file system. bool RegisterRemoteFileSystem(const std::string& mount_name, FileSystemType type, RemoteFileSystemProxyInterface* remote_proxy, - const FilePath& path); + const base::FilePath& path); // MountPoints overrides. virtual bool HandlesFileSystemMountType(FileSystemType type) const OVERRIDE; virtual bool RevokeFileSystem(const std::string& mount_name) OVERRIDE; virtual bool GetRegisteredPath(const std::string& mount_name, - FilePath* path) const OVERRIDE; - virtual bool CrackVirtualPath(const FilePath& virtual_path, + base::FilePath* path) const OVERRIDE; + virtual bool CrackVirtualPath(const base::FilePath& virtual_path, std::string* mount_name, FileSystemType* type, - FilePath* path) const OVERRIDE; + base::FilePath* path) const OVERRIDE; virtual FileSystemURL CrackURL(const GURL& url) const OVERRIDE; virtual FileSystemURL CreateCrackedFileSystemURL( const GURL& origin, FileSystemType type, - const FilePath& path) const OVERRIDE; + const base::FilePath& path) const OVERRIDE; // Retrieves the remote file system proxy for the registered file system. // Returns NULL if there is no file system with the given name, or if the file @@ -102,10 +104,11 @@ class WEBKIT_STORAGE_EXPORT ExternalMountPoints // part of any registered filesystem). // // Returned virtual_path will have normalized path separators. - bool GetVirtualPath(const FilePath& absolute_path, FilePath* virtual_path); + bool GetVirtualPath(const base::FilePath& absolute_path, + base::FilePath* virtual_path); // Returns the virtual root path that looks like /<mount_name>. - FilePath CreateVirtualRootPath(const std::string& mount_name) const; + base::FilePath CreateVirtualRootPath(const std::string& mount_name) const; private: friend class base::RefCountedThreadSafe<ExternalMountPoints>; @@ -116,7 +119,7 @@ class WEBKIT_STORAGE_EXPORT ExternalMountPoints typedef std::map<std::string, Instance*> NameToInstance; // Reverse map from registered path to its corresponding mount name. - typedef std::map<FilePath, std::string> PathToName; + typedef std::map<base::FilePath, std::string> PathToName; // Use |GetSystemInstance| of |CreateRefCounted| to get an instance. ExternalMountPoints(); @@ -131,7 +134,7 @@ class WEBKIT_STORAGE_EXPORT ExternalMountPoints // // |lock_| should be taken before calling this method. bool ValidateNewMountPoint(const std::string& mount_name, - const FilePath& path); + const base::FilePath& path); // This lock needs to be obtained when accessing the instance_map_. mutable base::Lock lock_; @@ -147,10 +150,10 @@ class WEBKIT_STORAGE_EXPORT ScopedExternalFileSystem { public: ScopedExternalFileSystem(const std::string& mount_name, FileSystemType type, - const FilePath& path); + const base::FilePath& path); ~ScopedExternalFileSystem(); - FilePath GetVirtualRootPath() const; + base::FilePath GetVirtualRootPath() const; private: const std::string mount_name_; diff --git a/webkit/fileapi/external_mount_points_unittest.cc b/webkit/fileapi/external_mount_points_unittest.cc index 4668264..c8edbdd 100644 --- a/webkit/fileapi/external_mount_points_unittest.cc +++ b/webkit/fileapi/external_mount_points_unittest.cc @@ -30,12 +30,12 @@ TEST(ExternalMountPointsTest, AddMountPoint) { // The mount point's name. const char* const name; // The mount point's path. - const FilePath::CharType* const path; + const base::FilePath::CharType* const path; // Whether the mount point registration should succeed. bool success; // Path returned by GetRegisteredPath. NULL if the method is expected to // fail. - const FilePath::CharType* const registered_path; + const base::FilePath::CharType* const registered_path; }; const TestCase kTestCases[] = { @@ -111,20 +111,20 @@ TEST(ExternalMountPointsTest, AddMountPoint) { mount_points->RegisterFileSystem( kTestCases[i].name, fileapi::kFileSystemTypeNativeLocal, - FilePath(kTestCases[i].path))) + base::FilePath(kTestCases[i].path))) << "Adding mount point: " << kTestCases[i].name << " with path " << kTestCases[i].path; } // Test that final mount point presence state is as expected. for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { - FilePath found_path; + base::FilePath found_path; EXPECT_EQ(kTestCases[i].registered_path != NULL, mount_points->GetRegisteredPath(kTestCases[i].name, &found_path)) << "Test case: " << i; if (kTestCases[i].registered_path) { - FilePath expected_path(kTestCases[i].registered_path); + base::FilePath expected_path(kTestCases[i].registered_path); EXPECT_EQ(expected_path.NormalizePathSeparators(), found_path); } } @@ -136,30 +136,30 @@ TEST(ExternalMountPointsTest, GetVirtualPath) { mount_points->RegisterFileSystem("c", fileapi::kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/a/b/c"))); + base::FilePath(DRIVE FPL("/a/b/c"))); // Note that "/a/b/c" < "/a/b/c(1)" < "/a/b/c/". mount_points->RegisterFileSystem("c(1)", fileapi::kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/a/b/c(1)"))); + base::FilePath(DRIVE FPL("/a/b/c(1)"))); mount_points->RegisterFileSystem("x", fileapi::kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/z/y/x"))); + base::FilePath(DRIVE FPL("/z/y/x"))); mount_points->RegisterFileSystem("o", fileapi::kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/m/n/o"))); + base::FilePath(DRIVE FPL("/m/n/o"))); // A mount point whose name does not match its path base name. mount_points->RegisterFileSystem("mount", fileapi::kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/root/foo"))); + base::FilePath(DRIVE FPL("/root/foo"))); // A mount point with an empty path. mount_points->RegisterFileSystem("empty_path", fileapi::kFileSystemTypeNativeLocal, - FilePath(FPL(""))); + base::FilePath(FPL(""))); struct TestCase { - const FilePath::CharType* const local_path; + const base::FilePath::CharType* const local_path; bool success; - const FilePath::CharType* const virtual_path; + const base::FilePath::CharType* const virtual_path; }; const TestCase kTestCases[] = { @@ -209,8 +209,8 @@ TEST(ExternalMountPointsTest, GetVirtualPath) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { // Initialize virtual path with a value. - FilePath virtual_path(DRIVE FPL("/mount")); - FilePath local_path(kTestCases[i].local_path); + base::FilePath virtual_path(DRIVE FPL("/mount")); + base::FilePath local_path(kTestCases[i].local_path); EXPECT_EQ(kTestCases[i].success, mount_points->GetVirtualPath(local_path, &virtual_path)) << "Resolving " << kTestCases[i].local_path; @@ -220,7 +220,7 @@ TEST(ExternalMountPointsTest, GetVirtualPath) { if (!kTestCases[i].success) continue; - FilePath expected_virtual_path(kTestCases[i].virtual_path); + base::FilePath expected_virtual_path(kTestCases[i].virtual_path); EXPECT_EQ(expected_virtual_path.NormalizePathSeparators(), virtual_path) << "Resolving " << kTestCases[i].local_path; } @@ -231,7 +231,7 @@ TEST(ExternalMountPointsTest, HandlesFileSystemMountType) { fileapi::ExternalMountPoints::CreateRefCounted()); const GURL test_origin("http://chromium.org"); - const FilePath test_path(FPL("/mount")); + const base::FilePath test_path(FPL("/mount")); // Should handle External File System. EXPECT_TRUE(mount_points->HandlesFileSystemMountType( @@ -265,16 +265,16 @@ TEST(ExternalMountPointsTest, CreateCrackedFileSystemURL) { mount_points->RegisterFileSystem("c", fileapi::kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/a/b/c"))); + base::FilePath(DRIVE FPL("/a/b/c"))); mount_points->RegisterFileSystem("c(1)", fileapi::kFileSystemTypeDrive, - FilePath(DRIVE FPL("/a/b/c(1)"))); + base::FilePath(DRIVE FPL("/a/b/c(1)"))); mount_points->RegisterFileSystem("empty_path", fileapi::kFileSystemTypeSyncable, - FilePath(FPL(""))); + base::FilePath(FPL(""))); mount_points->RegisterFileSystem("mount", fileapi::kFileSystemTypeDrive, - FilePath(DRIVE FPL("/root"))); + base::FilePath(DRIVE FPL("/root"))); // Try cracking invalid GURL. FileSystemURL invalid = mount_points->CrackURL(GURL("http://chromium.og")); @@ -282,19 +282,19 @@ TEST(ExternalMountPointsTest, CreateCrackedFileSystemURL) { // Try cracking isolated path. FileSystemURL isolated = mount_points->CreateCrackedFileSystemURL( - kTestOrigin, fileapi::kFileSystemTypeIsolated, FilePath(FPL("c"))); + kTestOrigin, fileapi::kFileSystemTypeIsolated, base::FilePath(FPL("c"))); EXPECT_FALSE(isolated.is_valid()); // Try native local which is not cracked. FileSystemURL native_local = mount_points->CreateCrackedFileSystemURL( - kTestOrigin, fileapi::kFileSystemTypeNativeLocal, FilePath(FPL("c"))); + kTestOrigin, fileapi::kFileSystemTypeNativeLocal, base::FilePath(FPL("c"))); EXPECT_FALSE(native_local.is_valid()); struct TestCase { - const FilePath::CharType* const path; + const base::FilePath::CharType* const path; bool expect_valid; fileapi::FileSystemType expect_type; - const FilePath::CharType* const expect_path; + const base::FilePath::CharType* const expect_path; const char* const expect_fs_id; }; @@ -343,7 +343,7 @@ TEST(ExternalMountPointsTest, CreateCrackedFileSystemURL) { FileSystemURL cracked = mount_points->CreateCrackedFileSystemURL( kTestOrigin, fileapi::kFileSystemTypeExternal, - FilePath(kTestCases[i].path)); + base::FilePath(kTestCases[i].path)); EXPECT_EQ(kTestCases[i].expect_valid, cracked.is_valid()) << "Test case index: " << i; @@ -355,10 +355,10 @@ TEST(ExternalMountPointsTest, CreateCrackedFileSystemURL) { << "Test case index: " << i; EXPECT_EQ(kTestCases[i].expect_type, cracked.type()) << "Test case index: " << i; - EXPECT_EQ(FilePath(kTestCases[i].expect_path).NormalizePathSeparators(), + EXPECT_EQ(base::FilePath(kTestCases[i].expect_path).NormalizePathSeparators(), cracked.path()) << "Test case index: " << i; - EXPECT_EQ(FilePath(kTestCases[i].path).NormalizePathSeparators(), + EXPECT_EQ(base::FilePath(kTestCases[i].path).NormalizePathSeparators(), cracked.virtual_path()) << "Test case index: " << i; EXPECT_EQ(kTestCases[i].expect_fs_id, cracked.filesystem_id()) @@ -376,22 +376,22 @@ TEST(ExternalMountPointsTest, CrackVirtualPath) { mount_points->RegisterFileSystem("c", fileapi::kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/a/b/c"))); + base::FilePath(DRIVE FPL("/a/b/c"))); mount_points->RegisterFileSystem("c(1)", fileapi::kFileSystemTypeDrive, - FilePath(DRIVE FPL("/a/b/c(1)"))); + base::FilePath(DRIVE FPL("/a/b/c(1)"))); mount_points->RegisterFileSystem("empty_path", fileapi::kFileSystemTypeSyncable, - FilePath(FPL(""))); + base::FilePath(FPL(""))); mount_points->RegisterFileSystem("mount", fileapi::kFileSystemTypeDrive, - FilePath(DRIVE FPL("/root"))); + base::FilePath(DRIVE FPL("/root"))); struct TestCase { - const FilePath::CharType* const path; + const base::FilePath::CharType* const path; bool expect_valid; fileapi::FileSystemType expect_type; - const FilePath::CharType* const expect_path; + const base::FilePath::CharType* const expect_path; const char* const expect_name; }; @@ -439,9 +439,9 @@ TEST(ExternalMountPointsTest, CrackVirtualPath) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { std::string cracked_name; fileapi::FileSystemType cracked_type; - FilePath cracked_path; + base::FilePath cracked_path; EXPECT_EQ(kTestCases[i].expect_valid, - mount_points->CrackVirtualPath(FilePath(kTestCases[i].path), + mount_points->CrackVirtualPath(base::FilePath(kTestCases[i].path), &cracked_name, &cracked_type, &cracked_path)) << "Test case index: " << i; @@ -450,7 +450,7 @@ TEST(ExternalMountPointsTest, CrackVirtualPath) { EXPECT_EQ(kTestCases[i].expect_type, cracked_type) << "Test case index: " << i; - EXPECT_EQ(FilePath(kTestCases[i].expect_path).NormalizePathSeparators(), + EXPECT_EQ(base::FilePath(kTestCases[i].expect_path).NormalizePathSeparators(), cracked_path) << "Test case index: " << i; EXPECT_EQ(kTestCases[i].expect_name, cracked_name) diff --git a/webkit/fileapi/file_system_callback_dispatcher.h b/webkit/fileapi/file_system_callback_dispatcher.h index af0a757..990e633 100644 --- a/webkit/fileapi/file_system_callback_dispatcher.h +++ b/webkit/fileapi/file_system_callback_dispatcher.h @@ -30,7 +30,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemCallbackDispatcher { // Callback to report information for a file. virtual void DidReadMetadata( const base::PlatformFileInfo& file_info, - const FilePath& platform_path) = 0; + const base::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_context.cc b/webkit/fileapi/file_system_context.cc index 67cbc6d..ab8c929 100644 --- a/webkit/fileapi/file_system_context.cc +++ b/webkit/fileapi/file_system_context.cc @@ -58,7 +58,7 @@ FileSystemContext::FileSystemContext( ExternalMountPoints* external_mount_points, quota::SpecialStoragePolicy* special_storage_policy, quota::QuotaManagerProxy* quota_manager_proxy, - const FilePath& partition_path, + const base::FilePath& partition_path, const FileSystemOptions& options) : task_runners_(task_runners.Pass()), quota_manager_proxy_(quota_manager_proxy), @@ -322,7 +322,7 @@ FileSystemURL FileSystemContext::CrackURL(const GURL& url) const { FileSystemURL FileSystemContext::CreateCrackedFileSystemURL( const GURL& origin, FileSystemType type, - const FilePath& path) const { + const base::FilePath& path) const { return CrackFileSystemURL(FileSystemURL(origin, type, path)); } diff --git a/webkit/fileapi/file_system_context.h b/webkit/fileapi/file_system_context.h index c5db158..ec9fc6e 100644 --- a/webkit/fileapi/file_system_context.h +++ b/webkit/fileapi/file_system_context.h @@ -19,7 +19,9 @@ #include "webkit/fileapi/task_runner_bound_observer_list.h" #include "webkit/storage/webkit_storage_export.h" +namespace base { class FilePath; +} namespace quota { class QuotaManagerProxy; @@ -75,7 +77,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemContext ExternalMountPoints* external_mount_points, quota::SpecialStoragePolicy* special_storage_policy, quota::QuotaManagerProxy* quota_manager_proxy, - const FilePath& partition_path, + const base::FilePath& partition_path, const FileSystemOptions& options); bool DeleteDataForOriginOnFileThread(const GURL& origin_url); @@ -186,7 +188,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemContext LocalFileSyncContext* sync_context() { return sync_context_.get(); } void set_sync_context(LocalFileSyncContext* sync_context); - const FilePath& partition_path() const { return partition_path_; } + const base::FilePath& partition_path() const { return partition_path_; } // Same as |CrackFileSystemURL|, but cracks FileSystemURL created from |url|. FileSystemURL CrackURL(const GURL& url) const; @@ -194,7 +196,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemContext // arguments. FileSystemURL CreateCrackedFileSystemURL(const GURL& origin, FileSystemType type, - const FilePath& path) const; + const base::FilePath& path) const; private: // Friended for GetFileUtil. @@ -257,7 +259,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemContext std::vector<MountPoints*> url_crackers_; // The base path of the storage partition for this context. - const FilePath partition_path_; + const base::FilePath partition_path_; // For syncable file systems. scoped_ptr<LocalFileChangeTracker> change_tracker_; diff --git a/webkit/fileapi/file_system_context_unittest.cc b/webkit/fileapi/file_system_context_unittest.cc index 5155636..0c13501 100644 --- a/webkit/fileapi/file_system_context_unittest.cc +++ b/webkit/fileapi/file_system_context_unittest.cc @@ -28,7 +28,7 @@ namespace fileapi { namespace { const char kTestOrigin[] = "http://chromium.org/"; -const FilePath::CharType kVirtualPathNoRoot[] = FPL("root/file"); +const base::FilePath::CharType kVirtualPathNoRoot[] = FPL("root/file"); GURL CreateRawFileSystemURL(const std::string& type_str, const std::string& fs_id) { @@ -73,8 +73,8 @@ class FileSystemContextTest : public testing::Test { const GURL& expect_origin, FileSystemType expect_mount_type, FileSystemType expect_type, - const FilePath& expect_path, - const FilePath& expect_virtual_path, + const base::FilePath& expect_path, + const base::FilePath& expect_virtual_path, const std::string& expect_filesystem_id) { EXPECT_TRUE(url.is_valid()); @@ -105,13 +105,13 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) { std::string isolated_id = IsolatedContext::GetInstance()->RegisterFileSystemForPath( kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/isolated/root")), + base::FilePath(DRIVE FPL("/test/isolated/root")), &isolated_name); // Register system external mount point. ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( "system", kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/sys/")))); + base::FilePath(DRIVE FPL("/test/sys/")))); FileSystemURL cracked_isolated = file_system_context->CrackURL( CreateRawFileSystemURL("isolated", isolated_id)); @@ -121,8 +121,8 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) { GURL(kTestOrigin), kFileSystemTypeIsolated, kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/isolated/root/file")).NormalizePathSeparators(), - FilePath::FromUTF8Unsafe(isolated_id).Append(FPL("root/file")). + base::FilePath(DRIVE FPL("/test/isolated/root/file")).NormalizePathSeparators(), + base::FilePath::FromUTF8Unsafe(isolated_id).Append(FPL("root/file")). NormalizePathSeparators(), isolated_id); @@ -134,8 +134,8 @@ TEST_F(FileSystemContextTest, NullExternalMountPoints) { GURL(kTestOrigin), kFileSystemTypeExternal, kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(), - FilePath(FPL("system/root/file")).NormalizePathSeparators(), + base::FilePath(DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(), + base::FilePath(FPL("system/root/file")).NormalizePathSeparators(), "system"); @@ -152,7 +152,7 @@ TEST_F(FileSystemContextTest, FileSystemContextKeepsMountPointsAlive) { ASSERT_TRUE(mount_points->RegisterFileSystem( "system", kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/sys/")))); + base::FilePath(DRIVE FPL("/test/sys/")))); scoped_refptr<FileSystemContext> file_system_context( CreateFileSystemContextForTest(mount_points.get())); @@ -170,8 +170,8 @@ TEST_F(FileSystemContextTest, FileSystemContextKeepsMountPointsAlive) { GURL(kTestOrigin), kFileSystemTypeExternal, kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(), - FilePath(FPL("system/root/file")).NormalizePathSeparators(), + base::FilePath(DRIVE FPL("/test/sys/root/file")).NormalizePathSeparators(), + base::FilePath(FPL("system/root/file")).NormalizePathSeparators(), "system"); // No need to revoke the registered filesystem since |mount_points| lifetime @@ -189,32 +189,32 @@ TEST_F(FileSystemContextTest, CrackFileSystemURL) { const std::string kIsolatedFileSystemID = IsolatedContext::GetInstance()->RegisterFileSystemForPath( kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/isolated/root")), + base::FilePath(DRIVE FPL("/test/isolated/root")), &isolated_file_system_name); // Register system external mount point. ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( "system", kFileSystemTypeDrive, - FilePath(DRIVE FPL("/test/sys/")))); + base::FilePath(DRIVE FPL("/test/sys/")))); ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( "ext", kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/ext")))); + base::FilePath(DRIVE FPL("/test/ext")))); // Register a system external mount point with the same name/id as the // registered isolated mount point. ASSERT_TRUE(ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( kIsolatedFileSystemID, kFileSystemTypeRestrictedNativeLocal, - FilePath(DRIVE FPL("/test/system/isolated")))); + base::FilePath(DRIVE FPL("/test/system/isolated")))); // Add a mount points with the same name as a system mount point to // FileSystemContext's external mount points. ASSERT_TRUE(external_mount_points->RegisterFileSystem( "ext", kFileSystemTypeNativeLocal, - FilePath(DRIVE FPL("/test/local/ext/")))); + base::FilePath(DRIVE FPL("/test/local/ext/")))); const GURL kTestOrigin = GURL("http://chromium.org/"); - const FilePath kVirtualPathNoRoot = FilePath(FPL("root/file")); + const base::FilePath kVirtualPathNoRoot = base::FilePath(FPL("root/file")); struct TestCase { // Test case values. @@ -225,7 +225,7 @@ TEST_F(FileSystemContextTest, CrackFileSystemURL) { bool expect_is_valid; FileSystemType expect_mount_type; FileSystemType expect_type; - const FilePath::CharType* expect_path; + const base::FilePath::CharType* expect_path; bool expect_virtual_path_empty; std::string expect_filesystem_id; }; @@ -290,8 +290,8 @@ TEST_F(FileSystemContextTest, CrackFileSystemURL) { }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); ++i) { - const FilePath virtual_path = - FilePath::FromUTF8Unsafe(kTestCases[i].root).Append(kVirtualPathNoRoot); + const base::FilePath virtual_path = + base::FilePath::FromUTF8Unsafe(kTestCases[i].root).Append(kVirtualPathNoRoot); GURL raw_url = CreateRawFileSystemURL(kTestCases[i].type_str, kTestCases[i].root); @@ -309,14 +309,14 @@ TEST_F(FileSystemContextTest, CrackFileSystemURL) { GURL(kTestOrigin), kTestCases[i].expect_mount_type, kTestCases[i].expect_type, - FilePath(kTestCases[i].expect_path).NormalizePathSeparators(), + base::FilePath(kTestCases[i].expect_path).NormalizePathSeparators(), kTestCases[i].expect_virtual_path_empty ? - FilePath() : virtual_path.NormalizePathSeparators(), + base::FilePath() : virtual_path.NormalizePathSeparators(), kTestCases[i].expect_filesystem_id); } IsolatedContext::GetInstance()->RevokeFileSystemByPath( - FilePath(DRIVE FPL("/test/isolated/root"))); + base::FilePath(DRIVE FPL("/test/isolated/root"))); ExternalMountPoints::GetSystemInstance()->RevokeFileSystem("system"); ExternalMountPoints::GetSystemInstance()->RevokeFileSystem("ext"); ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( diff --git a/webkit/fileapi/file_system_database_test_helper.cc b/webkit/fileapi/file_system_database_test_helper.cc index 838173a..da1a5e1 100644 --- a/webkit/fileapi/file_system_database_test_helper.cc +++ b/webkit/fileapi/file_system_database_test_helper.cc @@ -15,15 +15,15 @@ namespace fileapi { -void CorruptDatabase(const FilePath& db_path, +void CorruptDatabase(const base::FilePath& db_path, leveldb::FileType type, ptrdiff_t offset, size_t size) { file_util::FileEnumerator file_enum(db_path, false /* not recursive */, file_util::FileEnumerator::DIRECTORIES | file_util::FileEnumerator::FILES); - FilePath file_path; - FilePath picked_file_path; + base::FilePath file_path; + base::FilePath picked_file_path; uint64 picked_file_number = kuint64max; while (!(file_path = file_enum.Next()).empty()) { diff --git a/webkit/fileapi/file_system_database_test_helper.h b/webkit/fileapi/file_system_database_test_helper.h index 87e35e0..67689c1 100644 --- a/webkit/fileapi/file_system_database_test_helper.h +++ b/webkit/fileapi/file_system_database_test_helper.h @@ -9,11 +9,13 @@ #include "third_party/leveldatabase/src/db/filename.h" +namespace base { class FilePath; +} namespace fileapi { -void CorruptDatabase(const FilePath& db_path, +void CorruptDatabase(const base::FilePath& db_path, leveldb::FileType type, ptrdiff_t offset, size_t size); diff --git a/webkit/fileapi/file_system_dir_url_request_job.cc b/webkit/fileapi/file_system_dir_url_request_job.cc index e1031df..5943bcd 100644 --- a/webkit/fileapi/file_system_dir_url_request_job.cc +++ b/webkit/fileapi/file_system_dir_url_request_job.cc @@ -108,9 +108,9 @@ void FileSystemDirURLRequestJob::DidReadDirectory( return; if (data_.empty()) { - FilePath relative_path = url_.path(); + base::FilePath relative_path = url_.path(); #if defined(OS_POSIX) - relative_path = FilePath(FILE_PATH_LITERAL("/") + relative_path.value()); + relative_path = base::FilePath(FILE_PATH_LITERAL("/") + relative_path.value()); #endif const string16& title = relative_path.LossyDisplayName(); data_.append(net::GetDirectoryListingHeader(title)); @@ -118,7 +118,7 @@ void FileSystemDirURLRequestJob::DidReadDirectory( typedef std::vector<base::FileUtilProxy::Entry>::const_iterator EntryIterator; for (EntryIterator it = entries.begin(); it != entries.end(); ++it) { - const string16& name = FilePath(it->name).LossyDisplayName(); + const string16& name = base::FilePath(it->name).LossyDisplayName(); data_.append(net::GetDirectoryListingEntry( name, std::string(), it->is_directory, it->size, it->last_modified_time)); diff --git a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc index 0af56c4..b825c61 100644 --- a/webkit/fileapi/file_system_dir_url_request_job_unittest.cc +++ b/webkit/fileapi/file_system_dir_url_request_job_unittest.cc @@ -106,7 +106,7 @@ class FileSystemDirURLRequestJobTest : public testing::Test { TestRequestHelper(url, false); } - FileSystemURL CreateURL(const FilePath& file_path) { + FileSystemURL CreateURL(const base::FilePath& file_path) { return file_system_context_->CreateCrackedFileSystemURL( GURL("http://remote"), fileapi::kFileSystemTypeTemporary, @@ -121,7 +121,7 @@ class FileSystemDirURLRequestJobTest : public testing::Test { } void CreateDirectory(const base::StringPiece& dir_name) { - FilePath path = FilePath().AppendASCII(dir_name); + base::FilePath path = base::FilePath().AppendASCII(dir_name); scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->CreateDirectory( context.get(), @@ -131,22 +131,22 @@ class FileSystemDirURLRequestJobTest : public testing::Test { } void EnsureFileExists(const base::StringPiece file_name) { - FilePath path = FilePath().AppendASCII(file_name); + base::FilePath path = base::FilePath().AppendASCII(file_name); scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->EnsureFileExists( context.get(), CreateURL(path), NULL)); } void TruncateFile(const base::StringPiece file_name, int64 length) { - FilePath path = FilePath().AppendASCII(file_name); + base::FilePath path = base::FilePath().AppendASCII(file_name); scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->Truncate( context.get(), CreateURL(path), length)); } - base::PlatformFileError GetFileInfo(const FilePath& path, + base::PlatformFileError GetFileInfo(const base::FilePath& path, base::PlatformFileInfo* file_info, - FilePath* platform_file_path) { + base::FilePath* platform_file_path) { scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); return file_util()->GetFileInfo(context.get(), CreateURL(path), diff --git a/webkit/fileapi/file_system_directory_database.cc b/webkit/fileapi/file_system_directory_database.cc index 6dea063..900ef57 100644 --- a/webkit/fileapi/file_system_directory_database.cc +++ b/webkit/fileapi/file_system_directory_database.cc @@ -33,7 +33,7 @@ bool PickleFromFileInfo( std::string name; data_path = fileapi::FilePathToString(info.data_path); - name = fileapi::FilePathToString(FilePath(info.name)); + name = fileapi::FilePathToString(base::FilePath(info.name)); if (pickle->WriteInt64(info.parent_id) && pickle->WriteString(data_path) && @@ -66,7 +66,7 @@ bool FileInfoFromPickle( return false; } -const FilePath::CharType kDirectoryDatabaseName[] = FILE_PATH_LITERAL("Paths"); +const base::FilePath::CharType kDirectoryDatabaseName[] = FILE_PATH_LITERAL("Paths"); const char kChildLookupPrefix[] = "CHILD_OF:"; const char kChildLookupSeparator[] = ":"; const char kLastFileIdKey[] = "LAST_FILE_ID"; @@ -84,9 +84,9 @@ enum InitStatus { std::string GetChildLookupKey( fileapi::FileSystemDirectoryDatabase::FileId parent_id, - const FilePath::StringType& child_name) { + const base::FilePath::StringType& child_name) { std::string name; - name = fileapi::FilePathToString(FilePath(child_name)); + name = fileapi::FilePathToString(base::FilePath(child_name)); return std::string(kChildLookupPrefix) + base::Int64ToString(parent_id) + std::string(kChildLookupSeparator) + name; } @@ -129,7 +129,7 @@ class DatabaseCheckHelper { DatabaseCheckHelper(fileapi::FileSystemDirectoryDatabase* dir_db, leveldb::DB* db, - const FilePath& path); + const base::FilePath& path); bool IsFileSystemConsistent() { return IsDatabaseEmpty() || @@ -147,9 +147,9 @@ class DatabaseCheckHelper { fileapi::FileSystemDirectoryDatabase* dir_db_; leveldb::DB* db_; - FilePath path_; + base::FilePath path_; - std::set<FilePath> files_in_db_; + std::set<base::FilePath> files_in_db_; size_t num_directories_in_db_; size_t num_files_in_db_; @@ -162,7 +162,7 @@ class DatabaseCheckHelper { DatabaseCheckHelper::DatabaseCheckHelper( fileapi::FileSystemDirectoryDatabase* dir_db, leveldb::DB* db, - const FilePath& path) + const base::FilePath& path) : dir_db_(dir_db), db_(db), path_(path), num_directories_in_db_(0), num_files_in_db_(0), @@ -260,17 +260,17 @@ bool DatabaseCheckHelper::ScanDatabase() { bool DatabaseCheckHelper::ScanDirectory() { // TODO(kinuko): Scans all local file system entries to verify each of them // has a database entry. - const FilePath kExcludes[] = { - FilePath(kDirectoryDatabaseName), - FilePath(fileapi::FileSystemUsageCache::kUsageFileName), + const base::FilePath kExcludes[] = { + base::FilePath(kDirectoryDatabaseName), + base::FilePath(fileapi::FileSystemUsageCache::kUsageFileName), }; // Any path in |pending_directories| is relative to |path_|. - std::stack<FilePath> pending_directories; - pending_directories.push(FilePath()); + std::stack<base::FilePath> pending_directories; + pending_directories.push(base::FilePath()); while (!pending_directories.empty()) { - FilePath dir_path = pending_directories.top(); + base::FilePath dir_path = pending_directories.top(); pending_directories.pop(); file_util::FileEnumerator file_enum( @@ -279,12 +279,12 @@ bool DatabaseCheckHelper::ScanDirectory() { file_util::FileEnumerator::DIRECTORIES | file_util::FileEnumerator::FILES); - FilePath absolute_file_path; + base::FilePath absolute_file_path; while (!(absolute_file_path = file_enum.Next()).empty()) { file_util::FileEnumerator::FindInfo find_info; file_enum.GetFindInfo(&find_info); - FilePath relative_file_path; + base::FilePath relative_file_path; if (!path_.AppendRelativePath(absolute_file_path, &relative_file_path)) return false; @@ -298,7 +298,7 @@ bool DatabaseCheckHelper::ScanDirectory() { } // Check if the file has a database entry. - std::set<FilePath>::iterator itr = files_in_db_.find(relative_file_path); + std::set<base::FilePath>::iterator itr = files_in_db_.find(relative_file_path); if (itr == files_in_db_.end()) { if (!file_util::Delete(absolute_file_path, false)) return false; @@ -373,15 +373,15 @@ bool DatabaseCheckHelper::ScanHierarchy() { // and does not refer to special system files. // This is called in GetFileInfo, AddFileInfo and UpdateFileInfo to // ensure we're only dealing with valid data paths. -bool VerifyDataPath(const FilePath& data_path) { +bool VerifyDataPath(const base::FilePath& data_path) { // |data_path| should not contain any ".." and should be a relative path // (to the filesystem_data_directory_). if (data_path.ReferencesParent() || data_path.IsAbsolute()) return false; // See if it's not pointing to the special system paths. - const FilePath kExcludes[] = { - FilePath(kDirectoryDatabaseName), - FilePath(fileapi::FileSystemUsageCache::kUsageFileName), + const base::FilePath kExcludes[] = { + base::FilePath(kDirectoryDatabaseName), + base::FilePath(fileapi::FileSystemUsageCache::kUsageFileName), }; for (size_t i = 0; i < arraysize(kExcludes); ++i) { if (data_path == kExcludes[i] || kExcludes[i].IsParent(data_path)) @@ -401,7 +401,7 @@ FileSystemDirectoryDatabase::FileInfo::~FileInfo() { } FileSystemDirectoryDatabase::FileSystemDirectoryDatabase( - const FilePath& filesystem_data_directory) + const base::FilePath& filesystem_data_directory) : filesystem_data_directory_(filesystem_data_directory) { } @@ -409,7 +409,7 @@ FileSystemDirectoryDatabase::~FileSystemDirectoryDatabase() { } bool FileSystemDirectoryDatabase::GetChildWithName( - FileId parent_id, const FilePath::StringType& name, FileId* child_id) { + FileId parent_id, const base::FilePath::StringType& name, FileId* child_id) { if (!Init(REPAIR_ON_CORRUPTION)) return false; DCHECK(child_id); @@ -431,13 +431,13 @@ bool FileSystemDirectoryDatabase::GetChildWithName( } bool FileSystemDirectoryDatabase::GetFileWithPath( - const FilePath& path, FileId* file_id) { - std::vector<FilePath::StringType> components; + const base::FilePath& path, FileId* file_id) { + std::vector<base::FilePath::StringType> components; VirtualPath::GetComponents(path, &components); FileId local_id = 0; - std::vector<FilePath::StringType>::iterator iter; + std::vector<base::FilePath::StringType>::iterator iter; for (iter = components.begin(); iter != components.end(); ++iter) { - FilePath::StringType name; + base::FilePath::StringType name; name = *iter; if (name == FILE_PATH_LITERAL("/")) continue; @@ -497,8 +497,8 @@ bool FileSystemDirectoryDatabase::GetFileInfo(FileId file_id, FileInfo* info) { // Without this, a query for the root's file info, made before creating the // first file in the database, will fail and confuse callers. if (status.IsNotFound() && !file_id) { - info->name = FilePath::StringType(); - info->data_path = FilePath(); + info->name = base::FilePath::StringType(); + info->data_path = base::FilePath(); info->modification_time = base::Time::Now(); info->parent_id = 0; return true; @@ -686,7 +686,7 @@ bool FileSystemDirectoryDatabase::GetNextInteger(int64* next) { } // static -bool FileSystemDirectoryDatabase::DestroyDatabase(const FilePath& path) { +bool FileSystemDirectoryDatabase::DestroyDatabase(const base::FilePath& path) { std::string name = FilePathToString(path.Append(kDirectoryDatabaseName)); leveldb::Status status = leveldb::DestroyDB(name, leveldb::Options()); if (status.ok()) diff --git a/webkit/fileapi/file_system_directory_database.h b/webkit/fileapi/file_system_directory_database.h index c411f49..5ab9ec1 100644 --- a/webkit/fileapi/file_system_directory_database.h +++ b/webkit/fileapi/file_system_directory_database.h @@ -47,8 +47,8 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemDirectoryDatabase { } FileId parent_id; - FilePath data_path; - FilePath::StringType name; + base::FilePath data_path; + base::FilePath::StringType name; // This modification time is valid only for directories, not files, as // FileWriter will get the files out of sync. // For files, look at the modification time of the underlying data_path. @@ -56,12 +56,12 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemDirectoryDatabase { }; explicit FileSystemDirectoryDatabase( - const FilePath& filesystem_data_directory); + const base::FilePath& filesystem_data_directory); ~FileSystemDirectoryDatabase(); bool GetChildWithName( - FileId parent_id, const FilePath::StringType& name, FileId* child_id); - bool GetFileWithPath(const FilePath& path, FileId* file_id); + FileId parent_id, const base::FilePath::StringType& name, FileId* child_id); + bool GetFileWithPath(const base::FilePath& path, FileId* file_id); // ListChildren will succeed, returning 0 children, if parent_id doesn't // exist. bool ListChildren(FileId parent_id, std::vector<FileId>* children); @@ -88,7 +88,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemDirectoryDatabase { // Returns true if the database looks consistent with local filesystem. bool IsFileSystemConsistent(); - static bool DestroyDatabase(const FilePath& path); + static bool DestroyDatabase(const base::FilePath& path); private: enum RecoveryOption { @@ -111,7 +111,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemDirectoryDatabase { void HandleError(const tracked_objects::Location& from_here, const leveldb::Status& status); - const FilePath filesystem_data_directory_; + const base::FilePath filesystem_data_directory_; scoped_ptr<leveldb::DB> db_; base::Time last_reported_time_; DISALLOW_COPY_AND_ASSIGN(FileSystemDirectoryDatabase); diff --git a/webkit/fileapi/file_system_directory_database_unittest.cc b/webkit/fileapi/file_system_directory_database_unittest.cc index d5c31ae..3f15e7e 100644 --- a/webkit/fileapi/file_system_directory_database_unittest.cc +++ b/webkit/fileapi/file_system_directory_database_unittest.cc @@ -23,7 +23,7 @@ namespace fileapi { namespace { -const FilePath::CharType kDirectoryDatabaseName[] = FPL("Paths"); +const base::FilePath::CharType kDirectoryDatabaseName[] = FPL("Paths"); } class FileSystemDirectoryDatabaseTest : public testing::Test { @@ -51,7 +51,7 @@ class FileSystemDirectoryDatabaseTest : public testing::Test { db_.reset(); } - bool AddFileInfo(FileId parent_id, const FilePath::StringType& name) { + bool AddFileInfo(FileId parent_id, const base::FilePath::StringType& name) { FileId file_id; FileInfo info; info.parent_id = parent_id; @@ -60,7 +60,7 @@ class FileSystemDirectoryDatabaseTest : public testing::Test { } void CreateDirectory(FileId parent_id, - const FilePath::StringType& name, + const base::FilePath::StringType& name, FileId* file_id_out) { FileInfo info; info.parent_id = parent_id; @@ -69,18 +69,18 @@ class FileSystemDirectoryDatabaseTest : public testing::Test { } void CreateFile(FileId parent_id, - const FilePath::StringType& name, - const FilePath::StringType& data_path, + const base::FilePath::StringType& name, + const base::FilePath::StringType& data_path, FileId* file_id_out) { FileId file_id; FileInfo info; info.parent_id = parent_id; info.name = name; - info.data_path = FilePath(data_path).NormalizePathSeparators(); + info.data_path = base::FilePath(data_path).NormalizePathSeparators(); ASSERT_TRUE(db_->AddFileInfo(info, &file_id)); - FilePath local_path = path().Append(data_path); + base::FilePath local_path = path().Append(data_path); if (!file_util::DirectoryExists(local_path.DirName())) ASSERT_TRUE(file_util::CreateDirectory(local_path.DirName())); @@ -110,18 +110,18 @@ class FileSystemDirectoryDatabaseTest : public testing::Test { FilePathToString(path().Append(kDirectoryDatabaseName))); } - const FilePath& path() { + const base::FilePath& path() { return base_.path(); } // Makes link from |parent_id| to |child_id| with |name|. void MakeHierarchyLink(FileId parent_id, FileId child_id, - const FilePath::StringType& name) { + const base::FilePath::StringType& name) { ASSERT_TRUE(db()->db_->Put( leveldb::WriteOptions(), "CHILD_OF:" + base::Int64ToString(parent_id) + ":" + - FilePathToString(FilePath(name)), + FilePathToString(base::FilePath(name)), base::Int64ToString(child_id)).ok()); } @@ -132,7 +132,7 @@ class FileSystemDirectoryDatabaseTest : public testing::Test { ASSERT_TRUE(db()->db_->Delete( leveldb::WriteOptions(), "CHILD_OF:" + base::Int64ToString(file_info.parent_id) + ":" + - FilePathToString(FilePath(file_info.name))).ok()); + FilePathToString(base::FilePath(file_info.name))).ok()); } protected: @@ -171,7 +171,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestAddNameClash) { EXPECT_TRUE(db()->AddFileInfo(info, &file_id)); // Check for name clash in the root directory. - FilePath::StringType name = info.name; + base::FilePath::StringType name = info.name; EXPECT_FALSE(AddFileInfo(0, name)); name = FILE_PATH_LITERAL("dir 1"); EXPECT_TRUE(AddFileInfo(0, name)); @@ -188,9 +188,9 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestAddNameClash) { TEST_F(FileSystemDirectoryDatabaseTest, TestRenameNoMoveNameClash) { FileInfo info; FileId file_id0; - FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); - FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); - FilePath::StringType name2 = FILE_PATH_LITERAL("bas"); + base::FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); + base::FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); + base::FilePath::StringType name2 = FILE_PATH_LITERAL("bas"); info.parent_id = 0; info.name = name0; EXPECT_TRUE(db()->AddFileInfo(info, &file_id0)); @@ -205,8 +205,8 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestMoveSameNameNameClash) { FileInfo info; FileId file_id0; FileId file_id1; - FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); - FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); + base::FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); + base::FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); info.parent_id = 0; info.name = name0; EXPECT_TRUE(db()->AddFileInfo(info, &file_id0)); @@ -222,9 +222,9 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestMoveRenameNameClash) { FileInfo info; FileId file_id0; FileId file_id1; - FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); - FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); - FilePath::StringType name2 = FILE_PATH_LITERAL("bas"); + base::FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); + base::FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); + base::FilePath::StringType name2 = FILE_PATH_LITERAL("bas"); info.parent_id = 0; info.name = name0; EXPECT_TRUE(db()->AddFileInfo(info, &file_id0)); @@ -260,8 +260,8 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestGetChildWithName) { FileInfo info; FileId file_id0; FileId file_id1; - FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); - FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); + base::FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); + base::FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); info.parent_id = 0; info.name = name0; EXPECT_TRUE(db()->AddFileInfo(info, &file_id0)); @@ -284,9 +284,9 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestGetFileWithPath) { FileId file_id0; FileId file_id1; FileId file_id2; - FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); - FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); - FilePath::StringType name2 = FILE_PATH_LITERAL("dog"); + base::FilePath::StringType name0 = FILE_PATH_LITERAL("foo"); + base::FilePath::StringType name1 = FILE_PATH_LITERAL("bar"); + base::FilePath::StringType name2 = FILE_PATH_LITERAL("dog"); info.parent_id = 0; info.name = name0; @@ -302,7 +302,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestGetFileWithPath) { EXPECT_NE(file_id1, file_id2); FileId check_file_id; - FilePath path = FilePath(name0); + base::FilePath path = base::FilePath(name0); EXPECT_TRUE(db()->GetFileWithPath(path, &check_file_id)); EXPECT_EQ(file_id0, check_file_id); @@ -376,7 +376,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestUpdateModificationTime) { FileId file_id; info0.parent_id = 0; info0.name = FILE_PATH_LITERAL("name"); - info0.data_path = FilePath(FILE_PATH_LITERAL("fake path")); + info0.data_path = base::FilePath(FILE_PATH_LITERAL("fake path")); info0.modification_time = base::Time::Now(); EXPECT_TRUE(db()->AddFileInfo(info0, &file_id)); FileInfo info1; @@ -406,7 +406,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestSimpleFileOperations) { FileInfo info0; EXPECT_FALSE(db()->GetFileInfo(file_id, &info0)); info0.parent_id = 0; - info0.data_path = FilePath(FILE_PATH_LITERAL("foo")); + info0.data_path = base::FilePath(FILE_PATH_LITERAL("foo")); info0.name = FILE_PATH_LITERAL("file name"); info0.modification_time = base::Time::Now(); EXPECT_TRUE(db()->AddFileInfo(info0, &file_id)); @@ -431,7 +431,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestOverwritingMoveFileSrcDirectory) { FileId file_id; FileInfo info1; info1.parent_id = 0; - info1.data_path = FilePath(FILE_PATH_LITERAL("bar")); + info1.data_path = base::FilePath(FILE_PATH_LITERAL("bar")); info1.name = FILE_PATH_LITERAL("file"); info1.modification_time = base::Time::UnixEpoch(); EXPECT_TRUE(db()->AddFileInfo(info1, &file_id)); @@ -444,7 +444,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestOverwritingMoveFileDestDirectory) { FileInfo info0; info0.parent_id = 0; info0.name = FILE_PATH_LITERAL("file"); - info0.data_path = FilePath(FILE_PATH_LITERAL("bar")); + info0.data_path = base::FilePath(FILE_PATH_LITERAL("bar")); info0.modification_time = base::Time::Now(); EXPECT_TRUE(db()->AddFileInfo(info0, &file_id)); @@ -462,7 +462,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestOverwritingMoveFileSuccess) { FileId file_id0; FileInfo info0; info0.parent_id = 0; - info0.data_path = FilePath(FILE_PATH_LITERAL("foo")); + info0.data_path = base::FilePath(FILE_PATH_LITERAL("foo")); info0.name = FILE_PATH_LITERAL("file name 0"); info0.modification_time = base::Time::Now(); EXPECT_TRUE(db()->AddFileInfo(info0, &file_id0)); @@ -476,7 +476,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestOverwritingMoveFileSuccess) { FileId file_id1; FileInfo info1; info1.parent_id = dir_id; - info1.data_path = FilePath(FILE_PATH_LITERAL("bar")); + info1.data_path = base::FilePath(FILE_PATH_LITERAL("bar")); info1.name = FILE_PATH_LITERAL("file name 1"); info1.modification_time = base::Time::UnixEpoch(); EXPECT_TRUE(db()->AddFileInfo(info1, &file_id1)); @@ -486,9 +486,9 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestOverwritingMoveFileSuccess) { FileInfo check_info; FileId check_id; - EXPECT_FALSE(db()->GetFileWithPath(FilePath(info0.name), &check_id)); + EXPECT_FALSE(db()->GetFileWithPath(base::FilePath(info0.name), &check_id)); EXPECT_TRUE(db()->GetFileWithPath( - FilePath(dir_info.name).Append(info1.name), &check_id)); + base::FilePath(dir_info.name).Append(info1.name), &check_id)); EXPECT_TRUE(db()->GetFileInfo(check_id, &check_info)); EXPECT_EQ(info0.data_path, check_info.data_path); @@ -531,7 +531,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_Consistent) { TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_BackingMultiEntry) { - const FilePath::CharType kBackingFileName[] = FPL("the celeb"); + const base::FilePath::CharType kBackingFileName[] = FPL("the celeb"); CreateFile(0, FPL("foo"), kBackingFileName, NULL); EXPECT_TRUE(db()->IsFileSystemConsistent()); @@ -541,7 +541,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, } TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_FileLost) { - const FilePath::CharType kBackingFileName[] = FPL("hoge"); + const base::FilePath::CharType kBackingFileName[] = FPL("hoge"); CreateFile(0, FPL("foo"), kBackingFileName, NULL); EXPECT_TRUE(db()->IsFileSystemConsistent()); @@ -576,7 +576,7 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_RootLoop) { TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_DirectoryLoop) { FileId dir1_id; FileId dir2_id; - FilePath::StringType dir1_name = FPL("foo"); + base::FilePath::StringType dir1_name = FPL("foo"); CreateDirectory(0, dir1_name, &dir1_id); CreateDirectory(dir1_id, FPL("bar"), &dir2_id); @@ -610,13 +610,13 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestConsistencyCheck_WreckedEntries) { } TEST_F(FileSystemDirectoryDatabaseTest, TestRepairDatabase_Success) { - FilePath::StringType kFileName = FPL("bar"); + base::FilePath::StringType kFileName = FPL("bar"); FileId file_id_prev; CreateFile(0, FPL("foo"), FPL("hoge"), NULL); CreateFile(0, kFileName, FPL("fuga"), &file_id_prev); - const FilePath kDatabaseDirectory = path().Append(kDirectoryDatabaseName); + const base::FilePath kDatabaseDirectory = path().Append(kDirectoryDatabaseName); CloseDatabase(); CorruptDatabase(kDatabaseDirectory, leveldb::kDescriptorFile, 0, std::numeric_limits<size_t>::max()); @@ -631,12 +631,12 @@ TEST_F(FileSystemDirectoryDatabaseTest, TestRepairDatabase_Success) { } TEST_F(FileSystemDirectoryDatabaseTest, TestRepairDatabase_Failure) { - FilePath::StringType kFileName = FPL("bar"); + base::FilePath::StringType kFileName = FPL("bar"); CreateFile(0, FPL("foo"), FPL("hoge"), NULL); CreateFile(0, kFileName, FPL("fuga"), NULL); - const FilePath kDatabaseDirectory = path().Append(kDirectoryDatabaseName); + const base::FilePath kDatabaseDirectory = path().Append(kDirectoryDatabaseName); CloseDatabase(); CorruptDatabase(kDatabaseDirectory, leveldb::kDescriptorFile, 0, std::numeric_limits<size_t>::max()); diff --git a/webkit/fileapi/file_system_file_stream_reader.cc b/webkit/fileapi/file_system_file_stream_reader.cc index cb5f5dd..e5e0299 100644 --- a/webkit/fileapi/file_system_file_stream_reader.cc +++ b/webkit/fileapi/file_system_file_stream_reader.cc @@ -107,7 +107,7 @@ void FileSystemFileStreamReader::DidCreateSnapshot( const net::CompletionCallback& error_callback, base::PlatformFileError file_error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { DCHECK(has_pending_create_snapshot_); DCHECK(!local_file_reader_.get()); diff --git a/webkit/fileapi/file_system_file_stream_reader.h b/webkit/fileapi/file_system_file_stream_reader.h index 5115f72..0a6e750 100644 --- a/webkit/fileapi/file_system_file_stream_reader.h +++ b/webkit/fileapi/file_system_file_stream_reader.h @@ -14,9 +14,8 @@ #include "webkit/fileapi/file_system_url.h" #include "webkit/storage/webkit_storage_export.h" -class FilePath; - namespace base { +class FilePath; class SequencedTaskRunner; } @@ -60,7 +59,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemFileStreamReader const net::CompletionCallback& error_callback, base::PlatformFileError file_error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); scoped_refptr<FileSystemContext> file_system_context_; diff --git a/webkit/fileapi/file_system_file_stream_reader_unittest.cc b/webkit/fileapi/file_system_file_stream_reader_unittest.cc index 55d0b9fd..327cb64 100644 --- a/webkit/fileapi/file_system_file_stream_reader_unittest.cc +++ b/webkit/fileapi/file_system_file_stream_reader_unittest.cc @@ -133,7 +133,7 @@ class FileSystemFileStreamReaderTest : public testing::Test { base::ClosePlatformFile(handle); base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->GetFileInfo(&context, url, &file_info, &platform_path)); @@ -150,7 +150,7 @@ class FileSystemFileStreamReaderTest : public testing::Test { return file_system_context_->CreateCrackedFileSystemURL( GURL(kURLOrigin), kFileSystemTypeTemporary, - FilePath().AppendASCII(file_name)); + base::FilePath().AppendASCII(file_name)); } MessageLoop message_loop_; diff --git a/webkit/fileapi/file_system_file_util.cc b/webkit/fileapi/file_system_file_util.cc index 46b8b02..9d786ef 100644 --- a/webkit/fileapi/file_system_file_util.cc +++ b/webkit/fileapi/file_system_file_util.cc @@ -6,8 +6,8 @@ namespace fileapi { -FilePath FileSystemFileUtil::EmptyFileEnumerator::Next() { - return FilePath(); +base::FilePath FileSystemFileUtil::EmptyFileEnumerator::Next() { + return base::FilePath(); } int64 FileSystemFileUtil::EmptyFileEnumerator::Size() { diff --git a/webkit/fileapi/file_system_file_util.h b/webkit/fileapi/file_system_file_util.h index 5d4b72c..e4e94be 100644 --- a/webkit/fileapi/file_system_file_util.h +++ b/webkit/fileapi/file_system_file_util.h @@ -33,7 +33,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { virtual ~AbstractFileEnumerator() {} // Returns an empty string if there are no more results. - virtual FilePath Next() = 0; + virtual base::FilePath Next() = 0; // These methods return metadata for the file most recently returned by // Next(). If Next() has never been called, or if Next() most recently @@ -46,7 +46,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { class WEBKIT_STORAGE_EXPORT EmptyFileEnumerator : public AbstractFileEnumerator { - virtual FilePath Next() OVERRIDE; + virtual base::FilePath Next() OVERRIDE; virtual int64 Size() OVERRIDE; virtual base::Time LastModifiedTime() OVERRIDE; virtual bool IsDirectory() OVERRIDE; @@ -91,7 +91,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path) = 0; + base::FilePath* platform_path) = 0; // Returns a pointer to a new instance of AbstractFileEnumerator which is // implemented for each FileSystemFileUtil subclass. The instance needs to be @@ -114,7 +114,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { virtual base::PlatformFileError GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_file_path) = 0; + base::FilePath* local_file_path) = 0; // Updates the file metadata information. // See header comments for AsyncFileUtil::Touch() for more details. @@ -154,7 +154,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { // more details. virtual base::PlatformFileError CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) = 0; // Deletes a single file. @@ -178,7 +178,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemFileUtil { FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path, + base::FilePath* platform_path, SnapshotFilePolicy* policy) = 0; protected: diff --git a/webkit/fileapi/file_system_file_util_proxy.cc b/webkit/fileapi/file_system_file_util_proxy.cc index 35c08bf..8ab1c4f 100644 --- a/webkit/fileapi/file_system_file_util_proxy.cc +++ b/webkit/fileapi/file_system_file_util_proxy.cc @@ -79,7 +79,7 @@ class GetFileInfoHelper { private: base::PlatformFileError error_; base::PlatformFileInfo file_info_; - FilePath platform_path_; + base::FilePath platform_path_; FileSystemFileUtil::SnapshotFilePolicy snapshot_policy_; DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); }; @@ -181,7 +181,7 @@ bool FileSystemFileUtilProxy::MoveFileLocal( bool FileSystemFileUtilProxy::CopyInForeignFile( FileSystemOperationContext* context, FileSystemFileUtil* file_util, - const FilePath& src_local_disk_file_path, + const base::FilePath& src_local_disk_file_path, const FileSystemURL& dest_url, const StatusCallback& callback) { return base::PostTaskAndReplyWithResult( diff --git a/webkit/fileapi/file_system_file_util_proxy.h b/webkit/fileapi/file_system_file_util_proxy.h index 3c43e30..c20b8b5 100644 --- a/webkit/fileapi/file_system_file_util_proxy.h +++ b/webkit/fileapi/file_system_file_util_proxy.h @@ -37,7 +37,7 @@ class FileSystemFileUtilProxy { typedef base::Callback< void(base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, FileSystemFileUtil::SnapshotFilePolicy snapshot_policy)> SnapshotFileCallback; @@ -85,7 +85,7 @@ class FileSystemFileUtilProxy { static bool CopyInForeignFile( FileSystemOperationContext* context, FileSystemFileUtil* file_util, - const FilePath& src_local_disk_file_path, + const base::FilePath& src_local_disk_file_path, const FileSystemURL& dest_url, const StatusCallback& callback); diff --git a/webkit/fileapi/file_system_file_util_unittest.cc b/webkit/fileapi/file_system_file_util_unittest.cc index b33b32a..9e12299 100644 --- a/webkit/fileapi/file_system_file_util_unittest.cc +++ b/webkit/fileapi/file_system_file_util_unittest.cc @@ -116,7 +116,7 @@ class FileSystemFileUtilTest : public testing::Test { dest_root.path().Append(test_case.path)); base::PlatformFileInfo dest_file_info; - FilePath data_path; + base::FilePath data_path; context.reset(NewContext(&dest_helper)); EXPECT_EQ(base::PLATFORM_FILE_OK, file_util->GetFileInfo( @@ -140,7 +140,7 @@ class FileSystemFileUtilTest : public testing::Test { FileSystemURL url = src_root.WithPath( src_root.path().Append(test_case.path)); base::PlatformFileInfo src_file_info; - FilePath data_path; + base::FilePath data_path; context.reset(NewContext(&src_helper)); base::PlatformFileError expected_result; if (copy) diff --git a/webkit/fileapi/file_system_mount_point_provider.h b/webkit/fileapi/file_system_mount_point_provider.h index 585b3cd..2e19372 100644 --- a/webkit/fileapi/file_system_mount_point_provider.h +++ b/webkit/fileapi/file_system_mount_point_provider.h @@ -56,7 +56,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemMountPointProvider { // file system url on the file thread. // If |create| is true this may also create the root directory for // the filesystem if it doesn't exist. - virtual FilePath GetFileSystemRootPathOnFileThread( + virtual base::FilePath GetFileSystemRootPathOnFileThread( const FileSystemURL& url, bool create) = 0; @@ -65,7 +65,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemMountPointProvider { // Checks if a given |name| contains any restricted names/chars in it. // Callable on any thread. - virtual bool IsRestrictedFileName(const FilePath& filename) const = 0; + virtual bool IsRestrictedFileName(const base::FilePath& filename) const = 0; // Returns the specialized FileSystemFileUtil for this mount point. // It is ok to return NULL if the filesystem doesn't support synchronous @@ -135,21 +135,21 @@ class ExternalFileSystemMountPointProvider // Returns the list of top level directories that are exposed by this // provider. This list is used to set appropriate child process file access // permissions. - virtual std::vector<FilePath> GetRootDirectories() const = 0; + virtual std::vector<base::FilePath> GetRootDirectories() const = 0; // Grants access to all external file system from extension identified with // |extension_id|. virtual void GrantFullAccessToExtension(const std::string& extension_id) = 0; // Grants access to |virtual_path| from |origin_url|. virtual void GrantFileAccessToExtension( const std::string& extension_id, - const FilePath& virtual_path) = 0; + const base::FilePath& virtual_path) = 0; // Revokes file access from extension identified with |extension_id|. virtual void RevokeAccessForExtension( const std::string& extension_id) = 0; // Gets virtual path by known filesystem path. Returns false when filesystem // path is not exposed by this provider. - virtual bool GetVirtualPath(const FilePath& file_system_path, - FilePath* virtual_path) = 0; + virtual bool GetVirtualPath(const base::FilePath& file_system_path, + base::FilePath* virtual_path) = 0; }; } // namespace fileapi diff --git a/webkit/fileapi/file_system_mount_point_provider_unittest.cc b/webkit/fileapi/file_system_mount_point_provider_unittest.cc index c36aa9b..e3abb47 100644 --- a/webkit/fileapi/file_system_mount_point_provider_unittest.cc +++ b/webkit/fileapi/file_system_mount_point_provider_unittest.cc @@ -88,7 +88,7 @@ const struct RootPathFileURITest { }; const struct CheckValidPathTest { - FilePath::StringType path; + base::FilePath::StringType path; bool expected_valid; } kCheckValidPathTestCases[] = { { FILE_PATH_LITERAL("//tmp/foo.txt"), false, }, @@ -102,7 +102,7 @@ const struct CheckValidPathTest { }; const struct IsRestrictedNameTest { - FilePath::StringType name; + base::FilePath::StringType name; bool expected_dangerous; } kIsRestrictedNameTestCases[] = { // Names that contain strings that used to be restricted, but are now allowed. @@ -193,9 +193,9 @@ const struct IsRestrictedNameTest { }; // For External filesystem. -const FilePath::CharType kMountPoint[] = FILE_PATH_LITERAL("/tmp/testing"); -const FilePath::CharType kRootPath[] = FILE_PATH_LITERAL("/tmp"); -const FilePath::CharType kVirtualPath[] = FILE_PATH_LITERAL("testing"); +const base::FilePath::CharType kMountPoint[] = FILE_PATH_LITERAL("/tmp/testing"); +const base::FilePath::CharType kRootPath[] = FILE_PATH_LITERAL("/tmp"); +const base::FilePath::CharType kVirtualPath[] = FILE_PATH_LITERAL("testing"); } // namespace @@ -222,7 +222,7 @@ class FileSystemMountPointProviderTest : public testing::Test { data_dir_.path(), options); #if defined(OS_CHROMEOS) - FilePath mount_point_path = FilePath(kMountPoint); + base::FilePath mount_point_path = base::FilePath(kMountPoint); external_mount_points->RegisterFileSystem( mount_point_path.BaseName().AsUTF8Unsafe(), kFileSystemTypeNativeLocal, @@ -238,21 +238,21 @@ class FileSystemMountPointProviderTest : public testing::Test { bool GetRootPath(const GURL& origin_url, fileapi::FileSystemType type, bool create, - FilePath* root_path) { - FilePath virtual_path = FilePath(); + base::FilePath* root_path) { + base::FilePath virtual_path = base::FilePath(); if (type == kFileSystemTypeExternal) - virtual_path = FilePath(kVirtualPath); + virtual_path = base::FilePath(kVirtualPath); FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL( origin_url, type, virtual_path); - FilePath returned_root_path = + base::FilePath returned_root_path = provider(type)->GetFileSystemRootPathOnFileThread(url, create); if (root_path) *root_path = returned_root_path; return !returned_root_path.empty(); } - FilePath data_path() const { return data_dir_.path(); } - FilePath file_system_path() const { + base::FilePath data_path() const { return data_dir_.path(); } + base::FilePath file_system_path() const { return data_dir_.path().Append( SandboxMountPointProvider::kFileSystemDirectory); } @@ -272,7 +272,7 @@ class FileSystemMountPointProviderTest : public testing::Test { }; TEST_F(FileSystemMountPointProviderTest, GetRootPathCreateAndExamine) { - std::vector<FilePath> returned_root_path( + std::vector<base::FilePath> returned_root_path( ARRAYSIZE_UNSAFE(kRootPathTestCases)); SetupNewContext(CreateAllowFileAccessOptions()); @@ -281,13 +281,13 @@ TEST_F(FileSystemMountPointProviderTest, GetRootPathCreateAndExamine) { SCOPED_TRACE(testing::Message() << "RootPath (create) #" << i << " " << kRootPathTestCases[i].expected_path); - FilePath root_path; + base::FilePath root_path; EXPECT_TRUE(GetRootPath(GURL(kRootPathTestCases[i].origin_url), kRootPathTestCases[i].type, true /* create */, &root_path)); if (kRootPathTestCases[i].type != kFileSystemTypeExternal) { - FilePath expected = file_system_path().AppendASCII( + base::FilePath expected = file_system_path().AppendASCII( kRootPathTestCases[i].expected_path); EXPECT_EQ(expected.value(), root_path.value()); EXPECT_TRUE(file_util::DirectoryExists(root_path)); @@ -306,7 +306,7 @@ TEST_F(FileSystemMountPointProviderTest, GetRootPathCreateAndExamine) { SCOPED_TRACE(testing::Message() << "RootPath (get) #" << i << " " << kRootPathTestCases[i].expected_path); - FilePath root_path; + base::FilePath root_path; EXPECT_TRUE(GetRootPath(GURL(kRootPathTestCases[i].origin_url), kRootPathTestCases[i].type, false /* create */, &root_path)); @@ -317,18 +317,18 @@ TEST_F(FileSystemMountPointProviderTest, GetRootPathCreateAndExamine) { TEST_F(FileSystemMountPointProviderTest, GetRootPathCreateAndExamineWithNewProvider) { - std::vector<FilePath> returned_root_path( + std::vector<base::FilePath> returned_root_path( ARRAYSIZE_UNSAFE(kRootPathTestCases)); SetupNewContext(CreateAllowFileAccessOptions()); GURL origin_url("http://foo.com:1/"); - FilePath root_path1; + base::FilePath root_path1; EXPECT_TRUE(GetRootPath(origin_url, kFileSystemTypeTemporary, true, &root_path1)); SetupNewContext(CreateDisallowFileAccessOptions()); - FilePath root_path2; + base::FilePath root_path2; EXPECT_TRUE(GetRootPath(origin_url, kFileSystemTypeTemporary, false, &root_path2)); @@ -383,11 +383,11 @@ TEST_F(FileSystemMountPointProviderTest, GetRootPathFileURIWithAllowFlag) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kRootPathFileURITestCases); ++i) { SCOPED_TRACE(testing::Message() << "RootPathFileURI (allow) #" << i << " " << kRootPathFileURITestCases[i].expected_path); - FilePath root_path; + base::FilePath root_path; EXPECT_TRUE(GetRootPath(GURL(kRootPathFileURITestCases[i].origin_url), kRootPathFileURITestCases[i].type, true /* create */, &root_path)); - FilePath expected = file_system_path().AppendASCII( + base::FilePath expected = file_system_path().AppendASCII( kRootPathFileURITestCases[i].expected_path); EXPECT_EQ(expected.value(), root_path.value()); EXPECT_TRUE(file_util::DirectoryExists(root_path)); @@ -399,7 +399,7 @@ TEST_F(FileSystemMountPointProviderTest, IsRestrictedName) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kIsRestrictedNameTestCases); ++i) { SCOPED_TRACE(testing::Message() << "IsRestrictedName #" << i << " " << kIsRestrictedNameTestCases[i].name); - FilePath name(kIsRestrictedNameTestCases[i].name); + base::FilePath name(kIsRestrictedNameTestCases[i].name); EXPECT_EQ(kIsRestrictedNameTestCases[i].expected_dangerous, provider(kFileSystemTypeTemporary)->IsRestrictedFileName(name)); } diff --git a/webkit/fileapi/file_system_operation.h b/webkit/fileapi/file_system_operation.h index 5b23194..21bdf40 100644 --- a/webkit/fileapi/file_system_operation.h +++ b/webkit/fileapi/file_system_operation.h @@ -64,7 +64,7 @@ class FileSystemOperation { typedef base::Callback< void(base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path)> GetMetadataCallback; + const base::FilePath& platform_path)> GetMetadataCallback; // Used for OpenFile(). |result| is the return code of the operation. typedef base::Callback< @@ -107,7 +107,7 @@ class FileSystemOperation { typedef base::Callback< void(base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> SnapshotFileCallback; diff --git a/webkit/fileapi/file_system_origin_database.cc b/webkit/fileapi/file_system_origin_database.cc index 0c9207a..0300da2 100644 --- a/webkit/fileapi/file_system_origin_database.cc +++ b/webkit/fileapi/file_system_origin_database.cc @@ -20,7 +20,8 @@ namespace { -const FilePath::CharType kOriginDatabaseName[] = FILE_PATH_LITERAL("Origins"); +const base::FilePath::CharType kOriginDatabaseName[] = + FILE_PATH_LITERAL("Origins"); const char kOriginKeyPrefix[] = "ORIGIN:"; const char kLastPathKey[] = "LAST_PATH"; const int64 kMinimumReportIntervalHours = 1; @@ -51,7 +52,7 @@ FileSystemOriginDatabase::OriginRecord::OriginRecord() { } FileSystemOriginDatabase::OriginRecord::OriginRecord( - const std::string& origin_in, const FilePath& path_in) + const std::string& origin_in, const base::FilePath& path_in) : origin(origin_in), path(path_in) { } @@ -59,7 +60,7 @@ FileSystemOriginDatabase::OriginRecord::~OriginRecord() { } FileSystemOriginDatabase::FileSystemOriginDatabase( - const FilePath& file_system_directory) + const base::FilePath& file_system_directory) : file_system_directory_(file_system_directory) { } @@ -116,15 +117,15 @@ bool FileSystemOriginDatabase::RepairDatabase(const std::string& db_path) { } // See if the repaired entries match with what we have on disk. - std::set<FilePath> directories; + std::set<base::FilePath> directories; file_util::FileEnumerator file_enum(file_system_directory_, false /* recursive */, file_util::FileEnumerator::DIRECTORIES); - FilePath path_each; + base::FilePath path_each; while (!(path_each = file_enum.Next()).empty()) directories.insert(path_each.BaseName()); - std::set<FilePath>::iterator db_dir_itr = - directories.find(FilePath(kOriginDatabaseName)); + std::set<base::FilePath>::iterator db_dir_itr = + directories.find(base::FilePath(kOriginDatabaseName)); // Make sure we have the database file in its directory and therefore we are // working on the correct path. DCHECK(db_dir_itr != directories.end()); @@ -140,7 +141,7 @@ bool FileSystemOriginDatabase::RepairDatabase(const std::string& db_path) { for (std::vector<OriginRecord>::iterator db_origin_itr = origins.begin(); db_origin_itr != origins.end(); ++db_origin_itr) { - std::set<FilePath>::iterator dir_itr = + std::set<base::FilePath>::iterator dir_itr = directories.find(db_origin_itr->path); if (dir_itr == directories.end()) { if (!RemovePathForOrigin(db_origin_itr->origin)) { @@ -153,7 +154,7 @@ bool FileSystemOriginDatabase::RepairDatabase(const std::string& db_path) { } // Delete any directories not listed in the origins database. - for (std::set<FilePath>::iterator dir_itr = directories.begin(); + for (std::set<base::FilePath>::iterator dir_itr = directories.begin(); dir_itr != directories.end(); ++dir_itr) { if (!file_util::Delete(file_system_directory_.Append(*dir_itr), @@ -214,7 +215,7 @@ bool FileSystemOriginDatabase::HasOriginPath(const std::string& origin) { } bool FileSystemOriginDatabase::GetPathForOrigin( - const std::string& origin, FilePath* directory) { + const std::string& origin, base::FilePath* directory) { if (!Init(REPAIR_ON_CORRUPTION)) return false; DCHECK(directory); @@ -271,7 +272,7 @@ bool FileSystemOriginDatabase::ListAllOrigins( StartsWithASCII(iter->key().ToString(), origin_key_prefix, true)) { std::string origin = iter->key().ToString().substr(origin_key_prefix.length()); - FilePath path = StringToFilePath(iter->value().ToString()); + base::FilePath path = StringToFilePath(iter->value().ToString()); origins->push_back(OriginRecord(origin, path)); iter->Next(); } diff --git a/webkit/fileapi/file_system_origin_database.h b/webkit/fileapi/file_system_origin_database.h index ea71822..98eb212 100644 --- a/webkit/fileapi/file_system_origin_database.h +++ b/webkit/fileapi/file_system_origin_database.h @@ -31,23 +31,23 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOriginDatabase { public: struct WEBKIT_STORAGE_EXPORT_PRIVATE OriginRecord { std::string origin; - FilePath path; + base::FilePath path; OriginRecord(); - OriginRecord(const std::string& origin, const FilePath& path); + OriginRecord(const std::string& origin, const base::FilePath& path); ~OriginRecord(); }; // Only one instance of FileSystemOriginDatabase should exist for a given path // at a given time. - explicit FileSystemOriginDatabase(const FilePath& file_system_directory); + explicit FileSystemOriginDatabase(const base::FilePath& file_system_directory); ~FileSystemOriginDatabase(); bool HasOriginPath(const std::string& origin); // This will produce a unique path and add it to its database, if it's not // already present. - bool GetPathForOrigin(const std::string& origin, FilePath* directory); + bool GetPathForOrigin(const std::string& origin, base::FilePath* directory); // Also returns success if the origin is not found. bool RemovePathForOrigin(const std::string& origin); @@ -71,7 +71,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOriginDatabase { void ReportInitStatus(const leveldb::Status& status); bool GetLastPathNumber(int* number); - FilePath file_system_directory_; + base::FilePath file_system_directory_; scoped_ptr<leveldb::DB> db_; base::Time last_reported_time_; DISALLOW_COPY_AND_ASSIGN(FileSystemOriginDatabase); diff --git a/webkit/fileapi/file_system_origin_database_unittest.cc b/webkit/fileapi/file_system_origin_database_unittest.cc index 695bea8..e3cc8fb 100644 --- a/webkit/fileapi/file_system_origin_database_unittest.cc +++ b/webkit/fileapi/file_system_origin_database_unittest.cc @@ -22,15 +22,15 @@ namespace fileapi { namespace { -const FilePath::CharType kFileSystemDirName[] = +const base::FilePath::CharType kFileSystemDirName[] = FILE_PATH_LITERAL("File System"); -const FilePath::CharType kOriginDatabaseName[] = FILE_PATH_LITERAL("Origins"); +const base::FilePath::CharType kOriginDatabaseName[] = FILE_PATH_LITERAL("Origins"); } // namespace TEST(FileSystemOriginDatabaseTest, BasicTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - const FilePath kFSDir = dir.path().Append(kFileSystemDirName); + const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); EXPECT_FALSE(file_util::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); @@ -41,8 +41,8 @@ TEST(FileSystemOriginDatabaseTest, BasicTest) { // Double-check to make sure that had no side effects. EXPECT_FALSE(database.HasOriginPath(origin)); - FilePath path0; - FilePath path1; + base::FilePath path0; + base::FilePath path1; // Empty strings aren't valid origins. EXPECT_FALSE(database.GetPathForOrigin(std::string(), &path0)); @@ -60,7 +60,7 @@ TEST(FileSystemOriginDatabaseTest, BasicTest) { TEST(FileSystemOriginDatabaseTest, TwoPathTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - const FilePath kFSDir = dir.path().Append(kFileSystemDirName); + const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); EXPECT_FALSE(file_util::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); @@ -71,8 +71,8 @@ TEST(FileSystemOriginDatabaseTest, TwoPathTest) { EXPECT_FALSE(database.HasOriginPath(origin0)); EXPECT_FALSE(database.HasOriginPath(origin1)); - FilePath path0; - FilePath path1; + base::FilePath path0; + base::FilePath path1; EXPECT_TRUE(database.GetPathForOrigin(origin0, &path0)); EXPECT_TRUE(database.HasOriginPath(origin0)); EXPECT_FALSE(database.HasOriginPath(origin1)); @@ -88,7 +88,7 @@ TEST(FileSystemOriginDatabaseTest, TwoPathTest) { TEST(FileSystemOriginDatabaseTest, DropDatabaseTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - const FilePath kFSDir = dir.path().Append(kFileSystemDirName); + const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); EXPECT_FALSE(file_util::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); @@ -97,7 +97,7 @@ TEST(FileSystemOriginDatabaseTest, DropDatabaseTest) { EXPECT_FALSE(database.HasOriginPath(origin)); - FilePath path0; + base::FilePath path0; EXPECT_TRUE(database.GetPathForOrigin(origin, &path0)); EXPECT_TRUE(database.HasOriginPath(origin)); EXPECT_FALSE(path0.empty()); @@ -106,7 +106,7 @@ TEST(FileSystemOriginDatabaseTest, DropDatabaseTest) { database.DropDatabase(); - FilePath path1; + base::FilePath path1; EXPECT_TRUE(database.HasOriginPath(origin)); EXPECT_TRUE(database.GetPathForOrigin(origin, &path1)); EXPECT_FALSE(path1.empty()); @@ -116,7 +116,7 @@ TEST(FileSystemOriginDatabaseTest, DropDatabaseTest) { TEST(FileSystemOriginDatabaseTest, DeleteOriginTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - const FilePath kFSDir = dir.path().Append(kFileSystemDirName); + const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); EXPECT_FALSE(file_util::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); @@ -126,7 +126,7 @@ TEST(FileSystemOriginDatabaseTest, DeleteOriginTest) { EXPECT_FALSE(database.HasOriginPath(origin)); EXPECT_TRUE(database.RemovePathForOrigin(origin)); - FilePath path0; + base::FilePath path0; EXPECT_TRUE(database.GetPathForOrigin(origin, &path0)); EXPECT_TRUE(database.HasOriginPath(origin)); EXPECT_FALSE(path0.empty()); @@ -134,7 +134,7 @@ TEST(FileSystemOriginDatabaseTest, DeleteOriginTest) { EXPECT_TRUE(database.RemovePathForOrigin(origin)); EXPECT_FALSE(database.HasOriginPath(origin)); - FilePath path1; + base::FilePath path1; EXPECT_TRUE(database.GetPathForOrigin(origin, &path1)); EXPECT_FALSE(path1.empty()); EXPECT_NE(path0, path1); @@ -143,7 +143,7 @@ TEST(FileSystemOriginDatabaseTest, DeleteOriginTest) { TEST(FileSystemOriginDatabaseTest, ListOriginsTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - const FilePath kFSDir = dir.path().Append(kFileSystemDirName); + const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); EXPECT_FALSE(file_util::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); @@ -160,8 +160,8 @@ TEST(FileSystemOriginDatabaseTest, ListOriginsTest) { EXPECT_FALSE(database.HasOriginPath(origin0)); EXPECT_FALSE(database.HasOriginPath(origin1)); - FilePath path0; - FilePath path1; + base::FilePath path0; + base::FilePath path1; EXPECT_TRUE(database.GetPathForOrigin(origin0, &path0)); EXPECT_TRUE(database.ListAllOrigins(&origins)); EXPECT_EQ(origins.size(), 1UL); @@ -192,8 +192,8 @@ TEST(FileSystemOriginDatabaseTest, DatabaseRecoveryTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); - const FilePath kFSDir = dir.path().Append(kFileSystemDirName); - const FilePath kDBDir = kFSDir.Append(kOriginDatabaseName); + const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); + const base::FilePath kDBDir = kFSDir.Append(kOriginDatabaseName); EXPECT_FALSE(file_util::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); @@ -208,7 +208,7 @@ TEST(FileSystemOriginDatabaseTest, DatabaseRecoveryTest) { scoped_ptr<FileSystemOriginDatabase> database( new FileSystemOriginDatabase(kFSDir)); for (size_t i = 0; i < arraysize(kOrigins); ++i) { - FilePath path; + base::FilePath path; EXPECT_FALSE(database->HasOriginPath(kOrigins[i])); EXPECT_TRUE(database->GetPathForOrigin(kOrigins[i], &path)); EXPECT_FALSE(path.empty()); @@ -219,8 +219,8 @@ TEST(FileSystemOriginDatabaseTest, DatabaseRecoveryTest) { } database.reset(); - const FilePath kGarbageDir = kFSDir.AppendASCII("foo"); - const FilePath kGarbageFile = kGarbageDir.AppendASCII("bar"); + const base::FilePath kGarbageDir = kFSDir.AppendASCII("foo"); + const base::FilePath kGarbageFile = kGarbageDir.AppendASCII("bar"); EXPECT_TRUE(file_util::CreateDirectory(kGarbageDir)); bool created = false; base::PlatformFileError error; @@ -239,7 +239,7 @@ TEST(FileSystemOriginDatabaseTest, DatabaseRecoveryTest) { 0, std::numeric_limits<size_t>::max()); CorruptDatabase(kDBDir, leveldb::kLogFile, -1, 1); - FilePath path; + base::FilePath path; database.reset(new FileSystemOriginDatabase(kFSDir)); std::vector<FileSystemOriginDatabase::OriginRecord> origins_in_db; EXPECT_TRUE(database->ListAllOrigins(&origins_in_db)); diff --git a/webkit/fileapi/file_system_quota_client_unittest.cc b/webkit/fileapi/file_system_quota_client_unittest.cc index ae858e0..8859ddd 100644 --- a/webkit/fileapi/file_system_quota_client_unittest.cc +++ b/webkit/fileapi/file_system_quota_client_unittest.cc @@ -129,7 +129,7 @@ class FileSystemQuotaClientTest : public testing::Test { return context; } - bool CreateFileSystemDirectory(const FilePath& file_path, + bool CreateFileSystemDirectory(const base::FilePath& file_path, const std::string& origin_url, quota::StorageType storage_type) { FileSystemType type = QuotaStorageTypeToFileSystemType(storage_type); @@ -147,7 +147,7 @@ class FileSystemQuotaClientTest : public testing::Test { return true; } - bool CreateFileSystemFile(const FilePath& file_path, + bool CreateFileSystemFile(const base::FilePath& file_path, int64 file_size, const std::string& origin_url, quota::StorageType storage_type) { @@ -178,7 +178,7 @@ class FileSystemQuotaClientTest : public testing::Test { const TestFile* files, int num_files) { for (int i = 0; i < num_files; i++) { - FilePath path = FilePath().AppendASCII(files[i].name); + base::FilePath path = base::FilePath().AppendASCII(files[i].name); if (files[i].isDirectory) { ASSERT_TRUE(CreateFileSystemDirectory( path, files[i].origin_url, files[i].type)); @@ -210,7 +210,7 @@ class FileSystemQuotaClientTest : public testing::Test { for (int i = 0; i < num_files; i++) { if (files[i].type == type && GURL(files[i].origin_url) == GURL(origin_url)) { - FilePath path = FilePath().AppendASCII(files[i].name); + base::FilePath path = base::FilePath().AppendASCII(files[i].name); if (!path.empty()) { file_paths_cost += ObfuscatedFileUtil::ComputeFilePathCost(path); } diff --git a/webkit/fileapi/file_system_url.cc b/webkit/fileapi/file_system_url.cc index 7d88f14..5f38e53 100644 --- a/webkit/fileapi/file_system_url.cc +++ b/webkit/fileapi/file_system_url.cc @@ -21,7 +21,7 @@ namespace { bool ParseFileSystemURL(const GURL& url, GURL* origin_url, FileSystemType* type, - FilePath* file_path) { + base::FilePath* file_path) { GURL origin; FileSystemType file_system_type = kFileSystemTypeUnknown; @@ -60,7 +60,7 @@ bool ParseFileSystemURL(const GURL& url, while (!path.empty() && path[0] == '/') path.erase(0, 1); - FilePath converted_path = FilePath::FromUTF8Unsafe(path); + base::FilePath converted_path = base::FilePath::FromUTF8Unsafe(path); // All parent references should have been resolved in the renderer. if (converted_path.ReferencesParent()) @@ -92,7 +92,7 @@ FileSystemURL FileSystemURL::CreateForTest(const GURL& url) { FileSystemURL FileSystemURL::CreateForTest(const GURL& origin, FileSystemType type, - const FilePath& path) { + const base::FilePath& path) { return FileSystemURL(origin, type, path); } @@ -105,7 +105,7 @@ FileSystemURL::FileSystemURL(const GURL& url) FileSystemURL::FileSystemURL(const GURL& origin, FileSystemType type, - const FilePath& path) + const base::FilePath& path) : is_valid_(true), origin_(origin), type_(type), @@ -115,10 +115,10 @@ FileSystemURL::FileSystemURL(const GURL& origin, FileSystemURL::FileSystemURL(const GURL& origin, FileSystemType original_type, - const FilePath& original_path, + const base::FilePath& original_path, const std::string& filesystem_id, FileSystemType cracked_type, - const FilePath& cracked_path) + const base::FilePath& cracked_path) : is_valid_(true), origin_(origin), type_(cracked_type), @@ -149,7 +149,7 @@ std::string FileSystemURL::DebugString() const { return ss.str(); } -FileSystemURL FileSystemURL::WithPath(const FilePath& path) const { +FileSystemURL FileSystemURL::WithPath(const base::FilePath& path) const { FileSystemURL url = *this; url.path_ = path; url.virtual_path_.clear(); diff --git a/webkit/fileapi/file_system_url.h b/webkit/fileapi/file_system_url.h index 0245d94..99b187b 100644 --- a/webkit/fileapi/file_system_url.h +++ b/webkit/fileapi/file_system_url.h @@ -62,11 +62,11 @@ namespace fileapi { // one of the friended classes. // // TODO(ericu): Look into making path() [and all FileSystem API virtual -// paths] just an std::string, to prevent platform-specific FilePath behavior -// from getting invoked by accident. Currently the FilePath returned here needs +// paths] just an std::string, to prevent platform-specific base::FilePath behavior +// from getting invoked by accident. Currently the base::FilePath returned here needs // special treatment, as it may contain paths that are illegal on the current // platform. To avoid problems, use VirtualPath::BaseName and -// VirtualPath::GetComponents instead of the FilePath methods. +// VirtualPath::GetComponents instead of the base::FilePath methods. class WEBKIT_STORAGE_EXPORT FileSystemURL { public: FileSystemURL(); @@ -77,7 +77,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemURL { static FileSystemURL CreateForTest(const GURL& url); static FileSystemURL CreateForTest(const GURL& origin, FileSystemType type, - const FilePath& path); + const base::FilePath& path); // Returns true if this instance represents a valid FileSystem URL. bool is_valid() const { return is_valid_; } @@ -90,12 +90,12 @@ class WEBKIT_STORAGE_EXPORT FileSystemURL { // Returns the path part of this URL. See the class comment for details. // TODO(kinuko): this must return std::string. - const FilePath& path() const { return path_; } + const base::FilePath& path() const { return path_; } // Returns the original path part of this URL. // See the class comment for details. // TODO(kinuko): this must return std::string. - const FilePath& virtual_path() const { return virtual_path_; } + const base::FilePath& virtual_path() const { return virtual_path_; } // Returns the filesystem ID/mount name for isolated/external filesystem URLs. // See the class comment for details. @@ -112,7 +112,7 @@ class WEBKIT_STORAGE_EXPORT FileSystemURL { // Note that the resulting FileSystemURL loses original URL information // if it was a cracked filesystem; i.e. virtual_path and mount_type will // be set to empty values. - FileSystemURL WithPath(const FilePath& path) const; + FileSystemURL WithPath(const base::FilePath& path) const; // Returns true if this URL is a strict parent of the |child|. bool IsParent(const FileSystemURL& child) const; @@ -131,25 +131,25 @@ class WEBKIT_STORAGE_EXPORT FileSystemURL { explicit FileSystemURL(const GURL& filesystem_url); FileSystemURL(const GURL& origin, FileSystemType type, - const FilePath& internal_path); + const base::FilePath& internal_path); // Creates a cracked FileSystemURL. FileSystemURL(const GURL& origin, FileSystemType original_type, - const FilePath& original_path, + const base::FilePath& original_path, const std::string& filesystem_id, FileSystemType cracked_type, - const FilePath& cracked_path); + const base::FilePath& cracked_path); bool is_valid_; GURL origin_; FileSystemType type_; FileSystemType mount_type_; - FilePath path_; + base::FilePath path_; // Values specific to cracked URLs. std::string filesystem_id_; - FilePath virtual_path_; + base::FilePath virtual_path_; }; diff --git a/webkit/fileapi/file_system_url_request_job.cc b/webkit/fileapi/file_system_url_request_job.cc index 18bf738..4db776a 100644 --- a/webkit/fileapi/file_system_url_request_job.cc +++ b/webkit/fileapi/file_system_url_request_job.cc @@ -117,7 +117,7 @@ bool FileSystemURLRequestJob::ReadRawData(net::IOBuffer* dest, int dest_size, bool FileSystemURLRequestJob::GetMimeType(std::string* mime_type) const { DCHECK(request_); DCHECK(url_.is_valid()); - FilePath::StringType extension = url_.path().Extension(); + base::FilePath::StringType extension = url_.path().Extension(); if (!extension.empty()) extension = extension.substr(1); return net::GetWellKnownMimeTypeFromExtension(extension, mime_type); @@ -174,7 +174,7 @@ void FileSystemURLRequestJob::StartAsync() { void FileSystemURLRequestJob::DidGetMetadata( base::PlatformFileError error_code, const base::PlatformFileInfo& file_info, - const FilePath& platform_path) { + const base::FilePath& platform_path) { if (error_code != base::PLATFORM_FILE_OK) { NotifyFailed(error_code == base::PLATFORM_FILE_ERROR_INVALID_URL ? net::ERR_INVALID_URL : net::ERR_FILE_NOT_FOUND); diff --git a/webkit/fileapi/file_system_url_request_job.h b/webkit/fileapi/file_system_url_request_job.h index 5b6e42d..55f6e70 100644 --- a/webkit/fileapi/file_system_url_request_job.h +++ b/webkit/fileapi/file_system_url_request_job.h @@ -17,7 +17,10 @@ #include "webkit/storage/webkit_storage_export.h" class GURL; + +namespace base { class FilePath; +} namespace webkit_blob { class FileStreamReader; @@ -60,7 +63,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemURLRequestJob void DidGetMetadata( base::PlatformFileError error_code, const base::PlatformFileInfo& file_info, - const FilePath& platform_path); + const base::FilePath& platform_path); void DidRead(int result); void NotifyFailed(int rv); diff --git a/webkit/fileapi/file_system_url_request_job_unittest.cc b/webkit/fileapi/file_system_url_request_job_unittest.cc index 5168886..b142d6c 100644 --- a/webkit/fileapi/file_system_url_request_job_unittest.cc +++ b/webkit/fileapi/file_system_url_request_job_unittest.cc @@ -138,7 +138,7 @@ class FileSystemURLRequestJobTest : public testing::Test { FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL( GURL("http://remote"), kFileSystemTypeTemporary, - FilePath().AppendASCII(dir_name)); + base::FilePath().AppendASCII(dir_name)); FileSystemOperationContext context(file_system_context_); context.set_allowed_bytes_growth(1024); @@ -157,7 +157,7 @@ class FileSystemURLRequestJobTest : public testing::Test { FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL( GURL("http://remote"), kFileSystemTypeTemporary, - FilePath().AppendASCII(file_name)); + base::FilePath().AppendASCII(file_name)); FileSystemOperationContext context(file_system_context_); context.set_allowed_bytes_growth(1024); @@ -353,8 +353,8 @@ TEST_F(FileSystemURLRequestJobTest, GetMimeType) { const char kFilename[] = "hoge.html"; std::string mime_type_direct; - FilePath::StringType extension = - FilePath().AppendASCII(kFilename).Extension(); + base::FilePath::StringType extension = + base::FilePath().AppendASCII(kFilename).Extension(); if (!extension.empty()) extension = extension.substr(1); EXPECT_TRUE(net::GetWellKnownMimeTypeFromExtension( diff --git a/webkit/fileapi/file_system_url_unittest.cc b/webkit/fileapi/file_system_url_unittest.cc index 58a4b7a..158f768 100644 --- a/webkit/fileapi/file_system_url_unittest.cc +++ b/webkit/fileapi/file_system_url_unittest.cc @@ -41,12 +41,12 @@ FileSystemURL CreateFileSystemURL(const std::string& url_string) { FileSystemURL CreateExternalFileSystemURL(const GURL& origin, FileSystemType type, - const FilePath& path) { + const base::FilePath& path) { return ExternalMountPoints::GetSystemInstance()->CreateCrackedFileSystemURL( origin, type, path); } -std::string NormalizedUTF8Path(const FilePath& path) { +std::string NormalizedUTF8Path(const base::FilePath& path) { return path.NormalizePathSeparators().AsUTF8Unsafe(); } @@ -140,7 +140,7 @@ TEST(FileSystemURLTest, CompareURLs) { TEST(FileSystemURLTest, WithPath) { const GURL kURL("filesystem:http://chromium.org/temporary/dir"); - const FilePath::StringType paths[] = { + const base::FilePath::StringType paths[] = { FPL("dir a"), FPL("dir a/file 1"), FPL("dir a/dir b"), @@ -149,7 +149,7 @@ TEST(FileSystemURLTest, WithPath) { const FileSystemURL base = FileSystemURL::CreateForTest(kURL); for (size_t i = 0; i < arraysize(paths); ++i) { - const FileSystemURL url = base.WithPath(FilePath(paths[i])); + const FileSystemURL url = base.WithPath(base::FilePath(paths[i])); EXPECT_EQ(paths[i], url.path().value()); EXPECT_EQ(base.origin().spec(), url.origin().spec()); EXPECT_EQ(base.type(), url.type()); @@ -160,11 +160,11 @@ TEST(FileSystemURLTest, WithPath) { TEST(FileSystemURLTest, WithPathForExternal) { const std::string kId = "foo"; - ScopedExternalFileSystem scoped_fs(kId, kFileSystemTypeSyncable, FilePath()); - const FilePath kVirtualRoot = scoped_fs.GetVirtualRootPath(); + ScopedExternalFileSystem scoped_fs(kId, kFileSystemTypeSyncable, base::FilePath()); + const base::FilePath kVirtualRoot = scoped_fs.GetVirtualRootPath(); - const FilePath::CharType kBasePath[] = FPL("dir"); - const FilePath::StringType paths[] = { + const base::FilePath::CharType kBasePath[] = FPL("dir"); + const base::FilePath::StringType paths[] = { FPL("dir a"), FPL("dir a/file 1"), FPL("dir a/dir b"), @@ -177,7 +177,7 @@ TEST(FileSystemURLTest, WithPathForExternal) { kVirtualRoot.Append(kBasePath)); for (size_t i = 0; i < arraysize(paths); ++i) { - const FileSystemURL url = base.WithPath(FilePath(paths[i])); + const FileSystemURL url = base.WithPath(base::FilePath(paths[i])); EXPECT_EQ(paths[i], url.path().value()); EXPECT_EQ(base.origin().spec(), url.origin().spec()); EXPECT_EQ(base.type(), url.type()); @@ -187,8 +187,8 @@ TEST(FileSystemURLTest, WithPathForExternal) { } TEST(FileSystemURLTest, IsParent) { - ScopedExternalFileSystem scoped1("foo", kFileSystemTypeSyncable, FilePath()); - ScopedExternalFileSystem scoped2("bar", kFileSystemTypeSyncable, FilePath()); + ScopedExternalFileSystem scoped1("foo", kFileSystemTypeSyncable, base::FilePath()); + ScopedExternalFileSystem scoped2("bar", kFileSystemTypeSyncable, base::FilePath()); const std::string root1 = GetFileSystemRootURI( GURL("http://example.com"), kFileSystemTypeTemporary).spec(); @@ -232,7 +232,7 @@ TEST(FileSystemURLTest, IsParent) { TEST(FileSystemURLTest, DebugString) { const GURL kOrigin("http://example.com"); - const FilePath kPath(FPL("dir/file")); + const base::FilePath kPath(FPL("dir/file")); const FileSystemURL kURL1 = FileSystemURL::CreateForTest( kOrigin, kFileSystemTypeTemporary, kPath); @@ -240,7 +240,7 @@ TEST(FileSystemURLTest, DebugString) { NormalizedUTF8Path(kPath), kURL1.DebugString()); - const FilePath kRoot(DRIVE FPL("/root")); + const base::FilePath kRoot(DRIVE FPL("/root")); ScopedExternalFileSystem scoped_fs("foo", kFileSystemTypeNativeLocal, kRoot.NormalizePathSeparators()); diff --git a/webkit/fileapi/file_system_usage_cache.cc b/webkit/fileapi/file_system_usage_cache.cc index 1c5e824..fedb79e 100644 --- a/webkit/fileapi/file_system_usage_cache.cc +++ b/webkit/fileapi/file_system_usage_cache.cc @@ -10,7 +10,7 @@ namespace fileapi { -const FilePath::CharType FileSystemUsageCache::kUsageFileName[] = +const base::FilePath::CharType FileSystemUsageCache::kUsageFileName[] = FILE_PATH_LITERAL(".usage"); const char FileSystemUsageCache::kUsageFileHeader[] = "FSU5"; const int FileSystemUsageCache::kUsageFileHeaderSize = 4; @@ -22,7 +22,7 @@ const int FileSystemUsageCache::kUsageFileSize = sizeof(int) + sizeof(int32) + sizeof(int64); // static -int64 FileSystemUsageCache::GetUsage(const FilePath& usage_file_path) { +int64 FileSystemUsageCache::GetUsage(const base::FilePath& usage_file_path) { bool is_valid = true; uint32 dirty = 0; int64 fs_usage; @@ -35,7 +35,7 @@ int64 FileSystemUsageCache::GetUsage(const FilePath& usage_file_path) { } // static -int32 FileSystemUsageCache::GetDirty(const FilePath& usage_file_path) { +int32 FileSystemUsageCache::GetDirty(const base::FilePath& usage_file_path) { bool is_valid = true; uint32 dirty = 0; int64 fs_usage; @@ -48,7 +48,7 @@ int32 FileSystemUsageCache::GetDirty(const FilePath& usage_file_path) { } // static -bool FileSystemUsageCache::IncrementDirty(const FilePath& usage_file_path) { +bool FileSystemUsageCache::IncrementDirty(const base::FilePath& usage_file_path) { bool is_valid = true; uint32 dirty = 0; int64 fs_usage; @@ -61,7 +61,7 @@ bool FileSystemUsageCache::IncrementDirty(const FilePath& usage_file_path) { } // static -bool FileSystemUsageCache::DecrementDirty(const FilePath& usage_file_path) { +bool FileSystemUsageCache::DecrementDirty(const base::FilePath& usage_file_path) { bool is_valid = true; uint32 dirty = 0; int64 fs_usage; @@ -74,7 +74,7 @@ bool FileSystemUsageCache::DecrementDirty(const FilePath& usage_file_path) { } // static -bool FileSystemUsageCache::Invalidate(const FilePath& usage_file_path) { +bool FileSystemUsageCache::Invalidate(const base::FilePath& usage_file_path) { bool is_valid = true; uint32 dirty = 0; int64 fs_usage; @@ -83,7 +83,7 @@ bool FileSystemUsageCache::Invalidate(const FilePath& usage_file_path) { return fs_usage >= 0 && Write(usage_file_path, false, dirty, fs_usage); } -bool FileSystemUsageCache::IsValid(const FilePath& usage_file_path) { +bool FileSystemUsageCache::IsValid(const base::FilePath& usage_file_path) { bool is_valid = true; uint32 dirty = 0; int64 result = Read(usage_file_path, &is_valid, &dirty); @@ -95,7 +95,7 @@ bool FileSystemUsageCache::IsValid(const FilePath& usage_file_path) { // static int FileSystemUsageCache::AtomicUpdateUsageByDelta( - const FilePath& usage_file_path, int64 delta) { + const base::FilePath& usage_file_path, int64 delta) { bool is_valid = true; uint32 dirty = 0; int64 fs_usage; @@ -109,23 +109,23 @@ int FileSystemUsageCache::AtomicUpdateUsageByDelta( } // static -int FileSystemUsageCache::UpdateUsage(const FilePath& usage_file_path, +int FileSystemUsageCache::UpdateUsage(const base::FilePath& usage_file_path, int64 fs_usage) { return Write(usage_file_path, true, 0, fs_usage); } // static -bool FileSystemUsageCache::Exists(const FilePath& usage_file_path) { +bool FileSystemUsageCache::Exists(const base::FilePath& usage_file_path) { return file_util::PathExists(usage_file_path); } // static -bool FileSystemUsageCache::Delete(const FilePath& usage_file_path) { +bool FileSystemUsageCache::Delete(const base::FilePath& usage_file_path) { return file_util::Delete(usage_file_path, true); } // static -int64 FileSystemUsageCache::Read(const FilePath& usage_file_path, +int64 FileSystemUsageCache::Read(const base::FilePath& usage_file_path, bool* is_valid, uint32* dirty) { char buffer[kUsageFileSize]; @@ -154,7 +154,7 @@ int64 FileSystemUsageCache::Read(const FilePath& usage_file_path, } // static -int FileSystemUsageCache::Write(const FilePath& usage_file_path, +int FileSystemUsageCache::Write(const base::FilePath& usage_file_path, bool is_valid, uint32 dirty, int64 fs_usage) { @@ -164,7 +164,7 @@ int FileSystemUsageCache::Write(const FilePath& usage_file_path, write_pickle.WriteUInt32(dirty); write_pickle.WriteInt64(fs_usage); - FilePath temporary_usage_file_path; + base::FilePath temporary_usage_file_path; if (usage_file_path.empty() || !file_util::CreateTemporaryFileInDir(usage_file_path.DirName(), &temporary_usage_file_path)) { diff --git a/webkit/fileapi/file_system_usage_cache.h b/webkit/fileapi/file_system_usage_cache.h index 3d25120..428aa4b 100644 --- a/webkit/fileapi/file_system_usage_cache.h +++ b/webkit/fileapi/file_system_usage_cache.h @@ -16,34 +16,34 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemUsageCache { // Gets the size described in the .usage file even if dirty > 0 or // is_valid == false. Returns less than zero if the .usage file is not // available. - static int64 GetUsage(const FilePath& usage_file_path); + static int64 GetUsage(const base::FilePath& usage_file_path); // Gets the dirty count in the .usage file. // Returns less than zero if the .usage file is not available. - static int32 GetDirty(const FilePath& usage_file_path); + static int32 GetDirty(const base::FilePath& usage_file_path); // Increments or decrements the "dirty" entry in the .usage file. // Returns false if no .usage is available. - static bool IncrementDirty(const FilePath& usage_file_path); - static bool DecrementDirty(const FilePath& usage_file_path); + static bool IncrementDirty(const base::FilePath& usage_file_path); + static bool DecrementDirty(const base::FilePath& usage_file_path); // Notifies quota system that it needs to recalculate the usage cache of the // origin. Returns false if no .usage is available. - static bool Invalidate(const FilePath& usage_file_path); - static bool IsValid(const FilePath& usage_file_path); + static bool Invalidate(const base::FilePath& usage_file_path); + static bool IsValid(const base::FilePath& usage_file_path); // Updates the size described in the .usage file. - static int UpdateUsage(const FilePath& usage_file_path, int64 fs_usage); + static int UpdateUsage(const base::FilePath& usage_file_path, int64 fs_usage); // Updates the size described in the .usage file by delta with keeping dirty // even if dirty > 0. static int AtomicUpdateUsageByDelta( - const FilePath& usage_file_path, int64 delta); + const base::FilePath& usage_file_path, int64 delta); - static bool Exists(const FilePath& usage_file_path); - static bool Delete(const FilePath& usage_file_path); + static bool Exists(const base::FilePath& usage_file_path); + static bool Delete(const base::FilePath& usage_file_path); - static const FilePath::CharType kUsageFileName[]; + static const base::FilePath::CharType kUsageFileName[]; static const char kUsageFileHeader[]; static const int kUsageFileSize; static const int kUsageFileHeaderSize; @@ -51,11 +51,11 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemUsageCache { private: // Read the size, validity and the "dirty" entry described in the .usage file. // Returns less than zero if no .usage file is available. - static int64 Read(const FilePath& usage_file_path, + static int64 Read(const base::FilePath& usage_file_path, bool* is_valid, uint32* dirty); - static int Write(const FilePath& usage_file_path, + static int Write(const base::FilePath& usage_file_path, bool is_valid, uint32 dirty, int64 fs_usage); diff --git a/webkit/fileapi/file_system_usage_cache_unittest.cc b/webkit/fileapi/file_system_usage_cache_unittest.cc index 8662dc8..edc4457 100644 --- a/webkit/fileapi/file_system_usage_cache_unittest.cc +++ b/webkit/fileapi/file_system_usage_cache_unittest.cc @@ -20,7 +20,7 @@ class FileSystemUsageCacheTest : public testing::Test { } protected: - FilePath GetUsageFilePath() { + base::FilePath GetUsageFilePath() { return data_dir_.path().Append(FileSystemUsageCache::kUsageFileName); } @@ -31,14 +31,14 @@ class FileSystemUsageCacheTest : public testing::Test { }; TEST_F(FileSystemUsageCacheTest, CreateTest) { - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); EXPECT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, 0)); } TEST_F(FileSystemUsageCacheTest, SetSizeTest) { static const int64 size = 240122; - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, size)); EXPECT_EQ(size, FileSystemUsageCache::GetUsage(usage_file_path)); @@ -46,14 +46,14 @@ TEST_F(FileSystemUsageCacheTest, SetSizeTest) { TEST_F(FileSystemUsageCacheTest, SetLargeSizeTest) { static const int64 size = kint64max; - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, size)); EXPECT_EQ(size, FileSystemUsageCache::GetUsage(usage_file_path)); } TEST_F(FileSystemUsageCacheTest, IncAndGetSizeTest) { - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, 98214)); ASSERT_TRUE(FileSystemUsageCache::IncrementDirty(usage_file_path)); @@ -63,7 +63,7 @@ TEST_F(FileSystemUsageCacheTest, IncAndGetSizeTest) { TEST_F(FileSystemUsageCacheTest, DecAndGetSizeTest) { static const int64 size = 71839; - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, size)); // DecrementDirty for dirty = 0 is invalid. It returns false. @@ -73,7 +73,7 @@ TEST_F(FileSystemUsageCacheTest, DecAndGetSizeTest) { TEST_F(FileSystemUsageCacheTest, IncDecAndGetSizeTest) { static const int64 size = 198491; - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, size)); ASSERT_TRUE(FileSystemUsageCache::IncrementDirty(usage_file_path)); @@ -82,7 +82,7 @@ TEST_F(FileSystemUsageCacheTest, IncDecAndGetSizeTest) { } TEST_F(FileSystemUsageCacheTest, DecIncAndGetSizeTest) { - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, 854238)); // DecrementDirty for dirty = 0 is invalid. It returns false. @@ -96,7 +96,7 @@ TEST_F(FileSystemUsageCacheTest, DecIncAndGetSizeTest) { TEST_F(FileSystemUsageCacheTest, ManyIncsSameDecsAndGetSizeTest) { static const int64 size = 82412; - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, size)); for (int i = 0; i < 20; i++) @@ -107,7 +107,7 @@ TEST_F(FileSystemUsageCacheTest, ManyIncsSameDecsAndGetSizeTest) { } TEST_F(FileSystemUsageCacheTest, ManyIncsLessDecsAndGetSizeTest) { - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); ASSERT_EQ(FileSystemUsageCache::kUsageFileSize, FileSystemUsageCache::UpdateUsage(usage_file_path, 19319)); for (int i = 0; i < 20; i++) @@ -119,17 +119,17 @@ TEST_F(FileSystemUsageCacheTest, ManyIncsLessDecsAndGetSizeTest) { } TEST_F(FileSystemUsageCacheTest, GetSizeWithoutCacheFileTest) { - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); EXPECT_EQ(-1, FileSystemUsageCache::GetUsage(usage_file_path)); } TEST_F(FileSystemUsageCacheTest, IncrementDirtyWithoutCacheFileTest) { - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); EXPECT_FALSE(FileSystemUsageCache::IncrementDirty(usage_file_path)); } TEST_F(FileSystemUsageCacheTest, DecrementDirtyWithoutCacheFileTest) { - FilePath usage_file_path = GetUsageFilePath(); + base::FilePath usage_file_path = GetUsageFilePath(); EXPECT_FALSE(FileSystemUsageCache::IncrementDirty(usage_file_path)); } diff --git a/webkit/fileapi/file_system_util.cc b/webkit/fileapi/file_system_util.cc index 07db153..7e017f7 100644 --- a/webkit/fileapi/file_system_util.cc +++ b/webkit/fileapi/file_system_util.cc @@ -27,26 +27,26 @@ const char kTestDir[] = "/test"; // TODO(ericu): Consider removing support for '\', even on Windows, if possible. // There's a lot of test code that will need reworking, and we may have trouble -// with FilePath elsewhere [e.g. DirName and other methods may also need +// with base::FilePath elsewhere [e.g. DirName and other methods may also need // replacement]. -FilePath VirtualPath::BaseName(const FilePath& virtual_path) { - FilePath::StringType path = virtual_path.value(); +base::FilePath VirtualPath::BaseName(const base::FilePath& virtual_path) { + base::FilePath::StringType path = virtual_path.value(); // Keep everything after the final separator, but if the pathname is only // one character and it's a separator, leave it alone. - while (path.size() > 1 && FilePath::IsSeparator(path[path.size() - 1])) + while (path.size() > 1 && base::FilePath::IsSeparator(path[path.size() - 1])) path.resize(path.size() - 1); - FilePath::StringType::size_type last_separator = - path.find_last_of(FilePath::kSeparators); - if (last_separator != FilePath::StringType::npos && + base::FilePath::StringType::size_type last_separator = + path.find_last_of(base::FilePath::kSeparators); + if (last_separator != base::FilePath::StringType::npos && last_separator < path.size() - 1) path.erase(0, last_separator + 1); - return FilePath(path); + return base::FilePath(path); } void VirtualPath::GetComponents( - const FilePath& path, std::vector<FilePath::StringType>* components) { + const base::FilePath& path, std::vector<base::FilePath::StringType>* components) { DCHECK(components); if (!components) return; @@ -54,12 +54,12 @@ void VirtualPath::GetComponents( if (path.value().empty()) return; - std::vector<FilePath::StringType> ret_val; - FilePath current = path; - FilePath base; + std::vector<base::FilePath::StringType> ret_val; + base::FilePath current = path; + base::FilePath base; - // Due to the way things are implemented, FilePath::DirName works here, - // whereas FilePath::BaseName doesn't. + // Due to the way things are implemented, base::FilePath::DirName works here, + // whereas base::FilePath::BaseName doesn't. while (current != current.DirName()) { base = BaseName(current); ret_val.push_back(base.value()); @@ -67,7 +67,7 @@ void VirtualPath::GetComponents( } *components = - std::vector<FilePath::StringType>(ret_val.rbegin(), ret_val.rend()); + std::vector<base::FilePath::StringType>(ret_val.rbegin(), ret_val.rend()); } GURL GetFileSystemRootURI(const GURL& origin_url, FileSystemType type) { @@ -193,7 +193,7 @@ std::string GetFileSystemTypeString(FileSystemType type) { return std::string(); } -std::string FilePathToString(const FilePath& file_path) { +std::string FilePathToString(const base::FilePath& file_path) { #if defined(OS_WIN) return UTF16ToUTF8(file_path.value()); #elif defined(OS_POSIX) @@ -201,11 +201,11 @@ std::string FilePathToString(const FilePath& file_path) { #endif } -FilePath StringToFilePath(const std::string& file_path_string) { +base::FilePath StringToFilePath(const std::string& file_path_string) { #if defined(OS_WIN) - return FilePath(UTF8ToUTF16(file_path_string)); + return base::FilePath(UTF8ToUTF16(file_path_string)); #elif defined(OS_POSIX) - return FilePath(file_path_string); + return base::FilePath(file_path_string); #endif } @@ -282,7 +282,7 @@ std::string GetIsolatedFileSystemRootURIString( root.append(filesystem_id); root.append("/"); if (!optional_root_name.empty()) { - DCHECK(!FilePath::FromUTF8Unsafe(optional_root_name).ReferencesParent()); + DCHECK(!base::FilePath::FromUTF8Unsafe(optional_root_name).ReferencesParent()); root.append(optional_root_name); root.append("/"); } diff --git a/webkit/fileapi/file_system_util.h b/webkit/fileapi/file_system_util.h index b8bc41f..be863bf 100644 --- a/webkit/fileapi/file_system_util.h +++ b/webkit/fileapi/file_system_util.h @@ -27,17 +27,17 @@ extern const char kTestDir[]; class WEBKIT_STORAGE_EXPORT VirtualPath { public: - // Use this instead of FilePath::BaseName when operating on virtual paths. - // FilePath::BaseName will get confused by ':' on Windows when it looks like a + // Use this instead of base::FilePath::BaseName when operating on virtual paths. + // base::FilePath::BaseName will get confused by ':' on Windows when it looks like a // drive letter separator; this will treat it as just another character. - static FilePath BaseName(const FilePath& virtual_path); + static base::FilePath BaseName(const base::FilePath& virtual_path); - // Likewise, use this instead of FilePath::GetComponents when operating on + // Likewise, use this instead of base::FilePath::GetComponents when operating on // virtual paths. // Note that this assumes very clean input, with no leading slash, and it will // not evaluate '.' or '..' components. - static void GetComponents(const FilePath& path, - std::vector<FilePath::StringType>* components); + static void GetComponents(const base::FilePath& path, + std::vector<base::FilePath::StringType>* components); }; // Returns the root URI of the filesystem that can be specified by a pair of @@ -99,10 +99,10 @@ WEBKIT_STORAGE_EXPORT std::string GetFileSystemTypeString(FileSystemType type); // // TODO(tzik): Replace CreateFilePath and FilePathToString in // third_party/leveldatabase/env_chromium.cc with them. -WEBKIT_STORAGE_EXPORT std::string FilePathToString(const FilePath& file_path); +WEBKIT_STORAGE_EXPORT std::string FilePathToString(const base::FilePath& file_path); // Decode a file path from |file_path_string|. -WEBKIT_STORAGE_EXPORT FilePath StringToFilePath( +WEBKIT_STORAGE_EXPORT base::FilePath StringToFilePath( const std::string& file_path_string); // File error conversion diff --git a/webkit/fileapi/file_system_util_unittest.cc b/webkit/fileapi/file_system_util_unittest.cc index 946e75f..0fd4f0a 100644 --- a/webkit/fileapi/file_system_util_unittest.cc +++ b/webkit/fileapi/file_system_util_unittest.cc @@ -30,8 +30,8 @@ TEST_F(FileSystemUtilTest, GetPersistentFileSystemRootURI) { TEST_F(FileSystemUtilTest, VirtualPathBaseName) { struct test_data { - const FilePath::StringType path; - const FilePath::StringType base_name; + const base::FilePath::StringType path; + const base::FilePath::StringType base_name; } test_cases[] = { { FILE_PATH_LITERAL("foo/bar"), FILE_PATH_LITERAL("bar") }, { FILE_PATH_LITERAL("foo/b:bar"), FILE_PATH_LITERAL("b:bar") }, @@ -48,17 +48,17 @@ TEST_F(FileSystemUtilTest, VirtualPathBaseName) { { FILE_PATH_LITERAL("bar"), FILE_PATH_LITERAL("bar") } }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { - FilePath input = FilePath(test_cases[i].path); - FilePath base_name = VirtualPath::BaseName(input); + base::FilePath input = base::FilePath(test_cases[i].path); + base::FilePath base_name = VirtualPath::BaseName(input); EXPECT_EQ(test_cases[i].base_name, base_name.value()); } } TEST_F(FileSystemUtilTest, VirtualPathGetComponents) { struct test_data { - const FilePath::StringType path; + const base::FilePath::StringType path; size_t count; - const FilePath::StringType components[3]; + const base::FilePath::StringType components[3]; } test_cases[] = { { FILE_PATH_LITERAL("foo/bar"), 2, @@ -83,8 +83,8 @@ TEST_F(FileSystemUtilTest, VirtualPathGetComponents) { { FILE_PATH_LITERAL("foo"), FILE_PATH_LITERAL("bar") } }, }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { - FilePath input = FilePath(test_cases[i].path); - std::vector<FilePath::StringType> components; + base::FilePath input = base::FilePath(test_cases[i].path); + std::vector<base::FilePath::StringType> components; VirtualPath::GetComponents(input, &components); EXPECT_EQ(test_cases[i].count, components.size()); for (size_t j = 0; j < components.size(); ++j) diff --git a/webkit/fileapi/file_util_helper.cc b/webkit/fileapi/file_util_helper.cc index 2582f8a..49ea72c 100644 --- a/webkit/fileapi/file_util_helper.cc +++ b/webkit/fileapi/file_util_helper.cc @@ -21,20 +21,20 @@ namespace { // A helper class to delete a temporary file. class ScopedFileDeleter { public: - explicit ScopedFileDeleter(const FilePath& path) : path_(path) {} + explicit ScopedFileDeleter(const base::FilePath& path) : path_(path) {} ~ScopedFileDeleter() { file_util::Delete(path_, false /* recursive */); } private: - FilePath path_; + base::FilePath path_; }; bool IsInRoot(const FileSystemURL& url) { // If path is in the root, path.DirName() will be ".", // since we use paths with no leading '/'. - FilePath parent = url.path().DirName(); - return parent.empty() || parent == FilePath(FILE_PATH_LITERAL(".")); + base::FilePath parent = url.path().DirName(); + return parent.empty() || parent == base::FilePath(FILE_PATH_LITERAL(".")); } // A helper class for cross-FileUtil Copy/Move operations. @@ -160,7 +160,7 @@ PlatformFileError CrossFileUtilHelper::CopyOrMoveDirectory( // Store modified timestamp of the root directory. if (operation_ == OPERATION_MOVE) { base::PlatformFileInfo file_info; - FilePath platform_file_path; + base::FilePath platform_file_path; error = src_util_->GetFileInfo( context_, src_url, &file_info, &platform_file_path); if (error != base::PLATFORM_FILE_OK) @@ -173,9 +173,9 @@ PlatformFileError CrossFileUtilHelper::CopyOrMoveDirectory( src_util_->CreateFileEnumerator(context_, src_url, true /* recursive */)); - FilePath src_file_path_each; + base::FilePath src_file_path_each; while (!(src_file_path_each = file_enum->Next()).empty()) { - FilePath dest_file_path_each(dest_url.path()); + base::FilePath dest_file_path_each(dest_url.path()); src_url.path().AppendRelativePath( src_file_path_each, &dest_file_path_each); @@ -229,7 +229,7 @@ PlatformFileError CrossFileUtilHelper::CopyOrMoveFile( // Resolve the src_url's underlying file path. base::PlatformFileInfo file_info; - FilePath platform_file_path; + base::FilePath platform_file_path; SnapshotFilePolicy snapshot_policy; PlatformFileError error = src_util_->CreateSnapshotFile( @@ -265,7 +265,7 @@ bool FileUtilHelper::DirectoryExists(FileSystemOperationContext* context, return true; base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; PlatformFileError error = file_util->GetFileInfo( context, url, &file_info, &platform_path); return error == base::PLATFORM_FILE_OK && file_info.is_directory; @@ -320,7 +320,7 @@ base::PlatformFileError FileUtilHelper::ReadDirectory( DCHECK(entries); base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; PlatformFileError error = file_util->GetFileInfo( context, url, &file_info, &platform_path); if (error != base::PLATFORM_FILE_OK) @@ -331,7 +331,7 @@ base::PlatformFileError FileUtilHelper::ReadDirectory( scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( file_util->CreateFileEnumerator(context, url, false /* recursive */)); - FilePath current; + base::FilePath current; while (!(current = file_enum->Next()).empty()) { base::FileUtilProxy::Entry entry; entry.is_directory = file_enum->IsDirectory(); @@ -351,8 +351,8 @@ base::PlatformFileError FileUtilHelper::DeleteDirectoryRecursive( scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( file_util->CreateFileEnumerator(context, url, true /* recursive */)); - FilePath file_path_each; - std::stack<FilePath> directories; + base::FilePath file_path_each; + std::stack<base::FilePath> directories; while (!(file_path_each = file_enum->Next()).empty()) { if (file_enum->IsDirectory()) { directories.push(file_path_each); diff --git a/webkit/fileapi/file_writer_delegate_unittest.cc b/webkit/fileapi/file_writer_delegate_unittest.cc index 8a3fdf8..fa40da0 100644 --- a/webkit/fileapi/file_writer_delegate_unittest.cc +++ b/webkit/fileapi/file_writer_delegate_unittest.cc @@ -197,7 +197,7 @@ net::URLRequestJob* FileWriterDelegateTest::Factory( void FileWriterDelegateTest::SetUp() { ASSERT_TRUE(dir_.CreateUniqueTempDir()); - FilePath base_dir = dir_.path().AppendASCII("filesystem"); + base::FilePath base_dir = dir_.path().AppendASCII("filesystem"); test_helper_.SetUp(base_dir); scoped_ptr<FileSystemOperationContext> context( diff --git a/webkit/fileapi/isolated_context.cc b/webkit/fileapi/isolated_context.cc index fe1aec0..12232ce 100644 --- a/webkit/fileapi/isolated_context.cc +++ b/webkit/fileapi/isolated_context.cc @@ -18,15 +18,15 @@ namespace fileapi { namespace { -FilePath::StringType GetRegisterNameForPath(const FilePath& path) { +base::FilePath::StringType GetRegisterNameForPath(const base::FilePath& path) { // If it's not a root path simply return a base name. if (path.DirName() != path) return path.BaseName().value(); #if defined(FILE_PATH_USES_DRIVE_LETTERS) - FilePath::StringType name; + base::FilePath::StringType name; for (size_t i = 0; - i < path.value().size() && !FilePath::IsSeparator(path.value()[i]); + i < path.value().size() && !base::FilePath::IsSeparator(path.value()[i]); ++i) { if (path.value()[i] == L':') { name.append(L"_drive"); @@ -67,19 +67,19 @@ IsolatedContext::FileInfoSet::FileInfoSet() {} IsolatedContext::FileInfoSet::~FileInfoSet() {} bool IsolatedContext::FileInfoSet::AddPath( - const FilePath& path, std::string* registered_name) { + const base::FilePath& path, std::string* registered_name) { // The given path should not contain any '..' and should be absolute. if (path.ReferencesParent() || !path.IsAbsolute()) return false; - FilePath::StringType name = GetRegisterNameForPath(path); - std::string utf8name = FilePath(name).AsUTF8Unsafe(); - FilePath normalized_path = path.NormalizePathSeparators(); + base::FilePath::StringType name = GetRegisterNameForPath(path); + std::string utf8name = base::FilePath(name).AsUTF8Unsafe(); + base::FilePath normalized_path = path.NormalizePathSeparators(); bool inserted = fileset_.insert(MountPointInfo(utf8name, normalized_path)).second; if (!inserted) { int suffix = 1; - std::string basepart = FilePath(name).RemoveExtension().AsUTF8Unsafe(); - std::string ext = FilePath(FilePath(name).Extension()).AsUTF8Unsafe(); + std::string basepart = base::FilePath(name).RemoveExtension().AsUTF8Unsafe(); + std::string ext = base::FilePath(base::FilePath(name).Extension()).AsUTF8Unsafe(); while (!inserted) { utf8name = base::StringPrintf("%s (%d)", basepart.c_str(), suffix++); if (!ext.empty()) @@ -94,7 +94,7 @@ bool IsolatedContext::FileInfoSet::AddPath( } bool IsolatedContext::FileInfoSet::AddPathWithName( - const FilePath& path, const std::string& name) { + const base::FilePath& path, const std::string& name) { // The given path should not contain any '..' and should be absolute. if (path.ReferencesParent() || !path.IsAbsolute()) return false; @@ -126,7 +126,7 @@ class IsolatedContext::Instance { void AddRef() { ++ref_counts_; } void RemoveRef() { --ref_counts_; } - bool ResolvePathForName(const std::string& name, FilePath* path) const; + bool ResolvePathForName(const std::string& name, base::FilePath* path) const; // Returns true if the instance is a single-path instance. bool IsSinglePathInstance() const; @@ -166,13 +166,13 @@ IsolatedContext::Instance::Instance(FileSystemType type, IsolatedContext::Instance::~Instance() {} bool IsolatedContext::Instance::ResolvePathForName(const std::string& name, - FilePath* path) const { + base::FilePath* path) const { if (IsSinglePathIsolatedFileSystem(type_)) { *path = file_info_.path; return file_info_.name == name; } std::set<MountPointInfo>::const_iterator found = files_.find( - MountPointInfo(name, FilePath())); + MountPointInfo(name, base::FilePath())); if (found == files_.end()) return false; *path = found->path; @@ -206,15 +206,15 @@ std::string IsolatedContext::RegisterDraggedFileSystem( std::string IsolatedContext::RegisterFileSystemForPath( FileSystemType type, - const FilePath& path_in, + const base::FilePath& path_in, std::string* register_name) { - FilePath path(path_in.NormalizePathSeparators()); + base::FilePath path(path_in.NormalizePathSeparators()); DCHECK(!path.ReferencesParent() && path.IsAbsolute()); std::string name; if (register_name && !register_name->empty()) { name = *register_name; } else { - name = FilePath(GetRegisterNameForPath(path)).AsUTF8Unsafe(); + name = base::FilePath(GetRegisterNameForPath(path)).AsUTF8Unsafe(); if (register_name) register_name->assign(name); } @@ -236,7 +236,7 @@ bool IsolatedContext::RevokeFileSystem(const std::string& filesystem_id) { } bool IsolatedContext::GetRegisteredPath( - const std::string& filesystem_id, FilePath* path) const { + const std::string& filesystem_id, base::FilePath* path) const { DCHECK(path); base::AutoLock locker(lock_); IDToInstance::const_iterator found = instance_map_.find(filesystem_id); @@ -246,10 +246,10 @@ bool IsolatedContext::GetRegisteredPath( return true; } -bool IsolatedContext::CrackVirtualPath(const FilePath& virtual_path, +bool IsolatedContext::CrackVirtualPath(const base::FilePath& virtual_path, std::string* id_or_name, FileSystemType* type, - FilePath* path) const { + base::FilePath* path) const { DCHECK(id_or_name); DCHECK(path); @@ -258,17 +258,17 @@ bool IsolatedContext::CrackVirtualPath(const FilePath& virtual_path, return false; // The virtual_path should comprise <id_or_name> and <relative_path> parts. - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; virtual_path.GetComponents(&components); if (components.size() < 1) return false; - std::vector<FilePath::StringType>::iterator component_iter = + std::vector<base::FilePath::StringType>::iterator component_iter = components.begin(); - std::string fsid = FilePath(*component_iter++).MaybeAsASCII(); + std::string fsid = base::FilePath(*component_iter++).MaybeAsASCII(); if (fsid.empty()) return false; - FilePath cracked_path; + base::FilePath cracked_path; { base::AutoLock locker(lock_); IDToInstance::const_iterator found_instance = instance_map_.find(fsid); @@ -286,7 +286,7 @@ bool IsolatedContext::CrackVirtualPath(const FilePath& virtual_path, } // *component_iter should be a name of the registered path. - std::string name = FilePath(*component_iter++).AsUTF8Unsafe(); + std::string name = base::FilePath(*component_iter++).AsUTF8Unsafe(); if (!instance->ResolvePathForName(name, &cracked_path)) return false; } @@ -309,13 +309,13 @@ FileSystemURL IsolatedContext::CrackURL(const GURL& url) const { FileSystemURL IsolatedContext::CreateCrackedFileSystemURL( const GURL& origin, FileSystemType type, - const FilePath& path) const { + const base::FilePath& path) const { if (!HandlesFileSystemMountType(type)) return FileSystemURL(); std::string mount_name; FileSystemType cracked_type; - FilePath cracked_path; + base::FilePath cracked_path; if (!CrackVirtualPath(path, &mount_name, &cracked_type, &cracked_path)) return FileSystemURL(); @@ -323,9 +323,9 @@ FileSystemURL IsolatedContext::CreateCrackedFileSystemURL( mount_name, cracked_type, cracked_path); } -void IsolatedContext::RevokeFileSystemByPath(const FilePath& path_in) { +void IsolatedContext::RevokeFileSystemByPath(const base::FilePath& path_in) { base::AutoLock locker(lock_); - FilePath path(path_in.NormalizePathSeparators()); + base::FilePath path(path_in.NormalizePathSeparators()); PathToID::iterator ids_iter = path_to_id_map_.find(path); if (ids_iter == path_to_id_map_.end()) return; @@ -377,9 +377,9 @@ bool IsolatedContext::GetDraggedFileInfo( return true; } -FilePath IsolatedContext::CreateVirtualRootPath( +base::FilePath IsolatedContext::CreateVirtualRootPath( const std::string& filesystem_id) const { - return FilePath().AppendASCII(filesystem_id); + return base::FilePath().AppendASCII(filesystem_id); } IsolatedContext::IsolatedContext() { diff --git a/webkit/fileapi/isolated_context.h b/webkit/fileapi/isolated_context.h index d679bc3..faf034c 100644 --- a/webkit/fileapi/isolated_context.h +++ b/webkit/fileapi/isolated_context.h @@ -48,12 +48,12 @@ class WEBKIT_STORAGE_EXPORT IsolatedContext : public MountPoints { // the registered name assigned for the path. |path| needs to be // absolute and should not contain parent references. // Return false if the |path| is not valid and could not be added. - bool AddPath(const FilePath& path, std::string* registered_name); + bool AddPath(const base::FilePath& path, std::string* registered_name); // Add the given |path| with the |name|. // Return false if the |name| is already registered in the set or // is not valid and could not be added. - bool AddPathWithName(const FilePath& path, const std::string& name); + bool AddPathWithName(const base::FilePath& path, const std::string& name); const std::set<MountPointInfo>& fileset() const { return fileset_; } @@ -99,7 +99,7 @@ class WEBKIT_STORAGE_EXPORT IsolatedContext : public MountPoints { // registered as the given |register_name|, otherwise it is populated // with the name internally assigned to the path. std::string RegisterFileSystemForPath(FileSystemType type, - const FilePath& path, + const base::FilePath& path, std::string* register_name); // Revokes all filesystem(s) registered for the given path. @@ -110,7 +110,7 @@ class WEBKIT_STORAGE_EXPORT IsolatedContext : public MountPoints { // It is ok to call this for the path that has no associated filesystems. // Note that this only works for the filesystems registered by // |RegisterFileSystemForPath|. - void RevokeFileSystemByPath(const FilePath& path); + void RevokeFileSystemByPath(const base::FilePath& path); // Adds a reference to a filesystem specified by the given filesystem_id. void AddReference(const std::string& filesystem_id); @@ -133,19 +133,19 @@ class WEBKIT_STORAGE_EXPORT IsolatedContext : public MountPoints { virtual bool HandlesFileSystemMountType(FileSystemType type) const OVERRIDE; virtual bool RevokeFileSystem(const std::string& filesystem_id) OVERRIDE; virtual bool GetRegisteredPath(const std::string& filesystem_id, - FilePath* path) const OVERRIDE; - virtual bool CrackVirtualPath(const FilePath& virtual_path, + base::FilePath* path) const OVERRIDE; + virtual bool CrackVirtualPath(const base::FilePath& virtual_path, std::string* filesystem_id, FileSystemType* type, - FilePath* path) const OVERRIDE; + base::FilePath* path) const OVERRIDE; virtual FileSystemURL CrackURL(const GURL& url) const OVERRIDE; virtual FileSystemURL CreateCrackedFileSystemURL( const GURL& origin, FileSystemType type, - const FilePath& path) const OVERRIDE; + const base::FilePath& path) const OVERRIDE; // Returns the virtual root path that looks like /<filesystem_id>. - FilePath CreateVirtualRootPath(const std::string& filesystem_id) const; + base::FilePath CreateVirtualRootPath(const std::string& filesystem_id) const; private: friend struct base::DefaultLazyInstanceTraits<IsolatedContext>; @@ -156,7 +156,7 @@ class WEBKIT_STORAGE_EXPORT IsolatedContext : public MountPoints { typedef std::map<std::string, Instance*> IDToInstance; // Reverse map from registered path to IDs. - typedef std::map<FilePath, std::set<std::string> > PathToID; + typedef std::map<base::FilePath, std::set<std::string> > PathToID; // Obtain an instance of this class via GetInstance(). IsolatedContext(); diff --git a/webkit/fileapi/isolated_context_unittest.cc b/webkit/fileapi/isolated_context_unittest.cc index 4cb7a84..c2c9537 100644 --- a/webkit/fileapi/isolated_context_unittest.cc +++ b/webkit/fileapi/isolated_context_unittest.cc @@ -24,19 +24,19 @@ typedef IsolatedContext::MountPointInfo FileInfo; namespace { -const FilePath kTestPaths[] = { - FilePath(DRIVE FPL("/a/b.txt")), - FilePath(DRIVE FPL("/c/d/e")), - FilePath(DRIVE FPL("/h/")), - FilePath(DRIVE FPL("/")), +const base::FilePath kTestPaths[] = { + base::FilePath(DRIVE FPL("/a/b.txt")), + base::FilePath(DRIVE FPL("/c/d/e")), + base::FilePath(DRIVE FPL("/h/")), + base::FilePath(DRIVE FPL("/")), #if defined(FILE_PATH_USES_WIN_SEPARATORS) - FilePath(DRIVE FPL("\\foo\\bar")), - FilePath(DRIVE FPL("\\")), + base::FilePath(DRIVE FPL("\\foo\\bar")), + base::FilePath(DRIVE FPL("\\")), #endif // For duplicated base name test. - FilePath(DRIVE FPL("/")), - FilePath(DRIVE FPL("/f/e")), - FilePath(DRIVE FPL("/f/b.txt")), + base::FilePath(DRIVE FPL("/")), + base::FilePath(DRIVE FPL("/f/e")), + base::FilePath(DRIVE FPL("/f/b.txt")), }; } // namespace @@ -71,7 +71,7 @@ class IsolatedContextTest : public testing::Test { protected: std::string id_; - std::multiset<FilePath> fileset_; + std::multiset<base::FilePath> fileset_; std::vector<std::string> names_; private: @@ -91,10 +91,10 @@ TEST_F(IsolatedContextTest, RegisterAndRevokeTest) { // register in SetUp() by RegisterDraggedFileSystem) is properly cracked as // a valid virtual path in the isolated filesystem. for (size_t i = 0; i < arraysize(kTestPaths); ++i) { - FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) + base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) .AppendASCII(names_[i]); std::string cracked_id; - FilePath cracked_path; + base::FilePath cracked_path; FileSystemType cracked_type; ASSERT_TRUE(isolated_context()->CrackVirtualPath( virtual_path, &cracked_id, &cracked_type, &cracked_path)); @@ -106,14 +106,14 @@ TEST_F(IsolatedContextTest, RegisterAndRevokeTest) { // Make sure GetRegisteredPath returns false for id_ since it is // registered for dragged files. - FilePath path; + base::FilePath path; ASSERT_FALSE(isolated_context()->GetRegisteredPath(id_, &path)); // Deref the current one and registering a new one. isolated_context()->RemoveReference(id_); std::string id2 = isolated_context()->RegisterFileSystemForPath( - kFileSystemTypeNativeLocal, FilePath(DRIVE FPL("/foo")), NULL); + kFileSystemTypeNativeLocal, base::FilePath(DRIVE FPL("/foo")), NULL); // Make sure the GetDraggedFileInfo returns false for both ones. ASSERT_FALSE(isolated_context()->GetDraggedFileInfo(id2, &toplevels)); @@ -165,7 +165,7 @@ TEST_F(IsolatedContextTest, RegisterAndRevokeTest) { TEST_F(IsolatedContextTest, CrackWithRelativePaths) { const struct { - FilePath::StringType path; + base::FilePath::StringType path; bool valid; } relatives[] = { { FPL("foo"), true }, @@ -186,10 +186,10 @@ TEST_F(IsolatedContextTest, CrackWithRelativePaths) { for (size_t j = 0; j < ARRAYSIZE_UNSAFE(relatives); ++j) { SCOPED_TRACE(testing::Message() << "Testing " << kTestPaths[i].value() << " " << relatives[j].path); - FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) + base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) .AppendASCII(names_[i]).Append(relatives[j].path); std::string cracked_id; - FilePath cracked_path; + base::FilePath cracked_path; FileSystemType cracked_type; if (!relatives[j].valid) { ASSERT_FALSE(isolated_context()->CrackVirtualPath( @@ -209,7 +209,7 @@ TEST_F(IsolatedContextTest, CrackWithRelativePaths) { TEST_F(IsolatedContextTest, CrackURLWithRelativePaths) { const struct { - FilePath::StringType path; + base::FilePath::StringType path; bool valid; } relatives[] = { { FPL("foo"), true }, @@ -230,7 +230,7 @@ TEST_F(IsolatedContextTest, CrackURLWithRelativePaths) { for (size_t j = 0; j < ARRAYSIZE_UNSAFE(relatives); ++j) { SCOPED_TRACE(testing::Message() << "Testing " << kTestPaths[i].value() << " " << relatives[j].path); - FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) + base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) .AppendASCII(names_[i]).Append(relatives[j].path); FileSystemURL cracked = isolated_context()->CreateCrackedFileSystemURL( @@ -254,12 +254,12 @@ TEST_F(IsolatedContextTest, CrackURLWithRelativePaths) { TEST_F(IsolatedContextTest, TestWithVirtualRoot) { std::string cracked_id; - FilePath cracked_path; + base::FilePath cracked_path; // Trying to crack virtual root "/" returns true but with empty cracked path // as "/" of the isolated filesystem is a pure virtual directory // that has no corresponding platform directory. - FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_); + base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_); ASSERT_TRUE(isolated_context()->CrackVirtualPath( virtual_path, &cracked_id, NULL, &cracked_path)); ASSERT_EQ(FPL(""), cracked_path.value()); @@ -275,7 +275,7 @@ TEST_F(IsolatedContextTest, TestWithVirtualRoot) { TEST_F(IsolatedContextTest, CanHandleURL) { const GURL test_origin("http://chromium.org"); - const FilePath test_path(FPL("/mount")); + const base::FilePath test_path(FPL("/mount")); // Should handle isolated file system. EXPECT_TRUE(isolated_context()->HandlesFileSystemMountType( diff --git a/webkit/fileapi/isolated_file_util.cc b/webkit/fileapi/isolated_file_util.cc index efe485e..66abe55 100644 --- a/webkit/fileapi/isolated_file_util.cc +++ b/webkit/fileapi/isolated_file_util.cc @@ -34,10 +34,10 @@ class SetFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { virtual ~SetFileEnumerator() {} // AbstractFileEnumerator overrides. - virtual FilePath Next() OVERRIDE { + virtual base::FilePath Next() OVERRIDE { if (file_iter_ == files_.end()) - return FilePath(); - FilePath platform_file = (file_iter_++)->path; + return base::FilePath(); + base::FilePath platform_file = (file_iter_++)->path; NativeFileUtil::GetFileInfo(platform_file, &file_info_); return platform_file; } @@ -65,7 +65,7 @@ class RecursiveSetFileEnumerator virtual ~RecursiveSetFileEnumerator() {} // AbstractFileEnumerator overrides. - virtual FilePath Next() OVERRIDE; + virtual base::FilePath Next() OVERRIDE; virtual int64 Size() OVERRIDE { DCHECK(current_enumerator_.get()); return current_enumerator_->Size(); @@ -85,16 +85,16 @@ class RecursiveSetFileEnumerator scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> current_enumerator_; }; -FilePath RecursiveSetFileEnumerator::Next() { +base::FilePath RecursiveSetFileEnumerator::Next() { if (current_enumerator_.get()) { - FilePath path = current_enumerator_->Next(); + base::FilePath path = current_enumerator_->Next(); if (!path.empty()) return path; } // We reached the end. if (file_iter_ == files_.end()) - return FilePath(); + return base::FilePath(); // Enumerates subdirectories of the next path. FileInfo& next_file = *file_iter_++; @@ -113,7 +113,7 @@ IsolatedFileUtil::IsolatedFileUtil() {} PlatformFileError IsolatedFileUtil::GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& url, - FilePath* local_file_path) { + base::FilePath* local_file_path) { DCHECK(local_file_path); DCHECK(url.is_valid()); if (url.path().empty()) { @@ -132,7 +132,7 @@ PlatformFileError DraggedFileUtil::GetFileInfo( FileSystemOperationContext* context, const FileSystemURL& url, PlatformFileInfo* file_info, - FilePath* platform_path) { + base::FilePath* platform_path) { DCHECK(file_info); std::string filesystem_id; DCHECK(url.is_valid()); @@ -149,7 +149,7 @@ PlatformFileError DraggedFileUtil::GetFileInfo( } base::PlatformFileError error = NativeFileUtil::GetFileInfo(url.path(), file_info); - if (file_util::IsLink(url.path()) && !FilePath().IsParent(url.path())) { + if (file_util::IsLink(url.path()) && !base::FilePath().IsParent(url.path())) { // Don't follow symlinks unless it's the one that are selected by the user. return base::PLATFORM_FILE_ERROR_NOT_FOUND; } diff --git a/webkit/fileapi/isolated_file_util.h b/webkit/fileapi/isolated_file_util.h index e2f65ee..9f3ae90 100644 --- a/webkit/fileapi/isolated_file_util.h +++ b/webkit/fileapi/isolated_file_util.h @@ -22,7 +22,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE IsolatedFileUtil : public LocalFileUtil { virtual base::PlatformFileError GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_file_path) OVERRIDE; + base::FilePath* local_file_path) OVERRIDE; }; // Dragged file system is a specialized IsolatedFileUtil where read access to @@ -38,7 +38,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE DraggedFileUtil : public IsolatedFileUtil { FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path) OVERRIDE; + base::FilePath* platform_path) OVERRIDE; virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( FileSystemOperationContext* context, const FileSystemURL& root_url, diff --git a/webkit/fileapi/isolated_file_util_unittest.cc b/webkit/fileapi/isolated_file_util_unittest.cc index 06c1a34..4652372 100644 --- a/webkit/fileapi/isolated_file_util_unittest.cc +++ b/webkit/fileapi/isolated_file_util_unittest.cc @@ -39,16 +39,16 @@ namespace { // Random root paths in which we create each file/directory of the // RegularTestCases (so that we can simulate a drop with files/directories // from multiple directories). -static const FilePath::CharType* kRootPaths[] = { +static const base::FilePath::CharType* kRootPaths[] = { FILE_PATH_LITERAL("a"), FILE_PATH_LITERAL("b/c"), FILE_PATH_LITERAL("etc"), }; -FilePath GetTopLevelPath(const FilePath& path) { - std::vector<FilePath::StringType> components; +base::FilePath GetTopLevelPath(const base::FilePath& path) { + std::vector<base::FilePath::StringType> components; path.GetComponents(&components); - return FilePath(components[0]); + return base::FilePath(components[0]); } bool IsDirectoryEmpty(FileSystemOperationContext* context, @@ -100,7 +100,7 @@ class IsolatedFileUtilTest : public testing::Test { IsolatedContext* isolated_context() const { return IsolatedContext::GetInstance(); } - const FilePath& root_path() const { + const base::FilePath& root_path() const { return data_dir_.path(); } FileSystemContext* file_system_context() const { @@ -112,20 +112,20 @@ class IsolatedFileUtilTest : public testing::Test { } std::string filesystem_id() const { return filesystem_id_; } - FilePath GetTestCasePlatformPath(const FilePath::StringType& path) { - return toplevel_root_map_[GetTopLevelPath(FilePath(path))].Append(path). + base::FilePath GetTestCasePlatformPath(const base::FilePath::StringType& path) { + return toplevel_root_map_[GetTopLevelPath(base::FilePath(path))].Append(path). NormalizePathSeparators(); } - FilePath GetTestCaseLocalPath(const FilePath& path) { - FilePath relative; + base::FilePath GetTestCaseLocalPath(const base::FilePath& path) { + base::FilePath relative; if (data_dir_.path().AppendRelativePath(path, &relative)) return relative; return path; } - FileSystemURL GetFileSystemURL(const FilePath& path) const { - FilePath virtual_path = isolated_context()->CreateVirtualRootPath( + FileSystemURL GetFileSystemURL(const base::FilePath& path) const { + base::FilePath virtual_path = isolated_context()->CreateVirtualRootPath( filesystem_id()).Append(path); return file_system_context_->CreateCrackedFileSystemURL( GURL("http://example.com"), @@ -133,7 +133,7 @@ class IsolatedFileUtilTest : public testing::Test { virtual_path); } - FileSystemURL GetOtherFileSystemURL(const FilePath& path) { + FileSystemURL GetOtherFileSystemURL(const base::FilePath& path) { return other_file_util_helper_.CreateURL(GetTestCaseLocalPath(path)); } @@ -145,7 +145,7 @@ class IsolatedFileUtilTest : public testing::Test { // Get the file info for url1. base::PlatformFileInfo info1; - FilePath platform_path1; + base::FilePath platform_path1; context.reset(new FileSystemOperationContext(file_system_context())); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util1->GetFileInfo(context.get(), url1, @@ -153,7 +153,7 @@ class IsolatedFileUtilTest : public testing::Test { // Get the file info for url2. base::PlatformFileInfo info2; - FilePath platform_path2; + base::FilePath platform_path2; context.reset(new FileSystemOperationContext(file_system_context())); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util2->GetFileInfo(context.get(), url2, @@ -176,20 +176,20 @@ class IsolatedFileUtilTest : public testing::Test { const FileSystemURL& root1, const FileSystemURL& root2) { scoped_ptr<FileSystemOperationContext> context; - FilePath root_path1 = root1.path(); - FilePath root_path2 = root2.path(); + base::FilePath root_path1 = root1.path(); + base::FilePath root_path2 = root2.path(); context.reset(new FileSystemOperationContext(file_system_context())); scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum1 = file_util1->CreateFileEnumerator(context.get(), root1, true /* recursive */); - FilePath current; - std::set<FilePath> file_set1; + base::FilePath current; + std::set<base::FilePath> file_set1; while (!(current = file_enum1->Next()).empty()) { if (file_enum1->IsDirectory()) continue; - FilePath relative; + base::FilePath relative; root_path1.AppendRelativePath(current, &relative); file_set1.insert(relative); } @@ -200,7 +200,7 @@ class IsolatedFileUtilTest : public testing::Test { true /* recursive */); while (!(current = file_enum2->Next()).empty()) { - FilePath relative; + base::FilePath relative; root_path2.AppendRelativePath(current, &relative); FileSystemURL url1 = root1.WithPath(root_path1.Append(relative)); FileSystemURL url2 = root2.WithPath(root_path2.Append(relative)); @@ -229,13 +229,13 @@ class IsolatedFileUtilTest : public testing::Test { IsolatedContext::FileInfoSet toplevels; for (size_t i = 0; i < test::kRegularTestCaseSize; ++i) { const test::TestCaseRecord& test_case = test::kRegularTestCases[i]; - FilePath path(test_case.path); - FilePath toplevel = GetTopLevelPath(path); + base::FilePath path(test_case.path); + base::FilePath toplevel = GetTopLevelPath(path); // We create the test case files under one of the kRootPaths // to simulate a drop with multiple directories. if (toplevel_root_map_.find(toplevel) == toplevel_root_map_.end()) { - FilePath root = root_path().Append( + base::FilePath root = root_path().Append( kRootPaths[(root_path_index++) % arraysize(kRootPaths)]); toplevel_root_map_[toplevel] = root; toplevels.AddPath(root.Append(path), NULL); @@ -253,7 +253,7 @@ class IsolatedFileUtilTest : public testing::Test { MessageLoop message_loop_; std::string filesystem_id_; scoped_refptr<FileSystemContext> file_system_context_; - std::map<FilePath, FilePath> toplevel_root_map_; + std::map<base::FilePath, base::FilePath> toplevel_root_map_; scoped_ptr<IsolatedFileUtil> file_util_; LocalFileSystemTestOriginHelper other_file_util_helper_; DISALLOW_COPY_AND_ASSIGN(IsolatedFileUtilTest); @@ -264,13 +264,13 @@ TEST_F(IsolatedFileUtilTest, BasicTest) { SCOPED_TRACE(testing::Message() << "Testing RegularTestCases " << i); const test::TestCaseRecord& test_case = test::kRegularTestCases[i]; - FileSystemURL url = GetFileSystemURL(FilePath(test_case.path)); + FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path)); // See if we can query the file info via the isolated FileUtil. // (This should succeed since we have registered all the top-level // entries of the test cases in SetUp()) base::PlatformFileInfo info; - FilePath platform_path; + base::FilePath platform_path; FileSystemOperationContext context(file_system_context()); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->GetFileInfo(&context, url, &info, &platform_path)); @@ -312,7 +312,7 @@ TEST_F(IsolatedFileUtilTest, UnregisteredPathsTest) { for (size_t i = 0; i < arraysize(kUnregisteredCases); ++i) { SCOPED_TRACE(testing::Message() << "Creating kUnregisteredCases " << i); const test::TestCaseRecord& test_case = kUnregisteredCases[i]; - FileSystemURL url = GetFileSystemURL(FilePath(test_case.path)); + FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path)); // We should not be able to get the valid URL for unregistered files. ASSERT_FALSE(url.is_valid()); @@ -336,13 +336,13 @@ TEST_F(IsolatedFileUtilTest, ReadDirectoryTest) { << ": " << test_case.path); // Read entries in the directory to construct the expected results map. - typedef std::map<FilePath::StringType, base::FileUtilProxy::Entry> EntryMap; + typedef std::map<base::FilePath::StringType, base::FileUtilProxy::Entry> EntryMap; EntryMap expected_entry_map; FileEnumerator file_enum( GetTestCasePlatformPath(test_case.path), false /* not recursive */, FileEnumerator::FILES | FileEnumerator::DIRECTORIES); - FilePath current; + base::FilePath current; while (!(current = file_enum.Next()).empty()) { FileEnumerator::FindInfo file_info; file_enum.GetFindInfo(&file_info); @@ -355,7 +355,7 @@ TEST_F(IsolatedFileUtilTest, ReadDirectoryTest) { } // Perform ReadDirectory in the isolated filesystem. - FileSystemURL url = GetFileSystemURL(FilePath(test_case.path)); + FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path)); std::vector<base::FileUtilProxy::Entry> entries; FileSystemOperationContext context(file_system_context()); ASSERT_EQ(base::PLATFORM_FILE_OK, @@ -379,11 +379,11 @@ TEST_F(IsolatedFileUtilTest, ReadDirectoryTest) { TEST_F(IsolatedFileUtilTest, GetLocalFilePathTest) { for (size_t i = 0; i < test::kRegularTestCaseSize; ++i) { const test::TestCaseRecord& test_case = test::kRegularTestCases[i]; - FileSystemURL url = GetFileSystemURL(FilePath(test_case.path)); + FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path)); FileSystemOperationContext context(file_system_context()); - FilePath local_file_path; + base::FilePath local_file_path; EXPECT_EQ(base::PLATFORM_FILE_OK, file_util()->GetLocalFilePath(&context, url, &local_file_path)); EXPECT_EQ(GetTestCasePlatformPath(test_case.path).value(), @@ -394,12 +394,12 @@ TEST_F(IsolatedFileUtilTest, GetLocalFilePathTest) { TEST_F(IsolatedFileUtilTest, CopyOutFileTest) { scoped_ptr<FileSystemOperationContext> context( new FileSystemOperationContext(file_system_context())); - FileSystemURL root_url = GetFileSystemURL(FilePath()); + FileSystemURL root_url = GetFileSystemURL(base::FilePath()); scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( file_util()->CreateFileEnumerator(context.get(), root_url, true /* recursive */)); - FilePath current; + base::FilePath current; while (!(current = file_enum->Next()).empty()) { if (file_enum->IsDirectory()) continue; @@ -434,12 +434,12 @@ TEST_F(IsolatedFileUtilTest, CopyOutFileTest) { TEST_F(IsolatedFileUtilTest, CopyOutDirectoryTest) { scoped_ptr<FileSystemOperationContext> context( new FileSystemOperationContext(file_system_context())); - FileSystemURL root_url = GetFileSystemURL(FilePath()); + FileSystemURL root_url = GetFileSystemURL(base::FilePath()); scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> file_enum( file_util()->CreateFileEnumerator(context.get(), root_url, false /* recursive */)); - FilePath current; + base::FilePath current; while (!(current = file_enum->Next()).empty()) { if (!file_enum->IsDirectory()) continue; @@ -477,7 +477,7 @@ TEST_F(IsolatedFileUtilTest, TouchTest) { if (test_case.is_directory) continue; SCOPED_TRACE(testing::Message() << test_case.path); - FileSystemURL url = GetFileSystemURL(FilePath(test_case.path)); + FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path)); base::Time last_access_time = base::Time::FromTimeT(1000); base::Time last_modified_time = base::Time::FromTimeT(2000); @@ -489,7 +489,7 @@ TEST_F(IsolatedFileUtilTest, TouchTest) { // Verification. base::PlatformFileInfo info; - FilePath platform_path; + base::FilePath platform_path; ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->GetFileInfo(GetOperationContext().get(), url, &info, &platform_path)); @@ -505,11 +505,11 @@ TEST_F(IsolatedFileUtilTest, TruncateTest) { continue; SCOPED_TRACE(testing::Message() << test_case.path); - FileSystemURL url = GetFileSystemURL(FilePath(test_case.path)); + FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path)); // Truncate to 0. base::PlatformFileInfo info; - FilePath platform_path; + base::FilePath platform_path; EXPECT_EQ(base::PLATFORM_FILE_OK, file_util()->Truncate(GetOperationContext().get(), url, 0)); ASSERT_EQ(base::PLATFORM_FILE_OK, diff --git a/webkit/fileapi/isolated_mount_point_provider.cc b/webkit/fileapi/isolated_mount_point_provider.cc index f21909c..160a71c 100644 --- a/webkit/fileapi/isolated_mount_point_provider.cc +++ b/webkit/fileapi/isolated_mount_point_provider.cc @@ -35,7 +35,7 @@ namespace fileapi { IsolatedMountPointProvider::IsolatedMountPointProvider( - const FilePath& profile_path) + const base::FilePath& profile_path) : profile_path_(profile_path), media_path_filter_(new MediaPathFilter()), isolated_file_util_(new AsyncFileUtilAdapter(new IsolatedFileUtil())), @@ -64,12 +64,12 @@ void IsolatedMountPointProvider::ValidateFileSystemRoot( base::Bind(callback, base::PLATFORM_FILE_ERROR_SECURITY)); } -FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( +base::FilePath IsolatedMountPointProvider::GetFileSystemRootPathOnFileThread( const FileSystemURL& url, bool create) { // This is not supposed to be used. NOTREACHED(); - return FilePath(); + return base::FilePath(); } bool IsolatedMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { @@ -77,7 +77,7 @@ bool IsolatedMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { } bool IsolatedMountPointProvider::IsRestrictedFileName( - const FilePath& filename) const { + const base::FilePath& filename) const { // TODO(kinuko): We need to check platform-specific restricted file names // before we actually start allowing file creation in isolated file systems. return false; diff --git a/webkit/fileapi/isolated_mount_point_provider.h b/webkit/fileapi/isolated_mount_point_provider.h index 5c89f11..64f82a6 100644 --- a/webkit/fileapi/isolated_mount_point_provider.h +++ b/webkit/fileapi/isolated_mount_point_provider.h @@ -17,7 +17,7 @@ class MediaPathFilter; class IsolatedMountPointProvider : public FileSystemMountPointProvider { public: - explicit IsolatedMountPointProvider(const FilePath& profile_path); + explicit IsolatedMountPointProvider(const base::FilePath& profile_path); virtual ~IsolatedMountPointProvider(); // FileSystemMountPointProvider implementation. @@ -26,11 +26,11 @@ class IsolatedMountPointProvider : public FileSystemMountPointProvider { FileSystemType type, bool create, const ValidateFileSystemCallback& callback) OVERRIDE; - virtual FilePath GetFileSystemRootPathOnFileThread( + virtual base::FilePath GetFileSystemRootPathOnFileThread( const FileSystemURL& url, bool create) OVERRIDE; virtual bool IsAccessAllowed(const FileSystemURL& url) OVERRIDE; - virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; + virtual bool IsRestrictedFileName(const base::FilePath& filename) const OVERRIDE; virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; virtual FilePermissionPolicy GetPermissionPolicy( @@ -58,7 +58,7 @@ class IsolatedMountPointProvider : public FileSystemMountPointProvider { private: // Store the profile path. We need this to create temporary snapshot files. - const FilePath profile_path_; + const base::FilePath profile_path_; scoped_ptr<MediaPathFilter> media_path_filter_; diff --git a/webkit/fileapi/local_file_stream_writer.cc b/webkit/fileapi/local_file_stream_writer.cc index f3679f9..e17784e 100644 --- a/webkit/fileapi/local_file_stream_writer.cc +++ b/webkit/fileapi/local_file_stream_writer.cc @@ -20,7 +20,7 @@ const int kOpenFlagsForWrite = base::PLATFORM_FILE_OPEN | } // namespace -LocalFileStreamWriter::LocalFileStreamWriter(const FilePath& file_path, +LocalFileStreamWriter::LocalFileStreamWriter(const base::FilePath& file_path, int64 initial_offset) : file_path_(file_path), initial_offset_(initial_offset), diff --git a/webkit/fileapi/local_file_stream_writer.h b/webkit/fileapi/local_file_stream_writer.h index e23b476..a6d15f9 100644 --- a/webkit/fileapi/local_file_stream_writer.h +++ b/webkit/fileapi/local_file_stream_writer.h @@ -28,7 +28,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileStreamWriter public: // Create a writer for the existing file in the path |file_path| starting from // |initial_offset|. - LocalFileStreamWriter(const FilePath& file_path, int64 initial_offset); + LocalFileStreamWriter(const base::FilePath& file_path, int64 initial_offset); virtual ~LocalFileStreamWriter(); // FileStreamWriter overrides. @@ -72,7 +72,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileStreamWriter bool CancelIfRequested(); // Initialization parameters. - const FilePath file_path_; + const base::FilePath file_path_; const int64 initial_offset_; // Current states of the operation. diff --git a/webkit/fileapi/local_file_stream_writer_unittest.cc b/webkit/fileapi/local_file_stream_writer_unittest.cc index 3fda6d6..d67a7da 100644 --- a/webkit/fileapi/local_file_stream_writer_unittest.cc +++ b/webkit/fileapi/local_file_stream_writer_unittest.cc @@ -29,7 +29,7 @@ class LocalFileStreamWriterTest : public testing::Test { } protected: - FilePath Path(const std::string& name) { + base::FilePath Path(const std::string& name) { return temp_dir_.path().AppendASCII(name); } @@ -52,15 +52,15 @@ class LocalFileStreamWriterTest : public testing::Test { return net::OK; } - std::string GetFileContent(const FilePath& path) { + std::string GetFileContent(const base::FilePath& path) { std::string content; file_util::ReadFileToString(path, &content); return content; } - FilePath CreateFileWithContent(const std::string& name, + base::FilePath CreateFileWithContent(const std::string& name, const std::string& data) { - FilePath path = Path(name); + base::FilePath path = Path(name); file_util::WriteFile(path, data.c_str(), data.size()); return path; } @@ -77,7 +77,7 @@ void NeverCalled(int unused) { } // namespace TEST_F(LocalFileStreamWriterTest, Write) { - FilePath path = CreateFileWithContent("file_a", ""); + base::FilePath path = CreateFileWithContent("file_a", ""); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0)); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "foo")); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "bar")); @@ -88,7 +88,7 @@ TEST_F(LocalFileStreamWriterTest, Write) { } TEST_F(LocalFileStreamWriterTest, WriteMiddle) { - FilePath path = CreateFileWithContent("file_a", "foobar"); + base::FilePath path = CreateFileWithContent("file_a", "foobar"); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 2)); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "xxx")); writer.reset(); @@ -98,7 +98,7 @@ TEST_F(LocalFileStreamWriterTest, WriteMiddle) { } TEST_F(LocalFileStreamWriterTest, WriteEnd) { - FilePath path = CreateFileWithContent("file_a", "foobar"); + base::FilePath path = CreateFileWithContent("file_a", "foobar"); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 6)); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "xxx")); writer.reset(); @@ -108,7 +108,7 @@ TEST_F(LocalFileStreamWriterTest, WriteEnd) { } TEST_F(LocalFileStreamWriterTest, WriteFailForNonexistingFile) { - FilePath path = Path("file_a"); + base::FilePath path = Path("file_a"); ASSERT_FALSE(file_util::PathExists(path)); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0)); EXPECT_EQ(net::ERR_FILE_NOT_FOUND, WriteStringToWriter(writer.get(), "foo")); @@ -118,7 +118,7 @@ TEST_F(LocalFileStreamWriterTest, WriteFailForNonexistingFile) { } TEST_F(LocalFileStreamWriterTest, CancelBeforeOperation) { - FilePath path = Path("file_a"); + base::FilePath path = Path("file_a"); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0)); // Cancel immediately fails when there's no in-flight operation. int cancel_result = writer->Cancel(base::Bind(&NeverCalled)); @@ -126,7 +126,7 @@ TEST_F(LocalFileStreamWriterTest, CancelBeforeOperation) { } TEST_F(LocalFileStreamWriterTest, CancelAfterFinishedOperation) { - FilePath path = CreateFileWithContent("file_a", ""); + base::FilePath path = CreateFileWithContent("file_a", ""); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0)); EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "foo")); @@ -142,7 +142,7 @@ TEST_F(LocalFileStreamWriterTest, CancelAfterFinishedOperation) { } TEST_F(LocalFileStreamWriterTest, CancelWrite) { - FilePath path = CreateFileWithContent("file_a", "foobar"); + base::FilePath path = CreateFileWithContent("file_a", "foobar"); scoped_ptr<LocalFileStreamWriter> writer(new LocalFileStreamWriter(path, 0)); scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer("xxx")); diff --git a/webkit/fileapi/local_file_system_operation.cc b/webkit/fileapi/local_file_system_operation.cc index edf26b0..4cda1f8 100644 --- a/webkit/fileapi/local_file_system_operation.cc +++ b/webkit/fileapi/local_file_system_operation.cc @@ -193,7 +193,7 @@ void LocalFileSystemOperation::GetMetadata( base::PlatformFileError result = SetUp(url, SETUP_FOR_READ); if (result != base::PLATFORM_FILE_OK) { - callback.Run(result, base::PlatformFileInfo(), FilePath()); + callback.Run(result, base::PlatformFileInfo(), base::FilePath()); delete this; return; } @@ -372,7 +372,7 @@ LocalFileSystemOperation::AsLocalFileSystemOperation() { } void LocalFileSystemOperation::SyncGetPlatformPath(const FileSystemURL& url, - FilePath* platform_path) { + base::FilePath* platform_path) { DCHECK(SetPendingOperationType(kOperationGetLocalPath)); base::PlatformFileError result = SetUp(url, SETUP_FOR_READ); @@ -396,7 +396,7 @@ void LocalFileSystemOperation::CreateSnapshotFile( base::PlatformFileError result = SetUp(url, SETUP_FOR_READ); if (result != base::PLATFORM_FILE_OK) { - callback.Run(result, base::PlatformFileInfo(), FilePath(), NULL); + callback.Run(result, base::PlatformFileInfo(), base::FilePath(), NULL); delete this; return; } @@ -408,7 +408,7 @@ void LocalFileSystemOperation::CreateSnapshotFile( } void LocalFileSystemOperation::CopyInForeignFile( - const FilePath& src_local_disk_file_path, + const base::FilePath& src_local_disk_file_path, const FileSystemURL& dest_url, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationCopyInForeignFile)); @@ -666,7 +666,7 @@ void LocalFileSystemOperation::DoMoveFileLocal( } void LocalFileSystemOperation::DoCopyInForeignFile( - const FilePath& src_local_disk_file_path, + const base::FilePath& src_local_disk_file_path, const FileSystemURL& dest_url, const StatusCallback& callback) { async_file_util_->CopyInForeignFile( @@ -737,7 +737,7 @@ void LocalFileSystemOperation::DidDirectoryExists( const StatusCallback& callback, base::PlatformFileError rv, const base::PlatformFileInfo& file_info, - const FilePath& unused) { + const base::FilePath& unused) { if (rv == base::PLATFORM_FILE_OK && !file_info.is_directory) rv = base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; callback.Run(rv); @@ -747,7 +747,7 @@ void LocalFileSystemOperation::DidFileExists( const StatusCallback& callback, base::PlatformFileError rv, const base::PlatformFileInfo& file_info, - const FilePath& unused) { + const base::FilePath& unused) { if (rv == base::PLATFORM_FILE_OK && file_info.is_directory) rv = base::PLATFORM_FILE_ERROR_NOT_A_FILE; callback.Run(rv); @@ -757,7 +757,7 @@ void LocalFileSystemOperation::DidGetMetadata( const GetMetadataCallback& callback, base::PlatformFileError rv, const base::PlatformFileInfo& file_info, - const FilePath& platform_path) { + const base::FilePath& platform_path) { callback.Run(rv, file_info, platform_path); } @@ -812,7 +812,7 @@ void LocalFileSystemOperation::DidCreateSnapshotFile( const SnapshotFileCallback& callback, base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, SnapshotFilePolicy snapshot_policy) { scoped_refptr<ShareableFileReference> file_ref; if (result == base::PLATFORM_FILE_OK && diff --git a/webkit/fileapi/local_file_system_operation.h b/webkit/fileapi/local_file_system_operation.h index cd828d8..73ee457 100644 --- a/webkit/fileapi/local_file_system_operation.h +++ b/webkit/fileapi/local_file_system_operation.h @@ -91,7 +91,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation // - PLATFORM_FILE_ERROR_FAILED if |dest_url| does not exist and // its parent path is a file. // - void CopyInForeignFile(const FilePath& src_local_disk_path, + void CopyInForeignFile(const base::FilePath& src_local_disk_path, const FileSystemURL& dest_url, const StatusCallback& callback); @@ -149,7 +149,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation const StatusCallback& callback); // Synchronously gets the platform path for the given |url|. - void SyncGetPlatformPath(const FileSystemURL& url, FilePath* platform_path); + void SyncGetPlatformPath(const FileSystemURL& url, base::FilePath* platform_path); private: class ScopedUpdateNotifier; @@ -235,7 +235,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation void DoMoveFileLocal(const FileSystemURL& src, const FileSystemURL& dest, const StatusCallback& callback); - void DoCopyInForeignFile(const FilePath& src_local_disk_file_path, + void DoCopyInForeignFile(const base::FilePath& src_local_disk_file_path, const FileSystemURL& dest, const StatusCallback& callback); void DoTruncate(const FileSystemURL& url, @@ -264,15 +264,15 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation void DidDirectoryExists(const StatusCallback& callback, base::PlatformFileError rv, const base::PlatformFileInfo& file_info, - const FilePath& unused); + const base::FilePath& unused); void DidFileExists(const StatusCallback& callback, base::PlatformFileError rv, const base::PlatformFileInfo& file_info, - const FilePath& unused); + const base::FilePath& unused); void DidGetMetadata(const GetMetadataCallback& callback, base::PlatformFileError rv, const base::PlatformFileInfo& file_info, - const FilePath& platform_path); + const base::FilePath& platform_path); void DidReadDirectory(const ReadDirectoryCallback& callback, base::PlatformFileError rv, const std::vector<base::FileUtilProxy::Entry>& entries, @@ -291,7 +291,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileSystemOperation const SnapshotFileCallback& callback, base::PlatformFileError rv, const base::PlatformFileInfo& file_info, - const FilePath& platform_path, + const base::FilePath& platform_path, SnapshotFilePolicy snapshot_policy); // Checks the validity of a given |url| and populates |file_util| for |mode|. diff --git a/webkit/fileapi/local_file_system_operation_unittest.cc b/webkit/fileapi/local_file_system_operation_unittest.cc index c49e2b2..37b76a5 100644 --- a/webkit/fileapi/local_file_system_operation_unittest.cc +++ b/webkit/fileapi/local_file_system_operation_unittest.cc @@ -58,7 +58,7 @@ class LocalFileSystemOperationTest int status() const { return status_; } const base::PlatformFileInfo& info() const { return info_; } - const FilePath& path() const { return path_; } + const base::FilePath& path() const { return path_; } const std::vector<base::FileUtilProxy::Entry>& entries() const { return entries_; } @@ -101,32 +101,32 @@ class LocalFileSystemOperationTest return context; } - FileSystemURL URLForPath(const FilePath& path) const { + FileSystemURL URLForPath(const base::FilePath& path) const { return test_helper_.CreateURL(path); } - FilePath PlatformPath(const FilePath& virtual_path) { + base::FilePath PlatformPath(const base::FilePath& virtual_path) { return test_helper_.GetLocalPath(virtual_path); } - bool FileExists(const FilePath& virtual_path) { + bool FileExists(const base::FilePath& virtual_path) { FileSystemURL url = test_helper_.CreateURL(virtual_path); base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; scoped_ptr<FileSystemOperationContext> context(NewContext()); base::PlatformFileError error = file_util()->GetFileInfo( context.get(), url, &file_info, &platform_path); return error == base::PLATFORM_FILE_OK && !file_info.is_directory; } - bool DirectoryExists(const FilePath& virtual_path) { + bool DirectoryExists(const base::FilePath& virtual_path) { FileSystemURL url = test_helper_.CreateURL(virtual_path); scoped_ptr<FileSystemOperationContext> context(NewContext()); return FileUtilHelper::DirectoryExists(context.get(), file_util(), url); } - FilePath CreateUniqueFileInDir(const FilePath& virtual_dir_path) { - FilePath file_name = FilePath::FromUTF8Unsafe( + base::FilePath CreateUniqueFileInDir(const base::FilePath& virtual_dir_path) { + base::FilePath file_name = base::FilePath::FromUTF8Unsafe( "tmpfile-" + base::IntToString(next_unique_path_suffix_++)); FileSystemURL url = test_helper_.CreateURL( virtual_dir_path.Append(file_name)); @@ -139,8 +139,8 @@ class LocalFileSystemOperationTest return url.path(); } - FilePath CreateUniqueDirInDir(const FilePath& virtual_dir_path) { - FilePath dir_name = FilePath::FromUTF8Unsafe( + base::FilePath CreateUniqueDirInDir(const base::FilePath& virtual_dir_path) { + base::FilePath dir_name = base::FilePath::FromUTF8Unsafe( "tmpdir-" + base::IntToString(next_unique_path_suffix_++)); FileSystemURL url = test_helper_.CreateURL( virtual_dir_path.Append(dir_name)); @@ -151,8 +151,8 @@ class LocalFileSystemOperationTest return url.path(); } - FilePath CreateUniqueDir() { - return CreateUniqueDirInDir(FilePath()); + base::FilePath CreateUniqueDir() { + return CreateUniqueDirInDir(base::FilePath()); } LocalFileSystemTestOriginHelper test_helper_; @@ -192,7 +192,7 @@ class LocalFileSystemOperationTest void DidGetMetadata(base::PlatformFileError status, const base::PlatformFileInfo& info, - const FilePath& platform_path) { + const base::FilePath& platform_path) { info_ = info; path_ = platform_path; status_ = status; @@ -201,7 +201,7 @@ class LocalFileSystemOperationTest void DidCreateSnapshotFile( base::PlatformFileError status, const base::PlatformFileInfo& info, - const FilePath& platform_path, + const base::FilePath& platform_path, const scoped_refptr<ShareableFileReference>& shareable_file_ref) { info_ = info; path_ = platform_path; @@ -236,8 +236,8 @@ class LocalFileSystemOperationTest ASSERT_EQ(quota::kQuotaStatusOk, status); } - void GenerateUniquePathInDir(const FilePath& dir, - FilePath* file_path, + void GenerateUniquePathInDir(const base::FilePath& dir, + base::FilePath* file_path, int64* path_cost) { int64 base_usage; GetUsageAndQuota(&base_usage, NULL); @@ -272,7 +272,7 @@ class LocalFileSystemOperationTest // For post-operation status. int status_; base::PlatformFileInfo info_; - FilePath path_; + base::FilePath path_; std::vector<base::FileUtilProxy::Entry> entries_; scoped_refptr<ShareableFileReference> shareable_file_ref_; @@ -290,7 +290,7 @@ class LocalFileSystemOperationTest }; void LocalFileSystemOperationTest::SetUp() { - FilePath base_dir = base_.path().AppendASCII("filesystem"); + base::FilePath base_dir = base_.path().AppendASCII("filesystem"); quota_manager_ = new quota::MockQuotaManager( false /* is_incognito */, base_dir, base::MessageLoopProxy::current(), @@ -319,8 +319,8 @@ LocalFileSystemOperation* LocalFileSystemOperationTest::operation() { } TEST_F(LocalFileSystemOperationTest, TestMoveFailureSrcDoesntExist) { - FileSystemURL src(URLForPath(FilePath(FILE_PATH_LITERAL("a")))); - FileSystemURL dest(URLForPath(FilePath(FILE_PATH_LITERAL("b")))); + FileSystemURL src(URLForPath(base::FilePath(FILE_PATH_LITERAL("a")))); + FileSystemURL dest(URLForPath(base::FilePath(FILE_PATH_LITERAL("b")))); change_observer()->ResetCount(); operation()->Move(src, dest, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -329,8 +329,8 @@ TEST_F(LocalFileSystemOperationTest, TestMoveFailureSrcDoesntExist) { } TEST_F(LocalFileSystemOperationTest, TestMoveFailureContainsPath) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDirInDir(src_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDirInDir(src_dir_path)); operation()->Move(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -340,9 +340,9 @@ TEST_F(LocalFileSystemOperationTest, TestMoveFailureContainsPath) { TEST_F(LocalFileSystemOperationTest, TestMoveFailureSrcDirExistsDestFile) { // Src exists and is dir. Dest is a file. - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); operation()->Move(URLForPath(src_dir_path), URLForPath(dest_file_path), RecordStatusCallback()); @@ -354,9 +354,9 @@ TEST_F(LocalFileSystemOperationTest, TestMoveFailureSrcDirExistsDestFile) { TEST_F(LocalFileSystemOperationTest, TestMoveFailureSrcFileExistsDestNonEmptyDir) { // Src exists and is a directory. Dest is a non-empty directory. - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath child_file_path(CreateUniqueFileInDir(dest_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath child_file_path(CreateUniqueFileInDir(dest_dir_path)); operation()->Move(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); @@ -367,9 +367,9 @@ TEST_F(LocalFileSystemOperationTest, TEST_F(LocalFileSystemOperationTest, TestMoveFailureSrcFileExistsDestDir) { // Src exists and is a file. Dest is a directory. - FilePath src_dir_path(CreateUniqueDir()); - FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); + base::FilePath dest_dir_path(CreateUniqueDir()); operation()->Move(URLForPath(src_file_path), URLForPath(dest_dir_path), RecordStatusCallback()); @@ -380,8 +380,8 @@ TEST_F(LocalFileSystemOperationTest, TestMoveFailureSrcFileExistsDestDir) { TEST_F(LocalFileSystemOperationTest, TestMoveFailureDestParentDoesntExist) { // Dest. parent path does not exist. - FilePath src_dir_path(CreateUniqueDir()); - FilePath nonexisting_file = FilePath(FILE_PATH_LITERAL("NonexistingDir")). + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath nonexisting_file = base::FilePath(FILE_PATH_LITERAL("NonexistingDir")). Append(FILE_PATH_LITERAL("NonexistingFile")); operation()->Move(URLForPath(src_dir_path), URLForPath(nonexisting_file), @@ -392,10 +392,10 @@ TEST_F(LocalFileSystemOperationTest, TestMoveFailureDestParentDoesntExist) { } TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcFileAndOverwrite) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); operation()->Move(URLForPath(src_file_path), URLForPath(dest_file_path), RecordStatusCallback()); @@ -413,10 +413,10 @@ TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcFileAndOverwrite) { } TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcFileAndNew) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(dest_dir_path.Append(FILE_PATH_LITERAL("NewFile"))); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(dest_dir_path.Append(FILE_PATH_LITERAL("NewFile"))); operation()->Move(URLForPath(src_file_path), URLForPath(dest_file_path), RecordStatusCallback()); @@ -430,8 +430,8 @@ TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcFileAndNew) { } TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcDirAndOverwrite) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); operation()->Move(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); @@ -450,9 +450,9 @@ TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcDirAndOverwrite) { } TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcDirAndNew) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_parent_dir_path(CreateUniqueDir()); - FilePath dest_child_dir_path(dest_parent_dir_path. + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_parent_dir_path(CreateUniqueDir()); + base::FilePath dest_child_dir_path(dest_parent_dir_path. Append(FILE_PATH_LITERAL("NewDirectory"))); operation()->Move(URLForPath(src_dir_path), URLForPath(dest_child_dir_path), @@ -468,12 +468,12 @@ TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcDirAndNew) { } TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcDirRecursive) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath child_dir_path(CreateUniqueDirInDir(src_dir_path)); - FilePath grandchild_file_path( + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath child_dir_path(CreateUniqueDirInDir(src_dir_path)); + base::FilePath grandchild_file_path( CreateUniqueFileInDir(child_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); operation()->Move(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); @@ -493,8 +493,8 @@ TEST_F(LocalFileSystemOperationTest, TestMoveSuccessSrcDirRecursive) { } TEST_F(LocalFileSystemOperationTest, TestCopyFailureSrcDoesntExist) { - operation()->Copy(URLForPath(FilePath(FILE_PATH_LITERAL("a"))), - URLForPath(FilePath(FILE_PATH_LITERAL("b"))), + operation()->Copy(URLForPath(base::FilePath(FILE_PATH_LITERAL("a"))), + URLForPath(base::FilePath(FILE_PATH_LITERAL("b"))), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status()); @@ -502,8 +502,8 @@ TEST_F(LocalFileSystemOperationTest, TestCopyFailureSrcDoesntExist) { } TEST_F(LocalFileSystemOperationTest, TestCopyFailureContainsPath) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDirInDir(src_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDirInDir(src_dir_path)); operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -513,9 +513,9 @@ TEST_F(LocalFileSystemOperationTest, TestCopyFailureContainsPath) { TEST_F(LocalFileSystemOperationTest, TestCopyFailureSrcDirExistsDestFile) { // Src exists and is dir. Dest is a file. - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_file_path), RecordStatusCallback()); @@ -527,9 +527,9 @@ TEST_F(LocalFileSystemOperationTest, TestCopyFailureSrcDirExistsDestFile) { TEST_F(LocalFileSystemOperationTest, TestCopyFailureSrcFileExistsDestNonEmptyDir) { // Src exists and is a directory. Dest is a non-empty directory. - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath child_file_path(CreateUniqueFileInDir(dest_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath child_file_path(CreateUniqueFileInDir(dest_dir_path)); operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); @@ -540,9 +540,9 @@ TEST_F(LocalFileSystemOperationTest, TEST_F(LocalFileSystemOperationTest, TestCopyFailureSrcFileExistsDestDir) { // Src exists and is a file. Dest is a directory. - FilePath src_dir_path(CreateUniqueDir()); - FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); + base::FilePath dest_dir_path(CreateUniqueDir()); operation()->Copy(URLForPath(src_file_path), URLForPath(dest_dir_path), RecordStatusCallback()); @@ -553,10 +553,10 @@ TEST_F(LocalFileSystemOperationTest, TestCopyFailureSrcFileExistsDestDir) { TEST_F(LocalFileSystemOperationTest, TestCopyFailureDestParentDoesntExist) { // Dest. parent path does not exist. - FilePath src_dir_path(CreateUniqueDir()); - FilePath nonexisting_path = FilePath(FILE_PATH_LITERAL("DontExistDir")); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath nonexisting_path = base::FilePath(FILE_PATH_LITERAL("DontExistDir")); file_util::EnsureEndsWithSeparator(&nonexisting_path); - FilePath nonexisting_file_path(nonexisting_path.Append( + base::FilePath nonexisting_file_path(nonexisting_path.Append( FILE_PATH_LITERAL("DontExistFile"))); operation()->Copy(URLForPath(src_dir_path), @@ -570,11 +570,11 @@ TEST_F(LocalFileSystemOperationTest, TestCopyFailureDestParentDoesntExist) { TEST_F(LocalFileSystemOperationTest, TestCopyFailureByQuota) { base::PlatformFileInfo info; - FilePath src_dir_path(CreateUniqueDir()); - FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); + base::FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path; + base::FilePath dest_file_path; int64 dest_path_cost; GenerateUniquePathInDir(dest_dir_path, &dest_file_path, &dest_path_cost); @@ -599,10 +599,10 @@ TEST_F(LocalFileSystemOperationTest, TestCopyFailureByQuota) { } TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcFileAndOverwrite) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(CreateUniqueFileInDir(dest_dir_path)); operation()->Copy(URLForPath(src_file_path), URLForPath(dest_file_path), RecordStatusCallback()); @@ -616,10 +616,10 @@ TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcFileAndOverwrite) { } TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcFileAndNew) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(dest_dir_path.Append(FILE_PATH_LITERAL("NewFile"))); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_file_path(CreateUniqueFileInDir(src_dir_path)); + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(dest_dir_path.Append(FILE_PATH_LITERAL("NewFile"))); operation()->Copy(URLForPath(src_file_path), URLForPath(dest_file_path), RecordStatusCallback()); @@ -633,8 +633,8 @@ TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcFileAndNew) { } TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcDirAndOverwrite) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); @@ -653,9 +653,9 @@ TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcDirAndOverwrite) { } TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcDirAndNew) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath dest_parent_dir_path(CreateUniqueDir()); - FilePath dest_child_dir_path(dest_parent_dir_path. + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath dest_parent_dir_path(CreateUniqueDir()); + base::FilePath dest_child_dir_path(dest_parent_dir_path. Append(FILE_PATH_LITERAL("NewDirectory"))); operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_child_dir_path), @@ -670,12 +670,12 @@ TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcDirAndNew) { } TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcDirRecursive) { - FilePath src_dir_path(CreateUniqueDir()); - FilePath child_dir_path(CreateUniqueDirInDir(src_dir_path)); - FilePath grandchild_file_path( + base::FilePath src_dir_path(CreateUniqueDir()); + base::FilePath child_dir_path(CreateUniqueDirInDir(src_dir_path)); + base::FilePath grandchild_file_path( CreateUniqueFileInDir(child_dir_path)); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); operation()->Copy(URLForPath(src_dir_path), URLForPath(dest_dir_path), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -696,13 +696,13 @@ TEST_F(LocalFileSystemOperationTest, TestCopySuccessSrcDirRecursive) { } TEST_F(LocalFileSystemOperationTest, TestCopyInForeignFileSuccess) { - FilePath src_local_disk_file_path; + base::FilePath src_local_disk_file_path; file_util::CreateTemporaryFile(&src_local_disk_file_path); const char test_data[] = "foo"; int data_size = ARRAYSIZE_UNSAFE(test_data); file_util::WriteFile(src_local_disk_file_path, test_data, data_size); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(dest_dir_path.Append( + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(dest_dir_path.Append( src_local_disk_file_path.BaseName())); FileSystemURL dest_file_url = URLForPath(dest_file_path); int64 before_usage; @@ -729,14 +729,14 @@ TEST_F(LocalFileSystemOperationTest, TestCopyInForeignFileSuccess) { } TEST_F(LocalFileSystemOperationTest, TestCopyInForeignFileFailureByQuota) { - FilePath src_local_disk_file_path; + base::FilePath src_local_disk_file_path; file_util::CreateTemporaryFile(&src_local_disk_file_path); const char test_data[] = "foo"; file_util::WriteFile(src_local_disk_file_path, test_data, ARRAYSIZE_UNSAFE(test_data)); - FilePath dest_dir_path(CreateUniqueDir()); - FilePath dest_file_path(dest_dir_path.Append( + base::FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_file_path(dest_dir_path.Append( src_local_disk_file_path.BaseName())); FileSystemURL dest_file_url = URLForPath(dest_file_path); @@ -756,8 +756,8 @@ TEST_F(LocalFileSystemOperationTest, TestCopyInForeignFileFailureByQuota) { TEST_F(LocalFileSystemOperationTest, TestCreateFileFailure) { // Already existing file and exclusive true. - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); operation()->CreateFile(URLForPath(file_path), true, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -767,8 +767,8 @@ TEST_F(LocalFileSystemOperationTest, TestCreateFileFailure) { TEST_F(LocalFileSystemOperationTest, TestCreateFileSuccessFileExists) { // Already existing file and exclusive false. - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); operation()->CreateFile(URLForPath(file_path), false, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -781,8 +781,8 @@ TEST_F(LocalFileSystemOperationTest, TestCreateFileSuccessFileExists) { TEST_F(LocalFileSystemOperationTest, TestCreateFileSuccessExclusive) { // File doesn't exist but exclusive is true. - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(dir_path.Append(FILE_PATH_LITERAL("FileDoesntExist"))); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(dir_path.Append(FILE_PATH_LITERAL("FileDoesntExist"))); operation()->CreateFile(URLForPath(file_path), true, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -793,8 +793,8 @@ TEST_F(LocalFileSystemOperationTest, TestCreateFileSuccessExclusive) { TEST_F(LocalFileSystemOperationTest, TestCreateFileSuccessFileDoesntExist) { // Non existing file. - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(dir_path.Append(FILE_PATH_LITERAL("FileDoesntExist"))); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(dir_path.Append(FILE_PATH_LITERAL("FileDoesntExist"))); operation()->CreateFile(URLForPath(file_path), false, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -805,9 +805,9 @@ TEST_F(LocalFileSystemOperationTest, TestCreateFileSuccessFileDoesntExist) { TEST_F(LocalFileSystemOperationTest, TestCreateDirFailureDestParentDoesntExist) { // Dest. parent path does not exist. - FilePath nonexisting_path(FilePath( + base::FilePath nonexisting_path(base::FilePath( FILE_PATH_LITERAL("DirDoesntExist"))); - FilePath nonexisting_file_path(nonexisting_path.Append( + base::FilePath nonexisting_file_path(nonexisting_path.Append( FILE_PATH_LITERAL("FileDoesntExist"))); operation()->CreateDirectory(URLForPath(nonexisting_file_path), false, false, RecordStatusCallback()); @@ -818,7 +818,7 @@ TEST_F(LocalFileSystemOperationTest, TEST_F(LocalFileSystemOperationTest, TestCreateDirFailureDirExists) { // Exclusive and dir existing at path. - FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); operation()->CreateDirectory(URLForPath(src_dir_path), true, false, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -828,8 +828,8 @@ TEST_F(LocalFileSystemOperationTest, TestCreateDirFailureDirExists) { TEST_F(LocalFileSystemOperationTest, TestCreateDirFailureFileExists) { // Exclusive true and file existing at path. - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); operation()->CreateDirectory(URLForPath(file_path), true, false, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -839,7 +839,7 @@ TEST_F(LocalFileSystemOperationTest, TestCreateDirFailureFileExists) { TEST_F(LocalFileSystemOperationTest, TestCreateDirSuccess) { // Dir exists and exclusive is false. - FilePath dir_path(CreateUniqueDir()); + base::FilePath dir_path(CreateUniqueDir()); operation()->CreateDirectory(URLForPath(dir_path), false, false, RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -847,7 +847,7 @@ TEST_F(LocalFileSystemOperationTest, TestCreateDirSuccess) { EXPECT_TRUE(change_observer()->HasNoChange()); // Dir doesn't exist. - FilePath nonexisting_dir_path(FilePath( + base::FilePath nonexisting_dir_path(base::FilePath( FILE_PATH_LITERAL("nonexistingdir"))); operation()->CreateDirectory(URLForPath(nonexisting_dir_path), false, false, RecordStatusCallback()); @@ -859,7 +859,7 @@ TEST_F(LocalFileSystemOperationTest, TestCreateDirSuccess) { TEST_F(LocalFileSystemOperationTest, TestCreateDirSuccessExclusive) { // Dir doesn't exist. - FilePath nonexisting_dir_path(FilePath( + base::FilePath nonexisting_dir_path(base::FilePath( FILE_PATH_LITERAL("nonexistingdir"))); operation()->CreateDirectory(URLForPath(nonexisting_dir_path), true, false, @@ -872,7 +872,7 @@ TEST_F(LocalFileSystemOperationTest, TestCreateDirSuccessExclusive) { } TEST_F(LocalFileSystemOperationTest, TestExistsAndMetadataFailure) { - FilePath nonexisting_dir_path(FilePath( + base::FilePath nonexisting_dir_path(base::FilePath( FILE_PATH_LITERAL("nonexistingdir"))); operation()->GetMetadata(URLForPath(nonexisting_dir_path), RecordMetadataCallback()); @@ -893,7 +893,7 @@ TEST_F(LocalFileSystemOperationTest, TestExistsAndMetadataFailure) { } TEST_F(LocalFileSystemOperationTest, TestExistsAndMetadataSuccess) { - FilePath dir_path(CreateUniqueDir()); + base::FilePath dir_path(CreateUniqueDir()); int read_access = 0; operation()->DirectoryExists(URLForPath(dir_path), @@ -906,10 +906,10 @@ TEST_F(LocalFileSystemOperationTest, TestExistsAndMetadataSuccess) { MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(base::PLATFORM_FILE_OK, status()); EXPECT_TRUE(info().is_directory); - EXPECT_EQ(FilePath(), path()); + EXPECT_EQ(base::FilePath(), path()); ++read_access; - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); operation()->FileExists(URLForPath(file_path), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(base::PLATFORM_FILE_OK, status()); @@ -928,12 +928,12 @@ TEST_F(LocalFileSystemOperationTest, TestExistsAndMetadataSuccess) { } TEST_F(LocalFileSystemOperationTest, TestTypeMismatchErrors) { - FilePath dir_path(CreateUniqueDir()); + base::FilePath dir_path(CreateUniqueDir()); operation()->FileExists(URLForPath(dir_path), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE, status()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); ASSERT_FALSE(file_path.empty()); operation()->DirectoryExists(URLForPath(file_path), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); @@ -942,7 +942,7 @@ TEST_F(LocalFileSystemOperationTest, TestTypeMismatchErrors) { TEST_F(LocalFileSystemOperationTest, TestReadDirFailure) { // Path doesn't exist - FilePath nonexisting_dir_path(FilePath( + base::FilePath nonexisting_dir_path(base::FilePath( FILE_PATH_LITERAL("NonExistingDir"))); file_util::EnsureEndsWithSeparator(&nonexisting_dir_path); operation()->ReadDirectory(URLForPath(nonexisting_dir_path), @@ -951,8 +951,8 @@ TEST_F(LocalFileSystemOperationTest, TestReadDirFailure) { EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, status()); // File exists. - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); operation()->ReadDirectory(URLForPath(file_path), RecordReadDirectoryCallback()); MessageLoop::current()->RunUntilIdle(); @@ -965,9 +965,9 @@ TEST_F(LocalFileSystemOperationTest, TestReadDirSuccess) { // | | // child_dir child_file // Verify reading parent_dir. - FilePath parent_dir_path(CreateUniqueDir()); - FilePath child_file_path(CreateUniqueFileInDir(parent_dir_path)); - FilePath child_dir_path(CreateUniqueDirInDir(parent_dir_path)); + base::FilePath parent_dir_path(CreateUniqueDir()); + base::FilePath child_file_path(CreateUniqueFileInDir(parent_dir_path)); + base::FilePath child_dir_path(CreateUniqueDirInDir(parent_dir_path)); ASSERT_FALSE(child_dir_path.empty()); operation()->ReadDirectory(URLForPath(parent_dir_path), @@ -991,7 +991,7 @@ TEST_F(LocalFileSystemOperationTest, TestReadDirSuccess) { TEST_F(LocalFileSystemOperationTest, TestRemoveFailure) { // Path doesn't exist. - FilePath nonexisting_path(FilePath( + base::FilePath nonexisting_path(base::FilePath( FILE_PATH_LITERAL("NonExistingDir"))); file_util::EnsureEndsWithSeparator(&nonexisting_path); @@ -1006,9 +1006,9 @@ TEST_F(LocalFileSystemOperationTest, TestRemoveFailure) { // | | // child_dir child_file // Verify deleting parent_dir. - FilePath parent_dir_path(CreateUniqueDir()); - FilePath child_file_path(CreateUniqueFileInDir(parent_dir_path)); - FilePath child_dir_path(CreateUniqueDirInDir(parent_dir_path)); + base::FilePath parent_dir_path(CreateUniqueDir()); + base::FilePath child_file_path(CreateUniqueFileInDir(parent_dir_path)); + base::FilePath child_dir_path(CreateUniqueDirInDir(parent_dir_path)); ASSERT_FALSE(child_dir_path.empty()); operation()->Remove(URLForPath(parent_dir_path), false /* recursive */, @@ -1020,7 +1020,7 @@ TEST_F(LocalFileSystemOperationTest, TestRemoveFailure) { } TEST_F(LocalFileSystemOperationTest, TestRemoveSuccess) { - FilePath empty_dir_path(CreateUniqueDir()); + base::FilePath empty_dir_path(CreateUniqueDir()); EXPECT_TRUE(DirectoryExists(empty_dir_path)); operation()->Remove(URLForPath(empty_dir_path), false /* recursive */, @@ -1037,9 +1037,9 @@ TEST_F(LocalFileSystemOperationTest, TestRemoveSuccess) { // | | // child_dir child_file // Verify deleting parent_dir. - FilePath parent_dir_path(CreateUniqueDir()); - FilePath child_file_path(CreateUniqueFileInDir(parent_dir_path)); - FilePath child_dir_path(CreateUniqueDirInDir(parent_dir_path)); + base::FilePath parent_dir_path(CreateUniqueDir()); + base::FilePath child_file_path(CreateUniqueFileInDir(parent_dir_path)); + base::FilePath child_dir_path(CreateUniqueDirInDir(parent_dir_path)); ASSERT_FALSE(child_dir_path.empty()); operation()->Remove(URLForPath(parent_dir_path), true /* recursive */, @@ -1054,8 +1054,8 @@ TEST_F(LocalFileSystemOperationTest, TestRemoveSuccess) { } TEST_F(LocalFileSystemOperationTest, TestTruncate) { - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); char test_data[] = "test data"; int data_size = static_cast<int>(sizeof(test_data)); @@ -1118,8 +1118,8 @@ TEST_F(LocalFileSystemOperationTest, TestTruncate) { TEST_F(LocalFileSystemOperationTest, TestTruncateFailureByQuota) { base::PlatformFileInfo info; - FilePath dir_path(CreateUniqueDir()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath dir_path(CreateUniqueDir()); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); GrantQuotaForCurrentUsage(); AddQuota(10); @@ -1143,8 +1143,8 @@ TEST_F(LocalFileSystemOperationTest, TestTruncateFailureByQuota) { } TEST_F(LocalFileSystemOperationTest, TestTouchFile) { - FilePath file_path(CreateUniqueFileInDir(FilePath())); - FilePath platform_path = PlatformPath(file_path); + base::FilePath file_path(CreateUniqueFileInDir(base::FilePath())); + base::FilePath platform_path = PlatformPath(file_path); base::PlatformFileInfo info; @@ -1176,12 +1176,12 @@ TEST_F(LocalFileSystemOperationTest, TestTouchFile) { } TEST_F(LocalFileSystemOperationTest, TestCreateSnapshotFile) { - FilePath dir_path(CreateUniqueDir()); + base::FilePath dir_path(CreateUniqueDir()); // Create a file for the testing. operation()->DirectoryExists(URLForPath(dir_path), RecordStatusCallback()); - FilePath file_path(CreateUniqueFileInDir(dir_path)); + base::FilePath file_path(CreateUniqueFileInDir(dir_path)); operation()->FileExists(URLForPath(file_path), RecordStatusCallback()); MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(base::PLATFORM_FILE_OK, status()); diff --git a/webkit/fileapi/local_file_system_operation_write_unittest.cc b/webkit/fileapi/local_file_system_operation_write_unittest.cc index 4a8cd47..5841222 100644 --- a/webkit/fileapi/local_file_system_operation_write_unittest.cc +++ b/webkit/fileapi/local_file_system_operation_write_unittest.cc @@ -43,7 +43,7 @@ void AssertStatusEq(base::PlatformFileError expected, class MockQuotaManager : public QuotaManager { public: - MockQuotaManager(const FilePath& base_dir, int64 quota) + MockQuotaManager(const base::FilePath& base_dir, int64 quota) : QuotaManager(false /* is_incognito */, base_dir, base::MessageLoopProxy::current(), base::MessageLoopProxy::current(), @@ -109,7 +109,7 @@ class LocalFileSystemOperationWriteTest return &change_observer_; } - FileSystemURL URLForPath(const FilePath& path) const { + FileSystemURL URLForPath(const base::FilePath& path) const { return test_helper_.CreateURL(path); } @@ -153,7 +153,7 @@ class LocalFileSystemOperationWriteTest MessageLoop loop_; base::ScopedTempDir dir_; - FilePath virtual_path_; + base::FilePath virtual_path_; // For post-operation status. base::PlatformFileError status_; @@ -172,13 +172,13 @@ class LocalFileSystemOperationWriteTest void LocalFileSystemOperationWriteTest::SetUp() { ASSERT_TRUE(dir_.CreateUniqueTempDir()); - FilePath base_dir = dir_.path().AppendASCII("filesystem"); + base::FilePath base_dir = dir_.path().AppendASCII("filesystem"); quota_manager_ = new MockQuotaManager(base_dir, 1024); test_helper_.SetUp(base_dir, false /* unlimited quota */, quota_manager_->proxy()); - virtual_path_ = FilePath(FILE_PATH_LITERAL("temporary file")); + virtual_path_ = base::FilePath(FILE_PATH_LITERAL("temporary file")); operation()->CreateFile( URLForPath(virtual_path_), true /* exclusive */, @@ -248,7 +248,7 @@ TEST_F(LocalFileSystemOperationWriteTest, TestWriteInvalidFile) { ScopedTextBlob blob(url_request_context_, blob_url, "It\'ll not be written."); operation()->Write(&url_request_context_, - URLForPath(FilePath(FILE_PATH_LITERAL("nonexist"))), + URLForPath(base::FilePath(FILE_PATH_LITERAL("nonexist"))), blob_url, 0, RecordWriteCallback()); MessageLoop::current()->Run(); @@ -260,7 +260,7 @@ TEST_F(LocalFileSystemOperationWriteTest, TestWriteInvalidFile) { } TEST_F(LocalFileSystemOperationWriteTest, TestWriteDir) { - FilePath virtual_dir_path(FILE_PATH_LITERAL("d")); + base::FilePath virtual_dir_path(FILE_PATH_LITERAL("d")); operation()->CreateDirectory( URLForPath(virtual_dir_path), true /* exclusive */, false /* recursive */, @@ -330,7 +330,7 @@ TEST_F(LocalFileSystemOperationWriteTest, TestImmediateCancelFailingWrite) { FileSystemOperation* write_operation = operation(); write_operation->Write(&url_request_context_, - URLForPath(FilePath(FILE_PATH_LITERAL("nonexist"))), + URLForPath(base::FilePath(FILE_PATH_LITERAL("nonexist"))), blob_url, 0, RecordWriteCallback()); write_operation->Cancel(RecordCancelCallback()); // We use RunAllPendings() instead of Run() here, because we won't dispatch diff --git a/webkit/fileapi/local_file_system_quota_unittest.cc b/webkit/fileapi/local_file_system_quota_unittest.cc index 1e7f6a7..0e39102 100644 --- a/webkit/fileapi/local_file_system_quota_unittest.cc +++ b/webkit/fileapi/local_file_system_quota_unittest.cc @@ -72,13 +72,13 @@ class LocalFileSystemQuotaTest return context; } - void PrepareFileSet(const FilePath& virtual_path); + void PrepareFileSet(const base::FilePath& virtual_path); - FileSystemURL URLForPath(const FilePath& path) const { + FileSystemURL URLForPath(const base::FilePath& path) const { return test_helper_.CreateURL(path); } - FilePath PlatformPath(const FilePath& virtual_path) { + base::FilePath PlatformPath(const base::FilePath& virtual_path) { return test_helper_.GetLocalPath(virtual_path); } @@ -100,24 +100,24 @@ class LocalFileSystemQuotaTest MessageLoop::current()->RunUntilIdle(); } - bool FileExists(const FilePath& virtual_path) { + bool FileExists(const base::FilePath& virtual_path) { FileSystemURL url = test_helper_.CreateURL(virtual_path); base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; scoped_ptr<FileSystemOperationContext> context(NewContext()); base::PlatformFileError error = file_util()->GetFileInfo( context.get(), url, &file_info, &platform_path); return error == base::PLATFORM_FILE_OK; } - bool DirectoryExists(const FilePath& virtual_path) { + bool DirectoryExists(const base::FilePath& virtual_path) { FileSystemURL path = test_helper_.CreateURL(virtual_path); scoped_ptr<FileSystemOperationContext> context(NewContext()); return FileUtilHelper::DirectoryExists(context.get(), file_util(), path); } - FilePath CreateUniqueFileInDir(const FilePath& virtual_dir_path) { - FilePath file_name = FilePath::FromUTF8Unsafe( + base::FilePath CreateUniqueFileInDir(const base::FilePath& virtual_dir_path) { + base::FilePath file_name = base::FilePath::FromUTF8Unsafe( "tmpfile-" + base::IntToString(next_unique_path_suffix_++)); FileSystemURL url = test_helper_.CreateURL( virtual_dir_path.Append(file_name)); @@ -130,8 +130,8 @@ class LocalFileSystemQuotaTest return url.path(); } - FilePath CreateUniqueDirInDir(const FilePath& virtual_dir_path) { - FilePath dir_name = FilePath::FromUTF8Unsafe( + base::FilePath CreateUniqueDirInDir(const base::FilePath& virtual_dir_path) { + base::FilePath dir_name = base::FilePath::FromUTF8Unsafe( "tmpdir-" + base::IntToString(next_unique_path_suffix_++)); FileSystemURL url = test_helper_.CreateURL( virtual_dir_path.Append(dir_name)); @@ -142,15 +142,15 @@ class LocalFileSystemQuotaTest return url.path(); } - FilePath CreateUniqueDir() { - return CreateUniqueDirInDir(FilePath()); + base::FilePath CreateUniqueDir() { + return CreateUniqueDirInDir(base::FilePath()); } - FilePath child_dir_path_; - FilePath child_file1_path_; - FilePath child_file2_path_; - FilePath grandchild_file1_path_; - FilePath grandchild_file2_path_; + base::FilePath child_dir_path_; + base::FilePath child_file1_path_; + base::FilePath child_file2_path_; + base::FilePath grandchild_file1_path_; + base::FilePath grandchild_file2_path_; int64 child_path_cost_; int64 grandchild_path_cost_; @@ -186,7 +186,7 @@ class LocalFileSystemQuotaTest void LocalFileSystemQuotaTest::SetUp() { ASSERT_TRUE(work_dir_.CreateUniqueTempDir()); - FilePath filesystem_dir_path = work_dir_.path().AppendASCII("filesystem"); + base::FilePath filesystem_dir_path = work_dir_.path().AppendASCII("filesystem"); ASSERT_TRUE(file_util::CreateDirectory(filesystem_dir_path)); quota_manager_ = new quota::QuotaManager( @@ -217,7 +217,7 @@ void LocalFileSystemQuotaTest::OnGetUsageAndQuota( quota_ = quota; } -void LocalFileSystemQuotaTest::PrepareFileSet(const FilePath& virtual_path) { +void LocalFileSystemQuotaTest::PrepareFileSet(const base::FilePath& virtual_path) { int64 usage = SizeByQuotaUtil(); child_dir_path_ = CreateUniqueDirInDir(virtual_path); child_file1_path_ = CreateUniqueFileInDir(virtual_path); @@ -231,10 +231,10 @@ void LocalFileSystemQuotaTest::PrepareFileSet(const FilePath& virtual_path) { } TEST_F(LocalFileSystemQuotaTest, TestMoveSuccessSrcDirRecursive) { - FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); int src_path_cost = SizeByQuotaUtil(); PrepareFileSet(src_dir_path); - FilePath dest_dir_path(CreateUniqueDir()); + base::FilePath dest_dir_path(CreateUniqueDir()); EXPECT_EQ(0, ActualFileSize()); int total_path_cost = SizeByQuotaUtil(); @@ -279,10 +279,10 @@ TEST_F(LocalFileSystemQuotaTest, TestMoveSuccessSrcDirRecursive) { } TEST_F(LocalFileSystemQuotaTest, TestCopySuccessSrcDirRecursive) { - FilePath src_dir_path(CreateUniqueDir()); + base::FilePath src_dir_path(CreateUniqueDir()); PrepareFileSet(src_dir_path); - FilePath dest_dir1_path(CreateUniqueDir()); - FilePath dest_dir2_path(CreateUniqueDir()); + base::FilePath dest_dir1_path(CreateUniqueDir()); + base::FilePath dest_dir2_path(CreateUniqueDir()); EXPECT_EQ(0, ActualFileSize()); int total_path_cost = SizeByQuotaUtil(); diff --git a/webkit/fileapi/local_file_system_test_helper.cc b/webkit/fileapi/local_file_system_test_helper.cc index e3dbe61..fe206f1 100644 --- a/webkit/fileapi/local_file_system_test_helper.cc +++ b/webkit/fileapi/local_file_system_test_helper.cc @@ -38,7 +38,7 @@ LocalFileSystemTestOriginHelper::LocalFileSystemTestOriginHelper() LocalFileSystemTestOriginHelper::~LocalFileSystemTestOriginHelper() { } -void LocalFileSystemTestOriginHelper::SetUp(const FilePath& base_dir) { +void LocalFileSystemTestOriginHelper::SetUp(const base::FilePath& base_dir) { SetUp(base_dir, false, NULL); } @@ -50,17 +50,17 @@ void LocalFileSystemTestOriginHelper::SetUp( // Prepare the origin's root directory. file_system_context_->GetMountPointProvider(type_)-> - GetFileSystemRootPathOnFileThread(CreateURL(FilePath()), + GetFileSystemRootPathOnFileThread(CreateURL(base::FilePath()), true /* create */); // Initialize the usage cache file. - FilePath usage_cache_path = GetUsageCachePath(); + base::FilePath usage_cache_path = GetUsageCachePath(); if (!usage_cache_path.empty()) FileSystemUsageCache::UpdateUsage(usage_cache_path, 0); } void LocalFileSystemTestOriginHelper::SetUp( - const FilePath& base_dir, + const base::FilePath& base_dir, bool unlimited_quota, quota::QuotaManagerProxy* quota_manager_proxy) { scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy = @@ -79,11 +79,11 @@ void LocalFileSystemTestOriginHelper::SetUp( // Prepare the origin's root directory. FileSystemMountPointProvider* mount_point_provider = file_system_context_->GetMountPointProvider(type_); - mount_point_provider->GetFileSystemRootPathOnFileThread(CreateURL(FilePath()), + mount_point_provider->GetFileSystemRootPathOnFileThread(CreateURL(base::FilePath()), true /* create */); // Initialize the usage cache file. - FilePath usage_cache_path = GetUsageCachePath(); + base::FilePath usage_cache_path = GetUsageCachePath(); if (!usage_cache_path.empty()) FileSystemUsageCache::UpdateUsage(usage_cache_path, 0); } @@ -93,33 +93,33 @@ void LocalFileSystemTestOriginHelper::TearDown() { MessageLoop::current()->RunUntilIdle(); } -FilePath LocalFileSystemTestOriginHelper::GetOriginRootPath() const { +base::FilePath LocalFileSystemTestOriginHelper::GetOriginRootPath() const { return file_system_context_->GetMountPointProvider(type_)-> - GetFileSystemRootPathOnFileThread(CreateURL(FilePath()), false); + GetFileSystemRootPathOnFileThread(CreateURL(base::FilePath()), false); } -FilePath LocalFileSystemTestOriginHelper::GetLocalPath(const FilePath& path) { +base::FilePath LocalFileSystemTestOriginHelper::GetLocalPath(const base::FilePath& path) { DCHECK(file_util_); - FilePath local_path; + base::FilePath local_path; scoped_ptr<FileSystemOperationContext> context(NewOperationContext()); file_util_->GetLocalFilePath(context.get(), CreateURL(path), &local_path); return local_path; } -FilePath LocalFileSystemTestOriginHelper::GetLocalPathFromASCII( +base::FilePath LocalFileSystemTestOriginHelper::GetLocalPathFromASCII( const std::string& path) { - return GetLocalPath(FilePath().AppendASCII(path)); + return GetLocalPath(base::FilePath().AppendASCII(path)); } -FilePath LocalFileSystemTestOriginHelper::GetUsageCachePath() const { +base::FilePath LocalFileSystemTestOriginHelper::GetUsageCachePath() const { if (type_ != kFileSystemTypeTemporary && type_ != kFileSystemTypePersistent) - return FilePath(); + return base::FilePath(); return file_system_context_-> sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_); } -FileSystemURL LocalFileSystemTestOriginHelper::CreateURL(const FilePath& path) +FileSystemURL LocalFileSystemTestOriginHelper::CreateURL(const base::FilePath& path) const { return file_system_context_->CreateCrackedFileSystemURL(origin_, type_, path); } @@ -163,7 +163,7 @@ LocalFileSystemOperation* LocalFileSystemTestOriginHelper::NewOperation() { NewOperationContext()); LocalFileSystemOperation* operation = static_cast<LocalFileSystemOperation*>( file_system_context_->CreateFileSystemOperation( - CreateURL(FilePath()), NULL)); + CreateURL(base::FilePath()), NULL)); return operation; } diff --git a/webkit/fileapi/local_file_system_test_helper.h b/webkit/fileapi/local_file_system_test_helper.h index c6cf8c7..6dbebc6 100644 --- a/webkit/fileapi/local_file_system_test_helper.h +++ b/webkit/fileapi/local_file_system_test_helper.h @@ -15,12 +15,14 @@ #include "webkit/fileapi/file_system_util.h" #include "webkit/quota/quota_types.h" +namespace base { +class FilePath; +} + namespace quota { class QuotaManagerProxy; } -class FilePath; - namespace fileapi { class FileSystemContext; @@ -37,27 +39,27 @@ class LocalFileSystemTestOriginHelper { LocalFileSystemTestOriginHelper(); ~LocalFileSystemTestOriginHelper(); - void SetUp(const FilePath& base_dir); + void SetUp(const base::FilePath& base_dir); // If you want to use more than one LocalFileSystemTestOriginHelper in // a single base directory, they have to share a context, so that they don't // have multiple databases fighting over the lock to the origin directory // [deep down inside ObfuscatedFileUtil]. void SetUp(FileSystemContext* file_system_context); - void SetUp(const FilePath& base_dir, + void SetUp(const base::FilePath& base_dir, bool unlimited_quota, quota::QuotaManagerProxy* quota_manager_proxy); void TearDown(); - FilePath GetOriginRootPath() const; - FilePath GetLocalPath(const FilePath& path); - FilePath GetLocalPathFromASCII(const std::string& path); + base::FilePath GetOriginRootPath() const; + base::FilePath GetLocalPath(const base::FilePath& path); + base::FilePath GetLocalPathFromASCII(const std::string& path); // Returns empty path if filesystem type is neither temporary nor persistent. - FilePath GetUsageCachePath() const; + base::FilePath GetUsageCachePath() const; - FileSystemURL CreateURL(const FilePath& path) const; + FileSystemURL CreateURL(const base::FilePath& path) const; FileSystemURL CreateURLFromUTF8(const std::string& utf8) const { - return CreateURL(FilePath::FromUTF8Unsafe(utf8)); + return CreateURL(base::FilePath::FromUTF8Unsafe(utf8)); } // Helper methods for same-FileUtil copy/move. diff --git a/webkit/fileapi/local_file_util.cc b/webkit/fileapi/local_file_util.cc index 0cecdca..4b533c9 100644 --- a/webkit/fileapi/local_file_util.cc +++ b/webkit/fileapi/local_file_util.cc @@ -20,8 +20,8 @@ using base::PlatformFileError; class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { public: - LocalFileEnumerator(const FilePath& platform_root_path, - const FilePath& virtual_root_path, + LocalFileEnumerator(const base::FilePath& platform_root_path, + const base::FilePath& virtual_root_path, bool recursive, int file_type) : file_enum_(platform_root_path, recursive, file_type), @@ -34,7 +34,7 @@ class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { ~LocalFileEnumerator() {} - virtual FilePath Next() OVERRIDE; + virtual base::FilePath Next() OVERRIDE; virtual int64 Size() OVERRIDE; virtual base::Time LastModifiedTime() OVERRIDE; virtual bool IsDirectory() OVERRIDE; @@ -42,12 +42,12 @@ class LocalFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { private: file_util::FileEnumerator file_enum_; file_util::FileEnumerator::FindInfo file_util_info_; - FilePath platform_root_path_; - FilePath virtual_root_path_; + base::FilePath platform_root_path_; + base::FilePath virtual_root_path_; }; -FilePath LocalFileEnumerator::Next() { - FilePath next = file_enum_.Next(); +base::FilePath LocalFileEnumerator::Next() { + base::FilePath next = file_enum_.Next(); // Don't return symlinks. while (!next.empty() && file_util::IsLink(next)) next = file_enum_.Next(); @@ -55,7 +55,7 @@ FilePath LocalFileEnumerator::Next() { return next; file_enum_.GetFindInfo(&file_util_info_); - FilePath path; + base::FilePath path; platform_root_path_.AppendRelativePath(next, &path); return virtual_root_path_.Append(path); } @@ -82,7 +82,7 @@ PlatformFileError LocalFileUtil::CreateOrOpen( FileSystemOperationContext* context, const FileSystemURL& url, int file_flags, base::PlatformFile* file_handle, bool* created) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -99,7 +99,7 @@ PlatformFileError LocalFileUtil::EnsureFileExists( FileSystemOperationContext* context, const FileSystemURL& url, bool* created) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -111,7 +111,7 @@ PlatformFileError LocalFileUtil::CreateDirectory( const FileSystemURL& url, bool exclusive, bool recursive) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -122,8 +122,8 @@ PlatformFileError LocalFileUtil::GetFileInfo( FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_file_path) { - FilePath file_path; + base::FilePath* platform_file_path) { + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -141,7 +141,7 @@ scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> LocalFileUtil:: FileSystemOperationContext* context, const FileSystemURL& root_url, bool recursive) { - FilePath file_path; + base::FilePath file_path; if (GetLocalFilePath(context, root_url, &file_path) != base::PLATFORM_FILE_OK) { return make_scoped_ptr(new EmptyFileEnumerator) @@ -157,11 +157,11 @@ scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> LocalFileUtil:: PlatformFileError LocalFileUtil::GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& url, - FilePath* local_file_path) { + base::FilePath* local_file_path) { FileSystemMountPointProvider* provider = context->file_system_context()->GetMountPointProvider(url.type()); DCHECK(provider); - FilePath root = provider->GetFileSystemRootPathOnFileThread(url, false); + base::FilePath root = provider->GetFileSystemRootPathOnFileThread(url, false); if (root.empty()) return base::PLATFORM_FILE_ERROR_NOT_FOUND; *local_file_path = root.Append(url.path()); @@ -173,7 +173,7 @@ PlatformFileError LocalFileUtil::Touch( const FileSystemURL& url, const base::Time& last_access_time, const base::Time& last_modified_time) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -184,7 +184,7 @@ PlatformFileError LocalFileUtil::Truncate( FileSystemOperationContext* context, const FileSystemURL& url, int64 length) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -196,12 +196,12 @@ PlatformFileError LocalFileUtil::CopyOrMoveFile( const FileSystemURL& src_url, const FileSystemURL& dest_url, bool copy) { - FilePath src_file_path; + base::FilePath src_file_path; PlatformFileError error = GetLocalFilePath(context, src_url, &src_file_path); if (error != base::PLATFORM_FILE_OK) return error; - FilePath dest_file_path; + base::FilePath dest_file_path; error = GetLocalFilePath(context, dest_url, &dest_file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -211,12 +211,12 @@ PlatformFileError LocalFileUtil::CopyOrMoveFile( PlatformFileError LocalFileUtil::CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) { if (src_file_path.empty()) return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; - FilePath dest_file_path; + base::FilePath dest_file_path; PlatformFileError error = GetLocalFilePath(context, dest_url, &dest_file_path); if (error != base::PLATFORM_FILE_OK) @@ -227,7 +227,7 @@ PlatformFileError LocalFileUtil::CopyInForeignFile( PlatformFileError LocalFileUtil::DeleteFile( FileSystemOperationContext* context, const FileSystemURL& url) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -237,7 +237,7 @@ PlatformFileError LocalFileUtil::DeleteFile( PlatformFileError LocalFileUtil::DeleteDirectory( FileSystemOperationContext* context, const FileSystemURL& url) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -248,7 +248,7 @@ base::PlatformFileError LocalFileUtil::CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path, + base::FilePath* platform_path, SnapshotFilePolicy* policy) { DCHECK(policy); DCHECK(file_info); diff --git a/webkit/fileapi/local_file_util.h b/webkit/fileapi/local_file_util.h index bbe51f1..7f19a68 100644 --- a/webkit/fileapi/local_file_util.h +++ b/webkit/fileapi/local_file_util.h @@ -12,10 +12,10 @@ #include "webkit/storage/webkit_storage_export.h" namespace base { +class FilePath; class Time; } -class FilePath; class GURL; namespace fileapi { @@ -50,7 +50,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_file) OVERRIDE; + base::FilePath* platform_file) OVERRIDE; virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( FileSystemOperationContext* context, const FileSystemURL& root_url, @@ -58,7 +58,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { virtual base::PlatformFileError GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_file_path) OVERRIDE; + base::FilePath* local_file_path) OVERRIDE; virtual base::PlatformFileError Touch( FileSystemOperationContext* context, const FileSystemURL& url, @@ -75,7 +75,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { bool copy) OVERRIDE; virtual base::PlatformFileError CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) OVERRIDE; virtual base::PlatformFileError DeleteFile( FileSystemOperationContext* context, @@ -87,7 +87,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE LocalFileUtil : public FileSystemFileUtil { FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path, + base::FilePath* platform_path, SnapshotFilePolicy* snapshot_policy) OVERRIDE; private: diff --git a/webkit/fileapi/local_file_util_unittest.cc b/webkit/fileapi/local_file_util_unittest.cc index 72c9ecb..fc3175a 100644 --- a/webkit/fileapi/local_file_util_unittest.cc +++ b/webkit/fileapi/local_file_util_unittest.cc @@ -51,7 +51,7 @@ class LocalFileUtilTest : public testing::Test { return test_helper_.CreateURLFromUTF8(file_name); } - FilePath LocalPath(const char *file_name) { + base::FilePath LocalPath(const char *file_name) { return test_helper_.GetLocalPathFromASCII(file_name); } diff --git a/webkit/fileapi/media/device_media_file_util.cc b/webkit/fileapi/media/device_media_file_util.cc index a5db4a8..b1f037c 100644 --- a/webkit/fileapi/media/device_media_file_util.cc +++ b/webkit/fileapi/media/device_media_file_util.cc @@ -22,7 +22,7 @@ namespace fileapi { namespace { -const FilePath::CharType kDeviceMediaFileUtilTempDir[] = +const base::FilePath::CharType kDeviceMediaFileUtilTempDir[] = FILE_PATH_LITERAL("DeviceMediaFileSystem"); MTPDeviceDelegate* GetMTPDeviceDelegate(FileSystemOperationContext* context) { @@ -33,7 +33,7 @@ MTPDeviceDelegate* GetMTPDeviceDelegate(FileSystemOperationContext* context) { } // namespace -DeviceMediaFileUtil::DeviceMediaFileUtil(const FilePath& profile_path) +DeviceMediaFileUtil::DeviceMediaFileUtil(const base::FilePath& profile_path) : profile_path_(profile_path) { } @@ -70,7 +70,7 @@ PlatformFileError DeviceMediaFileUtil::GetFileInfo( FileSystemOperationContext* context, const FileSystemURL& url, PlatformFileInfo* file_info, - FilePath* platform_path) { + base::FilePath* platform_path) { MTPDeviceDelegate* delegate = GetMTPDeviceDelegate(context); if (!delegate) return base::PLATFORM_FILE_ERROR_NOT_FOUND; @@ -104,7 +104,7 @@ DeviceMediaFileUtil::CreateFileEnumerator( PlatformFileError DeviceMediaFileUtil::GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_file_path) { + base::FilePath* local_file_path) { return base::PLATFORM_FILE_ERROR_SECURITY; } @@ -133,7 +133,7 @@ PlatformFileError DeviceMediaFileUtil::CopyOrMoveFile( PlatformFileError DeviceMediaFileUtil::CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) { return base::PLATFORM_FILE_ERROR_SECURITY; } @@ -154,7 +154,7 @@ base::PlatformFileError DeviceMediaFileUtil::CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* local_path, + base::FilePath* local_path, SnapshotFilePolicy* snapshot_policy) { DCHECK(file_info); DCHECK(local_path); @@ -167,7 +167,7 @@ base::PlatformFileError DeviceMediaFileUtil::CreateSnapshotFile( return base::PLATFORM_FILE_ERROR_NOT_FOUND; // Create a temp file in "profile_path_/kDeviceMediaFileUtilTempDir". - FilePath isolated_media_file_system_dir_path = + base::FilePath isolated_media_file_system_dir_path = profile_path_.Append(kDeviceMediaFileUtilTempDir); bool dir_exists = file_util::DirectoryExists( isolated_media_file_system_dir_path); diff --git a/webkit/fileapi/media/device_media_file_util.h b/webkit/fileapi/media/device_media_file_util.h index bd6bb80..efe85c7 100644 --- a/webkit/fileapi/media/device_media_file_util.h +++ b/webkit/fileapi/media/device_media_file_util.h @@ -22,7 +22,7 @@ class FileSystemOperationContext; class WEBKIT_STORAGE_EXPORT_PRIVATE DeviceMediaFileUtil : public FileSystemFileUtil { public: - explicit DeviceMediaFileUtil(const FilePath& profile_path); + explicit DeviceMediaFileUtil(const base::FilePath& profile_path); virtual ~DeviceMediaFileUtil() {} // FileSystemFileUtil overrides. @@ -47,7 +47,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE DeviceMediaFileUtil FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path) OVERRIDE; + base::FilePath* platform_path) OVERRIDE; virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( FileSystemOperationContext* context, const FileSystemURL& root_url, @@ -55,7 +55,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE DeviceMediaFileUtil virtual base::PlatformFileError GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_file_path) OVERRIDE; + base::FilePath* local_file_path) OVERRIDE; virtual base::PlatformFileError Touch( FileSystemOperationContext* context, const FileSystemURL& url, @@ -72,7 +72,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE DeviceMediaFileUtil bool copy) OVERRIDE; virtual base::PlatformFileError CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) OVERRIDE; virtual base::PlatformFileError DeleteFile( FileSystemOperationContext* context, @@ -84,12 +84,12 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE DeviceMediaFileUtil FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path, + base::FilePath* platform_path, SnapshotFilePolicy* policy) OVERRIDE; private: // Profile path - const FilePath profile_path_; + const base::FilePath profile_path_; DISALLOW_COPY_AND_ASSIGN(DeviceMediaFileUtil); }; diff --git a/webkit/fileapi/media/filtering_file_enumerator.cc b/webkit/fileapi/media/filtering_file_enumerator.cc index e291697..393cfa2 100644 --- a/webkit/fileapi/media/filtering_file_enumerator.cc +++ b/webkit/fileapi/media/filtering_file_enumerator.cc @@ -21,8 +21,8 @@ namespace { // Used to skip the hidden folders and files. Returns true if the file specified // by |path| should be skipped. -bool ShouldSkip(const FilePath& path) { - const FilePath& base_name = path.BaseName(); +bool ShouldSkip(const base::FilePath& path) { + const base::FilePath& base_name = path.BaseName(); if (base_name.empty()) return false; @@ -77,9 +77,9 @@ FilteringFileEnumerator::FilteringFileEnumerator( FilteringFileEnumerator::~FilteringFileEnumerator() { } -FilePath FilteringFileEnumerator::Next() { +base::FilePath FilteringFileEnumerator::Next() { while (true) { - FilePath next = base_enumerator_->Next(); + base::FilePath next = base_enumerator_->Next(); if (ShouldSkip(next)) continue; diff --git a/webkit/fileapi/media/filtering_file_enumerator.h b/webkit/fileapi/media/filtering_file_enumerator.h index 9e70880..accb2b0 100644 --- a/webkit/fileapi/media/filtering_file_enumerator.h +++ b/webkit/fileapi/media/filtering_file_enumerator.h @@ -22,7 +22,7 @@ class WEBKIT_STORAGE_EXPORT FilteringFileEnumerator MediaPathFilter* filter); virtual ~FilteringFileEnumerator(); - virtual FilePath Next() OVERRIDE; + virtual base::FilePath Next() OVERRIDE; virtual int64 Size() OVERRIDE; virtual base::Time LastModifiedTime() OVERRIDE; virtual bool IsDirectory() OVERRIDE; diff --git a/webkit/fileapi/media/media_path_filter.cc b/webkit/fileapi/media/media_path_filter.cc index ae92c19..c9a0a81 100644 --- a/webkit/fileapi/media/media_path_filter.cc +++ b/webkit/fileapi/media/media_path_filter.cc @@ -14,7 +14,7 @@ namespace fileapi { namespace { -const FilePath::CharType* const kExtraSupportedExtensions[] = { +const base::FilePath::CharType* const kExtraSupportedExtensions[] = { FILE_PATH_LITERAL("3gp"), FILE_PATH_LITERAL("3gpp"), FILE_PATH_LITERAL("avi"), @@ -27,7 +27,7 @@ const FilePath::CharType* const kExtraSupportedExtensions[] = { FILE_PATH_LITERAL("wmv"), }; -bool IsUnsupportedExtension(const FilePath::StringType& extension) { +bool IsUnsupportedExtension(const base::FilePath::StringType& extension) { std::string mime_type; return !net::GetMimeTypeFromExtension(extension, &mime_type) || !net::IsSupportedMimeType(mime_type); @@ -42,7 +42,7 @@ MediaPathFilter::MediaPathFilter() MediaPathFilter::~MediaPathFilter() { } -bool MediaPathFilter::Match(const FilePath& path) { +bool MediaPathFilter::Match(const base::FilePath& path) { EnsureInitialized(); return std::binary_search(media_file_extensions_.begin(), media_file_extensions_.end(), @@ -73,7 +73,7 @@ void MediaPathFilter::EnsureInitialized() { for (MediaFileExtensionList::iterator itr = media_file_extensions_.begin(); itr != media_file_extensions_.end(); ++itr) - *itr = FilePath::kExtensionSeparator + *itr; + *itr = base::FilePath::kExtensionSeparator + *itr; std::sort(media_file_extensions_.begin(), media_file_extensions_.end()); initialized_ = true; diff --git a/webkit/fileapi/media/media_path_filter.h b/webkit/fileapi/media/media_path_filter.h index 9079b8d..694be4e 100644 --- a/webkit/fileapi/media/media_path_filter.h +++ b/webkit/fileapi/media/media_path_filter.h @@ -11,7 +11,9 @@ #include "base/synchronization/lock.h" #include "webkit/storage/webkit_storage_export.h" +namespace base { class FilePath; +} namespace fileapi { @@ -21,10 +23,10 @@ class WEBKIT_STORAGE_EXPORT MediaPathFilter { public: MediaPathFilter(); ~MediaPathFilter(); - bool Match(const FilePath& path); + bool Match(const base::FilePath& path); private: - typedef std::vector<FilePath::StringType> MediaFileExtensionList; + typedef std::vector<base::FilePath::StringType> MediaFileExtensionList; void EnsureInitialized(); diff --git a/webkit/fileapi/media/mtp_device_delegate.h b/webkit/fileapi/media/mtp_device_delegate.h index 793f46c..a5e89ac 100644 --- a/webkit/fileapi/media/mtp_device_delegate.h +++ b/webkit/fileapi/media/mtp_device_delegate.h @@ -9,9 +9,8 @@ #include "base/platform_file.h" #include "webkit/fileapi/file_system_file_util.h" -class FilePath; - namespace base { +class FilePath; class SequencedTaskRunner; class Time; } @@ -26,7 +25,7 @@ class MTPDeviceDelegate { public: // Returns information about the given file path. virtual base::PlatformFileError GetFileInfo( - const FilePath& file_path, + const base::FilePath& file_path, base::PlatformFileInfo* file_info) = 0; // Returns a pointer to a new instance of AbstractFileEnumerator to enumerate @@ -34,15 +33,15 @@ class MTPDeviceDelegate { // caller, and its lifetime should not extend past when the current call // returns to the main media task runner thread. virtual scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> - CreateFileEnumerator(const FilePath& root, + CreateFileEnumerator(const base::FilePath& root, bool recursive) = 0; // Updates the temporary snapshot file contents given by |local_path| with // media file contents given by |device_file_path| and also returns the // metadata of the temporary file. virtual base::PlatformFileError CreateSnapshotFile( - const FilePath& device_file_path, - const FilePath& local_path, + const base::FilePath& device_file_path, + const base::FilePath& local_path, base::PlatformFileInfo* file_info) = 0; // Called when the diff --git a/webkit/fileapi/media/mtp_device_map_service.cc b/webkit/fileapi/media/mtp_device_map_service.cc index 7316068..758a913 100644 --- a/webkit/fileapi/media/mtp_device_map_service.cc +++ b/webkit/fileapi/media/mtp_device_map_service.cc @@ -26,7 +26,7 @@ MTPDeviceMapService* MTPDeviceMapService::GetInstance() { } void MTPDeviceMapService::AddDelegate( - const FilePath::StringType& device_location, + const base::FilePath::StringType& device_location, MTPDeviceDelegate* delegate) { DCHECK(delegate); DCHECK(!device_location.empty()); @@ -38,7 +38,7 @@ void MTPDeviceMapService::AddDelegate( } void MTPDeviceMapService::RemoveDelegate( - const FilePath::StringType& device_location) { + const base::FilePath::StringType& device_location) { base::AutoLock lock(lock_); DelegateMap::iterator it = delegate_map_.find(device_location); DCHECK(it != delegate_map_.end()); @@ -48,13 +48,13 @@ void MTPDeviceMapService::RemoveDelegate( MTPDeviceDelegate* MTPDeviceMapService::GetMTPDeviceDelegate( const std::string& filesystem_id) { - FilePath device_path; + base::FilePath device_path; if (!IsolatedContext::GetInstance()->GetRegisteredPath(filesystem_id, &device_path)) { return NULL; } - const FilePath::StringType& device_location = device_path.value(); + const base::FilePath::StringType& device_location = device_path.value(); DCHECK(!device_location.empty()); base::AutoLock lock(lock_); diff --git a/webkit/fileapi/media/mtp_device_map_service.h b/webkit/fileapi/media/mtp_device_map_service.h index 686d1cb..69da393 100644 --- a/webkit/fileapi/media/mtp_device_map_service.h +++ b/webkit/fileapi/media/mtp_device_map_service.h @@ -26,13 +26,13 @@ class WEBKIT_STORAGE_EXPORT MTPDeviceMapService { // Adds the MTP device delegate to the map service. |device_location| // specifies the mount location of the MTP device. // Called on a media task runner thread. - void AddDelegate(const FilePath::StringType& device_location, + void AddDelegate(const base::FilePath::StringType& device_location, MTPDeviceDelegate* delegate); // Removes the MTP device delegate from the map service. |device_location| // specifies the mount location of the MTP device. // Called on the UI thread. - void RemoveDelegate(const FilePath::StringType& device_location); + void RemoveDelegate(const base::FilePath::StringType& device_location); // Gets the media device delegate associated with |filesystem_id|. // Return NULL if the |filesystem_id| is no longer valid (e.g. because the @@ -47,7 +47,7 @@ class WEBKIT_STORAGE_EXPORT MTPDeviceMapService { // Mapping of device_location and MTPDeviceDelegate* object. It is safe to // store and access the raw pointer. This class operates on the IO thread. - typedef std::map<FilePath::StringType, MTPDeviceDelegate*> DelegateMap; + typedef std::map<base::FilePath::StringType, MTPDeviceDelegate*> DelegateMap; // Get access to this class using GetInstance() method. MTPDeviceMapService(); diff --git a/webkit/fileapi/media/native_media_file_util.cc b/webkit/fileapi/media/native_media_file_util.cc index 6f7c53c..115278c 100644 --- a/webkit/fileapi/media/native_media_file_util.cc +++ b/webkit/fileapi/media/native_media_file_util.cc @@ -31,7 +31,7 @@ PlatformFileError NativeMediaFileUtil::CreateOrOpen( PlatformFileError NativeMediaFileUtil::EnsureFileExists( FileSystemOperationContext* context, const FileSystemURL& url, bool* created) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetFilteredLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -55,7 +55,7 @@ PlatformFileError NativeMediaFileUtil::Touch( const FileSystemURL& url, const base::Time& last_access_time, const base::Time& last_modified_time) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetFilteredLocalFilePathForExistingFileOrDirectory( context, url, @@ -71,7 +71,7 @@ PlatformFileError NativeMediaFileUtil::Truncate( FileSystemOperationContext* context, const FileSystemURL& url, int64 length) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetFilteredLocalFilePathForExistingFileOrDirectory( context, url, @@ -88,7 +88,7 @@ PlatformFileError NativeMediaFileUtil::CopyOrMoveFile( const FileSystemURL& src_url, const FileSystemURL& dest_url, bool copy) { - FilePath src_file_path; + base::FilePath src_file_path; PlatformFileError error = GetFilteredLocalFilePathForExistingFileOrDirectory( context, src_url, @@ -99,7 +99,7 @@ PlatformFileError NativeMediaFileUtil::CopyOrMoveFile( if (NativeFileUtil::DirectoryExists(src_file_path)) return base::PLATFORM_FILE_ERROR_NOT_A_FILE; - FilePath dest_file_path; + base::FilePath dest_file_path; error = GetLocalFilePath(context, dest_url, &dest_file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -118,12 +118,12 @@ PlatformFileError NativeMediaFileUtil::CopyOrMoveFile( PlatformFileError NativeMediaFileUtil::CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) { if (src_file_path.empty()) return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; - FilePath dest_file_path; + base::FilePath dest_file_path; PlatformFileError error = GetFilteredLocalFilePath(context, dest_url, &dest_file_path); if (error != base::PLATFORM_FILE_OK) @@ -134,7 +134,7 @@ PlatformFileError NativeMediaFileUtil::CopyInForeignFile( PlatformFileError NativeMediaFileUtil::DeleteFile( FileSystemOperationContext* context, const FileSystemURL& url) { - FilePath file_path; + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, url, &file_path); if (error != base::PLATFORM_FILE_OK) return error; @@ -153,7 +153,7 @@ PlatformFileError NativeMediaFileUtil::GetFileInfo( FileSystemOperationContext* context, const FileSystemURL& url, PlatformFileInfo* file_info, - FilePath* platform_path) { + base::FilePath* platform_path) { DCHECK(context); DCHECK(context->media_path_filter()); DCHECK(file_info); @@ -174,8 +174,8 @@ PlatformFileError NativeMediaFileUtil::GetFileInfo( PlatformFileError NativeMediaFileUtil::GetFilteredLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_file_path) { - FilePath file_path; + base::FilePath* local_file_path) { + base::FilePath file_path; PlatformFileError error = IsolatedFileUtil::GetLocalFilePath(context, file_system_url, &file_path); if (error != base::PLATFORM_FILE_OK) @@ -192,8 +192,8 @@ NativeMediaFileUtil::GetFilteredLocalFilePathForExistingFileOrDirectory( FileSystemOperationContext* context, const FileSystemURL& file_system_url, PlatformFileError failure_error, - FilePath* local_file_path) { - FilePath file_path; + base::FilePath* local_file_path) { + base::FilePath file_path; PlatformFileError error = GetLocalFilePath(context, file_system_url, &file_path); if (error != base::PLATFORM_FILE_OK) diff --git a/webkit/fileapi/media/native_media_file_util.h b/webkit/fileapi/media/native_media_file_util.h index 97b0999..b1e3573 100644 --- a/webkit/fileapi/media/native_media_file_util.h +++ b/webkit/fileapi/media/native_media_file_util.h @@ -48,7 +48,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE NativeMediaFileUtil bool copy) OVERRIDE; virtual base::PlatformFileError CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) OVERRIDE; virtual base::PlatformFileError DeleteFile( FileSystemOperationContext* context, @@ -57,7 +57,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE NativeMediaFileUtil FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path) OVERRIDE; + base::FilePath* platform_path) OVERRIDE; private: // Like GetLocalFilePath(), but always take media_path_filter() into @@ -66,7 +66,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE NativeMediaFileUtil base::PlatformFileError GetFilteredLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_file_path); + base::FilePath* local_file_path); // Like GetLocalFilePath(), but if the file does not exist, then return // |failure_error|. @@ -78,7 +78,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE NativeMediaFileUtil FileSystemOperationContext* context, const FileSystemURL& file_system_url, base::PlatformFileError failure_error, - FilePath* local_file_path); + base::FilePath* local_file_path); DISALLOW_COPY_AND_ASSIGN(NativeMediaFileUtil); }; diff --git a/webkit/fileapi/media/native_media_file_util_unittest.cc b/webkit/fileapi/media/native_media_file_util_unittest.cc index 8fab4d3..f98379b 100644 --- a/webkit/fileapi/media/native_media_file_util_unittest.cc +++ b/webkit/fileapi/media/native_media_file_util_unittest.cc @@ -32,7 +32,7 @@ namespace { typedef FileSystemOperation::FileEntryList FileEntryList; struct FilteringTestCase { - const FilePath::CharType* path; + const base::FilePath::CharType* path; bool is_directory; bool visible; }; @@ -62,13 +62,13 @@ void ExpectMetadataEqHelper(const std::string& test_name, bool expected_is_directory, base::PlatformFileError actual, const base::PlatformFileInfo& file_info, - const FilePath& /*platform_path*/) { + const base::FilePath& /*platform_path*/) { EXPECT_EQ(expected, actual) << test_name; if (actual == base::PLATFORM_FILE_OK) EXPECT_EQ(expected_is_directory, file_info.is_directory) << test_name; } -void DidReadDirectory(std::set<FilePath::StringType>* content, +void DidReadDirectory(std::set<base::FilePath::StringType>* content, bool* completed, base::PlatformFileError error, const FileEntryList& file_list, @@ -80,11 +80,11 @@ void DidReadDirectory(std::set<FilePath::StringType>* content, EXPECT_TRUE(content->insert(itr->name).second); } -void PopulateDirectoryWithTestCases(const FilePath& dir, +void PopulateDirectoryWithTestCases(const base::FilePath& dir, const FilteringTestCase* test_cases, size_t n) { for (size_t i = 0; i < n; ++i) { - FilePath path = dir.Append(test_cases[i].path); + base::FilePath path = dir.Append(test_cases[i].path); if (test_cases[i].is_directory) { ASSERT_TRUE(file_util::CreateDirectory(path)); } else { @@ -138,7 +138,7 @@ class NativeMediaFileUtilTest : public testing::Test { return file_system_context_.get(); } - FileSystemURL CreateURL(const FilePath::CharType* test_case_path) { + FileSystemURL CreateURL(const base::FilePath::CharType* test_case_path) { return file_system_context_->CreateCrackedFileSystemURL( origin(), fileapi::kFileSystemTypeIsolated, @@ -149,14 +149,14 @@ class NativeMediaFileUtilTest : public testing::Test { return IsolatedContext::GetInstance(); } - FilePath root_path() { + base::FilePath root_path() { return data_dir_.path().Append(FPL("Media Directory")); } - FilePath GetVirtualPath(const FilePath::CharType* test_case_path) { - return FilePath::FromUTF8Unsafe(filesystem_id_). + base::FilePath GetVirtualPath(const base::FilePath::CharType* test_case_path) { + return base::FilePath::FromUTF8Unsafe(filesystem_id_). Append(FPL("Media Directory")). - Append(FilePath(test_case_path)); + Append(base::FilePath(test_case_path)); } FileSystemFileUtil* file_util() { @@ -219,7 +219,7 @@ TEST_F(NativeMediaFileUtilTest, ReadDirectoryFiltering) { kFilteringTestCases, arraysize(kFilteringTestCases)); - std::set<FilePath::StringType> content; + std::set<base::FilePath::StringType> content; FileSystemURL url = CreateURL(FPL("")); bool completed = false; NewOperation(url)->ReadDirectory( @@ -229,9 +229,9 @@ TEST_F(NativeMediaFileUtilTest, ReadDirectoryFiltering) { EXPECT_EQ(5u, content.size()); for (size_t i = 0; i < arraysize(kFilteringTestCases); ++i) { - FilePath::StringType name = - FilePath(kFilteringTestCases[i].path).BaseName().value(); - std::set<FilePath::StringType>::const_iterator found = content.find(name); + base::FilePath::StringType name = + base::FilePath(kFilteringTestCases[i].path).BaseName().value(); + std::set<base::FilePath::StringType>::const_iterator found = content.find(name); EXPECT_EQ(kFilteringTestCases[i].visible, found != content.end()); } } @@ -267,7 +267,7 @@ TEST_F(NativeMediaFileUtilTest, CreateFileAndCreateDirectoryFiltering) { } TEST_F(NativeMediaFileUtilTest, CopySourceFiltering) { - FilePath dest_path = root_path().AppendASCII("dest"); + base::FilePath dest_path = root_path().AppendASCII("dest"); FileSystemURL dest_url = CreateURL(FPL("dest")); // Run the loop twice. The first run has no source files. The second run does. @@ -320,7 +320,7 @@ TEST_F(NativeMediaFileUtilTest, CopyDestFiltering) { } // Always create a dummy source data file. - FilePath src_path = root_path().AppendASCII("foo.jpg"); + base::FilePath src_path = root_path().AppendASCII("foo.jpg"); FileSystemURL src_url = CreateURL(FPL("foo.jpg")); static const char kDummyData[] = "dummy"; ASSERT_TRUE(file_util::WriteFile(src_path, kDummyData, strlen(kDummyData))); @@ -372,7 +372,7 @@ TEST_F(NativeMediaFileUtilTest, CopyDestFiltering) { } TEST_F(NativeMediaFileUtilTest, MoveSourceFiltering) { - FilePath dest_path = root_path().AppendASCII("dest"); + base::FilePath dest_path = root_path().AppendASCII("dest"); FileSystemURL dest_url = CreateURL(FPL("dest")); // Run the loop twice. The first run has no source files. The second run does. @@ -434,7 +434,7 @@ TEST_F(NativeMediaFileUtilTest, MoveDestFiltering) { } // Create the source file for every test case because it might get moved. - FilePath src_path = root_path().AppendASCII("foo.jpg"); + base::FilePath src_path = root_path().AppendASCII("foo.jpg"); FileSystemURL src_url = CreateURL(FPL("foo.jpg")); static const char kDummyData[] = "dummy"; ASSERT_TRUE( diff --git a/webkit/fileapi/mount_points.cc b/webkit/fileapi/mount_points.cc index d754b25..fbd881d 100644 --- a/webkit/fileapi/mount_points.cc +++ b/webkit/fileapi/mount_points.cc @@ -8,7 +8,7 @@ namespace fileapi { MountPoints::MountPointInfo::MountPointInfo() {} MountPoints::MountPointInfo::MountPointInfo( - const std::string& name, const FilePath& path) + const std::string& name, const base::FilePath& path) : name(name), path(path) {} } // namespace fileapi diff --git a/webkit/fileapi/mount_points.h b/webkit/fileapi/mount_points.h index 27df0f2..30779bb 100644 --- a/webkit/fileapi/mount_points.h +++ b/webkit/fileapi/mount_points.h @@ -26,7 +26,7 @@ class WEBKIT_STORAGE_EXPORT MountPoints { public: struct WEBKIT_STORAGE_EXPORT MountPointInfo { MountPointInfo(); - MountPointInfo(const std::string& name, const FilePath& path); + MountPointInfo(const std::string& name, const base::FilePath& path); // The name to be used to register the path. The registered file can // be referred by a virtual path /<filesystem_id>/<name>. @@ -34,7 +34,7 @@ class WEBKIT_STORAGE_EXPORT MountPoints { std::string name; // The path of the file. - FilePath path; + base::FilePath path; // For STL operation. bool operator<(const MountPointInfo& that) const { @@ -65,12 +65,12 @@ class WEBKIT_STORAGE_EXPORT MountPoints { virtual FileSystemURL CreateCrackedFileSystemURL( const GURL& origin, fileapi::FileSystemType type, - const FilePath& path) const = 0; + const base::FilePath& path) const = 0; // Returns the mount point root path registered for a given |mount_name|. // Returns false if the given |mount_name| is not valid. virtual bool GetRegisteredPath(const std::string& mount_name, - FilePath* path) const = 0; + base::FilePath* path) const = 0; // Cracks the given |virtual_path| (which is the path part of a filesystem URL // without '/external' or '/isolated' prefix part) and populates the @@ -83,10 +83,10 @@ class WEBKIT_STORAGE_EXPORT MountPoints { // Note that |path| is set to empty paths if the filesystem type is isolated // and |virtual_path| has no <relative_path> part (i.e. pointing to the // virtual root). - virtual bool CrackVirtualPath(const FilePath& virtual_path, + virtual bool CrackVirtualPath(const base::FilePath& virtual_path, std::string* mount_name, FileSystemType* type, - FilePath* path) const = 0; + base::FilePath* path) const = 0; private: DISALLOW_COPY_AND_ASSIGN(MountPoints); diff --git a/webkit/fileapi/native_file_util.cc b/webkit/fileapi/native_file_util.cc index 7ee3b04..a794250 100644 --- a/webkit/fileapi/native_file_util.cc +++ b/webkit/fileapi/native_file_util.cc @@ -16,7 +16,7 @@ namespace { // Returns true on success, or false otherwise. // // TODO(benchan): Find a better place outside webkit to host this function. -bool SetPlatformSpecificDirectoryPermissions(const FilePath& dir_path) { +bool SetPlatformSpecificDirectoryPermissions(const base::FilePath& dir_path) { #if defined(OS_CHROMEOS) // System daemons on Chrome OS may run as a user different than the Chrome // process but need to access files under the directories created here. @@ -38,7 +38,7 @@ using base::PlatformFileError; class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { public: - NativeFileEnumerator(const FilePath& root_path, + NativeFileEnumerator(const base::FilePath& root_path, bool recursive, int file_type) : file_enum_(root_path, recursive, file_type) { @@ -49,7 +49,7 @@ class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { ~NativeFileEnumerator() {} - virtual FilePath Next() OVERRIDE; + virtual base::FilePath Next() OVERRIDE; virtual int64 Size() OVERRIDE; virtual base::Time LastModifiedTime() OVERRIDE; virtual bool IsDirectory() OVERRIDE; @@ -59,8 +59,8 @@ class NativeFileEnumerator : public FileSystemFileUtil::AbstractFileEnumerator { file_util::FileEnumerator::FindInfo file_util_info_; }; -FilePath NativeFileEnumerator::Next() { - FilePath rv = file_enum_.Next(); +base::FilePath NativeFileEnumerator::Next() { + base::FilePath rv = file_enum_.Next(); if (!rv.empty()) file_enum_.GetFindInfo(&file_util_info_); return rv; @@ -79,7 +79,7 @@ bool NativeFileEnumerator::IsDirectory() { } PlatformFileError NativeFileUtil::CreateOrOpen( - const FilePath& path, int file_flags, + const base::FilePath& path, int file_flags, PlatformFile* file_handle, bool* created) { if (!file_util::DirectoryExists(path.DirName())) { // If its parent does not exist, should return NOT_FOUND error. @@ -98,7 +98,7 @@ PlatformFileError NativeFileUtil::Close(PlatformFile file_handle) { } PlatformFileError NativeFileUtil::EnsureFileExists( - const FilePath& path, + const base::FilePath& path, bool* created) { if (!file_util::DirectoryExists(path.DirName())) // If its parent does not exist, should return NOT_FOUND error. @@ -122,7 +122,7 @@ PlatformFileError NativeFileUtil::EnsureFileExists( } PlatformFileError NativeFileUtil::CreateDirectory( - const FilePath& path, + const base::FilePath& path, bool exclusive, bool recursive) { // If parent dir of file doesn't exist. @@ -147,7 +147,7 @@ PlatformFileError NativeFileUtil::CreateDirectory( } PlatformFileError NativeFileUtil::GetFileInfo( - const FilePath& path, + const base::FilePath& path, base::PlatformFileInfo* file_info) { if (!file_util::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; @@ -157,7 +157,7 @@ PlatformFileError NativeFileUtil::GetFileInfo( } scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> - NativeFileUtil::CreateFileEnumerator(const FilePath& root_path, + NativeFileUtil::CreateFileEnumerator(const base::FilePath& root_path, bool recursive) { return make_scoped_ptr(new NativeFileEnumerator( root_path, recursive, @@ -167,7 +167,7 @@ scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> } PlatformFileError NativeFileUtil::Touch( - const FilePath& path, + const base::FilePath& path, const base::Time& last_access_time, const base::Time& last_modified_time) { if (!file_util::TouchFile( @@ -176,7 +176,7 @@ PlatformFileError NativeFileUtil::Touch( return base::PLATFORM_FILE_OK; } -PlatformFileError NativeFileUtil::Truncate(const FilePath& path, int64 length) { +PlatformFileError NativeFileUtil::Truncate(const base::FilePath& path, int64 length) { PlatformFileError error_code(base::PLATFORM_FILE_ERROR_FAILED); PlatformFile file = base::CreatePlatformFile( @@ -194,17 +194,17 @@ PlatformFileError NativeFileUtil::Truncate(const FilePath& path, int64 length) { return error_code; } -bool NativeFileUtil::PathExists(const FilePath& path) { +bool NativeFileUtil::PathExists(const base::FilePath& path) { return file_util::PathExists(path); } -bool NativeFileUtil::DirectoryExists(const FilePath& path) { +bool NativeFileUtil::DirectoryExists(const base::FilePath& path) { return file_util::DirectoryExists(path); } PlatformFileError NativeFileUtil::CopyOrMoveFile( - const FilePath& src_path, - const FilePath& dest_path, + const base::FilePath& src_path, + const base::FilePath& dest_path, bool copy) { base::PlatformFileInfo info; base::PlatformFileError error = NativeFileUtil::GetFileInfo(src_path, &info); @@ -237,7 +237,7 @@ PlatformFileError NativeFileUtil::CopyOrMoveFile( return base::PLATFORM_FILE_ERROR_FAILED; } -PlatformFileError NativeFileUtil::DeleteFile(const FilePath& path) { +PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { if (!file_util::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (file_util::DirectoryExists(path)) @@ -247,7 +247,7 @@ PlatformFileError NativeFileUtil::DeleteFile(const FilePath& path) { return base::PLATFORM_FILE_OK; } -PlatformFileError NativeFileUtil::DeleteDirectory(const FilePath& path) { +PlatformFileError NativeFileUtil::DeleteDirectory(const base::FilePath& path) { if (!file_util::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (!file_util::DirectoryExists(path)) diff --git a/webkit/fileapi/native_file_util.h b/webkit/fileapi/native_file_util.h index 075d27b..55f3297 100644 --- a/webkit/fileapi/native_file_util.h +++ b/webkit/fileapi/native_file_util.h @@ -33,32 +33,32 @@ namespace fileapi { class WEBKIT_STORAGE_EXPORT_PRIVATE NativeFileUtil { public: static base::PlatformFileError CreateOrOpen( - const FilePath& path, + const base::FilePath& path, int file_flags, base::PlatformFile* file_handle, bool* created); static base::PlatformFileError Close(base::PlatformFile file); - static base::PlatformFileError EnsureFileExists(const FilePath& path, + static base::PlatformFileError EnsureFileExists(const base::FilePath& path, bool* created); - static base::PlatformFileError CreateDirectory(const FilePath& path, + static base::PlatformFileError CreateDirectory(const base::FilePath& path, bool exclusive, bool recursive); - static base::PlatformFileError GetFileInfo(const FilePath& path, + static base::PlatformFileError GetFileInfo(const base::FilePath& path, base::PlatformFileInfo* file_info); static scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> - CreateFileEnumerator(const FilePath& root_path, + CreateFileEnumerator(const base::FilePath& root_path, bool recursive); - static base::PlatformFileError Touch(const FilePath& path, + static base::PlatformFileError Touch(const base::FilePath& path, const base::Time& last_access_time, const base::Time& last_modified_time); - static base::PlatformFileError Truncate(const FilePath& path, int64 length); - static bool PathExists(const FilePath& path); - static bool DirectoryExists(const FilePath& path); - static base::PlatformFileError CopyOrMoveFile(const FilePath& src_path, - const FilePath& dest_path, + static base::PlatformFileError Truncate(const base::FilePath& path, int64 length); + static bool PathExists(const base::FilePath& path); + static bool DirectoryExists(const base::FilePath& path); + static base::PlatformFileError CopyOrMoveFile(const base::FilePath& src_path, + const base::FilePath& dest_path, bool copy); - static base::PlatformFileError DeleteFile(const FilePath& path); - static base::PlatformFileError DeleteDirectory(const FilePath& path); + static base::PlatformFileError DeleteFile(const base::FilePath& path); + static base::PlatformFileError DeleteDirectory(const base::FilePath& path); private: DISALLOW_IMPLICIT_CONSTRUCTORS(NativeFileUtil); diff --git a/webkit/fileapi/obfuscated_file_util.cc b/webkit/fileapi/obfuscated_file_util.cc index dd75118..657eef1 100644 --- a/webkit/fileapi/obfuscated_file_util.cc +++ b/webkit/fileapi/obfuscated_file_util.cc @@ -28,8 +28,8 @@ // Example of various paths: // void ObfuscatedFileUtil::DoSomething(const FileSystemURL& url) { -// FilePath virtual_path = url.path(); -// FilePath local_path = GetLocalFilePath(url); +// base::FilePath virtual_path = url.path(); +// base::FilePath local_path = GetLocalFilePath(url); // // NativeFileUtil::DoSomething(local_path); // file_util::DoAnother(local_path); @@ -47,7 +47,7 @@ const int64 kFlushDelaySeconds = 10 * 60; // 10 minutes void InitFileInfo( FileSystemDirectoryDatabase::FileInfo* file_info, FileSystemDirectoryDatabase::FileId parent_id, - const FilePath::StringType& file_name) { + const base::FilePath::StringType& file_name) { DCHECK(file_info); file_info->parent_id = parent_id; file_info->name = file_name; @@ -55,7 +55,7 @@ void InitFileInfo( // Costs computed as per crbug.com/86114, based on the LevelDB implementation of // path storage under Linux. It's not clear if that will differ on Windows, on -// which FilePath uses wide chars [since they're converted to UTF-8 for storage +// which base::FilePath uses wide chars [since they're converted to UTF-8 for storage // anyway], but as long as the cost is high enough that one can't cheat on quota // by storing data in paths, it doesn't need to be all that accurate. const int64 kPathCreationQuotaCost = 146; // Bytes per inode, basically. @@ -91,9 +91,9 @@ void TouchDirectory(FileSystemDirectoryDatabase* db, FileId dir_id) { NOTREACHED(); } -const FilePath::CharType kTemporaryDirectoryName[] = FILE_PATH_LITERAL("t"); -const FilePath::CharType kPersistentDirectoryName[] = FILE_PATH_LITERAL("p"); -const FilePath::CharType kSyncableDirectoryName[] = FILE_PATH_LITERAL("s"); +const base::FilePath::CharType kTemporaryDirectoryName[] = FILE_PATH_LITERAL("t"); +const base::FilePath::CharType kPersistentDirectoryName[] = FILE_PATH_LITERAL("p"); +const base::FilePath::CharType kSyncableDirectoryName[] = FILE_PATH_LITERAL("s"); } // namespace @@ -116,7 +116,7 @@ class ObfuscatedFileEnumerator type_(root_url.type()), recursive_(recursive), current_file_id_(0) { - FilePath root_virtual_path = root_url.path(); + base::FilePath root_virtual_path = root_url.path(); FileId file_id; if (!db_->GetFileWithPath(root_virtual_path, &file_id)) @@ -128,16 +128,16 @@ class ObfuscatedFileEnumerator virtual ~ObfuscatedFileEnumerator() {} - virtual FilePath Next() OVERRIDE { + virtual base::FilePath Next() OVERRIDE { ProcessRecurseQueue(); if (display_stack_.empty()) - return FilePath(); + return base::FilePath(); current_file_id_ = display_stack_.back(); display_stack_.pop_back(); FileInfo file_info; - FilePath platform_file_path; + base::FilePath platform_file_path; base::PlatformFileError error = obfuscated_file_util_->GetFileInfoInternal( db_, context_, origin_, type_, current_file_id_, @@ -145,7 +145,7 @@ class ObfuscatedFileEnumerator if (error != base::PLATFORM_FILE_OK) return Next(); - FilePath virtual_path = + base::FilePath virtual_path = current_parent_virtual_path_.Append(file_info.name); if (recursive_ && file_info.is_directory()) { FileRecord record = { current_file_id_, virtual_path }; @@ -172,7 +172,7 @@ class ObfuscatedFileEnumerator struct FileRecord { FileId file_id; - FilePath virtual_path; + base::FilePath virtual_path; }; void ProcessRecurseQueue() { @@ -196,7 +196,7 @@ class ObfuscatedFileEnumerator std::queue<FileRecord> recurse_queue_; std::vector<FileId> display_stack_; - FilePath current_parent_virtual_path_; + base::FilePath current_parent_virtual_path_; FileId current_file_id_; base::PlatformFileInfo current_platform_file_info_; @@ -208,7 +208,7 @@ class ObfuscatedOriginEnumerator typedef FileSystemOriginDatabase::OriginRecord OriginRecord; ObfuscatedOriginEnumerator( FileSystemOriginDatabase* origin_database, - const FilePath& base_file_path) + const base::FilePath& base_file_path) : base_file_path_(base_file_path) { if (origin_database) origin_database->ListAllOrigins(&origins_); @@ -231,24 +231,24 @@ class ObfuscatedOriginEnumerator virtual bool HasFileSystemType(FileSystemType type) const OVERRIDE { if (current_.path.empty()) return false; - FilePath::StringType type_string = + base::FilePath::StringType type_string = ObfuscatedFileUtil::GetDirectoryNameForType(type); if (type_string.empty()) { NOTREACHED(); return false; } - FilePath path = base_file_path_.Append(current_.path).Append(type_string); + base::FilePath path = base_file_path_.Append(current_.path).Append(type_string); return file_util::DirectoryExists(path); } private: std::vector<OriginRecord> origins_; OriginRecord current_; - FilePath base_file_path_; + base::FilePath base_file_path_; }; ObfuscatedFileUtil::ObfuscatedFileUtil( - const FilePath& file_system_directory) + const base::FilePath& file_system_directory) : file_system_directory_(file_system_directory) { } @@ -285,7 +285,7 @@ PlatformFileError ObfuscatedFileUtil::CreateOrOpen( if (!AllocateQuota(context, growth)) return base::PLATFORM_FILE_ERROR_NO_SPACE; PlatformFileError error = CreateFile( - context, FilePath(), + context, base::FilePath(), url.origin(), url.type(), &file_info, file_flags, file_handle); if (created && base::PLATFORM_FILE_OK == error) { @@ -301,7 +301,7 @@ PlatformFileError ObfuscatedFileUtil::CreateOrOpen( return base::PLATFORM_FILE_ERROR_EXISTS; base::PlatformFileInfo platform_file_info; - FilePath local_path; + base::FilePath local_path; FileInfo file_info; base::PlatformFileError error = GetFileInfoInternal( db, context, url.origin(), url.type(), file_id, @@ -378,7 +378,7 @@ PlatformFileError ObfuscatedFileUtil::EnsureFileExists( if (!AllocateQuota(context, growth)) return base::PLATFORM_FILE_ERROR_NO_SPACE; PlatformFileError error = CreateFile( - context, FilePath(), url.origin(), url.type(), &file_info, 0, NULL); + context, base::FilePath(), url.origin(), url.type(), &file_info, 0, NULL); if (created && base::PLATFORM_FILE_OK == error) { *created = true; UpdateUsage(context, url, growth); @@ -421,12 +421,12 @@ PlatformFileError ObfuscatedFileUtil::CreateDirectory( return base::PLATFORM_FILE_OK; } - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; VirtualPath::GetComponents(url.path(), &components); FileId parent_id = 0; size_t index; for (index = 0; index < components.size(); ++index) { - FilePath::StringType name = components[index]; + base::FilePath::StringType name = components[index]; if (name == FILE_PATH_LITERAL("/")) continue; if (!db->GetChildWithName(parent_id, name, &parent_id)) @@ -464,7 +464,7 @@ PlatformFileError ObfuscatedFileUtil::GetFileInfo( FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_file_path) { + base::FilePath* platform_file_path) { FileSystemDirectoryDatabase* db = GetDirectoryDatabase( url.origin(), url.type(), false); if (!db) @@ -498,7 +498,7 @@ scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> PlatformFileError ObfuscatedFileUtil::GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& url, - FilePath* local_path) { + base::FilePath* local_path) { FileSystemDirectoryDatabase* db = GetDirectoryDatabase( url.origin(), url.type(), false); if (!db) @@ -543,7 +543,7 @@ PlatformFileError ObfuscatedFileUtil::Touch( return base::PLATFORM_FILE_ERROR_FAILED; return base::PLATFORM_FILE_OK; } - FilePath local_path = DataPathToLocalPath( + base::FilePath local_path = DataPathToLocalPath( url.origin(), url.type(), file_info.data_path); return NativeFileUtil::Touch( local_path, last_access_time, last_modified_time); @@ -554,7 +554,7 @@ PlatformFileError ObfuscatedFileUtil::Truncate( const FileSystemURL& url, int64 length) { base::PlatformFileInfo file_info; - FilePath local_path; + base::FilePath local_path; base::PlatformFileError error = GetFileInfo(context, url, &file_info, &local_path); if (error != base::PLATFORM_FILE_OK) @@ -596,7 +596,7 @@ PlatformFileError ObfuscatedFileUtil::CopyOrMoveFile( FileInfo src_file_info; base::PlatformFileInfo src_platform_file_info; - FilePath src_local_path; + base::FilePath src_local_path; base::PlatformFileError error = GetFileInfoInternal( db, context, src_url.origin(), src_url.type(), src_file_id, &src_file_info, &src_platform_file_info, &src_local_path); @@ -607,7 +607,7 @@ PlatformFileError ObfuscatedFileUtil::CopyOrMoveFile( FileInfo dest_file_info; base::PlatformFileInfo dest_platform_file_info; // overwrite case only - FilePath dest_local_path; // overwrite case only + base::FilePath dest_local_path; // overwrite case only if (overwrite) { base::PlatformFileError error = GetFileInfoInternal( db, context, dest_url.origin(), dest_url.type(), dest_file_id, @@ -715,7 +715,7 @@ PlatformFileError ObfuscatedFileUtil::CopyOrMoveFile( PlatformFileError ObfuscatedFileUtil::CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) { FileSystemDirectoryDatabase* db = GetDirectoryDatabase( dest_url.origin(), dest_url.type(), true); @@ -733,7 +733,7 @@ PlatformFileError ObfuscatedFileUtil::CopyInForeignFile( FileInfo dest_file_info; base::PlatformFileInfo dest_platform_file_info; // overwrite case only if (overwrite) { - FilePath dest_local_path; + base::FilePath dest_local_path; base::PlatformFileError error = GetFileInfoInternal( db, context, dest_url.origin(), dest_url.type(), dest_file_id, &dest_file_info, &dest_platform_file_info, &dest_local_path); @@ -766,7 +766,7 @@ PlatformFileError ObfuscatedFileUtil::CopyInForeignFile( base::PlatformFileError error; if (overwrite) { - FilePath dest_local_path = DataPathToLocalPath( + base::FilePath dest_local_path = DataPathToLocalPath( dest_url.origin(), dest_url.type(), dest_file_info.data_path); error = NativeFileUtil::CopyOrMoveFile( src_file_path, dest_local_path, true); @@ -805,7 +805,7 @@ PlatformFileError ObfuscatedFileUtil::DeleteFile( FileInfo file_info; base::PlatformFileInfo platform_file_info; - FilePath local_path; + base::FilePath local_path; base::PlatformFileError error = GetFileInfoInternal( db, context, url.origin(), url.type(), file_id, &file_info, &platform_file_info, &local_path); @@ -870,7 +870,7 @@ base::PlatformFileError ObfuscatedFileUtil::CreateSnapshotFile( FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path, + base::FilePath* platform_path, SnapshotFilePolicy* policy) { DCHECK(policy); // We're just returning the local file information. @@ -909,23 +909,23 @@ bool ObfuscatedFileUtil::IsDirectoryEmpty( return children.empty(); } -FilePath ObfuscatedFileUtil::GetDirectoryForOriginAndType( +base::FilePath ObfuscatedFileUtil::GetDirectoryForOriginAndType( const GURL& origin, FileSystemType type, bool create, base::PlatformFileError* error_code) { - FilePath origin_dir = GetDirectoryForOrigin(origin, create, error_code); + base::FilePath origin_dir = GetDirectoryForOrigin(origin, create, error_code); if (origin_dir.empty()) - return FilePath(); - FilePath::StringType type_string = GetDirectoryNameForType(type); + return base::FilePath(); + base::FilePath::StringType type_string = GetDirectoryNameForType(type); if (type_string.empty()) { LOG(WARNING) << "Unknown filesystem type requested:" << type; if (error_code) *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL; - return FilePath(); + return base::FilePath(); } - FilePath path = origin_dir.Append(type_string); + base::FilePath path = origin_dir.Append(type_string); base::PlatformFileError error = base::PLATFORM_FILE_OK; if (!file_util::DirectoryExists(path) && (!create || !file_util::CreateDirectory(path))) { @@ -942,7 +942,7 @@ FilePath ObfuscatedFileUtil::GetDirectoryForOriginAndType( bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType( const GURL& origin, FileSystemType type) { base::PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath origin_type_path = GetDirectoryForOriginAndType(origin, type, false, + base::FilePath origin_type_path = GetDirectoryForOriginAndType(origin, type, false, &error); if (origin_type_path.empty()) return true; @@ -958,7 +958,7 @@ bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType( return false; } - FilePath origin_path = origin_type_path.DirName(); + base::FilePath origin_path = origin_type_path.DirName(); DCHECK_EQ(origin_path.value(), GetDirectoryForOrigin(origin, false, NULL).value()); @@ -992,7 +992,7 @@ bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType( } // static -FilePath::StringType ObfuscatedFileUtil::GetDirectoryNameForType( +base::FilePath::StringType ObfuscatedFileUtil::GetDirectoryNameForType( FileSystemType type) { switch (type) { case kFileSystemTypeTemporary: @@ -1003,7 +1003,7 @@ FilePath::StringType ObfuscatedFileUtil::GetDirectoryNameForType( return kSyncableDirectoryName; case kFileSystemTypeUnknown: default: - return FilePath::StringType(); + return base::FilePath::StringType(); } } @@ -1032,14 +1032,14 @@ bool ObfuscatedFileUtil::DestroyDirectoryDatabase( } PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath path = GetDirectoryForOriginAndType(origin, type, false, &error); + base::FilePath path = GetDirectoryForOriginAndType(origin, type, false, &error); if (path.empty() || error == base::PLATFORM_FILE_ERROR_NOT_FOUND) return true; return FileSystemDirectoryDatabase::DestroyDatabase(path); } // static -int64 ObfuscatedFileUtil::ComputeFilePathCost(const FilePath& path) { +int64 ObfuscatedFileUtil::ComputeFilePathCost(const base::FilePath& path) { return UsageForPath(VirtualPath::BaseName(path).value().size()); } @@ -1051,7 +1051,7 @@ PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal( FileId file_id, FileInfo* local_info, base::PlatformFileInfo* file_info, - FilePath* platform_file_path) { + base::FilePath* platform_file_path) { DCHECK(db); DCHECK(context); DCHECK(file_info); @@ -1067,13 +1067,13 @@ PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal( file_info->is_directory = true; file_info->is_symbolic_link = false; file_info->last_modified = local_info->modification_time; - *platform_file_path = FilePath(); + *platform_file_path = base::FilePath(); // We don't fill in ctime or atime. return base::PLATFORM_FILE_OK; } if (local_info->data_path.empty()) return base::PLATFORM_FILE_ERROR_INVALID_OPERATION; - FilePath local_path = DataPathToLocalPath( + base::FilePath local_path = DataPathToLocalPath( origin, type, local_info->data_path); base::PlatformFileError error = NativeFileUtil::GetFileInfo( local_path, file_info); @@ -1095,7 +1095,7 @@ PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal( PlatformFileError ObfuscatedFileUtil::CreateFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const GURL& dest_origin, FileSystemType dest_type, FileInfo* dest_file_info, int file_flags, PlatformFile* handle) { @@ -1105,12 +1105,12 @@ PlatformFileError ObfuscatedFileUtil::CreateFile( dest_origin, dest_type, true); PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath root = GetDirectoryForOriginAndType(dest_origin, dest_type, false, + base::FilePath root = GetDirectoryForOriginAndType(dest_origin, dest_type, false, &error); if (error != base::PLATFORM_FILE_OK) return error; - FilePath dest_local_path; + base::FilePath dest_local_path; error = GenerateNewLocalPath(db, context, dest_origin, dest_type, &dest_local_path); if (error != base::PLATFORM_FILE_OK) @@ -1157,7 +1157,7 @@ PlatformFileError ObfuscatedFileUtil::CreateFile( // This removes the root, including the trailing slash, leaving a relative // path. - dest_file_info->data_path = FilePath( + dest_file_info->data_path = base::FilePath( dest_local_path.value().substr(root.value().length() + 1)); FileId file_id; @@ -1174,12 +1174,12 @@ PlatformFileError ObfuscatedFileUtil::CreateFile( return base::PLATFORM_FILE_OK; } -FilePath ObfuscatedFileUtil::DataPathToLocalPath( - const GURL& origin, FileSystemType type, const FilePath& data_path) { +base::FilePath ObfuscatedFileUtil::DataPathToLocalPath( + const GURL& origin, FileSystemType type, const base::FilePath& data_path) { PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath root = GetDirectoryForOriginAndType(origin, type, false, &error); + base::FilePath root = GetDirectoryForOriginAndType(origin, type, false, &error); if (error != base::PLATFORM_FILE_OK) - return FilePath(); + return base::FilePath(); return root.Append(data_path); } @@ -1202,7 +1202,7 @@ FileSystemDirectoryDatabase* ObfuscatedFileUtil::GetDirectoryDatabase( } PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath path = GetDirectoryForOriginAndType(origin, type, create, &error); + base::FilePath path = GetDirectoryForOriginAndType(origin, type, create, &error); if (error != base::PLATFORM_FILE_OK) { LOG(WARNING) << "Failed to get origin+type directory: " << path.value(); return NULL; @@ -1213,7 +1213,7 @@ FileSystemDirectoryDatabase* ObfuscatedFileUtil::GetDirectoryDatabase( return database; } -FilePath ObfuscatedFileUtil::GetDirectoryForOrigin( +base::FilePath ObfuscatedFileUtil::GetDirectoryForOrigin( const GURL& origin, bool create, base::PlatformFileError* error_code) { if (!InitOriginDatabase(create)) { if (error_code) { @@ -1221,30 +1221,30 @@ FilePath ObfuscatedFileUtil::GetDirectoryForOrigin( base::PLATFORM_FILE_ERROR_FAILED : base::PLATFORM_FILE_ERROR_NOT_FOUND; } - return FilePath(); + return base::FilePath(); } - FilePath directory_name; + base::FilePath directory_name; std::string id = GetOriginIdentifierFromURL(origin); bool exists_in_db = origin_database_->HasOriginPath(id); if (!exists_in_db && !create) { if (error_code) *error_code = base::PLATFORM_FILE_ERROR_NOT_FOUND; - return FilePath(); + return base::FilePath(); } if (!origin_database_->GetPathForOrigin(id, &directory_name)) { if (error_code) *error_code = base::PLATFORM_FILE_ERROR_FAILED; - return FilePath(); + return base::FilePath(); } - FilePath path = file_system_directory_.Append(directory_name); + base::FilePath path = file_system_directory_.Append(directory_name); bool exists_in_fs = file_util::DirectoryExists(path); if (!exists_in_db && exists_in_fs) { if (!file_util::Delete(path, true)) { if (error_code) *error_code = base::PLATFORM_FILE_ERROR_FAILED; - return FilePath(); + return base::FilePath(); } exists_in_fs = false; } @@ -1255,7 +1255,7 @@ FilePath ObfuscatedFileUtil::GetDirectoryForOrigin( *error_code = create ? base::PLATFORM_FILE_ERROR_FAILED : base::PLATFORM_FILE_ERROR_NOT_FOUND; - return FilePath(); + return base::FilePath(); } } @@ -1308,15 +1308,15 @@ PlatformFileError ObfuscatedFileUtil::GenerateNewLocalPath( FileSystemOperationContext* context, const GURL& origin, FileSystemType type, - FilePath* local_path) { + base::FilePath* local_path) { DCHECK(local_path); int64 number; if (!db || !db->GetNextInteger(&number)) return base::PLATFORM_FILE_ERROR_FAILED; PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath new_local_path = GetDirectoryForOriginAndType(origin, type, false, - &error); + base::FilePath new_local_path = GetDirectoryForOriginAndType(origin, type, + false, &error); if (error != base::PLATFORM_FILE_OK) return base::PLATFORM_FILE_ERROR_FAILED; diff --git a/webkit/fileapi/obfuscated_file_util.h b/webkit/fileapi/obfuscated_file_util.h index 88fc441..f9d770b 100644 --- a/webkit/fileapi/obfuscated_file_util.h +++ b/webkit/fileapi/obfuscated_file_util.h @@ -55,7 +55,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil virtual bool HasFileSystemType(FileSystemType type) const = 0; }; - explicit ObfuscatedFileUtil(const FilePath& file_system_directory); + explicit ObfuscatedFileUtil(const base::FilePath& file_system_directory); virtual ~ObfuscatedFileUtil(); // FileSystemFileUtil overrides. @@ -80,7 +80,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_file) OVERRIDE; + base::FilePath* platform_file) OVERRIDE; virtual scoped_ptr<AbstractFileEnumerator> CreateFileEnumerator( FileSystemOperationContext* context, const FileSystemURL& root_url, @@ -88,7 +88,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil virtual base::PlatformFileError GetLocalFilePath( FileSystemOperationContext* context, const FileSystemURL& file_system_url, - FilePath* local_path) OVERRIDE; + base::FilePath* local_path) OVERRIDE; virtual base::PlatformFileError Touch( FileSystemOperationContext* context, const FileSystemURL& url, @@ -105,7 +105,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil bool copy) OVERRIDE; virtual base::PlatformFileError CopyInForeignFile( FileSystemOperationContext* context, - const FilePath& src_file_path, + const base::FilePath& src_file_path, const FileSystemURL& dest_url) OVERRIDE; virtual base::PlatformFileError DeleteFile( FileSystemOperationContext* context, @@ -117,7 +117,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil FileSystemOperationContext* context, const FileSystemURL& url, base::PlatformFileInfo* file_info, - FilePath* platform_path, + base::FilePath* platform_path, SnapshotFilePolicy* policy) OVERRIDE; // Returns true if the directory |url| is empty. @@ -133,7 +133,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil // there is a file system error (e.g. the directory doesn't exist on disk and // |create| is false). Callers should always check |error_code| to make sure // the returned path is usable. - FilePath GetDirectoryForOriginAndType( + base::FilePath GetDirectoryForOriginAndType( const GURL& origin, FileSystemType type, bool create, @@ -146,7 +146,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil // TODO(ericu): This doesn't really feel like it belongs in this class. // The previous version lives in FileSystemPathManager, but perhaps // SandboxMountPointProvider would be better? - static FilePath::StringType GetDirectoryNameForType(FileSystemType type); + static base::FilePath::StringType GetDirectoryNameForType(FileSystemType type); // This method and all methods of its returned class must be called only on // the FILE thread. The caller is responsible for deleting the returned @@ -162,7 +162,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil // this ignores all but the BaseName of the supplied path. In order to // compute the cost of adding a multi-segment directory recursively, call this // on each path segment and add the results. - static int64 ComputeFilePathCost(const FilePath& path); + static int64 ComputeFilePathCost(const base::FilePath& path); private: typedef FileSystemDirectoryDatabase::FileId FileId; @@ -178,7 +178,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil FileId file_id, FileInfo* local_info, base::PlatformFileInfo* file_info, - FilePath* platform_file_path); + base::FilePath* platform_file_path); // Creates a new file, both the underlying backing file and the entry in the // database. |dest_file_info| is an in-out parameter. Supply the name and @@ -193,7 +193,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil // DCHECK and handle will hold base::kInvalidPlatformFileValue. base::PlatformFileError CreateFile( FileSystemOperationContext* context, - const FilePath& source_file_path, + const base::FilePath& source_file_path, const GURL& dest_origin, FileSystemType dest_type, FileInfo* dest_file_info, @@ -203,10 +203,10 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil // This converts from a relative path [as is stored in the FileInfo.data_path // field] to an absolute platform path that can be given to the native // filesystem. - FilePath DataPathToLocalPath( + base::FilePath DataPathToLocalPath( const GURL& origin, FileSystemType type, - const FilePath& data_file_path); + const base::FilePath& data_file_path); // This returns NULL if |create| flag is false and a filesystem does not // exist for the given |origin_url| and |type|. @@ -216,7 +216,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil // Gets the topmost directory specific to this origin. This will // contain both the filesystem type subdirectories. - FilePath GetDirectoryForOrigin(const GURL& origin, + base::FilePath GetDirectoryForOrigin(const GURL& origin, bool create, base::PlatformFileError* error_code); @@ -233,12 +233,12 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE ObfuscatedFileUtil FileSystemOperationContext* context, const GURL& origin, FileSystemType type, - FilePath* local_path); + base::FilePath* local_path); typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; DirectoryMap directories_; scoped_ptr<FileSystemOriginDatabase> origin_database_; - FilePath file_system_directory_; + base::FilePath file_system_directory_; base::OneShotTimer<ObfuscatedFileUtil> timer_; DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); diff --git a/webkit/fileapi/obfuscated_file_util_unittest.cc b/webkit/fileapi/obfuscated_file_util_unittest.cc index f33bc6b..a481c0c 100644 --- a/webkit/fileapi/obfuscated_file_util_unittest.cc +++ b/webkit/fileapi/obfuscated_file_util_unittest.cc @@ -33,11 +33,11 @@ namespace fileapi { namespace { -bool FileExists(const FilePath& path) { +bool FileExists(const base::FilePath& path) { return file_util::PathExists(path) && !file_util::DirectoryExists(path); } -int64 GetSize(const FilePath& path) { +int64 GetSize(const base::FilePath& path) { int64 size; EXPECT_TRUE(file_util::GetFileSize(path, &size)); return size; @@ -191,7 +191,7 @@ class ObfuscatedFileUtilTest : public testing::Test { return static_cast<ObfuscatedFileUtil*>(test_helper_.file_util()); } - const FilePath& test_directory() const { + const base::FilePath& test_directory() const { return data_dir_.path(); } @@ -234,7 +234,7 @@ class ObfuscatedFileUtilTest : public testing::Test { bool PathExists(const FileSystemURL& url) { scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; base::PlatformFileError error = ofu()->GetFileInfo( context.get(), url, &file_info, &platform_path); return error == base::PLATFORM_FILE_OK; @@ -255,7 +255,7 @@ class ObfuscatedFileUtilTest : public testing::Test { return ObfuscatedFileUtil::ComputeFilePathCost(url.path()); } - FileSystemURL CreateURL(const FilePath& path) { + FileSystemURL CreateURL(const base::FilePath& path) { return test_helper_.CreateURL(path); } @@ -268,12 +268,12 @@ class ObfuscatedFileUtilTest : public testing::Test { void CheckFileAndCloseHandle( const FileSystemURL& url, base::PlatformFile file_handle) { scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); - FilePath local_path; + base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( context.get(), url, &local_path)); base::PlatformFileInfo file_info0; - FilePath data_path; + base::FilePath data_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( context.get(), url, &file_info0, &data_path)); EXPECT_EQ(data_path, local_path); @@ -326,10 +326,10 @@ class ObfuscatedFileUtilTest : public testing::Test { void ValidateTestDirectory( const FileSystemURL& root_url, - const std::set<FilePath::StringType>& files, - const std::set<FilePath::StringType>& directories) { + const std::set<base::FilePath::StringType>& files, + const std::set<base::FilePath::StringType>& directories) { scoped_ptr<FileSystemOperationContext> context; - std::set<FilePath::StringType>::const_iterator iter; + std::set<base::FilePath::StringType>::const_iterator iter; for (iter = files.begin(); iter != files.end(); ++iter) { bool created = true; context.reset(NewContext(NULL)); @@ -390,8 +390,8 @@ class ObfuscatedFileUtilTest : public testing::Test { void FillTestDirectory( const FileSystemURL& root_url, - std::set<FilePath::StringType>* files, - std::set<FilePath::StringType>* directories) { + std::set<base::FilePath::StringType>* files, + std::set<base::FilePath::StringType>* directories) { scoped_ptr<FileSystemOperationContext> context; context.reset(NewContext(NULL)); std::vector<base::FileUtilProxy::Entry> entries; @@ -408,7 +408,7 @@ class ObfuscatedFileUtilTest : public testing::Test { directories->insert(FILE_PATH_LITERAL("fourth")); directories->insert(FILE_PATH_LITERAL("fifth")); directories->insert(FILE_PATH_LITERAL("sixth")); - std::set<FilePath::StringType>::iterator iter; + std::set<base::FilePath::StringType>::iterator iter; for (iter = files->begin(); iter != files->end(); ++iter) { bool created = false; context.reset(NewContext(NULL)); @@ -432,8 +432,8 @@ class ObfuscatedFileUtilTest : public testing::Test { } void TestReadDirectoryHelper(const FileSystemURL& root_url) { - std::set<FilePath::StringType> files; - std::set<FilePath::StringType> directories; + std::set<base::FilePath::StringType> files; + std::set<base::FilePath::StringType> directories; FillTestDirectory(root_url, &files, &directories); scoped_ptr<FileSystemOperationContext> context; @@ -448,7 +448,7 @@ class ObfuscatedFileUtilTest : public testing::Test { for (entry_iter = entries.begin(); entry_iter != entries.end(); ++entry_iter) { const base::FileUtilProxy::Entry& entry = *entry_iter; - std::set<FilePath::StringType>::iterator iter = files.find(entry.name); + std::set<base::FilePath::StringType>::iterator iter = files.find(entry.name); if (iter != files.end()) { EXPECT_FALSE(entry.is_directory); files.erase(iter); @@ -471,7 +471,7 @@ class ObfuscatedFileUtilTest : public testing::Test { context.get(), url, last_access_time, last_modified_time)); // Currently we fire no change notifications for Touch. EXPECT_TRUE(change_observer()->HasNoChange()); - FilePath local_path; + base::FilePath local_path; base::PlatformFileInfo file_info; context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( @@ -499,8 +499,8 @@ class ObfuscatedFileUtilTest : public testing::Test { void TestCopyInForeignFileHelper(bool overwrite) { base::ScopedTempDir source_dir; ASSERT_TRUE(source_dir.CreateUniqueTempDir()); - FilePath root_file_path = source_dir.path(); - FilePath src_file_path = root_file_path.AppendASCII("file_name"); + base::FilePath root_file_path = source_dir.path(); + base::FilePath src_file_path = root_file_path.AppendASCII("file_name"); FileSystemURL dest_url = CreateURLFromUTF8("new file"); int64 src_file_length = 87; @@ -551,7 +551,7 @@ class ObfuscatedFileUtilTest : public testing::Test { context.reset(NewContext(NULL)); base::PlatformFileInfo file_info; - FilePath data_path; + base::FilePath data_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( context.get(), dest_url, &file_info, &data_path)); EXPECT_NE(data_path, src_file_path); @@ -571,7 +571,7 @@ class ObfuscatedFileUtilTest : public testing::Test { base::Time GetModifiedTime(const FileSystemURL& url) { scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); - FilePath data_path; + base::FilePath data_path; base::PlatformFileInfo file_info; context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, @@ -693,7 +693,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { CheckFileAndCloseHandle(url, file_handle); context.reset(NewContext(NULL)); - FilePath local_path; + base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( context.get(), url, &local_path)); EXPECT_TRUE(file_util::PathExists(local_path)); @@ -761,7 +761,7 @@ TEST_F(ObfuscatedFileUtilTest, TestTruncate) { EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count()); context.reset(NewContext(NULL)); - FilePath local_path; + base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( context.get(), url, &local_path)); EXPECT_EQ(0, GetSize(local_path)); @@ -837,7 +837,7 @@ TEST_F(ObfuscatedFileUtilTest, TestQuotaOnTruncation) { } // Delete backing file to make following truncation fail. - FilePath local_path; + base::FilePath local_path; ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( UnlimitedContext().get(), @@ -954,7 +954,7 @@ TEST_F(ObfuscatedFileUtilTest, TestDirectoryOps) { EXPECT_TRUE(change_observer()->HasNoChange()); base::PlatformFileInfo file_info; - FilePath local_path; + base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( context.get(), url, &file_info, &local_path)); EXPECT_TRUE(local_path.empty()); @@ -1138,13 +1138,13 @@ TEST_F(ObfuscatedFileUtilTest, TestPathQuotas) { bool exclusive = true; bool recursive = true; url = CreateURLFromUTF8("directory/to/use"); - std::vector<FilePath::StringType> components; + std::vector<base::FilePath::StringType> components; url.path().GetComponents(&components); path_cost = 0; - for (std::vector<FilePath::StringType>::iterator iter = components.begin(); + for (std::vector<base::FilePath::StringType>::iterator iter = components.begin(); iter != components.end(); ++iter) { path_cost += ObfuscatedFileUtil::ComputeFilePathCost( - FilePath(*iter)); + base::FilePath(*iter)); } context.reset(NewContext(NULL)); context->set_allowed_bytes_growth(1024); @@ -1250,7 +1250,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCopyOrMoveFileSuccess) { if (test_case.is_copy_not_move) { base::PlatformFileInfo file_info; - FilePath local_path; + base::FilePath local_path; context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( context.get(), source_url, &file_info, &local_path)); @@ -1259,13 +1259,13 @@ TEST_F(ObfuscatedFileUtilTest, TestCopyOrMoveFileSuccess) { ofu()->DeleteFile(context.get(), source_url)); } else { base::PlatformFileInfo file_info; - FilePath local_path; + base::FilePath local_path; context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->GetFileInfo( context.get(), source_url, &file_info, &local_path)); } base::PlatformFileInfo file_info; - FilePath local_path; + base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( context.get(), dest_url, &file_info, &local_path)); EXPECT_EQ(kSourceLength, file_info.size); @@ -1389,8 +1389,8 @@ TEST_F(ObfuscatedFileUtilTest, TestEnumerator) { ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( context.get(), src_url, exclusive, recursive)); - std::set<FilePath::StringType> files; - std::set<FilePath::StringType> directories; + std::set<base::FilePath::StringType> files; + std::set<base::FilePath::StringType> directories; FillTestDirectory(src_url, &files, &directories); FileSystemURL dest_url = CreateURLFromUTF8("destination dir"); @@ -1505,7 +1505,7 @@ TEST_F(ObfuscatedFileUtilTest, TestRevokeUsageCache) { for (size_t i = 0; i < test::kRegularTestCaseSize; ++i) { SCOPED_TRACE(testing::Message() << "Creating kRegularTestCase " << i); const test::TestCaseRecord& test_case = test::kRegularTestCases[i]; - FilePath file_path(test_case.path); + base::FilePath file_path(test_case.path); expected_quota += ObfuscatedFileUtil::ComputeFilePathCost(file_path); if (test_case.is_directory) { bool exclusive = true; @@ -1550,7 +1550,7 @@ TEST_F(ObfuscatedFileUtilTest, TestInconsistency) { scoped_ptr<FileSystemOperationContext> context; base::PlatformFile file; base::PlatformFileInfo file_info; - FilePath data_path; + base::FilePath data_path; bool created = false; // Create a non-empty file. @@ -1625,7 +1625,7 @@ TEST_F(ObfuscatedFileUtilTest, TestIncompleteDirectoryReading) { CreateURLFromUTF8("bar"), CreateURLFromUTF8("baz") }; - const FileSystemURL empty_path = CreateURL(FilePath()); + const FileSystemURL empty_path = CreateURL(base::FilePath()); scoped_ptr<FileSystemOperationContext> context; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kPath); ++i) { @@ -1644,7 +1644,7 @@ TEST_F(ObfuscatedFileUtilTest, TestIncompleteDirectoryReading) { EXPECT_EQ(3u, entries.size()); context.reset(NewContext(NULL)); - FilePath local_path; + base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path)); EXPECT_TRUE(file_util::Delete(local_path, false)); @@ -1780,7 +1780,7 @@ TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCreation) { EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->EnsureFileExists(context.get(), src_path, &created)); EXPECT_TRUE(created); - FilePath src_local_path; + base::FilePath src_local_path; context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(context.get(), src_path, &src_local_path)); @@ -1883,7 +1883,7 @@ TEST_F(ObfuscatedFileUtilTest, TestFileEnumeratorTimestamp) { EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory(context.get(), url2, false, false)); - FilePath file_path; + base::FilePath file_path; context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(context.get(), url1, &file_path)); @@ -1900,11 +1900,11 @@ TEST_F(ObfuscatedFileUtilTest, TestFileEnumeratorTimestamp) { ofu()->CreateFileEnumerator(context.get(), dir, false)); int count = 0; - FilePath file_path_each; + base::FilePath file_path_each; while (!(file_path_each = file_enum->Next()).empty()) { context.reset(NewContext(NULL)); base::PlatformFileInfo file_info; - FilePath file_path; + base::FilePath file_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(context.get(), dir.WithPath(file_path_each), diff --git a/webkit/fileapi/remote_file_system_proxy.h b/webkit/fileapi/remote_file_system_proxy.h index e54a266..2d3ba77 100644 --- a/webkit/fileapi/remote_file_system_proxy.h +++ b/webkit/fileapi/remote_file_system_proxy.h @@ -13,7 +13,7 @@ namespace fileapi { typedef base::Callback< void(base::PlatformFileError result, - const FilePath& platform_path, + const base::FilePath& platform_path, const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref)> WritableSnapshotFile; diff --git a/webkit/fileapi/sandbox_file_stream_writer.cc b/webkit/fileapi/sandbox_file_stream_writer.cc index 036c4dd..7906f17 100644 --- a/webkit/fileapi/sandbox_file_stream_writer.cc +++ b/webkit/fileapi/sandbox_file_stream_writer.cc @@ -121,7 +121,7 @@ void SandboxFileStreamWriter::DidGetFileInfo( const net::CompletionCallback& callback, base::PlatformFileError file_error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path) { + const base::FilePath& platform_path) { if (CancelIfRequested()) return; if (file_error != base::PLATFORM_FILE_OK) { diff --git a/webkit/fileapi/sandbox_file_stream_writer.h b/webkit/fileapi/sandbox_file_stream_writer.h index a1f0e19..c1dfe18 100644 --- a/webkit/fileapi/sandbox_file_stream_writer.h +++ b/webkit/fileapi/sandbox_file_stream_writer.h @@ -52,7 +52,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE SandboxFileStreamWriter void DidGetFileInfo(const net::CompletionCallback& callback, base::PlatformFileError file_error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path); + const base::FilePath& platform_path); void DidGetUsageAndQuota(const net::CompletionCallback& callback, quota::QuotaStatusCode status, int64 usage, int64 quota); @@ -74,7 +74,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE SandboxFileStreamWriter UpdateObserverList observers_; - FilePath file_path_; + base::FilePath file_path_; int64 file_size_; int64 total_bytes_written_; int64 allowed_bytes_to_write_; diff --git a/webkit/fileapi/sandbox_mount_point_provider.cc b/webkit/fileapi/sandbox_mount_point_provider.cc index baf7cac..a7121ac 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.cc +++ b/webkit/fileapi/sandbox_mount_point_provider.cc @@ -63,12 +63,12 @@ const char kPersistentOriginsCountLabel[] = "FileSystem.PersistentOriginsCount"; // Restricted names. // http://dev.w3.org/2009/dap/file-system/file-dir-sys.html#naming-restrictions -const FilePath::CharType* const kRestrictedNames[] = { +const base::FilePath::CharType* const kRestrictedNames[] = { FILE_PATH_LITERAL("."), FILE_PATH_LITERAL(".."), }; // Restricted chars. -const FilePath::CharType kRestrictedChars[] = { +const base::FilePath::CharType kRestrictedChars[] = { FILE_PATH_LITERAL('/'), FILE_PATH_LITERAL('\\'), }; @@ -109,7 +109,7 @@ void ValidateRootOnFileThread( base::PlatformFileError* error_ptr) { DCHECK(error_ptr); - FilePath root_path = + base::FilePath root_path = file_util->GetDirectoryForOriginAndType( origin_url, type, create, error_ptr); if (*error_ptr != base::PLATFORM_FILE_OK) { @@ -126,7 +126,7 @@ void ValidateRootOnFileThread( } // anonymous namespace -const FilePath::CharType SandboxMountPointProvider::kFileSystemDirectory[] = +const base::FilePath::CharType SandboxMountPointProvider::kFileSystemDirectory[] = FILE_PATH_LITERAL("File System"); // static @@ -139,7 +139,7 @@ bool SandboxMountPointProvider::CanHandleType(FileSystemType type) { SandboxMountPointProvider::SandboxMountPointProvider( quota::QuotaManagerProxy* quota_manager_proxy, base::SequencedTaskRunner* file_task_runner, - const FilePath& profile_path, + const base::FilePath& profile_path, const FileSystemOptions& file_system_options) : file_task_runner_(file_task_runner), profile_path_(profile_path), @@ -211,16 +211,16 @@ void SandboxMountPointProvider::ValidateFileSystemRoot( callback, base::Owned(error_ptr))); }; -FilePath +base::FilePath SandboxMountPointProvider::GetFileSystemRootPathOnFileThread( const FileSystemURL& url, bool create) { if (file_system_options_.is_incognito()) // TODO(kinuko): return an isolated temporary directory. - return FilePath(); + return base::FilePath(); if (!IsAllowedScheme(url.origin())) - return FilePath(); + return base::FilePath(); return GetBaseDirectoryForOriginAndType(url.origin(), url.type(), create); } @@ -233,7 +233,7 @@ bool SandboxMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { return IsAllowedScheme(url.origin()); } -bool SandboxMountPointProvider::IsRestrictedFileName(const FilePath& filename) +bool SandboxMountPointProvider::IsRestrictedFileName(const base::FilePath& filename) const { if (filename.value().empty()) return false; @@ -246,7 +246,7 @@ bool SandboxMountPointProvider::IsRestrictedFileName(const FilePath& filename) for (size_t i = 0; i < arraysize(kRestrictedChars); ++i) { if (filename.value().find(kRestrictedChars[i]) != - FilePath::StringType::npos) + base::FilePath::StringType::npos) return true; } @@ -341,14 +341,14 @@ SandboxMountPointProvider::CreateOriginEnumerator() { return new ObfuscatedOriginEnumerator(sandbox_sync_file_util()); } -FilePath SandboxMountPointProvider::GetBaseDirectoryForOriginAndType( +base::FilePath SandboxMountPointProvider::GetBaseDirectoryForOriginAndType( const GURL& origin_url, fileapi::FileSystemType type, bool create) { base::PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath path = sandbox_sync_file_util()->GetDirectoryForOriginAndType( + base::FilePath path = sandbox_sync_file_util()->GetDirectoryForOriginAndType( origin_url, type, create, &error); if (error != base::PLATFORM_FILE_OK) - return FilePath(); + return base::FilePath(); return path; } @@ -418,10 +418,10 @@ int64 SandboxMountPointProvider::GetOriginUsageOnFileThread( const GURL& origin_url, fileapi::FileSystemType type) { DCHECK(CanHandleType(type)); - FilePath base_path = + base::FilePath base_path = GetBaseDirectoryForOriginAndType(origin_url, type, false); if (base_path.empty() || !file_util::DirectoryExists(base_path)) return 0; - FilePath usage_file_path = + base::FilePath usage_file_path = base_path.Append(FileSystemUsageCache::kUsageFileName); bool is_valid = FileSystemUsageCache::IsValid(usage_file_path); @@ -439,11 +439,11 @@ int64 SandboxMountPointProvider::GetOriginUsageOnFileThread( FileSystemOperationContext context(file_system_context); FileSystemURL url = file_system_context->CreateCrackedFileSystemURL( - origin_url, type, FilePath()); + origin_url, type, base::FilePath()); scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator( sandbox_sync_file_util()->CreateFileEnumerator(&context, url, true)); - FilePath file_path_each; + base::FilePath file_path_each; int64 usage = 0; while (!(file_path_each = enumerator->Next()).empty()) { @@ -459,7 +459,7 @@ void SandboxMountPointProvider::InvalidateUsageCache( const GURL& origin_url, fileapi::FileSystemType type) { DCHECK(CanHandleType(type)); base::PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath usage_file_path = GetUsageCachePathForOriginAndType( + base::FilePath usage_file_path = GetUsageCachePathForOriginAndType( sandbox_sync_file_util(), origin_url, type, &error); if (error != base::PLATFORM_FILE_OK) return; @@ -540,29 +540,29 @@ SandboxMountPointProvider::CreateFileSystemOperationForSync( operation_context.Pass()); } -FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( +base::FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( const GURL& origin_url, FileSystemType type) { base::PlatformFileError error; - FilePath path = GetUsageCachePathForOriginAndType( + base::FilePath path = GetUsageCachePathForOriginAndType( sandbox_sync_file_util(), origin_url, type, &error); if (error != base::PLATFORM_FILE_OK) - return FilePath(); + return base::FilePath(); return path; } // static -FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( +base::FilePath SandboxMountPointProvider::GetUsageCachePathForOriginAndType( ObfuscatedFileUtil* sandbox_file_util, const GURL& origin_url, fileapi::FileSystemType type, base::PlatformFileError* error_out) { DCHECK(error_out); *error_out = base::PLATFORM_FILE_OK; - FilePath base_path = sandbox_file_util->GetDirectoryForOriginAndType( + base::FilePath base_path = sandbox_file_util->GetDirectoryForOriginAndType( origin_url, type, false /* create */, error_out); if (*error_out != base::PLATFORM_FILE_OK) - return FilePath(); + return base::FilePath(); return base_path.Append(FileSystemUsageCache::kUsageFileName); } diff --git a/webkit/fileapi/sandbox_mount_point_provider.h b/webkit/fileapi/sandbox_mount_point_provider.h index 2a8a3ff..6176875 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.h +++ b/webkit/fileapi/sandbox_mount_point_provider.h @@ -59,7 +59,7 @@ class WEBKIT_STORAGE_EXPORT SandboxMountPointProvider }; // The FileSystem directory name. - static const FilePath::CharType kFileSystemDirectory[]; + static const base::FilePath::CharType kFileSystemDirectory[]; static bool CanHandleType(FileSystemType type); @@ -68,7 +68,7 @@ class WEBKIT_STORAGE_EXPORT SandboxMountPointProvider SandboxMountPointProvider( quota::QuotaManagerProxy* quota_manager_proxy, base::SequencedTaskRunner* file_task_runner, - const FilePath& profile_path, + const base::FilePath& profile_path, const FileSystemOptions& file_system_options); virtual ~SandboxMountPointProvider(); @@ -78,11 +78,11 @@ class WEBKIT_STORAGE_EXPORT SandboxMountPointProvider FileSystemType type, bool create, const ValidateFileSystemCallback& callback) OVERRIDE; - virtual FilePath GetFileSystemRootPathOnFileThread( + virtual base::FilePath GetFileSystemRootPathOnFileThread( const FileSystemURL& url, bool create) OVERRIDE; virtual bool IsAccessAllowed(const FileSystemURL& url) OVERRIDE; - virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; + virtual bool IsRestrictedFileName(const base::FilePath& filename) const OVERRIDE; virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; virtual FilePermissionPolicy GetPermissionPolicy( @@ -118,7 +118,7 @@ class WEBKIT_STORAGE_EXPORT SandboxMountPointProvider // the 'unique' part.) // Returns an empty path if the given type is invalid. // This method can only be called on the file thread. - FilePath GetBaseDirectoryForOriginAndType( + base::FilePath GetBaseDirectoryForOriginAndType( const GURL& origin_url, FileSystemType type, bool create); @@ -174,12 +174,12 @@ class WEBKIT_STORAGE_EXPORT SandboxMountPointProvider friend class SyncableFileSystemOperation; // Returns a path to the usage cache file. - FilePath GetUsageCachePathForOriginAndType( + base::FilePath GetUsageCachePathForOriginAndType( const GURL& origin_url, FileSystemType type); // Returns a path to the usage cache file (static version). - static FilePath GetUsageCachePathForOriginAndType( + static base::FilePath GetUsageCachePathForOriginAndType( ObfuscatedFileUtil* sandbox_file_util, const GURL& origin_url, FileSystemType type, @@ -202,7 +202,7 @@ class WEBKIT_STORAGE_EXPORT SandboxMountPointProvider scoped_refptr<base::SequencedTaskRunner> file_task_runner_; - const FilePath profile_path_; + const base::FilePath profile_path_; FileSystemOptions file_system_options_; diff --git a/webkit/fileapi/sandbox_mount_point_provider_unittest.cc b/webkit/fileapi/sandbox_mount_point_provider_unittest.cc index 875ab76..9d51114 100644 --- a/webkit/fileapi/sandbox_mount_point_provider_unittest.cc +++ b/webkit/fileapi/sandbox_mount_point_provider_unittest.cc @@ -39,7 +39,7 @@ class SandboxMountPointProviderOriginEnumeratorTest : public testing::Test { protected: void CreateOriginTypeDirectory(const GURL& origin, fileapi::FileSystemType type) { - FilePath target = sandbox_provider_-> + base::FilePath target = sandbox_provider_-> GetBaseDirectoryForOriginAndType(origin, type, true); ASSERT_TRUE(!target.empty()); ASSERT_TRUE(file_util::DirectoryExists(target)); diff --git a/webkit/fileapi/sandbox_quota_observer.cc b/webkit/fileapi/sandbox_quota_observer.cc index ec24d37..c12ddb2 100644 --- a/webkit/fileapi/sandbox_quota_observer.cc +++ b/webkit/fileapi/sandbox_quota_observer.cc @@ -29,7 +29,7 @@ SandboxQuotaObserver::~SandboxQuotaObserver() {} void SandboxQuotaObserver::OnStartUpdate(const FileSystemURL& url) { DCHECK(SandboxMountPointProvider::CanHandleType(url.type())); DCHECK(update_notify_runner_->RunsTasksOnCurrentThread()); - FilePath usage_file_path = GetUsageCachePath(url); + base::FilePath usage_file_path = GetUsageCachePath(url); if (usage_file_path.empty()) return; FileSystemUsageCache::IncrementDirty(usage_file_path); @@ -48,7 +48,7 @@ void SandboxQuotaObserver::OnUpdate(const FileSystemURL& url, delta); } - FilePath usage_file_path = GetUsageCachePath(url); + base::FilePath usage_file_path = GetUsageCachePath(url); if (usage_file_path.empty()) return; @@ -65,7 +65,7 @@ void SandboxQuotaObserver::OnEndUpdate(const FileSystemURL& url) { DCHECK(SandboxMountPointProvider::CanHandleType(url.type())); DCHECK(update_notify_runner_->RunsTasksOnCurrentThread()); - FilePath usage_file_path = GetUsageCachePath(url); + base::FilePath usage_file_path = GetUsageCachePath(url); if (usage_file_path.empty()) return; @@ -89,15 +89,15 @@ void SandboxQuotaObserver::OnAccess(const FileSystemURL& url) { } } -FilePath SandboxQuotaObserver::GetUsageCachePath(const FileSystemURL& url) { +base::FilePath SandboxQuotaObserver::GetUsageCachePath(const FileSystemURL& url) { DCHECK(sandbox_file_util_); base::PlatformFileError error = base::PLATFORM_FILE_OK; - FilePath path = SandboxMountPointProvider::GetUsageCachePathForOriginAndType( + base::FilePath path = SandboxMountPointProvider::GetUsageCachePathForOriginAndType( sandbox_file_util_, url.origin(), url.type(), &error); if (error != base::PLATFORM_FILE_OK) { LOG(WARNING) << "Could not get usage cache path for: " << url.DebugString(); - return FilePath(); + return base::FilePath(); } return path; } @@ -114,7 +114,7 @@ void SandboxQuotaObserver::ApplyPendingUsageUpdate() { } void SandboxQuotaObserver::UpdateUsageCacheFile( - const FilePath& usage_file_path, + const base::FilePath& usage_file_path, int64 delta) { DCHECK(!usage_file_path.empty()); if (!usage_file_path.empty() && delta != 0) diff --git a/webkit/fileapi/sandbox_quota_observer.h b/webkit/fileapi/sandbox_quota_observer.h index 4711ec0..ea971a4 100644 --- a/webkit/fileapi/sandbox_quota_observer.h +++ b/webkit/fileapi/sandbox_quota_observer.h @@ -33,7 +33,7 @@ class SandboxQuotaObserver : public FileUpdateObserver, public FileAccessObserver { public: - typedef std::map<FilePath, int64> PendingUpdateNotificationMap; + typedef std::map<base::FilePath, int64> PendingUpdateNotificationMap; SandboxQuotaObserver( quota::QuotaManagerProxy* quota_manager_proxy, @@ -51,9 +51,9 @@ class SandboxQuotaObserver private: void ApplyPendingUsageUpdate(); - void UpdateUsageCacheFile(const FilePath& usage_file_path, int64 delta); + void UpdateUsageCacheFile(const base::FilePath& usage_file_path, int64 delta); - FilePath GetUsageCachePath(const FileSystemURL& url); + base::FilePath GetUsageCachePath(const FileSystemURL& url); scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; scoped_refptr<base::SequencedTaskRunner> update_notify_runner_; diff --git a/webkit/fileapi/syncable/canned_syncable_file_system.cc b/webkit/fileapi/syncable/canned_syncable_file_system.cc index e2746e5..d6c7c4d 100644 --- a/webkit/fileapi/syncable/canned_syncable_file_system.cc +++ b/webkit/fileapi/syncable/canned_syncable_file_system.cc @@ -89,7 +89,7 @@ void OnGetMetadataAndVerifyData( const CannedSyncableFileSystem::StatusCallback& callback, base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path) { + const base::FilePath& platform_path) { if (result != base::PLATFORM_FILE_OK) { callback.Run(result); return; @@ -104,11 +104,11 @@ void OnGetMetadataAndVerifyData( void OnGetMetadata( base::PlatformFileInfo* file_info_out, - FilePath* platform_path_out, + base::FilePath* platform_path_out, const CannedSyncableFileSystem::StatusCallback& callback, base::PlatformFileError result, const base::PlatformFileInfo& file_info, - const FilePath& platform_path) { + const base::FilePath& platform_path) { DCHECK(file_info_out); DCHECK(platform_path_out); *file_info_out = file_info; @@ -375,7 +375,7 @@ PlatformFileError CannedSyncableFileSystem::VerifyFile( PlatformFileError CannedSyncableFileSystem::GetMetadata( const FileSystemURL& url, base::PlatformFileInfo* info, - FilePath* platform_path) { + base::FilePath* platform_path) { return RunOnThread<PlatformFileError>( io_task_runner_, FROM_HERE, @@ -540,7 +540,7 @@ void CannedSyncableFileSystem::DoVerifyFile( void CannedSyncableFileSystem::DoGetMetadata( const FileSystemURL& url, base::PlatformFileInfo* info, - FilePath* platform_path, + base::FilePath* platform_path, const StatusCallback& callback) { EXPECT_TRUE(is_filesystem_opened_); NewOperation()->GetMetadata( diff --git a/webkit/fileapi/syncable/canned_syncable_file_system.h b/webkit/fileapi/syncable/canned_syncable_file_system.h index f297068..d520387 100644 --- a/webkit/fileapi/syncable/canned_syncable_file_system.h +++ b/webkit/fileapi/syncable/canned_syncable_file_system.h @@ -110,7 +110,7 @@ class CannedSyncableFileSystem const std::string& expected_data); base::PlatformFileError GetMetadata(const FileSystemURL& url, base::PlatformFileInfo* info, - FilePath* platform_path); + base::FilePath* platform_path); // Returns the # of bytes written (>=0) or an error code (<0). int64 Write(net::URLRequestContext* url_request_context, @@ -172,7 +172,7 @@ class CannedSyncableFileSystem const StatusCallback& callback); void DoGetMetadata(const FileSystemURL& url, base::PlatformFileInfo* info, - FilePath* platform_path, + base::FilePath* platform_path, const StatusCallback& callback); void DoWrite(net::URLRequestContext* url_request_context, const FileSystemURL& url, diff --git a/webkit/fileapi/syncable/local_file_change_tracker.cc b/webkit/fileapi/syncable/local_file_change_tracker.cc index b5ee20d..4257350 100644 --- a/webkit/fileapi/syncable/local_file_change_tracker.cc +++ b/webkit/fileapi/syncable/local_file_change_tracker.cc @@ -21,7 +21,7 @@ namespace fileapi { namespace { -const FilePath::CharType kDatabaseName[] = +const base::FilePath::CharType kDatabaseName[] = FILE_PATH_LITERAL("LocalFileChangeTracker"); const char kMark[] = "d"; } // namespace @@ -30,7 +30,7 @@ const char kMark[] = "d"; // object must be destructed on file_task_runner. class LocalFileChangeTracker::TrackerDB { public: - explicit TrackerDB(const FilePath& base_path); + explicit TrackerDB(const base::FilePath& base_path); SyncStatusCode MarkDirty(const std::string& url); SyncStatusCode ClearDirty(const std::string& url); @@ -47,7 +47,7 @@ class LocalFileChangeTracker::TrackerDB { void HandleError(const tracked_objects::Location& from_here, const leveldb::Status& status); - const FilePath base_path_; + const base::FilePath base_path_; scoped_ptr<leveldb::DB> db_; SyncStatusCode db_status_; @@ -60,7 +60,7 @@ LocalFileChangeTracker::ChangeInfo::~ChangeInfo() {} // LocalFileChangeTracker ------------------------------------------------------ LocalFileChangeTracker::LocalFileChangeTracker( - const FilePath& base_path, + const base::FilePath& base_path, base::SequencedTaskRunner* file_task_runner) : initialized_(false), file_task_runner_(file_task_runner), @@ -217,7 +217,7 @@ SyncStatusCode LocalFileChangeTracker::CollectLastDirtyChanges( new FileSystemOperationContext(file_system_context)); base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; while (!dirty_files.empty()) { const FileSystemURL url = dirty_files.front(); @@ -241,7 +241,7 @@ SyncStatusCode LocalFileChangeTracker::CollectLastDirtyChanges( file_util->CreateFileEnumerator(context.get(), url, false /* recursive */)); - FilePath path_each; + base::FilePath path_each; while (!(path_each = enumerator->Next()).empty()) { dirty_files.push(CreateSyncableFileSystemURL( url.origin(), url.filesystem_id(), path_each)); @@ -288,7 +288,7 @@ void LocalFileChangeTracker::RecordChange( // TrackerDB ------------------------------------------------------------------- -LocalFileChangeTracker::TrackerDB::TrackerDB(const FilePath& base_path) +LocalFileChangeTracker::TrackerDB::TrackerDB(const base::FilePath& base_path) : base_path_(base_path), db_status_(SYNC_STATUS_OK) {} diff --git a/webkit/fileapi/syncable/local_file_change_tracker.h b/webkit/fileapi/syncable/local_file_change_tracker.h index 9636027..b92ddaa 100644 --- a/webkit/fileapi/syncable/local_file_change_tracker.h +++ b/webkit/fileapi/syncable/local_file_change_tracker.h @@ -39,7 +39,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileChangeTracker // |file_task_runner| must be the one where the observee file operations run. // (So that we can make sure DB operations are done before actual update // happens) - LocalFileChangeTracker(const FilePath& base_path, + LocalFileChangeTracker(const base::FilePath& base_path, base::SequencedTaskRunner* file_task_runner); virtual ~LocalFileChangeTracker(); diff --git a/webkit/fileapi/syncable/local_file_sync_context.cc b/webkit/fileapi/syncable/local_file_sync_context.cc index 367e848..b237aaa 100644 --- a/webkit/fileapi/syncable/local_file_sync_context.cc +++ b/webkit/fileapi/syncable/local_file_sync_context.cc @@ -174,7 +174,7 @@ void LocalFileSyncContext::RegisterURLForWaitingSync( void LocalFileSyncContext::ApplyRemoteChange( FileSystemContext* file_system_context, const FileChange& change, - const FilePath& local_path, + const base::FilePath& local_path, const FileSystemURL& url, const SyncStatusCallback& callback) { if (!io_task_runner_->RunsTasksOnCurrentThread()) { @@ -564,7 +564,7 @@ void LocalFileSyncContext::DidGetWritingStatusForSync( FileChangeList changes; file_system_context->change_tracker()->GetChangesForURL(url, &changes); - FilePath platform_path; + base::FilePath platform_path; base::PlatformFileInfo file_info; FileSystemFileUtil* file_util = file_system_context->GetFileUtil(url.type()); DCHECK(file_util); @@ -624,7 +624,7 @@ void LocalFileSyncContext::DidGetFileMetadata( const SyncFileMetadataCallback& callback, base::PlatformFileError file_error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path) { + const base::FilePath& platform_path) { DCHECK(io_task_runner_->RunsTasksOnCurrentThread()); SyncFileMetadata metadata; if (file_error == base::PLATFORM_FILE_OK) { diff --git a/webkit/fileapi/syncable/local_file_sync_context.h b/webkit/fileapi/syncable/local_file_sync_context.h index 6ffc901..a2107f2a 100644 --- a/webkit/fileapi/syncable/local_file_sync_context.h +++ b/webkit/fileapi/syncable/local_file_sync_context.h @@ -115,7 +115,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileSyncContext void ApplyRemoteChange( FileSystemContext* file_system_context, const FileChange& change, - const FilePath& local_path, + const base::FilePath& local_path, const FileSystemURL& url, const SyncStatusCallback& callback); @@ -236,7 +236,7 @@ class WEBKIT_STORAGE_EXPORT LocalFileSyncContext const SyncFileMetadataCallback& callback, base::PlatformFileError file_error, const base::PlatformFileInfo& file_info, - const FilePath& platform_path); + const base::FilePath& platform_path); base::TimeDelta NotifyChangesDuration(); diff --git a/webkit/fileapi/syncable/local_file_sync_context_unittest.cc b/webkit/fileapi/syncable/local_file_sync_context_unittest.cc index 0f2ad44..4cb59c7 100644 --- a/webkit/fileapi/syncable/local_file_sync_context_unittest.cc +++ b/webkit/fileapi/syncable/local_file_sync_context_unittest.cc @@ -119,7 +119,7 @@ class LocalFileSyncContextTest : public testing::Test { SyncStatusCode ApplyRemoteChange(FileSystemContext* file_system_context, const FileChange& change, - const FilePath& local_path, + const base::FilePath& local_path, const FileSystemURL& url, SyncFileType expected_file_type) { SCOPED_TRACE(testing::Message() << "ApplyChange for " << @@ -431,7 +431,7 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion) { SYNC_FILE_TYPE_FILE); EXPECT_EQ(SYNC_STATUS_OK, ApplyRemoteChange(file_system.file_system_context(), - change, FilePath(), kFile, + change, base::FilePath(), kFile, SYNC_FILE_TYPE_FILE)); // The implementation doesn't check file type for deletion, and it must be ok @@ -439,7 +439,7 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForDeletion) { change = FileChange(FileChange::FILE_CHANGE_DELETE, SYNC_FILE_TYPE_UNKNOWN); EXPECT_EQ(SYNC_STATUS_OK, ApplyRemoteChange(file_system.file_system_context(), - change, FilePath(), kDir, + change, base::FilePath(), kDir, SYNC_FILE_TYPE_DIRECTORY)); // Check the directory/files are deleted successfully. @@ -506,8 +506,8 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) { file_system.ClearChangeForURLInTracker(*urls.begin()); // Prepare temporary files which represent the remote file data. - const FilePath kFilePath1(temp_dir.path().Append(FPL("file1"))); - const FilePath kFilePath2(temp_dir.path().Append(FPL("file2"))); + const base::FilePath kFilePath1(temp_dir.path().Append(FPL("file1"))); + const base::FilePath kFilePath2(temp_dir.path().Append(FPL("file2"))); ASSERT_EQ(static_cast<int>(arraysize(kTestFileData1) - 1), file_util::WriteFile(kFilePath1, kTestFileData1, @@ -565,7 +565,7 @@ TEST_F(LocalFileSyncContextTest, ApplyRemoteChangeForAddOrUpdate) { SYNC_FILE_TYPE_DIRECTORY); EXPECT_EQ(SYNC_STATUS_OK, ApplyRemoteChange(file_system.file_system_context(), - change, FilePath(), kDir, + change, base::FilePath(), kDir, SYNC_FILE_TYPE_UNKNOWN)); // This should not happen, but calling ApplyRemoteChange diff --git a/webkit/fileapi/syncable/sync_file_metadata.h b/webkit/fileapi/syncable/sync_file_metadata.h index 266241f..097c377 100644 --- a/webkit/fileapi/syncable/sync_file_metadata.h +++ b/webkit/fileapi/syncable/sync_file_metadata.h @@ -43,7 +43,7 @@ struct WEBKIT_STORAGE_EXPORT LocalFileSyncInfo { ~LocalFileSyncInfo(); FileSystemURL url; - FilePath local_file_path; + base::FilePath local_file_path; SyncFileMetadata metadata; FileChangeList changes; }; diff --git a/webkit/fileapi/syncable/syncable_file_system_operation.cc b/webkit/fileapi/syncable/syncable_file_system_operation.cc index 0387535..e2145b5 100644 --- a/webkit/fileapi/syncable/syncable_file_system_operation.cc +++ b/webkit/fileapi/syncable/syncable_file_system_operation.cc @@ -183,7 +183,7 @@ void SyncableFileSystemOperation::GetMetadata( DCHECK(CalledOnValidThread()); if (!operation_runner_) { callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, - base::PlatformFileInfo(), FilePath()); + base::PlatformFileInfo(), base::FilePath()); delete file_system_operation_; delete this; return; @@ -330,7 +330,7 @@ void SyncableFileSystemOperation::CreateSnapshotFile( DCHECK(CalledOnValidThread()); if (!operation_runner_) { callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, - base::PlatformFileInfo(), FilePath(), NULL); + base::PlatformFileInfo(), base::FilePath(), NULL); delete file_system_operation_; delete this; return; diff --git a/webkit/fileapi/syncable/syncable_file_system_util.cc b/webkit/fileapi/syncable/syncable_file_system_util.cc index e8d87d9..efb9122 100644 --- a/webkit/fileapi/syncable/syncable_file_system_util.cc +++ b/webkit/fileapi/syncable/syncable_file_system_util.cc @@ -14,7 +14,7 @@ namespace fileapi { bool RegisterSyncableFileSystem(const std::string& service_name) { return ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( - service_name, kFileSystemTypeSyncable, FilePath()); + service_name, kFileSystemTypeSyncable, base::FilePath()); } bool RevokeSyncableFileSystem(const std::string& service_name) { @@ -33,11 +33,11 @@ GURL GetSyncableFileSystemRootURI(const GURL& origin, FileSystemURL CreateSyncableFileSystemURL(const GURL& origin, const std::string& service_name, - const FilePath& path) { + const base::FilePath& path) { return ExternalMountPoints::GetSystemInstance()->CreateCrackedFileSystemURL( origin, kFileSystemTypeExternal, - FilePath::FromUTF8Unsafe(service_name).Append(path)); + base::FilePath::FromUTF8Unsafe(service_name).Append(path)); } bool SerializeSyncableFileSystemURL(const FileSystemURL& url, diff --git a/webkit/fileapi/syncable/syncable_file_system_util.h b/webkit/fileapi/syncable/syncable_file_system_util.h index 439a086..542856c 100644 --- a/webkit/fileapi/syncable/syncable_file_system_util.h +++ b/webkit/fileapi/syncable/syncable_file_system_util.h @@ -38,7 +38,8 @@ WEBKIT_STORAGE_EXPORT GURL GetSyncableFileSystemRootURI( // path: '/foo/bar', // returns 'filesystem:http://www.example.com/external/service_name/foo/bar' WEBKIT_STORAGE_EXPORT FileSystemURL CreateSyncableFileSystemURL( - const GURL& origin, const std::string& service_name, const FilePath& path); + const GURL& origin, const std::string& service_name, + const base::FilePath& path); // Serializes a given FileSystemURL |url| and sets the serialized string to // |serialized_url|. If the URL does not represent a syncable filesystem, diff --git a/webkit/fileapi/syncable/syncable_file_system_util_unittest.cc b/webkit/fileapi/syncable/syncable_file_system_util_unittest.cc index 91b0baa..6e8dcc0 100644 --- a/webkit/fileapi/syncable/syncable_file_system_util_unittest.cc +++ b/webkit/fileapi/syncable/syncable_file_system_util_unittest.cc @@ -25,14 +25,14 @@ const char kNonSyncableFileSystemRootURI[] = const char kOrigin[] = "http://www.example.com/"; const char kServiceName[] = "service"; -const FilePath::CharType kPath[] = FILE_PATH_LITERAL("dir/file"); +const base::FilePath::CharType kPath[] = FILE_PATH_LITERAL("dir/file"); FileSystemURL CreateFileSystemURL(const std::string& url) { return ExternalMountPoints::GetSystemInstance()->CrackURL(GURL(url)); } -FilePath CreateNormalizedFilePath(const FilePath::CharType* path) { - return FilePath(path).NormalizePathSeparators(); +base::FilePath CreateNormalizedFilePath(const base::FilePath::CharType* path) { + return base::FilePath(path).NormalizePathSeparators(); } } // namespace @@ -45,9 +45,9 @@ TEST(SyncableFileSystemUtilTest, GetSyncableFileSystemRootURI) { TEST(SyncableFileSystemUtilTest, CreateSyncableFileSystemURL) { ScopedExternalFileSystem scoped_fs( - kServiceName, kFileSystemTypeSyncable, FilePath()); + kServiceName, kFileSystemTypeSyncable, base::FilePath()); - const FilePath path(kPath); + const base::FilePath path(kPath); const FileSystemURL expected_url = CreateFileSystemURL(kSyncableFileSystemRootURI + path.AsUTF8Unsafe()); const FileSystemURL url = @@ -60,13 +60,13 @@ TEST(SyncableFileSystemUtilTest, CreateSyncableFileSystemURL) { TEST(SyncableFileSystemUtilTest, SerializeAndDesirializeSyncableFileSystemURL) { ScopedExternalFileSystem scoped_fs( - kServiceName, kFileSystemTypeSyncable, FilePath()); + kServiceName, kFileSystemTypeSyncable, base::FilePath()); const std::string expected_url_str = kSyncableFileSystemRootURI + CreateNormalizedFilePath(kPath).AsUTF8Unsafe(); const FileSystemURL expected_url = CreateFileSystemURL(expected_url_str); const FileSystemURL url = - CreateSyncableFileSystemURL(GURL(kOrigin), kServiceName, FilePath(kPath)); + CreateSyncableFileSystemURL(GURL(kOrigin), kServiceName, base::FilePath(kPath)); std::string serialized; EXPECT_TRUE(SerializeSyncableFileSystemURL(url, &serialized)); @@ -81,9 +81,9 @@ TEST(SyncableFileSystemUtilTest, TEST(SyncableFileSystemUtilTest, FailInSerializingAndDeserializingSyncableFileSystemURL) { ScopedExternalFileSystem scoped_fs( - kServiceName, kFileSystemTypeSyncable, FilePath()); + kServiceName, kFileSystemTypeSyncable, base::FilePath()); - const FilePath normalized_path = CreateNormalizedFilePath(kPath); + const base::FilePath normalized_path = CreateNormalizedFilePath(kPath); const std::string non_registered_url = kNonRegisteredFileSystemRootURI + normalized_path.AsUTF8Unsafe(); const std::string non_syncable_url = diff --git a/webkit/fileapi/test_file_set.cc b/webkit/fileapi/test_file_set.cc index 6d30f74..96213f1 100644 --- a/webkit/fileapi/test_file_set.cc +++ b/webkit/fileapi/test_file_set.cc @@ -39,9 +39,9 @@ const TestCaseRecord kRegularTestCases[] = { const size_t kRegularTestCaseSize = arraysize(kRegularTestCases); -void SetUpOneTestCase(const FilePath& root_path, +void SetUpOneTestCase(const base::FilePath& root_path, const TestCaseRecord& test_case) { - FilePath path = root_path.Append(test_case.path); + base::FilePath path = root_path.Append(test_case.path); if (test_case.is_directory) { ASSERT_TRUE(file_util::CreateDirectory(path)); return; @@ -64,7 +64,7 @@ void SetUpOneTestCase(const FilePath& root_path, } -void SetUpRegularTestCases(const FilePath& root_path) { +void SetUpRegularTestCases(const base::FilePath& root_path) { for (size_t i = 0; i < arraysize(kRegularTestCases); ++i) { SCOPED_TRACE(testing::Message() << "Creating kRegularTestCases " << i); SetUpOneTestCase(root_path, kRegularTestCases[i]); diff --git a/webkit/fileapi/test_file_set.h b/webkit/fileapi/test_file_set.h index 75673c9..6823c6d 100644 --- a/webkit/fileapi/test_file_set.h +++ b/webkit/fileapi/test_file_set.h @@ -19,7 +19,7 @@ namespace test { struct TestCaseRecord { bool is_directory; - const FilePath::CharType path[64]; + const base::FilePath::CharType path[64]; int64 data_file_size; }; @@ -29,10 +29,10 @@ extern const size_t kRegularTestCaseSize; size_t GetRegularTestCaseSize(); // Creates one file or directory specified by |record|. -void SetUpOneTestCase(const FilePath& root_path, const TestCaseRecord& record); +void SetUpOneTestCase(const base::FilePath& root_path, const TestCaseRecord& record); // Creates the files and directories specified in kRegularTestCases. -void SetUpRegularTestCases(const FilePath& root_path); +void SetUpRegularTestCases(const base::FilePath& root_path); } // namespace test diff --git a/webkit/fileapi/test_mount_point_provider.cc b/webkit/fileapi/test_mount_point_provider.cc index d062763..25b1630 100644 --- a/webkit/fileapi/test_mount_point_provider.cc +++ b/webkit/fileapi/test_mount_point_provider.cc @@ -66,7 +66,7 @@ class TestMountPointProvider::QuotaUtil TestMountPointProvider::TestMountPointProvider( base::SequencedTaskRunner* task_runner, - const FilePath& base_path) + const base::FilePath& base_path) : base_path_(base_path), task_runner_(task_runner), local_file_util_(new AsyncFileUtilAdapter(new LocalFileUtil())), @@ -89,7 +89,7 @@ void TestMountPointProvider::ValidateFileSystemRoot( NOTREACHED(); } -FilePath TestMountPointProvider::GetFileSystemRootPathOnFileThread( +base::FilePath TestMountPointProvider::GetFileSystemRootPathOnFileThread( const FileSystemURL& url, bool create) { DCHECK_EQ(kFileSystemTypeTest, url.type()); @@ -98,7 +98,7 @@ FilePath TestMountPointProvider::GetFileSystemRootPathOnFileThread( success = file_util::CreateDirectory(base_path_); else success = file_util::DirectoryExists(base_path_); - return success ? base_path_ : FilePath(); + return success ? base_path_ : base::FilePath(); } bool TestMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { @@ -106,7 +106,7 @@ bool TestMountPointProvider::IsAccessAllowed(const FileSystemURL& url) { } bool TestMountPointProvider::IsRestrictedFileName( - const FilePath& filename) const { + const base::FilePath& filename) const { return false; } diff --git a/webkit/fileapi/test_mount_point_provider.h b/webkit/fileapi/test_mount_point_provider.h index 4bee102..29a4614 100644 --- a/webkit/fileapi/test_mount_point_provider.h +++ b/webkit/fileapi/test_mount_point_provider.h @@ -30,7 +30,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE TestMountPointProvider public: TestMountPointProvider( base::SequencedTaskRunner* task_runner, - const FilePath& base_path); + const base::FilePath& base_path); virtual ~TestMountPointProvider(); // FileSystemMountPointProvider implementation. @@ -39,11 +39,11 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE TestMountPointProvider FileSystemType type, bool create, const ValidateFileSystemCallback& callback) OVERRIDE; - virtual FilePath GetFileSystemRootPathOnFileThread( + virtual base::FilePath GetFileSystemRootPathOnFileThread( const FileSystemURL& url, bool create) OVERRIDE; virtual bool IsAccessAllowed(const FileSystemURL& url) OVERRIDE; - virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; + virtual bool IsRestrictedFileName(const base::FilePath& filename) const OVERRIDE; virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; virtual FilePermissionPolicy GetPermissionPolicy( @@ -74,7 +74,7 @@ class WEBKIT_STORAGE_EXPORT_PRIVATE TestMountPointProvider private: class QuotaUtil; - FilePath base_path_; + base::FilePath base_path_; scoped_refptr<base::SequencedTaskRunner> task_runner_; scoped_ptr<AsyncFileUtilAdapter> local_file_util_; scoped_ptr<QuotaUtil> quota_util_; diff --git a/webkit/fileapi/upload_file_system_file_element_reader_unittest.cc b/webkit/fileapi/upload_file_system_file_element_reader_unittest.cc index 4d9c7bef..d9ea383 100644 --- a/webkit/fileapi/upload_file_system_file_element_reader_unittest.cc +++ b/webkit/fileapi/upload_file_system_file_element_reader_unittest.cc @@ -85,7 +85,7 @@ class UploadFileSystemFileElementReaderTest : public testing::Test { file_system_context_->CreateCrackedFileSystemURL( GURL(kFileSystemURLOrigin), kFileSystemType, - FilePath().AppendASCII(filename)); + base::FilePath().AppendASCII(filename)); fileapi::FileSystemFileUtil* file_util = file_system_context_->GetFileUtil(kFileSystemType); @@ -108,7 +108,7 @@ class UploadFileSystemFileElementReaderTest : public testing::Test { base::ClosePlatformFile(handle); base::PlatformFileInfo file_info; - FilePath platform_path; + base::FilePath platform_path; ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->GetFileInfo(&context, url, &file_info, &platform_path)); |