diff options
134 files changed, 304 insertions, 324 deletions
diff --git a/apps/app_restore_service_browsertest.cc b/apps/app_restore_service_browsertest.cc index 381efbf3..67c007f 100644 --- a/apps/app_restore_service_browsertest.cc +++ b/apps/app_restore_service_browsertest.cc @@ -63,8 +63,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) { base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), - &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), + &temp_file)); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &temp_file); @@ -108,8 +108,8 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_FileAccessIsRestored) { base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), - &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), + &temp_file)); FileSystemChooseEntryFunction::SkipPickerAndAlwaysSelectPathForTest( &temp_file); diff --git a/base/debug/trace_event_win_unittest.cc b/base/debug/trace_event_win_unittest.cc index 531c5f7..befd0cb 100644 --- a/base/debug/trace_event_win_unittest.cc +++ b/base/debug/trace_event_win_unittest.cc @@ -115,7 +115,7 @@ class TraceEventWinTest: public testing::Test { } // Create the log file. - ASSERT_TRUE(file_util::CreateTemporaryFile(&log_file_)); + ASSERT_TRUE(base::CreateTemporaryFile(&log_file_)); // Create a private log session on the file. EtwTraceProperties prop; diff --git a/base/file_util.cc b/base/file_util.cc index 1f8ba81..f6d8657 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -153,6 +153,14 @@ bool IsDirectoryEmpty(const FilePath& dir_path) { return false; } +FILE* CreateAndOpenTemporaryFile(FilePath* path) { + FilePath directory; + if (!GetTempDir(&directory)) + return NULL; + + return CreateAndOpenTemporaryFileInDir(directory, path); +} + } // namespace base // ----------------------------------------------------------------------------- @@ -163,14 +171,6 @@ using base::FileEnumerator; using base::FilePath; using base::kMaxUniqueFiles; -FILE* CreateAndOpenTemporaryFile(FilePath* path) { - FilePath directory; - if (!GetTempDir(&directory)) - return NULL; - - return CreateAndOpenTemporaryFileInDir(directory, path); -} - bool CreateDirectory(const base::FilePath& full_path) { return CreateDirectoryAndGetError(full_path, NULL); } diff --git a/base/file_util.h b/base/file_util.h index acced28..3437890 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -212,49 +212,49 @@ BASE_EXPORT bool GetShmemTempDir(bool executable, FilePath* path); BASE_EXPORT FilePath GetHomeDir(); #endif // OS_POSIX -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - // Creates a temporary file. The full path is placed in |path|, and the // function returns true if was successful in creating the file. The file will // be empty and all handles closed after this function returns. -BASE_EXPORT bool CreateTemporaryFile(base::FilePath* path); +BASE_EXPORT bool CreateTemporaryFile(FilePath* path); // Same as CreateTemporaryFile but the file is created in |dir|. -BASE_EXPORT bool CreateTemporaryFileInDir(const base::FilePath& dir, - base::FilePath* temp_file); +BASE_EXPORT bool CreateTemporaryFileInDir(const FilePath& dir, + FilePath* temp_file); // Create and open a temporary file. File is opened for read/write. // The full path is placed in |path|. // Returns a handle to the opened file or NULL if an error occurred. -BASE_EXPORT FILE* CreateAndOpenTemporaryFile(base::FilePath* path); +BASE_EXPORT FILE* CreateAndOpenTemporaryFile(FilePath* path); + // Like above but for shmem files. Only useful for POSIX. // The executable flag says the file needs to support using // mprotect with PROT_EXEC after mapping. -BASE_EXPORT FILE* CreateAndOpenTemporaryShmemFile(base::FilePath* path, +BASE_EXPORT FILE* CreateAndOpenTemporaryShmemFile(FilePath* path, bool executable); + // Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|. -BASE_EXPORT FILE* CreateAndOpenTemporaryFileInDir(const base::FilePath& dir, - base::FilePath* path); +BASE_EXPORT FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, + FilePath* path); // Create a new directory. If prefix is provided, the new directory name is in // the format of prefixyyyy. // NOTE: prefix is ignored in the POSIX implementation. // If success, return true and output the full path of the directory created. -BASE_EXPORT bool CreateNewTempDirectory( - const base::FilePath::StringType& prefix, - base::FilePath* new_temp_path); +BASE_EXPORT bool CreateNewTempDirectory(const FilePath::StringType& prefix, + FilePath* new_temp_path); // Create a directory within another directory. // Extra characters will be appended to |prefix| to ensure that the // new directory does not have the same name as an existing directory. -BASE_EXPORT bool CreateTemporaryDirInDir( - const base::FilePath& base_dir, - const base::FilePath::StringType& prefix, - base::FilePath* new_dir); +BASE_EXPORT bool CreateTemporaryDirInDir(const FilePath& base_dir, + const FilePath::StringType& prefix, + FilePath* new_dir); + +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { // Creates a directory, as well as creating any parent directories, if they // don't exist. Returns 'true' on successful creation, or if the directory diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 0557350..bfdc9269 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -513,25 +513,8 @@ FilePath GetHomeDir() { } #endif // !defined(OS_MACOSX) -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - -using base::stat_wrapper_t; -using base::CallStat; -using base::CallLstat; -using base::CreateAndOpenFdForTemporaryFile; -using base::DirectoryExists; -using base::FileEnumerator; -using base::FilePath; -using base::MakeAbsoluteFilePath; -using base::RealPath; -using base::VerifySpecificPathControlledByUser; - bool CreateTemporaryFile(FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); // For call to close(). + ThreadRestrictions::AssertIOAllowed(); // For call to close(). FilePath directory; if (!GetTempDir(&directory)) return false; @@ -562,7 +545,7 @@ FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { } bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) { - base::ThreadRestrictions::AssertIOAllowed(); // For call to close(). + ThreadRestrictions::AssertIOAllowed(); // For call to close(). int fd = CreateAndOpenFdForTemporaryFile(dir, temp_file); return ((fd >= 0) && !IGNORE_EINTR(close(fd))); } @@ -570,7 +553,7 @@ bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) { static bool CreateTemporaryDirInDirImpl(const FilePath& base_dir, const FilePath::StringType& name_tmpl, FilePath* new_dir) { - base::ThreadRestrictions::AssertIOAllowed(); // For call to mkdtemp(). + ThreadRestrictions::AssertIOAllowed(); // For call to mkdtemp(). DCHECK(name_tmpl.find("XXXXXX") != FilePath::StringType::npos) << "Directory name template must contain \"XXXXXX\"."; @@ -602,10 +585,27 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix, if (!GetTempDir(&tmpdir)) return false; - return CreateTemporaryDirInDirImpl(tmpdir, base::TempFileName(), - new_temp_path); + return CreateTemporaryDirInDirImpl(tmpdir, TempFileName(), new_temp_path); } + +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::stat_wrapper_t; +using base::CallStat; +using base::CallLstat; +using base::CreateAndOpenFdForTemporaryFile; +using base::DirectoryExists; +using base::FileEnumerator; +using base::FilePath; +using base::MakeAbsoluteFilePath; +using base::RealPath; +using base::VerifySpecificPathControlledByUser; + bool CreateDirectoryAndGetError(const FilePath& full_path, base::PlatformFileError* error) { base::ThreadRestrictions::AssertIOAllowed(); // For call to mkdir(). diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 71169b7..2dac484 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -531,7 +531,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileInDirLongPathTest) { ASSERT_STRNE(kLongDirName, short_test_dir.BaseName().value().c_str()); FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(short_test_dir, &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(short_test_dir, &temp_file)); EXPECT_STREQ(kLongDirName, temp_file.DirName().BaseName().value().c_str()); EXPECT_TRUE(PathExists(temp_file)); @@ -548,7 +548,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileInDirLongPathTest) { ASSERT_TRUE(file_util::MakeFileUnreadable(long_test_dir)); // Use the short form of the directory to create a temporary filename. - ASSERT_TRUE(file_util::CreateTemporaryFileInDir( + ASSERT_TRUE(base::CreateTemporaryFileInDir( short_test_dir.Append(kTestSubDirName), &temp_file)); EXPECT_TRUE(PathExists(temp_file)); EXPECT_TRUE(short_test_dir.IsParent(temp_file.DirName())); @@ -1582,7 +1582,7 @@ TEST_F(FileUtilTest, GetTempDirTest) { TEST_F(FileUtilTest, CreateTemporaryFileTest) { FilePath temp_files[3]; for (int i = 0; i < 3; i++) { - ASSERT_TRUE(file_util::CreateTemporaryFile(&(temp_files[i]))); + ASSERT_TRUE(base::CreateTemporaryFile(&(temp_files[i]))); EXPECT_TRUE(PathExists(temp_files[i])); EXPECT_FALSE(DirectoryExists(temp_files[i])); } @@ -1599,7 +1599,7 @@ TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) { // Create; make sure they are open and exist. for (i = 0; i < 3; ++i) { - fps[i] = file_util::CreateAndOpenTemporaryFile(&(names[i])); + fps[i] = base::CreateAndOpenTemporaryFile(&(names[i])); ASSERT_TRUE(fps[i]); EXPECT_TRUE(PathExists(names[i])); } @@ -1618,15 +1618,14 @@ TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) { TEST_F(FileUtilTest, CreateNewTempDirectoryTest) { FilePath temp_dir; - ASSERT_TRUE(file_util::CreateNewTempDirectory(FilePath::StringType(), - &temp_dir)); + ASSERT_TRUE(base::CreateNewTempDirectory(FilePath::StringType(), &temp_dir)); EXPECT_TRUE(PathExists(temp_dir)); EXPECT_TRUE(DeleteFile(temp_dir, false)); } TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) { FilePath new_dir; - ASSERT_TRUE(file_util::CreateTemporaryDirInDir( + ASSERT_TRUE(base::CreateTemporaryDirInDir( temp_dir_.path(), FILE_PATH_LITERAL("CreateNewTemporaryDirInDirTest"), &new_dir)); diff --git a/base/file_util_win.cc b/base/file_util_win.cc index b500b45..ac35c74 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -231,18 +231,8 @@ bool GetShmemTempDir(bool executable, FilePath* path) { return GetTempDir(path); } -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - -using base::DirectoryExists; -using base::FilePath; -using base::kFileShareAll; - bool CreateTemporaryFile(FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); FilePath temp_file; @@ -258,7 +248,7 @@ bool CreateTemporaryFile(FilePath* path) { } FILE* CreateAndOpenTemporaryShmemFile(FilePath* path, bool executable) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); return CreateAndOpenTemporaryFile(path); } @@ -267,24 +257,24 @@ FILE* CreateAndOpenTemporaryShmemFile(FilePath* path, bool executable) { // TODO(jrg): is there equivalent call to use on Windows instead of // going 2-step? FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); if (!CreateTemporaryFileInDir(dir, path)) { return NULL; } // Open file in binary mode, to avoid problems with fwrite. On Windows // it replaces \n's with \r\n's, which may surprise you. // Reference: http://msdn.microsoft.com/en-us/library/h9t88zwz(VS.71).aspx - return OpenFile(*path, "wb+"); + return file_util::OpenFile(*path, "wb+"); } -bool CreateTemporaryFileInDir(const FilePath& dir, - FilePath* temp_file) { - base::ThreadRestrictions::AssertIOAllowed(); +bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) { + ThreadRestrictions::AssertIOAllowed(); wchar_t temp_name[MAX_PATH + 1]; if (!GetTempFileName(dir.value().c_str(), L"", 0, temp_name)) { - DPLOG(WARNING) << "Failed to get temporary file name in " << dir.value(); + DPLOG(WARNING) << "Failed to get temporary file name in " + << UTF16ToUTF8(dir.value()); return false; } @@ -305,7 +295,7 @@ bool CreateTemporaryFileInDir(const FilePath& dir, bool CreateTemporaryDirInDir(const FilePath& base_dir, const FilePath::StringType& prefix, FilePath* new_dir) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); FilePath path_to_create; @@ -314,9 +304,9 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir, // the one exists, keep trying another path name until we reach some limit. string16 new_dir_name; new_dir_name.assign(prefix); - new_dir_name.append(base::IntToString16(::base::GetCurrentProcId())); + new_dir_name.append(IntToString16(GetCurrentProcId())); new_dir_name.push_back('_'); - new_dir_name.append(base::IntToString16(base::RandInt(0, kint16max))); + new_dir_name.append(IntToString16(RandInt(0, kint16max))); path_to_create = base_dir.Append(new_dir_name); if (::CreateDirectory(path_to_create.value().c_str(), NULL)) { @@ -330,7 +320,7 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir, bool CreateNewTempDirectory(const FilePath::StringType& prefix, FilePath* new_temp_path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); FilePath system_temp_dir; if (!GetTempDir(&system_temp_dir)) @@ -339,6 +329,16 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix, return CreateTemporaryDirInDir(system_temp_dir, prefix, new_temp_path); } +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::DirectoryExists; +using base::FilePath; +using base::kFileShareAll; + bool CreateDirectoryAndGetError(const FilePath& full_path, base::PlatformFileError* error) { base::ThreadRestrictions::AssertIOAllowed(); diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc index 965b489..a36328e 100644 --- a/base/files/file_util_proxy.cc +++ b/base/files/file_util_proxy.cc @@ -76,7 +76,7 @@ class CreateTemporaryHelper { void RunWork(int additional_file_flags) { // TODO(darin): file_util should have a variant of CreateTemporaryFile // that returns a FilePath and a PlatformFile. - file_util::CreateTemporaryFile(&file_path_); + base::CreateTemporaryFile(&file_path_); int file_flags = PLATFORM_FILE_WRITE | diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc index 466e95d..261c987 100644 --- a/base/files/important_file_writer.cc +++ b/base/files/important_file_writer.cc @@ -58,7 +58,7 @@ bool ImportantFileWriter::WriteFileAtomically(const FilePath& path, // as target file, so it can be moved in one step, and that the temp file // is securely created. FilePath tmp_file_path; - if (!file_util::CreateTemporaryFileInDir(path.DirName(), &tmp_file_path)) { + if (!base::CreateTemporaryFileInDir(path.DirName(), &tmp_file_path)) { LogFailure(path, FAILED_CREATING, "could not create temporary file"); return false; } diff --git a/base/files/scoped_temp_dir.cc b/base/files/scoped_temp_dir.cc index 497799e..5624a06 100644 --- a/base/files/scoped_temp_dir.cc +++ b/base/files/scoped_temp_dir.cc @@ -23,8 +23,7 @@ bool ScopedTempDir::CreateUniqueTempDir() { // This "scoped_dir" prefix is only used on Windows and serves as a template // for the unique name. - if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("scoped_dir"), - &path_)) + if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("scoped_dir"), &path_)) return false; return true; @@ -39,10 +38,9 @@ bool ScopedTempDir::CreateUniqueTempDirUnderPath(const FilePath& base_path) { return false; // Create a new, uniquely named directory under |base_path|. - if (!file_util::CreateTemporaryDirInDir( - base_path, - FILE_PATH_LITERAL("scoped_dir_"), - &path_)) + if (!base::CreateTemporaryDirInDir(base_path, + FILE_PATH_LITERAL("scoped_dir_"), + &path_)) return false; return true; diff --git a/base/files/scoped_temp_dir_unittest.cc b/base/files/scoped_temp_dir_unittest.cc index 02b910c..fe243ce 100644 --- a/base/files/scoped_temp_dir_unittest.cc +++ b/base/files/scoped_temp_dir_unittest.cc @@ -13,8 +13,8 @@ namespace base { TEST(ScopedTempDir, FullPath) { FilePath test_path; - file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("scoped_temp_dir"), - &test_path); + base::CreateNewTempDirectory(FILE_PATH_LITERAL("scoped_temp_dir"), + &test_path); // Against an existing dir, it should get destroyed when leaving scope. EXPECT_TRUE(DirectoryExists(test_path)); @@ -64,8 +64,8 @@ TEST(ScopedTempDir, TempDir) { TEST(ScopedTempDir, UniqueTempDirUnderPath) { // Create a path which will contain a unique temp path. FilePath base_path; - ASSERT_TRUE(file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("base_dir"), - &base_path)); + ASSERT_TRUE(base::CreateNewTempDirectory(FILE_PATH_LITERAL("base_dir"), + &base_path)); FilePath test_path; { diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc index 8bc7da8..4620247 100644 --- a/base/memory/shared_memory_posix.cc +++ b/base/memory/shared_memory_posix.cc @@ -141,8 +141,7 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) { DCHECK(!options.open_existing); // Q: Why not use the shm_open() etc. APIs? // A: Because they're limited to 4mb on OS X. FFFFFFFUUUUUUUUUUU - fp.reset( - file_util::CreateAndOpenTemporaryShmemFile(&path, options.executable)); + fp.reset(base::CreateAndOpenTemporaryShmemFile(&path, options.executable)); if (fp) { // Also open as readonly so that we can ShareReadOnlyToProcess. diff --git a/base/test/launcher/test_launcher.cc b/base/test/launcher/test_launcher.cc index e5387be..0b32c84 100644 --- a/base/test/launcher/test_launcher.cc +++ b/base/test/launcher/test_launcher.cc @@ -248,7 +248,7 @@ void DoLaunchChildTestProcess( // Redirect child process output to a file. base::FilePath output_file; - CHECK(file_util::CreateTemporaryFile(&output_file)); + CHECK(base::CreateTemporaryFile(&output_file)); LaunchOptions options; #if defined(OS_WIN) diff --git a/base/test/launcher/unit_test_launcher.cc b/base/test/launcher/unit_test_launcher.cc index a265f02..c9924ef 100644 --- a/base/test/launcher/unit_test_launcher.cc +++ b/base/test/launcher/unit_test_launcher.cc @@ -157,8 +157,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { // per run to ensure clean state and make it possible to launch multiple // processes in parallel. base::FilePath output_file; - CHECK(file_util::CreateNewTempDirectory(FilePath::StringType(), - &output_file)); + CHECK(CreateNewTempDirectory(FilePath::StringType(), &output_file)); output_file = output_file.AppendASCII("test_results.xml"); std::vector<std::string> current_test_names; @@ -192,8 +191,7 @@ class UnitTestLauncherDelegate : public TestLauncherDelegate { // per run to ensure clean state and make it possible to launch multiple // processes in parallel. base::FilePath output_file; - CHECK(file_util::CreateNewTempDirectory(FilePath::StringType(), - &output_file)); + CHECK(CreateNewTempDirectory(FilePath::StringType(), &output_file)); output_file = output_file.AppendASCII("test_results.xml"); CommandLine cmd_line( diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc index 16bf1e1..4d23edd 100644 --- a/base/win/event_trace_controller_unittest.cc +++ b/base/win/event_trace_controller_unittest.cc @@ -164,7 +164,7 @@ TEST_F(EtwTraceControllerTest, StartFileSession) { ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); FilePath temp; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &temp)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp)); EtwTraceController controller; HRESULT hr = controller.StartFileSession(session_name_.c_str(), diff --git a/base/win/shortcut_unittest.cc b/base/win/shortcut_unittest.cc index b3247b6..6db5741 100644 --- a/base/win/shortcut_unittest.cc +++ b/base/win/shortcut_unittest.cc @@ -52,7 +52,7 @@ class ShortcutTest : public testing::Test { arraysize(kFileContents2)); FilePath icon_path_2; - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &icon_path_2); + base::CreateTemporaryFileInDir(temp_dir_.path(), &icon_path_2); link_properties_2_.set_target(target_file_2); link_properties_2_.set_working_dir(temp_dir_2_.path()); diff --git a/chrome/browser/chromeos/drive/download_handler.cc b/chrome/browser/chromeos/drive/download_handler.cc index 1e84ac2..50599c3 100644 --- a/chrome/browser/chromeos/drive/download_handler.cc +++ b/chrome/browser/chromeos/drive/download_handler.cc @@ -60,8 +60,8 @@ base::FilePath GetDriveTempDownloadPath( DCHECK(created) << "Can not create temp download directory at " << drive_tmp_download_dir.value(); base::FilePath drive_tmp_download_path; - created = file_util::CreateTemporaryFileInDir(drive_tmp_download_dir, - &drive_tmp_download_path); + created = base::CreateTemporaryFileInDir(drive_tmp_download_dir, + &drive_tmp_download_path); DCHECK(created) << "Temporary download file creation failed"; return drive_tmp_download_path; } diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc index d604f0d..dd16cf4 100644 --- a/chrome/browser/chromeos/drive/file_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc @@ -58,8 +58,8 @@ class FileCacheTestOnUIThread : public testing::Test { ASSERT_TRUE(file_util::CreateDirectory(metadata_dir)); ASSERT_TRUE(file_util::CreateDirectory(cache_dir)); - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &dummy_file_path_)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &dummy_file_path_)); fake_free_disk_space_getter_.reset(new FakeFreeDiskSpaceGetter); scoped_refptr<base::SequencedWorkerPool> pool = @@ -803,7 +803,7 @@ TEST_F(FileCacheTest, RecoverFilesFromCacheDirectory) { TEST_F(FileCacheTest, Iterator) { base::FilePath src_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &src_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &src_file)); // Prepare entries. std::map<std::string, std::string> md5s; @@ -828,7 +828,7 @@ TEST_F(FileCacheTest, Iterator) { TEST_F(FileCacheTest, FreeDiskSpaceIfNeededFor) { base::FilePath src_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &src_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &src_file)); // Store a file as a 'temporary' file and remember the path. const std::string id_tmp = "id_tmp", md5_tmp = "md5_tmp"; @@ -959,7 +959,7 @@ TEST_F(FileCacheTest, ClearAll) { // Store an existing file. base::FilePath src_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &src_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &src_file)); ASSERT_EQ(FILE_ERROR_OK, cache_->Store(id, md5, src_file, FileCache::FILE_OPERATION_COPY)); diff --git a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc index 67cc830..cb4c8dc 100644 --- a/chrome/browser/chromeos/drive/file_system/create_file_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/create_file_operation.cc @@ -114,7 +114,7 @@ FileError UpdateLocalStateForCreateFile( // Here, failure is not a fatal error, so ignore the returned code. FileError cache_store_error = FILE_ERROR_FAILED; base::FilePath empty_file; - if (file_util::CreateTemporaryFile(&empty_file)) { + if (base::CreateTemporaryFile(&empty_file)) { cache_store_error = cache->Store( local_id, entry.file_specific_info().md5(), diff --git a/chrome/browser/chromeos/drive/file_system/download_operation.cc b/chrome/browser/chromeos/drive/file_system/download_operation.cc index cc00daa..2e1aa51 100644 --- a/chrome/browser/chromeos/drive/file_system/download_operation.cc +++ b/chrome/browser/chromeos/drive/file_system/download_operation.cc @@ -62,8 +62,8 @@ FileError CheckPreConditionForEnsureFileDownloaded( if (entry->file_specific_info().is_hosted_document()) { base::FilePath gdoc_file_path; base::PlatformFileInfo file_info; - if (!file_util::CreateTemporaryFileInDir(temporary_file_directory, - &gdoc_file_path) || + if (!base::CreateTemporaryFileInDir(temporary_file_directory, + &gdoc_file_path) || !util::CreateGDocFile(gdoc_file_path, GURL(entry->file_specific_info().alternate_url()), entry->resource_id()) || @@ -146,7 +146,7 @@ FileError CheckPreConditionForEnsureFileDownloadedByPath( // processes (e.g., cros_disks for mounting zip files). bool CreateTemporaryReadableFileInDir(const base::FilePath& dir, base::FilePath* temp_file) { - if (!file_util::CreateTemporaryFileInDir(dir, temp_file)) + if (!base::CreateTemporaryFileInDir(dir, temp_file)) return false; return base::SetPosixFilePermissions( *temp_file, diff --git a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc index 0eedc78..726885c 100644 --- a/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system/download_operation_unittest.cc @@ -197,7 +197,7 @@ TEST_F(DownloadOperationTest, TEST_F(DownloadOperationTest, EnsureFileDownloadedByPath_FromCache) { base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir(), &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir(), &temp_file)); base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); ResourceEntry src_entry; @@ -364,7 +364,7 @@ TEST_F(DownloadOperationTest, TEST_F(DownloadOperationTest, EnsureFileDownloadedByLocalId_FromCache) { base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir(), &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir(), &temp_file)); base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); ResourceEntry src_entry; diff --git a/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc b/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc index 096c7bb..dbe9b48 100644 --- a/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc +++ b/chrome/browser/chromeos/drive/fileapi_worker_unittest.cc @@ -170,7 +170,7 @@ TEST_F(FileApiWorkerTest, OpenFileForCreateWrite) { const std::string kWriteData = "byebye"; base::FilePath temp_path; - file_util::CreateTemporaryFile(&temp_path); + base::CreateTemporaryFile(&temp_path); // CREATE => CREATE (fails if file existed.) TestFileSystemForOpenFile file_system(temp_path, CREATE_FILE); @@ -190,7 +190,7 @@ TEST_F(FileApiWorkerTest, OpenFileForOpenAlwaysWrite) { const std::string kInitialData = "hello"; base::FilePath temp_path; - file_util::CreateTemporaryFile(&temp_path); + base::CreateTemporaryFile(&temp_path); google_apis::test_util::WriteStringToFile(temp_path, kInitialData); // OPEN_ALWAYS => OPEN_OR_CREATE (success whether file exists or not.) @@ -212,7 +212,7 @@ TEST_F(FileApiWorkerTest, OpenFileForOpenTruncatedWrite) { const std::string kWriteData = "byebye"; base::FilePath temp_path; - file_util::CreateTemporaryFile(&temp_path); + base::CreateTemporaryFile(&temp_path); google_apis::test_util::WriteStringToFile(temp_path, kInitialData); // OPEN_TRUNCATED => OPEN (failure when the file did not exist.) @@ -234,7 +234,7 @@ TEST_F(FileApiWorkerTest, OpenFileForOpenCreateAlwaysWrite) { const std::string kWriteData = "byebye"; base::FilePath temp_path; - file_util::CreateTemporaryFile(&temp_path); + base::CreateTemporaryFile(&temp_path); google_apis::test_util::WriteStringToFile(temp_path, kInitialData); // CREATE_ALWAYS => OPEN_OR_CREATE (success whether file exists or not.) @@ -255,7 +255,7 @@ TEST_F(FileApiWorkerTest, OpenFileForOpenRead) { const std::string kInitialData = "hello"; base::FilePath temp_path; - file_util::CreateTemporaryFile(&temp_path); + base::CreateTemporaryFile(&temp_path); google_apis::test_util::WriteStringToFile(temp_path, kInitialData); // OPEN => OPEN (failure when the file did not exist.) diff --git a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc index 5e0252b..a832f09 100644 --- a/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc +++ b/chrome/browser/chromeos/drive/remove_stale_cache_files_unittest.cc @@ -58,8 +58,7 @@ class RemoveStaleCacheFilesTest : public testing::Test { TEST_F(RemoveStaleCacheFilesTest, RemoveStaleCacheFiles) { base::FilePath dummy_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &dummy_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_file)); std::string local_id("pdf:1a2b3c"); std::string md5("abcdef0123456789"); @@ -85,8 +84,7 @@ TEST_F(RemoveStaleCacheFilesTest, RemoveStaleCacheFiles) { TEST_F(RemoveStaleCacheFilesTest, DirtyCacheFiles) { base::FilePath dummy_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &dummy_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_file)); // Dirty and deleted (= absent in resource_metada) cache entry. std::string local_id_1("file:1"); diff --git a/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc b/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc index 0094c31..be97a90 100644 --- a/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc +++ b/chrome/browser/chromeos/drive/resource_metadata_storage_unittest.cc @@ -432,7 +432,7 @@ TEST_F(ResourceMetadataStorageTest, IncompatibleDB_Unknown) { TEST_F(ResourceMetadataStorageTest, WrongPath) { // Create a file. base::FilePath path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &path)); storage_.reset(new ResourceMetadataStorage( path, base::MessageLoopProxy::current().get())); diff --git a/chrome/browser/chromeos/drive/search_metadata_unittest.cc b/chrome/browser/chromeos/drive/search_metadata_unittest.cc index fb928de..f5f7502 100644 --- a/chrome/browser/chromeos/drive/search_metadata_unittest.cc +++ b/chrome/browser/chromeos/drive/search_metadata_unittest.cc @@ -63,8 +63,7 @@ class SearchMetadataTest : public testing::Test { void AddEntriesToMetadata() { base::FilePath temp_file; - EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); const std::string temp_file_md5 = "md5"; ResourceEntry entry; diff --git a/chrome/browser/chromeos/drive/sync_client_unittest.cc b/chrome/browser/chromeos/drive/sync_client_unittest.cc index c58373f..f190d25 100644 --- a/chrome/browser/chromeos/drive/sync_client_unittest.cc +++ b/chrome/browser/chromeos/drive/sync_client_unittest.cc @@ -152,8 +152,7 @@ class SyncClientTest : public testing::Test { void SetUpTestData() { // Prepare a temp file. base::FilePath temp_file; - EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); ASSERT_TRUE(google_apis::test_util::WriteStringToFile(temp_file, kLocalContent)); diff --git a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc index 773fd21..747ef5e 100644 --- a/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_watcher_unittest.cc @@ -138,8 +138,7 @@ TEST_F(FileManagerFileWatcherTest, WatchLocalFile) { // Create a temporary file in the temporary directory. The file watcher // should detect the change in the directory. base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp_file_path)); // Wait until the directory change is notified. run_loop.Run(); ASSERT_FALSE(on_change_error); diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc index 2bcf243..831c626 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc @@ -95,7 +95,7 @@ class ParallelAuthenticatorTest : public testing::Test { base::FilePath PopulateTempFile(const char* data, int data_len) { base::FilePath out; - FILE* tmp_file = file_util::CreateAndOpenTemporaryFile(&out); + FILE* tmp_file = base::CreateAndOpenTemporaryFile(&out); EXPECT_NE(tmp_file, static_cast<FILE*>(NULL)); EXPECT_EQ(file_util::WriteFile(out, data, data_len), data_len); EXPECT_TRUE(file_util::CloseFile(tmp_file)); diff --git a/chrome/browser/chromeos/login/resource_loader_browsertest.cc b/chrome/browser/chromeos/login/resource_loader_browsertest.cc index fe106b8..2b91a32 100644 --- a/chrome/browser/chromeos/login/resource_loader_browsertest.cc +++ b/chrome/browser/chromeos/login/resource_loader_browsertest.cc @@ -22,7 +22,7 @@ namespace { GURL CreateResource(const std::string& content) { base::FilePath path; - EXPECT_TRUE(file_util::CreateTemporaryFile(&path)); + EXPECT_TRUE(base::CreateTemporaryFile(&path)); EXPECT_TRUE(file_util::WriteFile(path, content.c_str(), content.size())); return GURL("file:///" + path.AsUTF8Unsafe()); } diff --git a/chrome/browser/chromeos/system/syslogs_provider.cc b/chrome/browser/chromeos/system/syslogs_provider.cc index 5a1c00e..5cbba5d 100644 --- a/chrome/browser/chromeos/system/syslogs_provider.cc +++ b/chrome/browser/chromeos/system/syslogs_provider.cc @@ -122,7 +122,7 @@ LogDictionaryType* GetSystemLogs(base::FilePath* zip_file_name, // Create the temp file, logs will go here base::FilePath temp_filename; - if (!file_util::CreateTemporaryFile(&temp_filename)) + if (!base::CreateTemporaryFile(&temp_filename)) return NULL; std::string cmd = std::string(kSysLogsScript) + " " + context + " >> " + @@ -305,7 +305,7 @@ void SyslogsProviderImpl::ReadSyslogs( // Create temp file. base::FilePath zip_file; - if (compress_logs && !file_util::CreateTemporaryFile(&zip_file)) { + if (compress_logs && !base::CreateTemporaryFile(&zip_file)) { LOG(ERROR) << "Cannot create temp file"; compress_logs = false; } diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc index 5541a9b..789049a 100644 --- a/chrome/browser/component_updater/component_unpacker.cc +++ b/chrome/browser/component_updater/component_unpacker.cc @@ -146,8 +146,8 @@ ComponentUnpacker::ComponentUnpacker(const std::vector<uint8>& pk_hash, error_ = kInvalidId; return; } - if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), - &unpack_path_)) { + if (!base::CreateNewTempDirectory(base::FilePath::StringType(), + &unpack_path_)) { error_ = kUnzipPathError; return; } @@ -155,8 +155,8 @@ ComponentUnpacker::ComponentUnpacker(const std::vector<uint8>& pk_hash, // We want a different temp directory for the delta files; we'll put the // patch output into unpack_path_. base::FilePath unpack_diff_path; - if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), - &unpack_diff_path)) { + if (!base::CreateNewTempDirectory(base::FilePath::StringType(), + &unpack_diff_path)) { error_ = kUnzipPathError; return; } diff --git a/chrome/browser/component_updater/test/test_installer.cc b/chrome/browser/component_updater/test/test_installer.cc index 28ff22d..f379b6f 100644 --- a/chrome/browser/component_updater/test/test_installer.cc +++ b/chrome/browser/component_updater/test/test_installer.cc @@ -47,8 +47,7 @@ bool ReadOnlyTestInstaller::GetInstalledFile(const std::string& file, VersionedTestInstaller::VersionedTestInstaller() { - file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("TEST_"), - &install_directory_); + base::CreateNewTempDirectory(FILE_PATH_LITERAL("TEST_"), &install_directory_); } VersionedTestInstaller::~VersionedTestInstaller() { diff --git a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc index b821226..156d445 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc @@ -707,7 +707,7 @@ class HTML5FileWriter { int length) { // Create a temp file. base::FilePath temp_file; - if (!file_util::CreateTemporaryFile(&temp_file) || + if (!base::CreateTemporaryFile(&temp_file) || file_util::WriteFile(temp_file, data, length) != length) { return false; } diff --git a/chrome/browser/extensions/api/image_writer_private/operation.cc b/chrome/browser/extensions/api/image_writer_private/operation.cc index dcd147f..1f1f303 100644 --- a/chrome/browser/extensions/api/image_writer_private/operation.cc +++ b/chrome/browser/extensions/api/image_writer_private/operation.cc @@ -179,9 +179,9 @@ void Operation::UnzipStart(scoped_ptr<base::FilePath> zip_file) { SetStage(image_writer_api::STAGE_UNZIP); base::FilePath tmp_dir; - if (!file_util::CreateTemporaryDirInDir(zip_file->DirName(), - FILE_PATH_LITERAL("image_writer"), - &tmp_dir)) { + if (!base::CreateTemporaryDirInDir(zip_file->DirName(), + FILE_PATH_LITERAL("image_writer"), + &tmp_dir)) { Error(error::kTempDir); return; } diff --git a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc index dec61bf..9a6b8d4 100644 --- a/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc +++ b/chrome/browser/extensions/api/image_writer_private/write_from_url_operation.cc @@ -67,7 +67,7 @@ void WriteFromUrlOperation::CreateTempFile() { tmp_file_.reset(new base::FilePath()); - if (file_util::CreateTemporaryFile(tmp_file_.get())) { + if (base::CreateTemporaryFile(tmp_file_.get())) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, diff --git a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc index 749a790..b3b09f5 100644 --- a/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc +++ b/chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc @@ -156,7 +156,7 @@ class NativeMessagingTest : public ::testing::Test, base::FilePath CreateTempFileWithMessage(const std::string& message) { base::FilePath filename = temp_dir_.path().AppendASCII("input"); - file_util::CreateTemporaryFile(&filename); + base::CreateTemporaryFile(&filename); std::string message_with_header = FormatMessage(message); EXPECT_TRUE(file_util::WriteFile( filename, message_with_header.data(), message_with_header.size())); diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chrome/browser/extensions/api/page_capture/page_capture_api.cc index d520c4f..1dd31b7 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_api.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_api.cc @@ -90,7 +90,7 @@ bool PageCaptureSaveAsMHTMLFunction::OnMessageReceivedFromRenderView( void PageCaptureSaveAsMHTMLFunction::CreateTemporaryFile() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - bool success = file_util::CreateTemporaryFile(&mhtml_path_); + bool success = base::CreateTemporaryFile(&mhtml_path_); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&PageCaptureSaveAsMHTMLFunction::TemporaryFileCreated, this, diff --git a/chrome/browser/extensions/extension_creator_filter_unittest.cc b/chrome/browser/extensions/extension_creator_filter_unittest.cc index 61a1f66..bcb8117 100644 --- a/chrome/browser/extensions/extension_creator_filter_unittest.cc +++ b/chrome/browser/extensions/extension_creator_filter_unittest.cc @@ -25,7 +25,7 @@ class ExtensionCreatorFilterTest : public PlatformTest { base::FilePath CreateEmptyTestFile(const base::FilePath& file_path) { base::FilePath test_file(test_dir_.Append(file_path)); base::FilePath temp_file; - EXPECT_TRUE(file_util::CreateTemporaryFileInDir(test_dir_, &temp_file)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(test_dir_, &temp_file)); EXPECT_TRUE(base::Move(temp_file, test_file)); return test_file; } @@ -37,7 +37,7 @@ class ExtensionCreatorFilterTest : public PlatformTest { base::FilePath test_file(temp_sub_dir.Append(file_name)); EXPECT_TRUE(file_util::CreateDirectory(temp_sub_dir)); base::FilePath temp_file; - EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_sub_dir, &temp_file)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_sub_dir, &temp_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 ab3404b..73252df 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -218,7 +218,7 @@ static void AddPattern(URLPatternSet* extent, const std::string& pattern) { #if !(defined(OS_LINUX) && defined(USE_AURA) && !defined(OS_CHROMEOS)) base::FilePath GetTemporaryFile() { base::FilePath temp_file; - CHECK(file_util::CreateTemporaryFile(&temp_file)); + CHECK(base::CreateTemporaryFile(&temp_file)); return temp_file; } diff --git a/chrome/browser/extensions/sandboxed_unpacker.cc b/chrome/browser/extensions/sandboxed_unpacker.cc index 6dd89c9..8fd15ef 100644 --- a/chrome/browser/extensions/sandboxed_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_unpacker.cc @@ -124,7 +124,7 @@ bool VerifyJunctionFreeLocation(base::FilePath* temp_dir) { return false; base::FilePath temp_file; - if (!file_util::CreateTemporaryFileInDir(*temp_dir, &temp_file)) { + if (!base::CreateTemporaryFileInDir(*temp_dir, &temp_file)) { LOG(ERROR) << temp_dir->value() << " is not writable"; return false; } diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc index ace8c39..f738e32 100644 --- a/chrome/browser/feedback/feedback_util.cc +++ b/chrome/browser/feedback/feedback_util.cc @@ -378,12 +378,12 @@ bool ZipString(const base::FilePath& filename, // Create a temporary directory, put the logs into a file in it. Create // another temporary file to receive the zip file in. - if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), &temp_path)) + if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path)) return false; if (file_util::WriteFile(temp_path.Append(filename), data.c_str(), data.size()) == -1) return false; - if (!file_util::CreateTemporaryFile(&zip_file)) + if (!base::CreateTemporaryFile(&zip_file)) return false; if (!zip::Zip(temp_path, zip_file, false)) diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index a642bf2..89481c2 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc @@ -83,7 +83,7 @@ class FirstRunMasterPrefsBrowserTestBase : public InProcessBrowserTest { // before this class' SetUp() is invoked. ASSERT_TRUE(text_.get()); - ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file_)); + ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file_)); EXPECT_TRUE(file_util::WriteFile(prefs_file_, text_->c_str(), text_->size())); first_run::SetMasterPrefsPathForTesting(prefs_file_); diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc index e87ba72..b63e30f 100644 --- a/chrome/browser/first_run/first_run_internal_win.cc +++ b/chrome/browser/first_run/first_run_internal_win.cc @@ -125,7 +125,7 @@ bool IsEULANotAccepted(installer::MasterPreferences* install_prefs) { bool WriteEULAtoTempFile(base::FilePath* eula_path) { std::string terms = l10n_util::GetStringUTF8(IDS_TERMS_HTML); return (!terms.empty() && - file_util::CreateTemporaryFile(eula_path) && + base::CreateTemporaryFile(eula_path) && file_util::WriteFile(*eula_path, terms.data(), terms.size()) != -1); } diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc index 8beca3e..6a65542 100644 --- a/chrome/browser/history/history_backend_unittest.cc +++ b/chrome/browser/history/history_backend_unittest.cc @@ -362,8 +362,8 @@ class HistoryBackendTest : public testing::Test { protected: // testing::Test virtual void SetUp() { - if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"), - &test_dir_)) + if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("BackendTest"), + &test_dir_)) return; backend_ = new HistoryBackend(test_dir_, 0, diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc index a4c2dab..885f999 100644 --- a/chrome/browser/history/redirect_browsertest.cc +++ b/chrome/browser/history/redirect_browsertest.cc @@ -134,8 +134,8 @@ IN_PROC_BROWSER_TEST_F(RedirectTest, ClientEmptyReferer) { base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), - &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), + &temp_file)); ASSERT_EQ(static_cast<int>(file_redirect_contents.size()), file_util::WriteFile(temp_file, file_redirect_contents.data(), diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 9dad7a6..a4991ce 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -233,7 +233,7 @@ bool CreateIconFile(const SkBitmap& bitmap, // We don't have to care about the extension of this temporary file because // JumpList does not care about it. base::FilePath path; - if (!file_util::CreateTemporaryFileInDir(icon_dir, &path)) + if (!base::CreateTemporaryFileInDir(icon_dir, &path)) return false; // Create an icon file from the favicon attached to the given |page|, and diff --git a/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc index 25ee2fa..93af7fb 100644 --- a/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc @@ -156,7 +156,7 @@ class WebrtcAudioQualityBrowserTest : public WebRtcTestBase { base::FilePath CreateTemporaryWaveFile() { base::FilePath filename; - EXPECT_TRUE(file_util::CreateTemporaryFile(&filename)); + EXPECT_TRUE(base::CreateTemporaryFile(&filename)); base::FilePath wav_filename = filename.AddExtension(FILE_PATH_LITERAL(".wav")); EXPECT_TRUE(base::Move(filename, wav_filename)); diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc index 294fa09..8c5a2ba 100644 --- a/chrome/browser/media/chrome_webrtc_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_browsertest.cc @@ -227,7 +227,7 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcBrowserTest, MANUAL_CpuUsage15Seconds) { ASSERT_TRUE(peerconnection_server_.Start()); base::FilePath results_file; - ASSERT_TRUE(file_util::CreateTemporaryFile(&results_file)); + ASSERT_TRUE(base::CreateTemporaryFile(&results_file)); content::WebContents* left_tab = OpenTestPageAndGetUserMediaInNewTab(); diff --git a/chrome/browser/media/webrtc_log_uploader_unittest.cc b/chrome/browser/media/webrtc_log_uploader_unittest.cc index e2fb25a..3e13f45 100644 --- a/chrome/browser/media/webrtc_log_uploader_unittest.cc +++ b/chrome/browser/media/webrtc_log_uploader_unittest.cc @@ -88,7 +88,7 @@ class WebRtcLogUploaderTest : public testing::Test { TEST_F(WebRtcLogUploaderTest, AddUploadedLogInfoToUploadListFile) { // Get a temporary filename. We don't want the file to exist to begin with // since that's the normal use case, hence the delete. - ASSERT_TRUE(file_util::CreateTemporaryFile(&test_list_path_)); + ASSERT_TRUE(base::CreateTemporaryFile(&test_list_path_)); EXPECT_TRUE(base::DeleteFile(test_list_path_, false)); scoped_ptr<WebRtcLogUploader> webrtc_log_uploader_( new WebRtcLogUploader()); diff --git a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc index 63a553c..5087660 100644 --- a/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/device_media_async_file_util.cc @@ -46,8 +46,8 @@ void CreateSnapshotFileOnBlockingPool( base::FilePath isolated_media_file_system_dir_path = profile_path.AppendASCII(kDeviceMediaAsyncFileUtilTempDir); if (!file_util::CreateDirectory(isolated_media_file_system_dir_path) || - !file_util::CreateTemporaryFileInDir(isolated_media_file_system_dir_path, - snapshot_file_path)) { + !base::CreateTemporaryFileInDir(isolated_media_file_system_dir_path, + snapshot_file_path)) { LOG(WARNING) << "Could not create media snapshot file " << isolated_media_file_system_dir_path.value(); *snapshot_file_path = base::FilePath(); diff --git a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc index 01cbb83..a134e06 100644 --- a/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc +++ b/chrome/browser/nacl_host/test/nacl_gdb_browsertest.cc @@ -30,7 +30,7 @@ class NaClGdbTest : public PPAPINaClNewlibTest { EXPECT_TRUE(PathService::Get(base::DIR_EXE, &mock_nacl_gdb)); mock_nacl_gdb = mock_nacl_gdb.Append(kMockNaClGdb); command_line->AppendSwitchPath(switches::kNaClGdb, mock_nacl_gdb); - EXPECT_TRUE(file_util::CreateTemporaryFile(&script_)); + EXPECT_TRUE(base::CreateTemporaryFile(&script_)); command_line->AppendSwitchPath(switches::kNaClGdbScript, script_); } @@ -50,7 +50,7 @@ class NaClGdbTest : public PPAPINaClNewlibTest { return; } #endif - EXPECT_TRUE(file_util::CreateTemporaryFile(&mock_nacl_gdb_file)); + EXPECT_TRUE(base::CreateTemporaryFile(&mock_nacl_gdb_file)); env->SetVar("MOCK_NACL_GDB", mock_nacl_gdb_file.AsUTF8Unsafe()); RunTestViaHTTP(test_name); env->UnSetVar("MOCK_NACL_GDB"); diff --git a/chrome/browser/net/net_log_temp_file_unittest.cc b/chrome/browser/net/net_log_temp_file_unittest.cc index f30254f..6c414e82 100644 --- a/chrome/browser/net/net_log_temp_file_unittest.cc +++ b/chrome/browser/net/net_log_temp_file_unittest.cc @@ -65,8 +65,7 @@ class NetLogTempFileTest : public ::testing::Test { // Get a temporary file name for unit tests. base::FilePath net_log_dir; ASSERT_TRUE(net_log_temp_file_->GetNetExportLogDirectory(&net_log_dir)); - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(net_log_dir, - &net_export_log_)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(net_log_dir, &net_export_log_)); net_log_temp_file_->log_filename_ = net_export_log_.BaseName().value(); diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc index 7c13b1a..54a69cc 100644 --- a/chrome/browser/printing/print_dialog_gtk.cc +++ b/chrome/browser/printing/print_dialog_gtk.cc @@ -274,7 +274,7 @@ void PrintDialogGtk::PrintDocument(const printing::Metafile* metafile, AddRef(); bool error = false; - if (!file_util::CreateTemporaryFile(&path_to_pdf_)) { + if (!base::CreateTemporaryFile(&path_to_pdf_)) { LOG(ERROR) << "Creating temporary file failed"; error = true; } diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc index 262ed79..70107eb 100644 --- a/chrome/browser/printing/printing_message_filter.cc +++ b/chrome/browser/printing/printing_message_filter.cc @@ -168,7 +168,7 @@ void PrintingMessageFilter::OnAllocateTempFileForPrinting( *sequence_number = g_printing_file_descriptor_map.Get().sequence++; base::FilePath path; - if (file_util::CreateTemporaryFile(&path)) { + if (base::CreateTemporaryFile(&path)) { int fd = open(path.value().c_str(), O_WRONLY); if (fd >= 0) { SequenceToPathMap::iterator it = map->find(*sequence_number); diff --git a/chrome/browser/shell_integration_win_unittest.cc b/chrome/browser/shell_integration_win_unittest.cc index fa91c1c..2f0081d 100644 --- a/chrome/browser/shell_integration_win_unittest.cc +++ b/chrome/browser/shell_integration_win_unittest.cc @@ -36,10 +36,10 @@ class ShellIntegrationWinMigrateShortcutTest : public testing::Test { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); // A path to a random target. - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &other_target_); + base::CreateTemporaryFileInDir(temp_dir_.path(), &other_target_); // This doesn't need to actually have a base name of "chrome.exe". - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &chrome_exe_); + base::CreateTemporaryFileInDir(temp_dir_.path(), &chrome_exe_); chrome_app_id_ = ShellUtil::GetBrowserModelId(BrowserDistribution::GetDistribution(), diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index e7ff318..0979ef4 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -312,8 +312,8 @@ scoped_refptr<Extension> CreateExtension(const base::FilePath& base_dir, ADD_FAILURE(); return NULL; } - if (!file_util::CreateTemporaryDirInDir( - base_dir, sub_dir.value(), &extension_dir)) { + if (!base::CreateTemporaryDirInDir(base_dir, sub_dir.value(), + &extension_dir)) { ADD_FAILURE(); return NULL; } diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc index fdcd188..4904ca1 100644 --- a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc +++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc @@ -127,7 +127,7 @@ scoped_ptr<FileMetadata> CreateDeletedFileMetadata( webkit_blob::ScopedFile CreateTemporaryFile( base::TaskRunner* file_task_runner) { base::FilePath temp_file_path; - if (!file_util::CreateTemporaryFile(&temp_file_path)) + if (!base::CreateTemporaryFile(&temp_file_path)) return webkit_blob::ScopedFile(); return webkit_blob::ScopedFile( diff --git a/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc b/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc index 6c26105..2666654 100644 --- a/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc +++ b/chrome/browser/sync_file_system/drive_backend_v1/api_util.cc @@ -145,7 +145,7 @@ bool CreateTemporaryFile(const base::FilePath& dir_path, webkit_blob::ScopedFile* temp_file) { base::FilePath temp_file_path; const bool success = file_util::CreateDirectory(dir_path) && - file_util::CreateTemporaryFileInDir(dir_path, &temp_file_path); + base::CreateTemporaryFileInDir(dir_path, &temp_file_path); if (!success) return success; *temp_file = diff --git a/chrome/browser/sync_file_system/drive_backend_v1/fake_drive_service_helper.cc b/chrome/browser/sync_file_system/drive_backend_v1/fake_drive_service_helper.cc index 430f94e..0f93d9b 100644 --- a/chrome/browser/sync_file_system/drive_backend_v1/fake_drive_service_helper.cc +++ b/chrome/browser/sync_file_system/drive_backend_v1/fake_drive_service_helper.cc @@ -226,7 +226,7 @@ GDataErrorCode FakeDriveServiceHelper::ReadFile( error = google_apis::GDATA_OTHER_ERROR; base::FilePath temp_file; - EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_, &temp_file)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_, &temp_file)); fake_drive_service_->DownloadFile( temp_file, file->resource_id(), base::Bind(&DownloadResultCallback, &error), @@ -285,7 +285,7 @@ void FakeDriveServiceHelper::Initialize() { base::FilePath FakeDriveServiceHelper::WriteToTempFile( const std::string& content) { base::FilePath temp_file; - EXPECT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_, &temp_file)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_, &temp_file)); EXPECT_EQ(static_cast<int>(content.size()), file_util::WriteFile(temp_file, content.data(), content.size())); return temp_file; diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.cc b/chrome/browser/sync_file_system/local/local_file_sync_context.cc index 59eede4..840f59c 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_context.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_context.cc @@ -793,8 +793,8 @@ void LocalFileSyncContext::DidGetWritingStatusForSync( webkit_blob::ScopedFile snapshot; if (file_error == base::PLATFORM_FILE_OK && sync_mode == SYNC_SNAPSHOT) { base::FilePath snapshot_path; - file_util::CreateTemporaryFileInDir(local_base_path_.Append(kSnapshotDir), - &snapshot_path); + base::CreateTemporaryFileInDir(local_base_path_.Append(kSnapshotDir), + &snapshot_path); if (base::CopyFile(platform_path, snapshot_path)) { platform_path = snapshot_path; snapshot = webkit_blob::ScopedFile( diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc index 286c53e..6ad32ff 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc +++ b/chrome/browser/sync_file_system/local/local_file_sync_service_unittest.cc @@ -211,8 +211,7 @@ TEST_F(LocalFileSyncServiceTest, RemoteSyncStepsSimple) { const int kTestFileDataSize = static_cast<int>(arraysize(kTestFileData) - 1); base::FilePath local_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &local_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &local_path)); ASSERT_EQ(kTestFileDataSize, file_util::WriteFile(local_path, kTestFileData, kTestFileDataSize)); diff --git a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc index 7e7693f..a49b916 100644 --- a/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc +++ b/chrome/browser/sync_file_system/local/syncable_file_operation_runner_unittest.cc @@ -126,7 +126,7 @@ class SyncableFileOperationRunnerTest : public testing::Test { } bool CreateTempFile(base::FilePath* path) { - return file_util::CreateTemporaryFileInDir(dir_.path(), path); + return base::CreateTemporaryFileInDir(dir_.path(), path); } ScopedEnableSyncFSDirectoryOperation enable_directory_operation_; diff --git a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc index 6b75c4a..dc2fffd 100644 --- a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc +++ b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc @@ -139,7 +139,7 @@ base::FilePath CreateTempImageFile(gfx::ImageSkia* image_ptr, // Create a new temporary directory for each image since using a single // temporary directory seems to have issues when changing icons in quick // succession. - if (!file_util::CreateNewTempDirectory("", &temp_dir)) + if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_dir)) return base::FilePath(); new_file_path = temp_dir.Append(id + base::StringPrintf("_%d.png", icon_change_count)); diff --git a/chrome/browser/ui/network_profile_bubble.cc b/chrome/browser/ui/network_profile_bubble.cc index 6de46c3..491a9e7 100644 --- a/chrome/browser/ui/network_profile_bubble.cc +++ b/chrome/browser/ui/network_profile_bubble.cc @@ -127,7 +127,7 @@ void NetworkProfileBubble::CheckNetworkProfile( base::FilePath temp_file; // Try to create some non-empty temp file in the profile dir and use // it to check if there is a reparse-point free path to it. - if (file_util::CreateTemporaryFileInDir(profile_folder, &temp_file) && + if (base::CreateTemporaryFileInDir(profile_folder, &temp_file) && (file_util::WriteFile(temp_file, ".", 1) == 1)) { base::FilePath normalized_temp_file; if (!file_util::NormalizeFilePath(temp_file, &normalized_temp_file)) diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index 07809fe..1a51904 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -181,7 +181,7 @@ class PDFBrowserTest : public InProcessBrowserTest, if (snapshot_different_) { std::vector<unsigned char> png_data; gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, &png_data); - if (file_util::CreateTemporaryFile(&snapshot_filename_)) { + if (base::CreateTemporaryFile(&snapshot_filename_)) { file_util::WriteFile(snapshot_filename_, reinterpret_cast<char*>(&png_data[0]), png_data.size()); } diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc index 8bb3373..68345cb 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui_browsertest.cc @@ -340,8 +340,8 @@ void NetInternalsTest::MessageHandler::GetNetLogLoggerLog( base::ScopedTempDir temp_directory; ASSERT_TRUE(temp_directory.CreateUniqueTempDir()); base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_directory.path(), - &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_directory.path(), + &temp_file)); FILE* temp_file_handle = file_util::OpenFile(temp_file, "w"); ASSERT_TRUE(temp_file_handle); diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index 5f90105..7259256 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc @@ -318,8 +318,7 @@ TEST_F(InstallShortcutTest, CreateAllShortcutsButQuickLaunchShortcut) { TEST_F(InstallShortcutTest, ReplaceAll) { base::win::ShortcutProperties dummy_properties; base::FilePath dummy_target; - ASSERT_TRUE( - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); dummy_properties.set_target(dummy_target); dummy_properties.set_working_dir(fake_user_desktop_.path()); dummy_properties.set_arguments(L"--dummy --args"); @@ -349,8 +348,7 @@ TEST_F(InstallShortcutTest, ReplaceAll) { TEST_F(InstallShortcutTest, ReplaceExisting) { base::win::ShortcutProperties dummy_properties; base::FilePath dummy_target; - ASSERT_TRUE( - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); dummy_properties.set_target(dummy_target); dummy_properties.set_working_dir(fake_user_desktop_.path()); dummy_properties.set_arguments(L"--dummy --args"); @@ -372,8 +370,7 @@ TEST_F(InstallShortcutTest, ReplaceExisting) { TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { base::win::ShortcutProperties dummy_properties; base::FilePath dummy_target; - ASSERT_TRUE( - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); dummy_properties.set_target(dummy_target); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( @@ -410,8 +407,7 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelNoSystemShortcutsExist) { TEST_F(InstallShortcutTest, CreateIfNoSystemLevelSomeSystemShortcutsExist) { base::win::ShortcutProperties dummy_properties; base::FilePath dummy_target; - ASSERT_TRUE( - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &dummy_target)); dummy_properties.set_target(dummy_target); ASSERT_TRUE(base::win::CreateOrUpdateShortcutLink( diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index dc2bec6c..2789f31 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -691,9 +691,9 @@ bool CreateTemporaryAndUnpackDirectories( } VLOG(1) << "Created path " << temp_path->path().value(); - if (!file_util::CreateTemporaryDirInDir(temp_path->path(), - installer::kInstallSourceDir, - unpack_path)) { + if (!base::CreateTemporaryDirInDir(temp_path->path(), + installer::kInstallSourceDir, + unpack_path)) { PLOG(ERROR) << "Could not create temporary path for unpacked archive."; return false; } diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index 389cc1e..3a02f28 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -135,7 +135,7 @@ TEST_F(SetupUtilTestWithDir, GetMaxVersionFromArchiveDirTest) { TEST_F(SetupUtilTestWithDir, DeleteFileFromTempProcess) { base::FilePath test_file; - file_util::CreateTemporaryFileInDir(test_dir_.path(), &test_file); + base::CreateTemporaryFileInDir(test_dir_.path(), &test_file); ASSERT_TRUE(base::PathExists(test_file)); file_util::WriteFile(test_file, "foo", 3); EXPECT_TRUE(installer::DeleteFileFromTempProcess(test_file, 0)); diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index de4f3f7..c713834 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -477,7 +477,7 @@ base::FilePath BackupLocalStateFile( local_state_folder.Append(chrome::kLocalStateFilename)); if (!base::PathExists(state_file)) continue; - if (!file_util::CreateTemporaryFile(&backup)) + if (!base::CreateTemporaryFile(&backup)) LOG(ERROR) << "Failed to create temporary file for Local State."; else base::CopyFile(state_file, backup); @@ -535,7 +535,7 @@ bool MoveSetupOutOfInstallFolder(const InstallerState& installer_state, base::FilePath temp_file; if (!PathService::Get(base::DIR_TEMP, &tmp_dir)) { NOTREACHED(); - } else if (!file_util::CreateTemporaryFileInDir(tmp_dir, &temp_file)) { + } else if (!base::CreateTemporaryFileInDir(tmp_dir, &temp_file)) { LOG(ERROR) << "Failed to create temporary file for setup.exe."; } else { VLOG(1) << "Changing current directory to: " << tmp_dir.value(); diff --git a/chrome/installer/test/alternate_version_generator.cc b/chrome/installer/test/alternate_version_generator.cc index d00da4f..6b65aa1 100644 --- a/chrome/installer/test/alternate_version_generator.cc +++ b/chrome/installer/test/alternate_version_generator.cc @@ -84,7 +84,7 @@ class ScopedTempDirectory { // Creates a temporary directory. bool Initialize() { DCHECK(directory_.empty()); - if (!file_util::CreateNewTempDirectory(&kTempDirPrefix[0], &directory_)) { + if (!base::CreateNewTempDirectory(&kTempDirPrefix[0], &directory_)) { LOG(DFATAL) << "Failed creating temporary directory."; return false; } diff --git a/chrome/installer/test/upgrade_test.cc b/chrome/installer/test/upgrade_test.cc index cca9359..d50089f 100644 --- a/chrome/installer/test/upgrade_test.cc +++ b/chrome/installer/test/upgrade_test.cc @@ -22,7 +22,7 @@ class UpgradeTest : public testing::Test { static void SetUpTestCase() { base::FilePath dir_exe; ASSERT_TRUE(PathService::Get(base::DIR_EXE, &dir_exe)); - ASSERT_TRUE(file_util::CreateTemporaryFile(&next_mini_installer_path_)); + ASSERT_TRUE(base::CreateTemporaryFile(&next_mini_installer_path_)); ASSERT_TRUE( upgrade_test::GenerateAlternateVersion( dir_exe.Append(&kMiniInstallerExe[0]), diff --git a/chrome/installer/util/delete_after_reboot_helper_unittest.cc b/chrome/installer/util/delete_after_reboot_helper_unittest.cc index c97cecd..d5a65812 100644 --- a/chrome/installer/util/delete_after_reboot_helper_unittest.cc +++ b/chrome/installer/util/delete_after_reboot_helper_unittest.cc @@ -24,13 +24,12 @@ class DeleteAfterRebootHelperTest : public testing::Test { protected: virtual void SetUp() { // Create a temporary directory for testing and fill it with some files. - std::wstring no_prefix; - file_util::CreateNewTempDirectory(no_prefix, &temp_dir_); - file_util::CreateTemporaryFileInDir(temp_dir_, &temp_file_); + base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_dir_); + base::CreateTemporaryFileInDir(temp_dir_, &temp_file_); temp_subdir_ = temp_dir_.Append(L"subdir"); file_util::CreateDirectory(temp_subdir_); - file_util::CreateTemporaryFileInDir(temp_subdir_, &temp_subdir_file_); + base::CreateTemporaryFileInDir(temp_subdir_, &temp_subdir_file_); // Copy the current pending moves and then clear it if we can: if (IsUserAnAdmin()) { diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index 45497d56..a085817 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -474,7 +474,7 @@ TEST_F(InstallerStateTest, IsFileInUse) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &temp_file)); EXPECT_FALSE(MockInstallerState::IsFileInUse(temp_file)); diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index 0ed209d..f1e38ed 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -20,7 +20,7 @@ namespace { class MasterPreferencesTest : public testing::Test { protected: virtual void SetUp() { - ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file_)); + ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file_)); } virtual void TearDown() { @@ -241,7 +241,7 @@ TEST(MasterPrefsExtension, ValidateExtensionJSON) { TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { // Create a temporary prefs file. base::FilePath prefs_file; - ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file)); + ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file)); const char text[] = "{ \n" " \"distribution\": { \n" diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index b7303e8..6b9ce72 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -73,7 +73,7 @@ class ShellUtilShortcutTest : public testing::Test { fake_common_start_menu_.path())); base::FilePath icon_path; - file_util::CreateTemporaryFileInDir(temp_dir_.path(), &icon_path); + base::CreateTemporaryFileInDir(temp_dir_.path(), &icon_path); test_properties_.set_target(chrome_exe_); test_properties_.set_arguments(L"--test --chrome"); test_properties_.set_description(L"Makes polar bears dance."); diff --git a/chrome/renderer/chrome_mock_render_thread.cc b/chrome/renderer/chrome_mock_render_thread.cc index ec8a2ad..d0e13e1 100644 --- a/chrome/renderer/chrome_mock_render_thread.cc +++ b/chrome/renderer/chrome_mock_render_thread.cc @@ -103,7 +103,7 @@ void ChromeMockRenderThread::OnAllocateTempFileForPrinting( renderer_fd->auto_close = false; base::FilePath path; - if (file_util::CreateTemporaryFile(&path)) { + if (base::CreateTemporaryFile(&path)) { int fd = open(path.value().c_str(), O_WRONLY); DCHECK_GE(fd, 0); renderer_fd->fd = *browser_fd = fd; diff --git a/chrome/renderer/printing/print_web_view_helper_browsertest.cc b/chrome/renderer/printing/print_web_view_helper_browsertest.cc index 7a3953f..4bf4dbd 100644 --- a/chrome/renderer/printing/print_web_view_helper_browsertest.cc +++ b/chrome/renderer/printing/print_web_view_helper_browsertest.cc @@ -422,11 +422,11 @@ TEST_F(PrintWebViewHelperTest, PrintLayoutTest) { // Save the source data and the bitmap data into temporary files to // create base-line results. base::FilePath source_path; - file_util::CreateTemporaryFile(&source_path); + base::CreateTemporaryFile(&source_path); chrome_render_thread_->printer()->SaveSource(0, source_path); base::FilePath bitmap_path; - file_util::CreateTemporaryFile(&bitmap_path); + base::CreateTemporaryFile(&bitmap_path); chrome_render_thread_->printer()->SaveBitmap(0, bitmap_path); } } diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc index f41e826..59dff0b 100644 --- a/chrome/service/cloud_print/printer_job_handler.cc +++ b/chrome/service/cloud_print/printer_job_handler.cc @@ -367,7 +367,7 @@ PrinterJobHandler::HandlePrintDataResponse(const net::URLFetcher* source, const std::string& data) { VLOG(1) << "CP_CONNECTOR: Handling print data response" << ", printer id: " << printer_info_cloud_.printer_id; - if (file_util::CreateTemporaryFile(&job_details_.print_data_file_path_)) { + if (base::CreateTemporaryFile(&job_details_.print_data_file_path_)) { UMA_HISTOGRAM_ENUMERATION("CloudPrint.JobHandlerEvent", JOB_HANDLER_DATA, JOB_HANDLER_MAX); int ret = file_util::WriteFile(job_details_.print_data_file_path_, diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index d3b0aa6..2b4e310 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -104,8 +104,8 @@ bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( scratch_metafile_dir_.reset(new base::ScopedTempDir); if (!scratch_metafile_dir_->CreateUniqueTempDir()) return false; - if (!file_util::CreateTemporaryFileInDir(scratch_metafile_dir_->path(), - &metafile_path_)) { + if (!base::CreateTemporaryFileInDir(scratch_metafile_dir_->path(), + &metafile_path_)) { return false; } diff --git a/chrome/test/chromedriver/session_commands.cc b/chrome/test/chromedriver/session_commands.cc index 85809f6..8e0ef6b 100644 --- a/chrome/test/chromedriver/session_commands.cc +++ b/chrome/test/chromedriver/session_commands.cc @@ -592,8 +592,9 @@ Status ExecuteUploadFile( return Status(kUnknownError, "unable to create temp dir"); } base::FilePath upload_dir; - if (!file_util::CreateTemporaryDirInDir( - session->temp_dir.path(), FILE_PATH_LITERAL("upload"), &upload_dir)) { + if (!base::CreateTemporaryDirInDir(session->temp_dir.path(), + FILE_PATH_LITERAL("upload"), + &upload_dir)) { return Status(kUnknownError, "unable to create temp dir"); } std::string error_msg; diff --git a/chrome/test/perf/memory_test.cc b/chrome/test/perf/memory_test.cc index 95a03c04..f5952ba 100644 --- a/chrome/test/perf/memory_test.cc +++ b/chrome/test/perf/memory_test.cc @@ -233,7 +233,7 @@ class MemoryTest : public UIPerfTest { // We create a copy of the test dir and use it so that each // run of this test starts with the same data. Running this // test has the side effect that it will change the profile. - if (!file_util::CreateNewTempDirectory(kTempDirName, &temp_dir_)) { + if (!base::CreateNewTempDirectory(kTempDirName, &temp_dir_)) { LOG(ERROR) << "Could not create temp directory:" << kTempDirName; return false; } diff --git a/chrome/test/remoting/me2me_browsertest.cc b/chrome/test/remoting/me2me_browsertest.cc index 7072cae..d5cefe7 100644 --- a/chrome/test/remoting/me2me_browsertest.cc +++ b/chrome/test/remoting/me2me_browsertest.cc @@ -87,7 +87,7 @@ void Me2MeBrowserTest::TestKeyboardInput() { ASSERT_TRUE(TimeoutWaiter(base::TimeDelta::FromMilliseconds(300)).Wait()); base::FilePath temp_file; - EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_file)); + EXPECT_TRUE(base::CreateTemporaryFile(&temp_file)); // Write some text into the temp file. std::string text = "Abigail"; diff --git a/chrome/tools/convert_dict/convert_dict_unittest.cc b/chrome/tools/convert_dict/convert_dict_unittest.cc index 77f760d..4fee2fb 100644 --- a/chrome/tools/convert_dict/convert_dict_unittest.cc +++ b/chrome/tools/convert_dict/convert_dict_unittest.cc @@ -80,11 +80,11 @@ void RunDictionaryTest(const char* codepage, // Create a temporary affix file and a dictionary file from the test data. base::FilePath aff_file; - file_util::CreateTemporaryFile(&aff_file); + base::CreateTemporaryFile(&aff_file); file_util::WriteFile(aff_file, aff_data.c_str(), aff_data.length()); base::FilePath dic_file; - file_util::CreateTemporaryFile(&dic_file); + base::CreateTemporaryFile(&dic_file); file_util::WriteFile(dic_file, dic_data.c_str(), dic_data.length()); { diff --git a/chrome/utility/media_galleries/pmp_column_reader_unittest.cc b/chrome/utility/media_galleries/pmp_column_reader_unittest.cc index e271e6f..eb6fee1b 100644 --- a/chrome/utility/media_galleries/pmp_column_reader_unittest.cc +++ b/chrome/utility/media_galleries/pmp_column_reader_unittest.cc @@ -26,7 +26,7 @@ bool InitColumnReaderFromBytes( return false; base::FilePath temp_path; - if (!file_util::CreateTemporaryFileInDir(temp_dir.path(), &temp_path)) + if (!base::CreateTemporaryFileInDir(temp_dir.path(), &temp_path)) return false; // Explicit conversion from signed to unsigned. diff --git a/chrome_frame/crash_reporting/minidump_test.cc b/chrome_frame/crash_reporting/minidump_test.cc index d8aa653..9702ba1 100644 --- a/chrome_frame/crash_reporting/minidump_test.cc +++ b/chrome_frame/crash_reporting/minidump_test.cc @@ -57,7 +57,7 @@ class MinidumpTest: public testing::Test { ASSERT_TRUE(urlmon != NULL); ASSERT_TRUE(::FreeLibrary(urlmon)); - ASSERT_TRUE(file_util::CreateTemporaryFile(&dump_file_)); + ASSERT_TRUE(base::CreateTemporaryFile(&dump_file_)); dump_file_handle_.Set(::CreateFile(dump_file_.value().c_str(), GENERIC_WRITE | GENERIC_READ, 0, diff --git a/chrome_frame/test/navigation_test.cc b/chrome_frame/test/navigation_test.cc index fca132c..78db862 100644 --- a/chrome_frame/test/navigation_test.cc +++ b/chrome_frame/test/navigation_test.cc @@ -844,7 +844,7 @@ TEST_F(FullTabDownloadTest, CF_DownloadFileFromPost) { EXPECT_CALL(download_window_mock, OnQuit()).Times(testing::AtMost(1)); base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path)); file_util::DieFileDie(temp_file_path, false); temp_file_path = temp_file_path.ReplaceExtension(L"txt"); diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index b38e8c9..9bac14d 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -899,7 +899,7 @@ void CFUrlRequestUnittestRunner::PostDestroyThreads() { } void CFUrlRequestUnittestRunner::StartFileLogger() { - if (file_util::CreateTemporaryFile(&log_file_)) { + if (base::CreateTemporaryFile(&log_file_)) { file_logger_.reset(new logging_win::FileLogger()); file_logger_->Initialize(); file_logger_->StartLogging(log_file_); diff --git a/chrome_frame/test/perf/chrome_frame_perftest.cc b/chrome_frame/test/perf/chrome_frame_perftest.cc index 31f9ac1..5f1a0f1 100644 --- a/chrome_frame/test/perf/chrome_frame_perftest.cc +++ b/chrome_frame/test/perf/chrome_frame_perftest.cc @@ -1340,7 +1340,7 @@ class EtwPerfSession { // To ensure there is no session leftover from crashes, previous runs, etc. base::win::EtwTraceProperties ignore; base::win::EtwTraceController::Stop(L"cf_perf", &ignore); - ASSERT_TRUE(file_util::CreateTemporaryFile(&etl_log_file_)); + ASSERT_TRUE(base::CreateTemporaryFile(&etl_log_file_)); ASSERT_HRESULT_SUCCEEDED(controller_.StartFileSession(L"cf_perf", etl_log_file_.value().c_str(), false)); ASSERT_HRESULT_SUCCEEDED(controller_.EnableProvider( diff --git a/chrome_frame/test/ui_test.cc b/chrome_frame/test/ui_test.cc index 8823a2e..faab2a2 100644 --- a/chrome_frame/test/ui_test.cc +++ b/chrome_frame/test/ui_test.cc @@ -497,7 +497,7 @@ class ContextMenuTest : public MockIEEventSinkTest, public testing::Test { // Get safe download name using temporary file. base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path)); ASSERT_TRUE(file_util::DieFileDie(temp_file_path, false)); temp_file_path = temp_file_path.ReplaceExtension(file_ext); diff --git a/cloud_print/common/win/install_utils.cc b/cloud_print/common/win/install_utils.cc index 4190a7b..98a3e0d 100644 --- a/cloud_print/common/win/install_utils.cc +++ b/cloud_print/common/win/install_utils.cc @@ -172,7 +172,7 @@ void DeleteProgramDir(const std::string& delete_switch) { if (!IsProgramsFilesParent(installer_source)) return; base::FilePath temp_path; - if (!file_util::CreateTemporaryFile(&temp_path)) + if (!base::CreateTemporaryFile(&temp_path)) return; base::CopyFile(installer_source, temp_path); base::DeleteFileAfterReboot(temp_path); diff --git a/cloud_print/gcp20/prototype/print_job_handler.cc b/cloud_print/gcp20/prototype/print_job_handler.cc index 8f457e1..2d46db9 100644 --- a/cloud_print/gcp20/prototype/print_job_handler.cc +++ b/cloud_print/gcp20/prototype/print_job_handler.cc @@ -230,7 +230,7 @@ bool PrintJobHandler::SavePrintJob(const std::string& content, create_time_exploded.hour, create_time_exploded.minute, create_time_exploded.second); - if (!file_util::CreateTemporaryDirInDir(directory, job_prefix, &directory)) { + if (!base::CreateTemporaryDirInDir(directory, job_prefix, &directory)) { LOG(WARNING) << "Cannot create directory for " << job_prefix; return false; } diff --git a/cloud_print/service/win/service_listener.cc b/cloud_print/service/win/service_listener.cc index 96c6bbf..e0f9112 100644 --- a/cloud_print/service/win/service_listener.cc +++ b/cloud_print/service/win/service_listener.cc @@ -39,7 +39,7 @@ std::string GetEnvironment(const base::FilePath& user_data_dir) { chrome_launcher_support::GetAnyChromePath().value()); if (file_util::CreateDirectory(user_data_dir)) { base::FilePath temp_file; - if (file_util::CreateTemporaryFileInDir(user_data_dir, &temp_file)) { + if (base::CreateTemporaryFileInDir(user_data_dir, &temp_file)) { DCHECK(base::PathExists(temp_file)); environment.SetString(SetupListener::kUserDataDirJsonValueName, user_data_dir.value()); diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc index d20b5851..cec4aac 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc @@ -429,7 +429,7 @@ BOOL WINAPI Monitor2StartDocPort(HANDLE port_handle, return FALSE; DeleteLeakedFiles(app_data_dir); if (!file_util::CreateDirectory(app_data_dir) || - !file_util::CreateTemporaryFileInDir(app_data_dir, &file_path)) { + !base::CreateTemporaryFileInDir(app_data_dir, &file_path)) { LOG(ERROR) << "Can't create temporary file in " << app_data_dir.value(); return FALSE; } diff --git a/components/breakpad/browser/crash_dump_manager_android.cc b/components/breakpad/browser/crash_dump_manager_android.cc index 9b46fc6..2aa5d40 100644 --- a/components/breakpad/browser/crash_dump_manager_android.cc +++ b/components/breakpad/browser/crash_dump_manager_android.cc @@ -58,7 +58,7 @@ CrashDumpManager::~CrashDumpManager() { int CrashDumpManager::CreateMinidumpFile(int child_process_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)); base::FilePath minidump_path; - if (!file_util::CreateTemporaryFile(&minidump_path)) + if (!base::CreateTemporaryFile(&minidump_path)) return base::kInvalidPlatformFileValue; base::PlatformFileError error; diff --git a/components/nacl/browser/pnacl_host.cc b/components/nacl/browser/pnacl_host.cc index 2ed4d5d..6344b3b 100644 --- a/components/nacl/browser/pnacl_host.cc +++ b/components/nacl/browser/pnacl_host.cc @@ -136,8 +136,8 @@ void PnaclHost::DoCreateTemporaryFile(base::FilePath temp_dir, base::FilePath file_path; base::PlatformFile file_handle(base::kInvalidPlatformFileValue); bool rv = temp_dir.empty() - ? file_util::CreateTemporaryFile(&file_path) - : file_util::CreateTemporaryFileInDir(temp_dir, &file_path); + ? base::CreateTemporaryFile(&file_path) + : base::CreateTemporaryFileInDir(temp_dir, &file_path); if (!rv) { PLOG(ERROR) << "Temp file creation failed."; } else { diff --git a/components/visitedlink/test/visitedlink_perftest.cc b/components/visitedlink/test/visitedlink_perftest.cc index a527c34..24ddf05 100644 --- a/components/visitedlink/test/visitedlink_perftest.cc +++ b/components/visitedlink/test/visitedlink_perftest.cc @@ -65,7 +65,7 @@ class VisitedLink : public testing::Test { protected: base::FilePath db_path_; virtual void SetUp() { - ASSERT_TRUE(file_util::CreateTemporaryFile(&db_path_)); + ASSERT_TRUE(base::CreateTemporaryFile(&db_path_)); } virtual void TearDown() { base::DeleteFile(db_path_, false); diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc index 90ab485..a1ba735 100644 --- a/content/browser/download/base_file.cc +++ b/content/browser/download/base_file.cc @@ -82,8 +82,8 @@ DownloadInterruptReason BaseFile::Initialize( // |initial_directory| can still be empty if ContentBrowserClient returned // an empty path for the downloads directory. if ((initial_directory.empty() || - !file_util::CreateTemporaryFileInDir(initial_directory, &temp_file)) && - !file_util::CreateTemporaryFile(&temp_file)) { + !base::CreateTemporaryFileInDir(initial_directory, &temp_file)) && + !base::CreateTemporaryFile(&temp_file)) { return LogInterruptReason("Unable to create", 0, DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); } diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index b82b0a8..8e6b4d0 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -482,7 +482,7 @@ TEST_F(BaseFileTest, RenameWithError) { // Write data to the file multiple times. TEST_F(BaseFileTest, MultipleWritesWithError) { base::FilePath path; - ASSERT_TRUE(file_util::CreateTemporaryFile(&path)); + ASSERT_TRUE(base::CreateTemporaryFile(&path)); // Create a new file stream. scoped_ptr takes ownership and passes it to // BaseFile; we use the pointer anyway and rely on the BaseFile not // deleting the MockFileStream until the BaseFile is reset. @@ -623,8 +623,7 @@ TEST_F(BaseFileTest, CreatedInDefaultDirectory) { // be a string-wise match to base_file_->full_path().DirName() even though // they are in the same directory. base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &temp_file)); ASSERT_FALSE(temp_file.empty()); EXPECT_STREQ(temp_file.DirName().value().c_str(), base_file_->full_path().DirName().value().c_str()); diff --git a/content/browser/download/file_metadata_unittest_linux.cc b/content/browser/download/file_metadata_unittest_linux.cc index 4f22351..96db264 100644 --- a/content/browser/download/file_metadata_unittest_linux.cc +++ b/content/browser/download/file_metadata_unittest_linux.cc @@ -52,8 +52,7 @@ class FileMetadataLinuxTest : public testing::Test { protected: virtual void SetUp() OVERRIDE { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &test_file_)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &test_file_)); int result = setxattr(test_file_.value().c_str(), "user.test", "test", 4, 0); is_xattr_supported_ = (!result) || (errno != ENOTSUP); diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 2fc68df..b734efe 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -519,7 +519,7 @@ bool SavePackage::GenerateFileName(const std::string& disposition, if (ordinal_number > (kMaxFileOrdinalNumber - 1)) { // Use a random file from temporary file. base::FilePath temp_file; - file_util::CreateTemporaryFile(&temp_file); + base::CreateTemporaryFile(&temp_file); file_name = temp_file.RemoveExtension().BaseName().value(); // Get safe pure file name. if (!GetSafePureFileName(saved_main_directory_path_, diff --git a/content/browser/fileapi/file_system_operation_impl_unittest.cc b/content/browser/fileapi/file_system_operation_impl_unittest.cc index 23dfede..06489b8 100644 --- a/content/browser/fileapi/file_system_operation_impl_unittest.cc +++ b/content/browser/fileapi/file_system_operation_impl_unittest.cc @@ -664,7 +664,7 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursive) { TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) { base::FilePath src_local_disk_file_path; - file_util::CreateTemporaryFile(&src_local_disk_file_path); + base::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); @@ -697,7 +697,7 @@ TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) { TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileFailureByQuota) { base::FilePath src_local_disk_file_path; - file_util::CreateTemporaryFile(&src_local_disk_file_path); + base::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)); diff --git a/content/browser/fileapi/transient_file_util_unittest.cc b/content/browser/fileapi/transient_file_util_unittest.cc index b12a99e..2ddb315 100644 --- a/content/browser/fileapi/transient_file_util_unittest.cc +++ b/content/browser/fileapi/transient_file_util_unittest.cc @@ -40,8 +40,7 @@ class TransientFileUtilTest : public testing::Test { void CreateAndRegisterTemporaryFile( FileSystemURL* file_url, base::FilePath* file_path) { - EXPECT_TRUE( - file_util::CreateTemporaryFileInDir(data_dir_.path(), file_path)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(data_dir_.path(), file_path)); IsolatedContext* isolated_context = IsolatedContext::GetInstance(); std::string name = "tmp"; std::string fsid = isolated_context->RegisterFileSystemForPath( 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 7e010d6..f18b93b 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 @@ -259,7 +259,7 @@ int32_t PepperFlashFileMessageFilter::OnCreateTemporaryFile( } base::FilePath file_path; - if (!file_util::CreateTemporaryFileInDir(validated_dir_path, &file_path)) { + if (!base::CreateTemporaryFileInDir(validated_dir_path, &file_path)) { return ppapi::PlatformFileErrorToPepperError( base::PLATFORM_FILE_ERROR_FAILED); } diff --git a/content/browser/renderer_host/pepper/quota_file_io_unittest.cc b/content/browser/renderer_host/pepper/quota_file_io_unittest.cc index bcc08d3..bac9f12 100644 --- a/content/browser/renderer_host/pepper/quota_file_io_unittest.cc +++ b/content/browser/renderer_host/pepper/quota_file_io_unittest.cc @@ -89,7 +89,7 @@ class QuotaFileIOTest : public PpapiUnittest { PpapiUnittest::SetUp(); ASSERT_TRUE(dir_.CreateUniqueTempDir()); base::FilePath path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(dir_.path(), &path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(dir_.path(), &path)); int file_flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 90f9497..85934f1 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -290,8 +290,8 @@ void BlockingGarbageCollect( base::FileEnumerator enumerator(storage_root, false, kAllFileTypes); base::FilePath trash_directory; - if (!file_util::CreateTemporaryDirInDir(storage_root, kTrashDirname, - &trash_directory)) { + if (!base::CreateTemporaryDirInDir(storage_root, kTrashDirname, + &trash_directory)) { // Unable to continue without creating the trash directory so give up. return; } diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc index 0affc27..2be451d 100644 --- a/content/browser/tracing/tracing_controller_browsertest.cc +++ b/content/browser/tracing/tracing_controller_browsertest.cc @@ -220,7 +220,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest, EnableAndDisableRecording) { IN_PROC_BROWSER_TEST_F(TracingControllerTest, EnableAndDisableRecordingWithFilePath) { base::FilePath file_path; - file_util::CreateTemporaryFile(&file_path); + base::CreateTemporaryFile(&file_path); TestEnableAndDisableRecording(file_path); EXPECT_EQ(file_path.value(), last_actual_recording_file_path().value()); } @@ -246,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(TracingControllerTest, IN_PROC_BROWSER_TEST_F(TracingControllerTest, EnableCaptureAndDisableMonitoringWithFilePath) { base::FilePath file_path; - file_util::CreateTemporaryFile(&file_path); + base::CreateTemporaryFile(&file_path); TestEnableCaptureAndDisableMonitoring(file_path); EXPECT_EQ(file_path.value(), last_actual_monitoring_file_path().value()); } diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc index 1340b67..1269b7d 100644 --- a/content/browser/tracing/tracing_controller_impl.cc +++ b/content/browser/tracing/tracing_controller_impl.cc @@ -66,7 +66,7 @@ TracingControllerImpl::ResultFile::ResultFile(const base::FilePath& path) void TracingControllerImpl::ResultFile::OpenTask() { if (path_.empty()) - file_util::CreateTemporaryFile(&path_); + base::CreateTemporaryFile(&path_); file_ = file_util::OpenFile(path_, "w"); if (!file_) { LOG(ERROR) << "Failed to open " << path_.value(); diff --git a/content/browser/web_contents/web_contents_drag_win.cc b/content/browser/web_contents/web_contents_drag_win.cc index 72c1758..3a59057 100644 --- a/content/browser/web_contents/web_contents_drag_win.cc +++ b/content/browser/web_contents/web_contents_drag_win.cc @@ -247,8 +247,8 @@ void WebContentsDragWin::PrepareDragForDownload( UTF16ToUTF8(mime_type), default_name); base::FilePath temp_dir_path; - if (!file_util::CreateNewTempDirectory( - FILE_PATH_LITERAL("chrome_drag"), &temp_dir_path)) + if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("chrome_drag"), + &temp_dir_path)) return; base::FilePath download_path = temp_dir_path.Append(generated_download_file_name); diff --git a/content/child/npapi/plugin_stream_posix.cc b/content/child/npapi/plugin_stream_posix.cc index 47812688..b84a6d9 100644 --- a/content/child/npapi/plugin_stream_posix.cc +++ b/content/child/npapi/plugin_stream_posix.cc @@ -33,7 +33,7 @@ size_t PluginStream::WriteBytes(const char* buf, size_t length) { bool PluginStream::OpenTempFile() { DCHECK_EQ(static_cast<FILE*>(NULL), temp_file_); - if (file_util::CreateTemporaryFile(&temp_file_path_)) + if (base::CreateTemporaryFile(&temp_file_path_)) temp_file_ = file_util::OpenFile(temp_file_path_, "a"); if (!temp_file_) { diff --git a/content/common/sandbox_mac_diraccess_unittest.mm b/content/common/sandbox_mac_diraccess_unittest.mm index c8611df..ee109c2 100644 --- a/content/common/sandbox_mac_diraccess_unittest.mm +++ b/content/common/sandbox_mac_diraccess_unittest.mm @@ -148,7 +148,8 @@ TEST_F(MacDirAccessSandboxTest, SandboxAccess) { using file_util::CreateDirectory; base::FilePath tmp_dir; - ASSERT_TRUE(file_util::CreateNewTempDirectory("", &tmp_dir)); + ASSERT_TRUE(base::CreateNewTempDirectory(base::FilePath::StringType(), + &tmp_dir)); // This step is important on OS X since the sandbox only understands "real" // paths and the paths CreateNewTempDirectory() returns are empirically in // /var which is a symlink to /private/var . diff --git a/content/common/sandbox_mac_fontloading_unittest.mm b/content/common/sandbox_mac_fontloading_unittest.mm index d78f2f4..1285359 100644 --- a/content/common/sandbox_mac_fontloading_unittest.mm +++ b/content/common/sandbox_mac_fontloading_unittest.mm @@ -103,7 +103,7 @@ bool FontLoadingTestCase::SandboxedTest() { TEST_F(MacSandboxTest, FontLoadingTest) { base::FilePath temp_file_path; - FILE* temp_file = file_util::CreateAndOpenTemporaryFile(&temp_file_path); + FILE* temp_file = base::CreateAndOpenTemporaryFile(&temp_file_path); ASSERT_TRUE(temp_file); file_util::ScopedFILE temp_file_closer(temp_file); diff --git a/content/public/test/render_widget_test.h b/content/public/test/render_widget_test.h index 056b086..8497194 100644 --- a/content/public/test/render_widget_test.h +++ b/content/public/test/render_widget_test.h @@ -52,7 +52,7 @@ class RenderWidgetTest : public RenderViewTest { // This can be used for debugging if you want to output a bitmap // image to a file. // FilePath tmp_path; - // file_util::CreateTemporaryFile(&tmp_path); + // base::CreateTemporaryFile(&tmp_path); // OutputBitmapToFile(bitmap, tmp_path); // VLOG(0) << "Bitmap image stored at: " << tmp_path.value(); void OutputBitmapToFile(const SkBitmap& bitmap, diff --git a/content/public/test/test_launcher.cc b/content/public/test/test_launcher.cc index de05538..87a56b6 100644 --- a/content/public/test/test_launcher.cc +++ b/content/public/test/test_launcher.cc @@ -222,8 +222,8 @@ size_t WrapperTestLauncherDelegate::RunTests( if (!ContainsKey(user_data_dir_map_, full_name)) { base::FilePath temp_dir; - CHECK(file_util::CreateTemporaryDirInDir( - temp_dir_.path(), FILE_PATH_LITERAL("d"), &temp_dir)); + CHECK(base::CreateTemporaryDirInDir(temp_dir_.path(), + FILE_PATH_LITERAL("d"), &temp_dir)); user_data_dir_map_[full_name] = temp_dir; } @@ -278,8 +278,8 @@ size_t WrapperTestLauncherDelegate::RetryTests( std::string test_name_no_pre(RemoveAnyPrePrefixes(full_name)); if (!ContainsKey(user_data_dir_map_, test_name_no_pre)) { base::FilePath temp_dir; - CHECK(file_util::CreateTemporaryDirInDir( - temp_dir_.path(), FILE_PATH_LITERAL("d"), &temp_dir)); + CHECK(base::CreateTemporaryDirInDir(temp_dir_.path(), + FILE_PATH_LITERAL("d"), &temp_dir)); user_data_dir_map_[test_name_no_pre] = temp_dir; } diff --git a/courgette/memory_allocator.cc b/courgette/memory_allocator.cc index b3b8cf4..f089163 100644 --- a/courgette/memory_allocator.cc +++ b/courgette/memory_allocator.cc @@ -32,7 +32,7 @@ void TempFile::Close() { bool TempFile::Create() { DCHECK(file_ == base::kInvalidPlatformFileValue); base::FilePath path; - if (!file_util::CreateTemporaryFile(&path)) + if (!base::CreateTemporaryFile(&path)) return false; bool created = false; diff --git a/extensions/common/file_util_unittest.cc b/extensions/common/file_util_unittest.cc index 9ca883c..04afe898 100644 --- a/extensions/common/file_util_unittest.cc +++ b/extensions/common/file_util_unittest.cc @@ -56,7 +56,7 @@ TEST_F(FileUtilTest, ExtensionURLToRelativeFilePath) { TEST_F(FileUtilTest, ExtensionResourceURLToFilePath) { // Setup filesystem for testing. base::FilePath root_path; - ASSERT_TRUE(file_util::CreateNewTempDirectory( + ASSERT_TRUE(base::CreateNewTempDirectory( base::FilePath::StringType(), &root_path)); root_path = base::MakeAbsoluteFilePath(root_path); ASSERT_FALSE(root_path.empty()); diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index 89f8213..20d8ad6 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -65,7 +65,7 @@ bool CreateFileOfSpecifiedSize(const base::FilePath& temp_dir, size_t size, base::FilePath* path, std::string* data) { - if (!file_util::CreateTemporaryFileInDir(temp_dir, path)) + if (!base::CreateTemporaryFileInDir(temp_dir, path)) return false; if (size == 0) { diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index e721569..95e9ebd 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -46,7 +46,7 @@ class FileStreamTest : public PlatformTest { virtual void SetUp() { PlatformTest::SetUp(); - file_util::CreateTemporaryFile(&temp_file_path_); + base::CreateTemporaryFile(&temp_file_path_); file_util::WriteFile(temp_file_path_, kTestData, kTestDataSize); } virtual void TearDown() { diff --git a/net/base/upload_data_stream_unittest.cc b/net/base/upload_data_stream_unittest.cc index 737568a..0dca21e 100644 --- a/net/base/upload_data_stream_unittest.cc +++ b/net/base/upload_data_stream_unittest.cc @@ -171,8 +171,8 @@ TEST_F(UploadDataStreamTest, ConsumeAllBytes) { TEST_F(UploadDataStreamTest, File) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); @@ -205,8 +205,8 @@ TEST_F(UploadDataStreamTest, File) { TEST_F(UploadDataStreamTest, FileSmallerThanLength) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); const uint64 kFakeSize = kTestDataSize*2; @@ -323,8 +323,8 @@ TEST_F(UploadDataStreamTest, ReadErrorAsync) { TEST_F(UploadDataStreamTest, FileAndBytes) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); @@ -549,8 +549,8 @@ void UploadDataStreamTest::FileChangedHelper(const base::FilePath& file_path, TEST_F(UploadDataStreamTest, FileChanged) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); @@ -568,8 +568,8 @@ TEST_F(UploadDataStreamTest, FileChanged) { TEST_F(UploadDataStreamTest, MultipleInit) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); @@ -612,8 +612,8 @@ TEST_F(UploadDataStreamTest, MultipleInit) { TEST_F(UploadDataStreamTest, MultipleInitAsync) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); TestCompletionCallback test_callback; @@ -655,8 +655,8 @@ TEST_F(UploadDataStreamTest, MultipleInitAsync) { TEST_F(UploadDataStreamTest, InitToReset) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); @@ -712,8 +712,8 @@ TEST_F(UploadDataStreamTest, InitToReset) { TEST_F(UploadDataStreamTest, InitDuringAsyncInit) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); @@ -760,8 +760,8 @@ TEST_F(UploadDataStreamTest, InitDuringAsyncInit) { TEST_F(UploadDataStreamTest, InitDuringAsyncRead) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path)); ASSERT_EQ(static_cast<int>(kTestDataSize), file_util::WriteFile(temp_file_path, kTestData, kTestDataSize)); diff --git a/net/base/upload_file_element_reader_unittest.cc b/net/base/upload_file_element_reader_unittest.cc index b611846..3e7c110 100644 --- a/net/base/upload_file_element_reader_unittest.cc +++ b/net/base/upload_file_element_reader_unittest.cc @@ -26,8 +26,8 @@ class UploadFileElementReaderTest : public PlatformTest { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path_)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path_)); ASSERT_EQ( static_cast<int>(bytes_.size()), file_util::WriteFile(temp_file_path_, &bytes_[0], bytes_.size())); @@ -244,8 +244,8 @@ class UploadFileElementReaderSyncTest : public PlatformTest { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir_.path(), - &temp_file_path_)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), + &temp_file_path_)); ASSERT_EQ( static_cast<int>(bytes_.size()), file_util::WriteFile(temp_file_path_, &bytes_[0], bytes_.size())); diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 67fabf1..0029541 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -7652,7 +7652,7 @@ TEST_P(HttpNetworkTransactionTest, LargeContentLengthThenClose) { TEST_P(HttpNetworkTransactionTest, UploadFileSmallerThanLength) { base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFile(&temp_file_path)); const uint64 kFakeSize = 100000; // file is actually blank UploadFileElementReader::ScopedOverridingContentLengthForTests overriding_content_length(kFakeSize); @@ -7708,7 +7708,7 @@ TEST_P(HttpNetworkTransactionTest, UploadFileSmallerThanLength) { TEST_P(HttpNetworkTransactionTest, UploadUnreadableFile) { base::FilePath temp_file; - ASSERT_TRUE(file_util::CreateTemporaryFile(&temp_file)); + ASSERT_TRUE(base::CreateTemporaryFile(&temp_file)); std::string temp_file_content("Unreadable file."); ASSERT_TRUE(file_util::WriteFile(temp_file, temp_file_content.c_str(), temp_file_content.length())); diff --git a/net/http/http_stream_parser_unittest.cc b/net/http/http_stream_parser_unittest.cc index 3038484..e57003a 100644 --- a/net/http/http_stream_parser_unittest.cc +++ b/net/http/http_stream_parser_unittest.cc @@ -126,8 +126,8 @@ TEST(HttpStreamParser, ShouldMergeRequestHeadersAndBody_FileBody) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath temp_file_path; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), - &temp_file_path)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), + &temp_file_path)); element_readers.push_back( new UploadFileElementReader(base::MessageLoopProxy::current().get(), diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc index 03bba04..f3700f6 100644 --- a/net/proxy/proxy_config_service_linux_unittest.cc +++ b/net/proxy/proxy_config_service_linux_unittest.cc @@ -356,7 +356,7 @@ class ProxyConfigServiceLinuxTest : public PlatformTest { PlatformTest::SetUp(); // Set up a temporary KDE home directory. std::string prefix("ProxyConfigServiceLinuxTest_user_home"); - file_util::CreateNewTempDirectory(prefix, &user_home_); + base::CreateNewTempDirectory(prefix, &user_home_); kde_home_ = user_home_.Append(FILE_PATH_LITERAL(".kde")); base::FilePath path = kde_home_.Append(FILE_PATH_LITERAL("share")); path = path.Append(FILE_PATH_LITERAL("config")); diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index f58f64b..bf9fbce 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -438,7 +438,7 @@ class SpdyNetworkTransactionTest const HttpRequestInfo& CreateFilePostRequest() { if (!google_post_request_initialized_) { base::FilePath file_path; - CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); + CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); CHECK_EQ(static_cast<int>(kUploadDataSize), file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); @@ -465,7 +465,7 @@ class SpdyNetworkTransactionTest return google_post_request_; base::FilePath file_path; - CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); + CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); CHECK_EQ(static_cast<int>(kUploadDataSize), file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); CHECK(file_util::MakeFileUnreadable(file_path)); @@ -494,7 +494,7 @@ class SpdyNetworkTransactionTest CHECK_LT(kFileRangeOffset + kFileRangeLength, kUploadDataSize); base::FilePath file_path; - CHECK(file_util::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); + CHECK(base::CreateTemporaryFileInDir(temp_dir_.path(), &file_path)); CHECK_EQ(static_cast<int>(kUploadDataSize), file_util::WriteFile(file_path, kUploadData, kUploadDataSize)); diff --git a/net/url_request/url_fetcher_response_writer.cc b/net/url_request/url_fetcher_response_writer.cc index fd08a8d..1a63d40 100644 --- a/net/url_request/url_fetcher_response_writer.cc +++ b/net/url_request/url_fetcher_response_writer.cc @@ -72,7 +72,7 @@ int URLFetcherFileWriter::Initialize(const CompletionCallback& callback) { base::PostTaskAndReplyWithResult( file_task_runner_.get(), FROM_HERE, - base::Bind(&file_util::CreateTemporaryFile, temp_file_path), + base::Bind(&base::CreateTemporaryFile, temp_file_path), base::Bind(&URLFetcherFileWriter::DidCreateTempFile, weak_factory_.GetWeakPtr(), callback, diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 327ffef..9913fbc 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -742,7 +742,7 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { FillBuffer(buffer.get(), buffer_size); base::FilePath temp_path; - EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path)); + EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); GURL temp_url = FilePathToFileURL(temp_path); EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); @@ -786,7 +786,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) { FillBuffer(buffer.get(), buffer_size); base::FilePath temp_path; - EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path)); + EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); GURL temp_url = FilePathToFileURL(temp_path); EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); @@ -829,7 +829,7 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) { FillBuffer(buffer.get(), buffer_size); base::FilePath temp_path; - EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path)); + EXPECT_TRUE(base::CreateTemporaryFile(&temp_path)); GURL temp_url = FilePathToFileURL(temp_path); EXPECT_TRUE(file_util::WriteFile(temp_path, buffer.get(), buffer_size)); @@ -857,7 +857,7 @@ TEST_F(URLRequestTest, AllowFileURLs) { base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath test_file; - ASSERT_TRUE(file_util::CreateTemporaryFileInDir(temp_dir.path(), &test_file)); + ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &test_file)); std::string test_data("monkey"); file_util::WriteFile(test_file, test_data.data(), test_data.size()); GURL test_file_url = net::FilePathToFileURL(test_file); diff --git a/printing/backend/cups_helper.cc b/printing/backend/cups_helper.cc index 1ed04cb..5636f08 100644 --- a/printing/backend/cups_helper.cc +++ b/printing/backend/cups_helper.cc @@ -341,7 +341,7 @@ bool ParsePpdCapabilities( const std::string& printer_capabilities, PrinterSemanticCapsAndDefaults* printer_info) { base::FilePath ppd_file_path; - if (!file_util::CreateTemporaryFile(&ppd_file_path)) + if (!base::CreateTemporaryFile(&ppd_file_path)) return false; int data_size = printer_capabilities.length(); diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc index 44f693e..261fe73 100644 --- a/printing/emf_win_unittest.cc +++ b/printing/emf_win_unittest.cc @@ -172,8 +172,8 @@ TEST(EmfTest, FileBackedEmf) { base::ScopedTempDir scratch_metafile_dir; ASSERT_TRUE(scratch_metafile_dir.CreateUniqueTempDir()); base::FilePath metafile_path; - EXPECT_TRUE(file_util::CreateTemporaryFileInDir(scratch_metafile_dir.path(), - &metafile_path)); + EXPECT_TRUE(base::CreateTemporaryFileInDir(scratch_metafile_dir.path(), + &metafile_path)); uint32 size; std::vector<BYTE> data; { diff --git a/remoting/host/config_file_watcher_unittest.cc b/remoting/host/config_file_watcher_unittest.cc index 1d349a3..2eaffd6 100644 --- a/remoting/host/config_file_watcher_unittest.cc +++ b/remoting/host/config_file_watcher_unittest.cc @@ -94,7 +94,7 @@ void ConfigFileWatcherTest::TearDown() { // Verifies that the initial notification is delivered. TEST_F(ConfigFileWatcherTest, Basic) { - EXPECT_TRUE(file_util::CreateTemporaryFile(&config_file_)); + EXPECT_TRUE(base::CreateTemporaryFile(&config_file_)); std::string data("test"); EXPECT_NE(file_util::WriteFile(config_file_, data.c_str(), @@ -116,7 +116,7 @@ MATCHER_P(EqualsString, s, "") { // Verifies that an update notification is sent when the file is changed. TEST_F(ConfigFileWatcherTest, Update) { - EXPECT_TRUE(file_util::CreateTemporaryFile(&config_file_)); + EXPECT_TRUE(base::CreateTemporaryFile(&config_file_)); EXPECT_CALL(delegate_, OnConfigUpdated(EqualsString("test"))) .Times(1) diff --git a/remoting/host/pairing_registry_delegate_linux_unittest.cc b/remoting/host/pairing_registry_delegate_linux_unittest.cc index 70cd558..5ca9c94 100644 --- a/remoting/host/pairing_registry_delegate_linux_unittest.cc +++ b/remoting/host/pairing_registry_delegate_linux_unittest.cc @@ -19,7 +19,7 @@ class PairingRegistryDelegateLinuxTest : public testing::Test { // Create a temporary directory in order to get a unique name and use a // subdirectory to ensure that PairingRegistryDelegateLinux::Save() creates // the parent directory if it doesn't exist. - file_util::CreateNewTempDirectory("chromoting-test", &temp_dir_); + base::CreateNewTempDirectory("chromoting-test", &temp_dir_); temp_registry_ = temp_dir_.Append("paired-clients"); } diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index ad9aef0..265a42e 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc @@ -983,8 +983,8 @@ Status ChromiumEnv::UnlockFile(FileLock* lock) { Status ChromiumEnv::GetTestDirectory(std::string* path) { mu_.Acquire(); if (test_directory_.empty()) { - if (!::file_util::CreateNewTempDirectory(kLevelDBTestDirectoryPrefix, - &test_directory_)) { + if (!base::CreateNewTempDirectory(kLevelDBTestDirectoryPrefix, + &test_directory_)) { mu_.Release(); RecordErrorAt(kGetTestDirectory); return MakeIOError( diff --git a/webkit/browser/database/database_tracker.cc b/webkit/browser/database/database_tracker.cc index 19e3df8..db6ab0ad 100644 --- a/webkit/browser/database/database_tracker.cc +++ b/webkit/browser/database/database_tracker.cc @@ -402,9 +402,9 @@ bool DatabaseTracker::DeleteOrigin(const std::string& origin_identifier, // as we can't delete the origin directory on windows if it contains opened // files. base::FilePath new_origin_dir; - file_util::CreateTemporaryDirInDir(db_dir_, - kTemporaryDirectoryPrefix, - &new_origin_dir); + base::CreateTemporaryDirInDir(db_dir_, + kTemporaryDirectoryPrefix, + &new_origin_dir); base::FileEnumerator databases( origin_dir, false, diff --git a/webkit/browser/database/vfs_backend.cc b/webkit/browser/database/vfs_backend.cc index 500598a..bf43192 100644 --- a/webkit/browser/database/vfs_backend.cc +++ b/webkit/browser/database/vfs_backend.cc @@ -112,7 +112,7 @@ void VfsBackend::OpenTempFileInDirectory( // Get a unique temp file name in the database directory. base::FilePath temp_file_path; - if (!file_util::CreateTemporaryFileInDir(dir_path, &temp_file_path)) + if (!base::CreateTemporaryFileInDir(dir_path, &temp_file_path)) return; OpenFile(temp_file_path, desired_flags, file_handle); diff --git a/webkit/common/blob/shareable_file_reference_unittest.cc b/webkit/common/blob/shareable_file_reference_unittest.cc index bbbe774..5d6fc41 100644 --- a/webkit/common/blob/shareable_file_reference_unittest.cc +++ b/webkit/common/blob/shareable_file_reference_unittest.cc @@ -21,7 +21,7 @@ TEST(ShareableFileReferenceTest, TestReferences) { // Create a file. base::FilePath file; - file_util::CreateTemporaryFileInDir(temp_dir.path(), &file); + base::CreateTemporaryFileInDir(temp_dir.path(), &file); EXPECT_TRUE(base::PathExists(file)); // Create a first reference to that file. |