diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-01 23:07:36 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-01 23:07:36 +0000 |
commit | 5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01 (patch) | |
tree | f719fa0c440cb3492ccf9c9a2739afd5af5eace6 | |
parent | 10c1234fe5e6b43cd9f2f03f91da2c96083c7643 (diff) | |
download | chromium_src-5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01.zip chromium_src-5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01.tar.gz chromium_src-5553d5bcd8c1f0d90d74a2a52a4c9af51d730d01.tar.bz2 |
Move DeleteAfterReboot, Move, and ReplaceFile to base namespace
Rename ReplaceFileAndGetError (only used once) to ReplaceFile (used 5 times) and have each of those callers specify NULL for the output error if they don't care.
Remove InsertBeforeExtension from file_util.cc which seems to be unused.
BUG=
Review URL: https://codereview.chromium.org/18383003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209532 0039d316-1c4b-4281-b951-d872f2087c98
54 files changed, 155 insertions, 185 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index 049bb36..bf5ce23 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -44,6 +44,12 @@ int64 ComputeDirectorySize(const FilePath& root_path) { return running_size; } +bool Move(const FilePath& from_path, const FilePath& to_path) { + if (from_path.ReferencesParent() || to_path.ReferencesParent()) + return false; + return MoveUnsafe(from_path, to_path); +} + } // namespace base // ----------------------------------------------------------------------------- @@ -55,37 +61,6 @@ using base::FilePath; using base::kExtensionSeparator; using base::kMaxUniqueFiles; -void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix) { - FilePath::StringType& value = - const_cast<FilePath::StringType&>(path->value()); - - const FilePath::StringType::size_type last_dot = - value.rfind(kExtensionSeparator); - const FilePath::StringType::size_type last_separator = - value.find_last_of(FilePath::StringType(FilePath::kSeparators)); - - if (last_dot == FilePath::StringType::npos || - (last_separator != std::wstring::npos && last_dot < last_separator)) { - // The path looks something like "C:\pics.old\jojo" or "C:\pics\jojo". - // We should just append the suffix to the entire path. - value.append(suffix); - return; - } - - value.insert(last_dot, suffix); -} - -bool Move(const FilePath& from_path, const FilePath& to_path) { - if (from_path.ReferencesParent() || to_path.ReferencesParent()) - return false; - return MoveUnsafe(from_path, to_path); -} - -bool ReplaceFile(const base::FilePath& from_path, - const base::FilePath& to_path) { - return ReplaceFileAndGetError(from_path, to_path, NULL); -} - bool CopyFile(const FilePath& from_path, const FilePath& to_path) { if (from_path.ReferencesParent() || to_path.ReferencesParent()) return false; diff --git a/base/file_util.h b/base/file_util.h index 0fa7017..bdef48a 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -71,19 +71,13 @@ BASE_EXPORT int64 ComputeDirectorySize(const FilePath& root_path); // TO "rm -rf", SO USE WITH CAUTION. BASE_EXPORT bool Delete(const FilePath& path, bool recursive); -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - #if defined(OS_WIN) // Schedules to delete the given path, whether it's a file or a directory, until // the operating system is restarted. // Note: // 1) The file/directory to be deleted should exist in a temp folder. // 2) The directory to be deleted must be empty. -BASE_EXPORT bool DeleteAfterReboot(const base::FilePath& path); +BASE_EXPORT bool DeleteAfterReboot(const FilePath& path); #endif // Moves the given path, whether it's a file or a directory. @@ -91,13 +85,12 @@ BASE_EXPORT bool DeleteAfterReboot(const base::FilePath& path); // on different volumes, this will attempt to copy and delete. Returns // true for success. // This function fails if either path contains traversal components ('..'). -BASE_EXPORT bool Move(const base::FilePath& from_path, - const base::FilePath& to_path); +BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path); // Same as Move but allows paths with traversal components. // Use only with extreme care. -BASE_EXPORT bool MoveUnsafe(const base::FilePath& from_path, - const base::FilePath& to_path); +BASE_EXPORT bool MoveUnsafe(const FilePath& from_path, + const FilePath& to_path); // Renames file |from_path| to |to_path|. Both paths must be on the same // volume, or the function will fail. Destination file will be created @@ -105,13 +98,15 @@ BASE_EXPORT bool MoveUnsafe(const base::FilePath& from_path, // temporary files. On Windows it preserves attributes of the target file. // Returns true on success, leaving *error unchanged. // Returns false on failure and sets *error appropriately, if it is non-NULL. -BASE_EXPORT bool ReplaceFileAndGetError(const base::FilePath& from_path, - const base::FilePath& to_path, - base::PlatformFileError* error); +BASE_EXPORT bool ReplaceFile(const FilePath& from_path, + const FilePath& to_path, + PlatformFileError* error); -// Backward-compatible convenience method for the above. -BASE_EXPORT bool ReplaceFile(const base::FilePath& from_path, - const base::FilePath& to_path); +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { // Copies a single file. Use CopyDirectory to copy directories. // This function fails if either path contains traversal components ('..'). diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index afb34b4..899bdb9 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -65,28 +65,28 @@ namespace { #if defined(OS_BSD) || defined(OS_MACOSX) typedef struct stat stat_wrapper_t; static int CallStat(const char *path, stat_wrapper_t *sb) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); return stat(path, sb); } static int CallLstat(const char *path, stat_wrapper_t *sb) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); return lstat(path, sb); } #else typedef struct stat64 stat_wrapper_t; static int CallStat(const char *path, stat_wrapper_t *sb) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); return stat64(path, sb); } static int CallLstat(const char *path, stat_wrapper_t *sb) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); return lstat64(path, sb); } #endif // Helper for NormalizeFilePath(), defined below. bool RealPath(const FilePath& path, FilePath* real_path) { - base::ThreadRestrictions::AssertIOAllowed(); // For realpath(). + ThreadRestrictions::AssertIOAllowed(); // For realpath(). FilePath::CharType buf[PATH_MAX]; if (!realpath(path.value().c_str(), buf)) return false; @@ -134,6 +134,18 @@ bool VerifySpecificPathControlledByUser(const FilePath& path, return true; } +std::string TempFileName() { +#if defined(OS_MACOSX) + return StringPrintf(".%s.XXXXXX", base::mac::BaseBundleID()); +#endif + +#if defined(GOOGLE_CHROME_BUILD) + return std::string(".com.google.Chrome.XXXXXX"); +#else + return std::string(".org.chromium.Chromium.XXXXXX"); +#endif +} + } // namespace FilePath MakeAbsoluteFilePath(const FilePath& input) { @@ -185,35 +197,8 @@ bool Delete(const FilePath& path, bool recursive) { return success; } -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - -using base::stat_wrapper_t; -using base::CallStat; -using base::CallLstat; -using base::FileEnumerator; -using base::FilePath; -using base::MakeAbsoluteFilePath; -using base::RealPath; -using base::VerifySpecificPathControlledByUser; - -static std::string TempFileName() { -#if defined(OS_MACOSX) - return base::StringPrintf(".%s.XXXXXX", base::mac::BaseBundleID()); -#endif - -#if defined(GOOGLE_CHROME_BUILD) - return std::string(".com.google.Chrome.XXXXXX"); -#else - return std::string(".org.chromium.Chromium.XXXXXX"); -#endif -} - bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); // Windows compatibility: if to_path exists, from_path and to_path // must be the same type, either both files, or both directories. stat_wrapper_t to_file_info; @@ -230,24 +215,39 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { if (rename(from_path.value().c_str(), to_path.value().c_str()) == 0) return true; - if (!CopyDirectory(from_path, to_path, true)) + if (!file_util::CopyDirectory(from_path, to_path, true)) return false; Delete(from_path, true); return true; } -bool ReplaceFileAndGetError(const FilePath& from_path, - const FilePath& to_path, - base::PlatformFileError* error) { - base::ThreadRestrictions::AssertIOAllowed(); +bool ReplaceFile(const FilePath& from_path, + const FilePath& to_path, + PlatformFileError* error) { + ThreadRestrictions::AssertIOAllowed(); if (rename(from_path.value().c_str(), to_path.value().c_str()) == 0) return true; if (error) - *error = base::ErrnoToPlatformFileError(errno); + *error = ErrnoToPlatformFileError(errno); return false; } +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::stat_wrapper_t; +using base::CallStat; +using base::CallLstat; +using base::FileEnumerator; +using base::FilePath; +using base::MakeAbsoluteFilePath; +using base::RealPath; +using base::VerifySpecificPathControlledByUser; + bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, bool recursive) { @@ -442,7 +442,7 @@ bool SetPosixFilePermissions(const FilePath& path, // This function does NOT unlink() the file. int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) { base::ThreadRestrictions::AssertIOAllowed(); // For call to mkstemp(). - *path = directory.Append(TempFileName()); + *path = directory.Append(base::TempFileName()); const std::string& tmpdir_string = path->value(); // this should be OK since mkstemp just replaces characters in place char* buffer = const_cast<char*>(tmpdir_string.c_str()); @@ -522,7 +522,8 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix, if (!GetTempDir(&tmpdir)) return false; - return CreateTemporaryDirInDirImpl(tmpdir, TempFileName(), new_temp_path); + return CreateTemporaryDirInDirImpl(tmpdir, base::TempFileName(), + new_temp_path); } bool CreateDirectoryAndGetError(const FilePath& full_path, diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 7626957..aab56a9 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -1069,7 +1069,7 @@ TEST_F(FileUtilTest, MoveFileNew) { FILE_PATH_LITERAL("Move_Test_File_Destination.txt")); ASSERT_FALSE(file_util::PathExists(file_name_to)); - EXPECT_TRUE(file_util::Move(file_name_from, file_name_to)); + EXPECT_TRUE(base::Move(file_name_from, file_name_to)); // Check everything has been moved. EXPECT_FALSE(file_util::PathExists(file_name_from)); @@ -1089,7 +1089,7 @@ TEST_F(FileUtilTest, MoveFileExists) { CreateTextFile(file_name_to, L"Old file content"); ASSERT_TRUE(file_util::PathExists(file_name_to)); - EXPECT_TRUE(file_util::Move(file_name_from, file_name_to)); + EXPECT_TRUE(base::Move(file_name_from, file_name_to)); // Check everything has been moved. EXPECT_FALSE(file_util::PathExists(file_name_from)); @@ -1110,7 +1110,7 @@ TEST_F(FileUtilTest, MoveFileDirExists) { file_util::CreateDirectory(dir_name_to); ASSERT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_FALSE(file_util::Move(file_name_from, dir_name_to)); + EXPECT_FALSE(base::Move(file_name_from, dir_name_to)); } @@ -1135,7 +1135,7 @@ TEST_F(FileUtilTest, MoveNew) { ASSERT_FALSE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::Move(dir_name_from, dir_name_to)); + EXPECT_TRUE(base::Move(dir_name_from, dir_name_to)); // Check everything has been moved. EXPECT_FALSE(file_util::PathExists(dir_name_from)); @@ -1147,10 +1147,10 @@ TEST_F(FileUtilTest, MoveNew) { file_name_from = dir_name_to.Append(txt_file_name); file_name_to = dir_name_to.Append(FILE_PATH_LITERAL("..")); file_name_to = file_name_to.Append(txt_file_name); - EXPECT_FALSE(file_util::Move(file_name_from, file_name_to)); + EXPECT_FALSE(base::Move(file_name_from, file_name_to)); EXPECT_TRUE(file_util::PathExists(file_name_from)); EXPECT_FALSE(file_util::PathExists(file_name_to)); - EXPECT_TRUE(file_util::MoveUnsafe(file_name_from, file_name_to)); + EXPECT_TRUE(base::MoveUnsafe(file_name_from, file_name_to)); EXPECT_FALSE(file_util::PathExists(file_name_from)); EXPECT_TRUE(file_util::PathExists(file_name_to)); } @@ -1181,7 +1181,7 @@ TEST_F(FileUtilTest, MoveExist) { file_util::CreateDirectory(dir_name_exists); ASSERT_TRUE(file_util::PathExists(dir_name_exists)); - EXPECT_TRUE(file_util::Move(dir_name_from, dir_name_to)); + EXPECT_TRUE(base::Move(dir_name_from, dir_name_to)); // Check everything has been moved. EXPECT_FALSE(file_util::PathExists(dir_name_from)); diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 44367a0..2a56ea9 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -98,15 +98,8 @@ bool Delete(const FilePath& path, bool recursive) { return (err == 0 || err == ERROR_FILE_NOT_FOUND || err == 0x402); } -} // namespace base - -namespace file_util { - -using base::FilePath; -using base::kFileShareAll; - bool DeleteAfterReboot(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); if (path.value().length() >= MAX_PATH) return false; @@ -117,7 +110,7 @@ bool DeleteAfterReboot(const FilePath& path) { } bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); // NOTE: I suspect we could support longer paths, but that would involve // analyzing all our usage of files. @@ -134,11 +127,11 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { bool ret = false; DWORD last_error = ::GetLastError(); - if (DirectoryExists(from_path)) { + if (file_util::DirectoryExists(from_path)) { // MoveFileEx fails if moving directory across volumes. We will simulate // the move by using Copy and Delete. Ideally we could check whether // from_path and to_path are indeed in different volumes. - ret = CopyAndDeleteDirectory(from_path, to_path); + ret = file_util::CopyAndDeleteDirectory(from_path, to_path); } if (!ret) { @@ -150,10 +143,10 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { return ret; } -bool ReplaceFileAndGetError(const FilePath& from_path, - const FilePath& to_path, - base::PlatformFileError* error) { - base::ThreadRestrictions::AssertIOAllowed(); +bool ReplaceFile(const FilePath& from_path, + const FilePath& to_path, + PlatformFileError* error) { + ThreadRestrictions::AssertIOAllowed(); // Try a simple move first. It will only succeed when |to_path| doesn't // already exist. if (::MoveFile(from_path.value().c_str(), to_path.value().c_str())) @@ -167,10 +160,19 @@ bool ReplaceFileAndGetError(const FilePath& from_path, return true; } if (error) - *error = base::LastErrorToPlatformFileError(GetLastError()); + *error = LastErrorToPlatformFileError(GetLastError()); return false; } +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::FilePath; +using base::kFileShareAll; + bool CopyFileUnsafe(const FilePath& from_path, const FilePath& to_path) { base::ThreadRestrictions::AssertIOAllowed(); diff --git a/base/files/file_path_watcher_browsertest.cc b/base/files/file_path_watcher_browsertest.cc index 2a8b0cf..a0b4319 100644 --- a/base/files/file_path_watcher_browsertest.cc +++ b/base/files/file_path_watcher_browsertest.cc @@ -261,7 +261,7 @@ TEST_F(FilePathWatcherTest, MovedFile) { ASSERT_TRUE(SetupWatch(test_file(), &watcher, delegate.get(), false)); // Now make sure we get notified if the file is modified. - ASSERT_TRUE(file_util::Move(source_file, test_file())); + ASSERT_TRUE(base::Move(source_file, test_file())); ASSERT_TRUE(WaitForEvents()); DeleteDelegateOnFileThread(delegate.release()); } @@ -496,7 +496,7 @@ TEST_F(FilePathWatcherTest, MoveParent) { ASSERT_TRUE(WaitForEvents()); // Move the parent directory. - file_util::Move(dir, dest); + base::Move(dir, dest); VLOG(1) << "Waiting for directory move"; ASSERT_TRUE(WaitForEvents()); DeleteDelegateOnFileThread(file_delegate.release()); @@ -588,7 +588,7 @@ TEST_F(FilePathWatcherTest, MoveChild) { false)); // Move the directory into place, s.t. the watched file appears. - ASSERT_TRUE(file_util::Move(source_dir, dest_dir)); + ASSERT_TRUE(base::Move(source_dir, dest_dir)); ASSERT_TRUE(WaitForEvents()); DeleteDelegateOnFileThread(file_delegate.release()); DeleteDelegateOnFileThread(subdir_delegate.release()); diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc index a4ba571..f524ba4 100644 --- a/base/files/file_util_proxy_unittest.cc +++ b/base/files/file_util_proxy_unittest.cc @@ -169,7 +169,7 @@ TEST_F(FileUtilProxyTest, Close) { #if defined(OS_WIN) // This fails on Windows if the file is not closed. - EXPECT_FALSE(file_util::Move(test_path(), + EXPECT_FALSE(base::Move(test_path(), test_dir_path().AppendASCII("new"))); #endif @@ -181,7 +181,7 @@ TEST_F(FileUtilProxyTest, Close) { EXPECT_EQ(PLATFORM_FILE_OK, error_); // Now it should pass on all platforms. - EXPECT_TRUE(file_util::Move(test_path(), test_dir_path().AppendASCII("new"))); + EXPECT_TRUE(base::Move(test_path(), test_dir_path().AppendASCII("new"))); } TEST_F(FileUtilProxyTest, CreateTemporary) { diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc index f10e7e6..b3564ef 100644 --- a/base/files/important_file_writer.cc +++ b/base/files/important_file_writer.cc @@ -84,7 +84,7 @@ bool ImportantFileWriter::WriteFileAtomically(const FilePath& path, return false; } - if (!file_util::ReplaceFile(tmp_file_path, path)) { + if (!base::ReplaceFile(tmp_file_path, path, NULL)) { LogFailure(path, FAILED_RENAMING, "could not rename temporary file"); base::Delete(tmp_file_path, false); return false; diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc index a753dae..ff3c232 100644 --- a/base/prefs/json_pref_store.cc +++ b/base/prefs/json_pref_store.cc @@ -130,7 +130,7 @@ void FileThreadDeserializer::HandleErrors( // want to differentiate between recent and long ago errors. if (file_util::PathExists(bad)) *error = PersistentPrefStore::PREF_READ_ERROR_JSON_REPEAT; - file_util::Move(path, bad); + base::Move(path, bad); break; } } else if (!value->IsType(base::Value::TYPE_DICTIONARY)) { diff --git a/chrome/browser/android/crash_dump_manager.cc b/chrome/browser/android/crash_dump_manager.cc index eb41d2c..6ee4e04 100644 --- a/chrome/browser/android/crash_dump_manager.cc +++ b/chrome/browser/android/crash_dump_manager.cc @@ -111,7 +111,7 @@ void CrashDumpManager::ProcessMinidump(const base::FilePath& minidump_path, base::StringPrintf("chromium-renderer-minidump-%016" PRIx64 ".dmp%d", rand, pid); base::FilePath dest_path = crash_dump_dir.Append(filename); - r = file_util::Move(minidump_path, dest_path); + r = base::Move(minidump_path, dest_path); if (!r) { LOG(ERROR) << "Failed to move crash dump from " << minidump_path.value() << " to " << dest_path.value(); diff --git a/chrome/browser/chromeos/drive/download_handler.cc b/chrome/browser/chromeos/drive/download_handler.cc index 6ec8436..850caf9 100644 --- a/chrome/browser/chromeos/drive/download_handler.cc +++ b/chrome/browser/chromeos/drive/download_handler.cc @@ -72,7 +72,7 @@ void MoveDownloadedFile(const base::FilePath& downloaded_file, const base::FilePath& dest_path) { if (error != FILE_ERROR_OK) return; - file_util::Move(downloaded_file, dest_path); + base::Move(downloaded_file, dest_path); } // Used to implement CheckForFileExistence(). diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc index 35a960b..2fbce21 100644 --- a/chrome/browser/chromeos/drive/file_cache.cc +++ b/chrome/browser/chromeos/drive/file_cache.cc @@ -81,7 +81,7 @@ void ScanCacheDirectory(const base::FilePath& directory_path, // Moves the file. bool MoveFile(const base::FilePath& source_path, const base::FilePath& dest_path) { - if (!file_util::Move(source_path, dest_path)) { + if (!base::Move(source_path, dest_path)) { LOG(ERROR) << "Failed to move " << source_path.value() << " to " << dest_path.value(); return false; diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc index 45c3074..704450c 100644 --- a/chrome/browser/chromeos/drive/file_system_util.cc +++ b/chrome/browser/chromeos/drive/file_system_util.cc @@ -114,7 +114,7 @@ void MoveAllFilesFromDirectory(const base::FilePath& directory_from, file_from = enumerator.Next()) { const base::FilePath file_to = directory_to.Append(file_from.BaseName()); if (!file_util::PathExists(file_to)) // Do not overwrite existing files. - file_util::Move(file_from, file_to); + base::Move(file_from, file_to); } } diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index 875d61b..dcd09ae 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -851,14 +851,14 @@ void WallpaperManager::MoveCustomWallpapersOnWorker(const UserList& users) { // Appends DUMMY to the file name of moved custom wallpaper. This way we // do not need to update WallpaperInfo for user. to_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, email, "DUMMY"); - file_util::Move(from_path, to_path); + base::Move(from_path, to_path); } from_path = GetWallpaperPathForUser(email, false); if (!file_util::PathExists(from_path)) from_path = from_path.AddExtension(".png"); if (file_util::PathExists(from_path)) { to_path = GetCustomWallpaperPath(kLargeWallpaperSubDir, email, "DUMMY"); - file_util::Move(from_path, to_path); + base::Move(from_path, to_path); } from_path = GetOriginalWallpaperPathForUser(email); if (!file_util::PathExists(from_path)) @@ -866,7 +866,7 @@ void WallpaperManager::MoveCustomWallpapersOnWorker(const UserList& users) { if (file_util::PathExists(from_path)) { to_path = GetCustomWallpaperPath(kOriginalWallpaperSubDir, email, "DUMMY"); - file_util::Move(from_path, to_path); + base::Move(from_path, to_path); } } } diff --git a/chrome/browser/chromeos/policy/app_pack_updater.cc b/chrome/browser/chromeos/policy/app_pack_updater.cc index d700ca0..628150f 100644 --- a/chrome/browser/chromeos/policy/app_pack_updater.cc +++ b/chrome/browser/chromeos/policy/app_pack_updater.cc @@ -494,7 +494,7 @@ void AppPackUpdater::BlockingInstallCacheEntry( } } - if (!file_util::Move(path, cached_crx_path)) { + if (!base::Move(path, cached_crx_path)) { LOG(ERROR) << "Failed to move AppPack crx from " << path.value() << " to " << cached_crx_path.value(); base::Delete(path, true /* recursive */); diff --git a/chrome/browser/chromeos/system/timezone_settings.cc b/chrome/browser/chromeos/system/timezone_settings.cc index c46e1b2..5aa6593 100644 --- a/chrome/browser/chromeos/system/timezone_settings.cc +++ b/chrome/browser/chromeos/system/timezone_settings.cc @@ -219,7 +219,7 @@ void SetTimezoneIDFromString(const std::string& id) { } // Move symlink2 to symlink. - if (!file_util::ReplaceFile(timezone_symlink2, timezone_symlink)) { + if (!base::ReplaceFile(timezone_symlink2, timezone_symlink, NULL)) { LOG(ERROR) << "SetTimezoneID: Unable to move symlink " << timezone_symlink2.value() << " to " << timezone_symlink.value(); diff --git a/chrome/browser/component_updater/component_patcher_operation.cc b/chrome/browser/component_updater/component_patcher_operation.cc index 0c119919..f814238 100644 --- a/chrome/browser/component_updater/component_patcher_operation.cc +++ b/chrome/browser/component_updater/component_patcher_operation.cc @@ -150,7 +150,7 @@ ComponentUnpacker::Error DeltaUpdateOpCreate::DoParseArguments( ComponentUnpacker::Error DeltaUpdateOpCreate::DoRun(ComponentPatcher*, int* error) { *error = 0; - if (!file_util::Move(patch_abs_path_, output_abs_path_)) + if (!base::Move(patch_abs_path_, output_abs_path_)) return ComponentUnpacker::kDeltaOperationFailure; return ComponentUnpacker::kNone; diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index 2b07c40..c7cf4da 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc @@ -282,7 +282,7 @@ bool PepperFlashComponentInstaller::Install( GetPepperFlashBaseDirectory().AppendASCII(version.GetString()); if (file_util::PathExists(path)) return false; - if (!file_util::Move(unpack_path, path)) + if (!base::Move(unpack_path, path)) return false; // Installation is done. Now tell the rest of chrome. Both the path service // and to the plugin service. diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc index c608c35..44b66f3 100644 --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc @@ -270,7 +270,7 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest, NotifyInstallError(); return false; } - if (!file_util::Move(unpack_path, path)) { + if (!base::Move(unpack_path, path)) { LOG(WARNING) << "Move failed, not installing."; NotifyInstallError(); return false; diff --git a/chrome/browser/component_updater/swiftshader_component_installer.cc b/chrome/browser/component_updater/swiftshader_component_installer.cc index b4a4650..9aa42e0 100644 --- a/chrome/browser/component_updater/swiftshader_component_installer.cc +++ b/chrome/browser/component_updater/swiftshader_component_installer.cc @@ -143,7 +143,7 @@ bool SwiftShaderComponentInstaller::Install( GetSwiftShaderBaseDirectory().AppendASCII(version.GetString()); if (file_util::PathExists(path)) return false; - if (!file_util::Move(unpack_path, path)) + if (!base::Move(unpack_path, path)) return false; // Installation is done. Now tell the rest of chrome. current_version_ = version; diff --git a/chrome/browser/component_updater/test/test_installer.cc b/chrome/browser/component_updater/test/test_installer.cc index 2dc2913..3f9b0e0 100644 --- a/chrome/browser/component_updater/test/test_installer.cc +++ b/chrome/browser/component_updater/test/test_installer.cc @@ -65,7 +65,7 @@ bool VersionedTestInstaller::Install(const base::DictionaryValue& manifest, base::FilePath path; path = install_directory_.AppendASCII(version.GetString()); file_util::CreateDirectory(path.DirName()); - if (!file_util::Move(unpack_path, path)) + if (!base::Move(unpack_path, path)) return false; current_version_ = version; ++install_count_; diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index 0b1c1b0..bbfebbd 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc @@ -234,7 +234,7 @@ bool WidevineCdmComponentInstaller::Install( GetWidevineCdmBaseDirectory().AppendASCII(version.GetString()); if (file_util::PathExists(install_path)) return false; - if (!file_util::Move(unpack_path, install_path)) + if (!base::Move(unpack_path, install_path)) return false; base::FilePath adapter_install_path = diff --git a/chrome/browser/extensions/extension_creator_filter_unittest.cc b/chrome/browser/extensions/extension_creator_filter_unittest.cc index 45e9941..48f5806 100644 --- a/chrome/browser/extensions/extension_creator_filter_unittest.cc +++ b/chrome/browser/extensions/extension_creator_filter_unittest.cc @@ -26,7 +26,7 @@ class ExtensionCreatorFilterTest : public PlatformTest { base::FilePath test_file(test_dir_.Append(file_path)); base::FilePath temp_file; EXPECT_TRUE(file_util::CreateTemporaryFileInDir(test_dir_, &temp_file)); - EXPECT_TRUE(file_util::Move(temp_file, test_file)); + EXPECT_TRUE(base::Move(temp_file, test_file)); return test_file; } diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 6a5de4b..9297723 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -2177,7 +2177,7 @@ TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { base::Delete(crx_path, false); // Move the pem file into the extension. - file_util::Move(privkey_path, + base::Move(privkey_path, input_directory.AppendASCII("privkey.pem")); // This pack should fail because of the contained private key. diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index a419c12..2ceb31a 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -737,7 +737,7 @@ void JumpList::RunUpdate() { base::FilePath icon_dir_old(icon_dir_.value() + L"Old"); if (file_util::PathExists(icon_dir_old)) base::Delete(icon_dir_old, true); - file_util::Move(icon_dir_, icon_dir_old); + base::Move(icon_dir_, icon_dir_old); file_util::CreateDirectory(icon_dir_); // Create temporary icon files for shortcuts in the "Most Visited" category. diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc index fb66c05..e4eb340 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc @@ -492,7 +492,7 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcuts) { GetDefaultShortcutPathForProfile(profile_2_name_); const base::FilePath profile_2_shortcut_path_2 = GetUserShortcutsDirectory().Append(L"MyChrome.lnk"); - ASSERT_TRUE(file_util::Move(profile_2_shortcut_path_1, + ASSERT_TRUE(base::Move(profile_2_shortcut_path_1, profile_2_shortcut_path_2)); // Ensure that a new shortcut does not get made if the old one was renamed. diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc index 754e5d6..239a54e 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc @@ -255,7 +255,7 @@ void ListDesktopShortcutsWithCommandLine(const base::FilePath& chrome_exe, // Renames the given desktop shortcut and informs the shell of this change. bool RenameDesktopShortcut(const base::FilePath& old_shortcut_path, const base::FilePath& new_shortcut_path) { - if (!file_util::Move(old_shortcut_path, new_shortcut_path)) + if (!base::Move(old_shortcut_path, new_shortcut_path)) return false; // Notify the shell of the rename, which allows the icon to keep its position diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc index 7f35b6f..234716c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc @@ -659,7 +659,7 @@ bool SafeBrowsingStoreFile::DoUpdate( return false; const base::FilePath new_filename = TemporaryFileForFilename(filename_); - if (!file_util::Move(new_filename, filename_)) + if (!base::Move(new_filename, filename_)) return false; // Record counts before swapping to caller. diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc index bc133da..90e6a38 100644 --- a/chrome/browser/sessions/session_backend.cc +++ b/chrome/browser/sessions/session_backend.cc @@ -287,8 +287,7 @@ void SessionBackend::MoveCurrentSessionToLastSession() { static_cast<int>(file_size / 1024)); } } - last_session_valid_ = file_util::Move(current_session_path, - last_session_path); + last_session_valid_ = base::Move(current_session_path, last_session_path); } if (file_util::PathExists(current_session_path)) diff --git a/chrome/browser/storage_monitor/image_capture_device.mm b/chrome/browser/storage_monitor/image_capture_device.mm index 15fb913..7a4fe86 100644 --- a/chrome/browser/storage_monitor/image_capture_device.mm +++ b/chrome/browser/storage_monitor/image_capture_device.mm @@ -13,7 +13,7 @@ void RenameFile(const base::FilePath& downloaded_filename, const base::FilePath& desired_filename, base::PlatformFileError* result) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); - bool success = file_util::ReplaceFile(downloaded_filename, desired_filename); + bool success = base::ReplaceFile(downloaded_filename, desired_filename, NULL); *result = success ? base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_NOT_FOUND; } diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index f6f4a14..188abc4 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -87,7 +87,7 @@ base::FilePath InstallExtension(const base::FilePath& unpacked_source_dir, } base::FilePath crx_temp_source = extension_temp_dir.path().Append(unpacked_source_dir.BaseName()); - if (!file_util::Move(unpacked_source_dir, crx_temp_source)) { + if (!base::Move(unpacked_source_dir, crx_temp_source)) { LOG(ERROR) << "Moving extension from : " << unpacked_source_dir.value() << " to : " << crx_temp_source.value() << " failed."; return base::FilePath(); @@ -111,7 +111,7 @@ base::FilePath InstallExtension(const base::FilePath& unpacked_source_dir, return base::FilePath(); } - if (!file_util::Move(crx_temp_source, version_dir)) { + if (!base::Move(crx_temp_source, version_dir)) { LOG(ERROR) << "Installing extension from : " << crx_temp_source.value() << " into : " << version_dir.value() << " failed."; return base::FilePath(); diff --git a/chrome/common/service_process_util_unittest.cc b/chrome/common/service_process_util_unittest.cc index 3f3d063..92c5340 100644 --- a/chrome/common/service_process_util_unittest.cc +++ b/chrome/common/service_process_util_unittest.cc @@ -302,7 +302,7 @@ void DeleteFunc(const base::FilePath& file) { } void MoveFunc(const base::FilePath& from, const base::FilePath& to) { - EXPECT_TRUE(file_util::Move(from, to)); + EXPECT_TRUE(base::Move(from, to)); } void ChangeAttr(const base::FilePath& from, int mode) { diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 242fcde..a39f153 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -495,12 +495,12 @@ bool MoveSetupOutOfInstallFolder(const InstallerState& installer_state, PLOG(ERROR) << "Failed to change the current directory."; VLOG(1) << "Attempting to move setup to: " << temp_file.value(); - ret = file_util::Move(setup_exe, temp_file); + ret = base::Move(setup_exe, temp_file); PLOG_IF(ERROR, !ret) << "Failed to move setup to " << temp_file.value(); // We cannot delete the file right away, but try to delete it some other // way. Either with the help of a different process or the system. - if (ret && !file_util::DeleteAfterReboot(temp_file)) { + if (ret && !base::DeleteAfterReboot(temp_file)) { static const uint32 kDeleteAfterMs = 10 * 1000; installer::DeleteFileFromTempProcess(temp_file, kDeleteAfterMs); } diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc index 44361d5..3cd067a 100644 --- a/chrome/installer/test/alternate_version_generator.cc +++ b/chrome/installer/test/alternate_version_generator.cc @@ -447,8 +447,8 @@ bool ApplyAlternateVersion(const base::FilePath& work_dir, // Change the versioned directory. base::FilePath chrome_bin = work_dir.Append(&kChromeBin[0]); - doing_great = file_util::Move(chrome_bin.Append(ctx.current_version_str), - chrome_bin.Append(ctx.new_version_str)); + doing_great = base::Move(chrome_bin.Append(ctx.current_version_str), + chrome_bin.Append(ctx.new_version_str)); if (doing_great) { // Report the version numbers if requested. @@ -649,7 +649,7 @@ bool GenerateAlternateVersion(const base::FilePath& original_installer_path, } // Finally, move the updated mini_installer into place. - return file_util::Move(mini_installer, target_path); + return base::Move(mini_installer, target_path); } bool GenerateAlternatePEFileVersion(const base::FilePath& original_file, diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc index 5f0bd93..118a217 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc @@ -78,7 +78,7 @@ bool CopyTreeWorkItem::Do() { } base::FilePath backup = backup_path_.path().Append(dest_path_.BaseName()); - if (file_util::Move(dest_path_, backup)) { + if (base::Move(dest_path_, backup)) { moved_to_backup_ = true; VLOG(1) << "Moved destination " << dest_path_.value() << " to backup path " << backup.value(); @@ -114,7 +114,7 @@ void CopyTreeWorkItem::Rollback() { } if (moved_to_backup_) { base::FilePath backup(backup_path_.path().Append(dest_path_.BaseName())); - if (!file_util::Move(backup, dest_path_)) { + if (!base::Move(backup, dest_path_)) { LOG(ERROR) << "failed move " << backup.value() << " to " << dest_path_.value(); } diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc index 4aaf151..a5ccf4d 100644 --- a/chrome/installer/util/delete_tree_work_item.cc +++ b/chrome/installer/util/delete_tree_work_item.cc @@ -144,7 +144,7 @@ void DeleteTreeWorkItem::Rollback() { DCHECK(!backup_path_.path().empty()); base::FilePath backup = backup_path_.path().Append(root_path_.BaseName()); if (file_util::PathExists(backup)) - file_util::Move(backup, root_path_); + base::Move(backup, root_path_); } for (ptrdiff_t i = 0; i != num_key_files_; ++i) { @@ -154,7 +154,7 @@ void DeleteTreeWorkItem::Rollback() { base::FilePath backup_file = backup_dir.path().Append(key_file.BaseName()); if (file_util::PathExists(backup_file) && - !file_util::Move(backup_file, key_file)) { + !base::Move(backup_file, key_file)) { // This could happen if we could not delete the key file to begin with. PLOG(WARNING) << "Rollback: Failed to move backup file back in place: " << backup_file.value() << " to " << key_file.value(); diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index b6c28b9..adb0172 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -47,8 +47,8 @@ TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) { if (old_log_file.IsValid()) { result = LOGFILE_DELETED; base::FilePath tmp_log(log_file.value() + FILE_PATH_LITERAL(".tmp")); - // Note that file_util::Move will attempt to replace existing files. - if (file_util::Move(log_file, tmp_log)) { + // Note that base::Move will attempt to replace existing files. + if (base::Move(log_file, tmp_log)) { int64 offset = log_size - kTruncatedInstallerLogFileSize; std::string old_log_data(kTruncatedInstallerLogFileSize, 0); int bytes_read = base::ReadPlatformFile(old_log_file, diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index 7190222..ccbbf64 100644 --- a/chrome/installer/util/move_tree_work_item.cc +++ b/chrome/installer/util/move_tree_work_item.cc @@ -55,7 +55,7 @@ bool MoveTreeWorkItem::Do() { // The files we are moving are already present in the destination path. // We most likely don't need to do anything. As such, just move the // source files to the temp folder as backup. - if (file_util::Move(source_path_, backup)) { + if (base::Move(source_path_, backup)) { source_moved_to_backup_ = true; VLOG(1) << "Moved source " << source_path_.value() << " to backup path " << backup.value(); @@ -74,7 +74,7 @@ bool MoveTreeWorkItem::Do() { } } - if (file_util::Move(dest_path_, backup)) { + if (base::Move(dest_path_, backup)) { moved_to_backup_ = true; VLOG(1) << "Moved destination " << dest_path_.value() << " to backup path " << backup.value(); @@ -86,7 +86,7 @@ bool MoveTreeWorkItem::Do() { } // Now move source to destination. - if (file_util::Move(source_path_, dest_path_)) { + if (base::Move(source_path_, dest_path_)) { moved_to_dest_path_ = true; VLOG(1) << "Moved source " << source_path_.value() << " to destination " << dest_path_.value(); @@ -100,17 +100,17 @@ bool MoveTreeWorkItem::Do() { } void MoveTreeWorkItem::Rollback() { - if (moved_to_dest_path_ && !file_util::Move(dest_path_, source_path_)) + if (moved_to_dest_path_ && !base::Move(dest_path_, source_path_)) LOG(ERROR) << "Can not move " << dest_path_.value() << " to " << source_path_.value(); base::FilePath backup = backup_path_.path().Append(dest_path_.BaseName()); - if (moved_to_backup_ && !file_util::Move(backup, dest_path_)) { + if (moved_to_backup_ && !base::Move(backup, dest_path_)) { LOG(ERROR) << "failed move " << backup.value() << " to " << dest_path_.value(); } - if (source_moved_to_backup_ && !file_util::Move(backup, source_path_)) { + if (source_moved_to_backup_ && !base::Move(backup, source_path_)) { LOG(ERROR) << "Can not restore " << backup.value() << " to " << source_path_.value(); } diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index be5c9ec..ddbf6eb 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -660,7 +660,7 @@ class PageLoadTest : public UITest { if (!log_path.empty()) { base::FilePath saved_log_file_path = ConstructSavedDebugLogPath(log_path, index); - if (file_util::Move(log_path, saved_log_file_path)) { + if (base::Move(log_path, saved_log_file_path)) { log_file << " " << log_id << "=" << saved_log_file_path.value(); } } diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc index ff36eca..63a674b 100644 --- a/chrome/tools/crash_service/crash_service.cc +++ b/chrome/tools/crash_service/crash_service.cc @@ -372,7 +372,7 @@ void CrashService::OnClientDumpRequest(void* context, file_util::CreateDirectoryW(alternate_dump_location); alternate_dump_location = alternate_dump_location.Append( dump_location.BaseName()); - file_util::Move(dump_location, alternate_dump_location); + base::Move(dump_location, alternate_dump_location); dump_location = alternate_dump_location; } diff --git a/chrome_frame/test/dll_redirector_loading_test.cc b/chrome_frame/test/dll_redirector_loading_test.cc index b0c5760..b3cea3d 100644 --- a/chrome_frame/test/dll_redirector_loading_test.cc +++ b/chrome_frame/test/dll_redirector_loading_test.cc @@ -93,8 +93,8 @@ class DllRedirectorLoadingTest : public testing::Test { ASSERT_TRUE(file_util::CreateDirectory(new_version_dir)); new_chrome_frame_dll_ = new_version_dir.Append(build_chrome_frame_dll.BaseName()); - ASSERT_TRUE(file_util::Move(temporary_new_chrome_frame_dll, - new_chrome_frame_dll_)); + ASSERT_TRUE(base::Move(temporary_new_chrome_frame_dll, + new_chrome_frame_dll_)); ASSERT_TRUE(file_util::PathExists(new_chrome_frame_dll_)); } diff --git a/chrome_frame/test/reliability/page_load_test.cc b/chrome_frame/test/reliability/page_load_test.cc index 101af0a..ffc4197 100644 --- a/chrome_frame/test/reliability/page_load_test.cc +++ b/chrome_frame/test/reliability/page_load_test.cc @@ -369,7 +369,7 @@ class PageLoadTest : public testing::Test { if (!log_path.empty()) { base::FilePath saved_log_file_path = ConstructSavedDebugLogPath(log_path, index); - if (file_util::Move(log_path, saved_log_file_path)) { + if (base::Move(log_path, saved_log_file_path)) { log_file << " " << log_id << "=" << saved_log_file_path.value(); } } diff --git a/cloud_print/common/win/install_utils.cc b/cloud_print/common/win/install_utils.cc index 15c55b2..ab8a66e 100644 --- a/cloud_print/common/win/install_utils.cc +++ b/cloud_print/common/win/install_utils.cc @@ -175,7 +175,7 @@ void DeleteProgramDir(const std::string& delete_switch) { if (!file_util::CreateTemporaryFile(&temp_path)) return; file_util::CopyFile(installer_source, temp_path); - file_util::DeleteAfterReboot(temp_path); + base::DeleteAfterReboot(temp_path); CommandLine command_line(temp_path); command_line.AppendSwitchPath(delete_switch, installer_source.DirName()); base::LaunchOptions options; diff --git a/content/browser/download/base_file_posix.cc b/content/browser/download/base_file_posix.cc index bd351ad..1900942 100644 --- a/content/browser/download/base_file_posix.cc +++ b/content/browser/download/base_file_posix.cc @@ -29,7 +29,7 @@ DownloadInterruptReason BaseFile::MoveFileAndAdjustPermissions( // TODO(estade): Move() falls back to copying and deleting when a simple // rename fails. Copying sucks for large downloads. crbug.com/8737 - if (!file_util::Move(full_path_, new_path)) + if (!base::Move(full_path_, new_path)) return LogSystemError("Move", errno); if (stat_succeeded) { diff --git a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc index 8c8b5c5..20af748 100644 --- a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc @@ -157,7 +157,7 @@ int32_t PepperFlashFileMessageFilter::OnRenameFile( base::PLATFORM_FILE_ERROR_ACCESS_DENIED); } - bool result = file_util::Move(from_full_path, to_full_path); + bool result = base::Move(from_full_path, to_full_path); return ppapi::PlatformFileErrorToPepperError(result ? base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_ACCESS_DENIED); } diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 6a90f8a..3750a723 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -337,7 +337,7 @@ void BlockingGarbageCollect( path != trash_directory) { // Since |trash_directory| is unique for each run of this function there // can be no colllisions on the move. - file_util::Move(path, trash_directory.Append(path.BaseName())); + base::Move(path, trash_directory.Append(path.BaseName())); } } diff --git a/content/browser/web_contents/web_contents_drag_win.cc b/content/browser/web_contents/web_contents_drag_win.cc index ab06293..414537b 100644 --- a/content/browser/web_contents/web_contents_drag_win.cc +++ b/content/browser/web_contents/web_contents_drag_win.cc @@ -255,8 +255,8 @@ void WebContentsDragWin::PrepareDragForDownload( // We cannot know when the target application will be done using the temporary // file, so schedule it to be deleted after rebooting. - file_util::DeleteAfterReboot(download_path); - file_util::DeleteAfterReboot(temp_dir_path); + base::DeleteAfterReboot(download_path); + base::DeleteAfterReboot(temp_dir_path); // Provide the data as file (CF_HDROP). A temporary download file with the // Zone.Identifier ADS (Alternate Data Stream) attached will be created. diff --git a/net/disk_cache/cache_util_posix.cc b/net/disk_cache/cache_util_posix.cc index db1a4ac..40cf9a5 100644 --- a/net/disk_cache/cache_util_posix.cc +++ b/net/disk_cache/cache_util_posix.cc @@ -28,14 +28,14 @@ bool MoveCache(const base::FilePath& from_path, const base::FilePath& to_path) { for (base::FilePath name = iter.Next(); !name.value().empty(); name = iter.Next()) { base::FilePath destination = to_path.Append(name.BaseName()); - if (!file_util::Move(name, destination)) { + if (!base::Move(name, destination)) { LOG(ERROR) << "Unable to move cache item."; return false; } } return true; #else - return file_util::Move(from_path, to_path); + return base::Move(from_path, to_path); #endif } diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc index 39bbe8b..4da5313d 100644 --- a/net/disk_cache/simple/simple_index_file.cc +++ b/net/disk_cache/simple/simple_index_file.cc @@ -54,7 +54,7 @@ void WriteToDiskInternal(const base::FilePath& index_filename, base::Delete(temp_filename, /* recursive = */ false); } else { // Swap temp and index_file. - bool result = file_util::ReplaceFile(temp_filename, index_filename); + bool result = base::ReplaceFile(temp_filename, index_filename, NULL); DCHECK(result); } if (app_on_background) { diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index d10ccb6..5efd74d 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc @@ -672,10 +672,8 @@ Status ChromiumEnv::RenameFile(const std::string& src, const std::string& dst) { Retrier retrier(kRenameFile, this); base::PlatformFileError error = base::PLATFORM_FILE_OK; do { - if (::file_util::ReplaceFileAndGetError( - src_file_path, destination, &error)) { + if (base::ReplaceFile(src_file_path, destination, &error)) return result; - } } while (retrier.ShouldKeepTrying(error)); DCHECK(error != base::PLATFORM_FILE_OK); diff --git a/tools/memory_watcher/memory_watcher.cc b/tools/memory_watcher/memory_watcher.cc index 1aeb6a4..4743a37 100644 --- a/tools/memory_watcher/memory_watcher.cc +++ b/tools/memory_watcher/memory_watcher.cc @@ -82,8 +82,8 @@ void MemoryWatcher::CloseLogFile() { file_ = NULL; std::wstring tmp_name = ASCIIToWide(file_name_); tmp_name += L".tmp"; - file_util::Move(base::FilePath(tmp_name), - base::FilePath(ASCIIToWide(file_name_))); + base::Move(base::FilePath(tmp_name), + base::FilePath(ASCIIToWide(file_name_))); } } diff --git a/webkit/browser/database/database_tracker.cc b/webkit/browser/database/database_tracker.cc index 5adb3bf..aa6838b 100644 --- a/webkit/browser/database/database_tracker.cc +++ b/webkit/browser/database/database_tracker.cc @@ -414,7 +414,7 @@ bool DatabaseTracker::DeleteOrigin(const std::string& origin_identifier, for (base::FilePath database = databases.Next(); !database.empty(); database = databases.Next()) { base::FilePath new_file = new_origin_dir.Append(database.BaseName()); - file_util::Move(database, new_file); + base::Move(database, new_file); } base::Delete(origin_dir, true); base::Delete(new_origin_dir, true); // might fail on windows. diff --git a/webkit/browser/fileapi/native_file_util.cc b/webkit/browser/fileapi/native_file_util.cc index 1f6a2e8..e27cb4a 100644 --- a/webkit/browser/fileapi/native_file_util.cc +++ b/webkit/browser/fileapi/native_file_util.cc @@ -231,7 +231,7 @@ PlatformFileError NativeFileUtil::CopyOrMoveFile( if (file_util::CopyFile(src_path, dest_path)) return base::PLATFORM_FILE_OK; } else { - if (file_util::Move(src_path, dest_path)) + if (base::Move(src_path, dest_path)) return base::PLATFORM_FILE_OK; } return base::PLATFORM_FILE_ERROR_FAILED; diff --git a/webkit/browser/fileapi/sandbox_isolated_origin_database.cc b/webkit/browser/fileapi/sandbox_isolated_origin_database.cc index 1f15573..a64ea5e 100644 --- a/webkit/browser/fileapi/sandbox_isolated_origin_database.cc +++ b/webkit/browser/fileapi/sandbox_isolated_origin_database.cc @@ -74,7 +74,7 @@ void SandboxIsolatedOriginDatabase::MigrateDatabaseIfNeeded() { if (file_util::PathExists(to_path)) base::Delete(to_path, true /* recursive */); - file_util::Move(from_path, to_path); + base::Move(from_path, to_path); } database->RemoveDatabase(); |