diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:07:55 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-18 16:07:55 +0000 |
commit | 33edeab42b851a5617a77caa1d65a3782a01ee7b (patch) | |
tree | d1baa44ff796c9f0c4881e9819e7e5b359489b1d | |
parent | f348b92e95dd67fef3a9a6109bc0465fb4078d6b (diff) | |
download | chromium_src-33edeab42b851a5617a77caa1d65a3782a01ee7b.zip chromium_src-33edeab42b851a5617a77caa1d65a3782a01ee7b.tar.gz chromium_src-33edeab42b851a5617a77caa1d65a3782a01ee7b.tar.bz2 |
Renames the function CreateTemporaryFilename to CreateTemporaryFile and track down all callers, also removes the
deprecated function that uses std::wstring.
BUG=3078 (http://crbug.com/3078)
TEST=run base_unittests, installer_util_unittests, net_unittests, setup_unittests, and unit_tests.
Review URL: http://codereview.chromium.org/164537
Patch from Thiago Farina.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23631 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/file_util.cc | 7 | ||||
-rw-r--r-- | base/file_util.h | 13 | ||||
-rw-r--r-- | base/file_util_posix.cc | 9 | ||||
-rw-r--r-- | base/file_util_unittest.cc | 8 | ||||
-rw-r--r-- | base/file_util_win.cc | 24 | ||||
-rw-r--r-- | chrome/browser/download/download_file.cc | 2 | ||||
-rw-r--r-- | chrome/browser/download/save_file.cc | 2 | ||||
-rw-r--r-- | chrome/browser/download/save_package.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_updater.cc | 2 | ||||
-rw-r--r-- | chrome/browser/jumplist.cc | 8 | ||||
-rw-r--r-- | chrome/browser/renderer_host/file_system_accessor_unittest.cc | 2 | ||||
-rw-r--r-- | chrome/installer/setup/setup_util_unittest.cc | 7 | ||||
-rw-r--r-- | chrome/installer/setup/uninstall.cc | 23 | ||||
-rw-r--r-- | chrome/installer/util/master_preferences_unittest.cc | 21 | ||||
-rw-r--r-- | chrome/installer/util/move_tree_work_item.cc | 10 | ||||
-rw-r--r-- | chrome/renderer/render_view_unittest.cc | 4 | ||||
-rw-r--r-- | net/base/file_stream_unittest.cc | 2 | ||||
-rw-r--r-- | net/url_request/url_request_unittest.cc | 6 | ||||
-rw-r--r-- | webkit/glue/plugins/plugin_stream_posix.cc | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell_gtk.cc | 4 |
20 files changed, 76 insertions, 82 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index 505dfb4..d632b96 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -343,13 +343,6 @@ bool CreateNewTempDirectory(const std::wstring& prefix, *new_temp_path = temp_path.ToWStringHack(); return true; } -bool CreateTemporaryFileName(std::wstring* temp_file) { - FilePath temp_file_path; - if (!CreateTemporaryFileName(&temp_file_path)) - return false; - *temp_file = temp_file_path.ToWStringHack(); - return true; -} bool Delete(const std::wstring& path, bool recursive) { return Delete(FilePath::FromWStringHack(path), recursive); } diff --git a/base/file_util.h b/base/file_util.h index 71780f8..1c1a79f 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -283,12 +283,7 @@ bool GetShmemTempDir(FilePath* path); // 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. -// TODO(erikkay): rename this function and track down all of the callers. -// (Clarification of erik's comment: the intent is to rename the BlahFileName() -// calls into BlahFile(), since they create temp files (not temp filenames).) -bool CreateTemporaryFileName(FilePath* path); -// Deprecated temporary compatibility function. -bool CreateTemporaryFileName(std::wstring* temp_file); +bool CreateTemporaryFile(FilePath* path); // Create and open a temporary file. File is opened for read/write. // The full path is placed in |path|, and the function returns true if @@ -300,9 +295,9 @@ FILE* CreateAndOpenTemporaryShmemFile(FilePath* path); // Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|. FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path); -// Same as CreateTemporaryFileName but the file is created in |dir|. -bool CreateTemporaryFileNameInDir(const std::wstring& dir, - std::wstring* temp_file); +// Same as CreateTemporaryFile but the file is created in |dir|. +bool CreateTemporaryFileInDir(const FilePath& dir, + FilePath* temp_file); // Create a new directory under TempPath. If prefix is provided, the new // directory name is in the format of prefixyyyy. diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 5a02278..b02df8e 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -387,7 +387,7 @@ int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) { return mkstemp(buffer); } -bool CreateTemporaryFileName(FilePath* path) { +bool CreateTemporaryFile(FilePath* path) { FilePath directory; if (!GetTempDir(&directory)) return false; @@ -413,10 +413,9 @@ FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { return fdopen(fd, "a+"); } - -bool CreateTemporaryFileNameInDir(const std::wstring& dir, - std::wstring* temp_file) { - // Not implemented yet. +// TODO(port): implement me. +bool CreateTemporaryFileInDir(const FilePath& dir, + FilePath* temp_file) { NOTREACHED(); return false; } diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 7dff868..b1f7822 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -777,10 +777,10 @@ TEST_F(FileUtilTest, CopyAndDeleteDirectoryTest) { } #endif -TEST_F(FileUtilTest, CreateTemporaryFileNameTest) { - std::wstring temp_files[3]; +TEST_F(FileUtilTest, CreateTemporaryFileTest) { + FilePath temp_files[3]; for (int i = 0; i < 3; i++) { - ASSERT_TRUE(file_util::CreateTemporaryFileName(&(temp_files[i]))); + ASSERT_TRUE(file_util::CreateTemporaryFile(&(temp_files[i]))); EXPECT_TRUE(file_util::PathExists(temp_files[i])); EXPECT_FALSE(file_util::DirectoryExists(temp_files[i])); } @@ -790,7 +790,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileNameTest) { EXPECT_TRUE(file_util::Delete(temp_files[i], false)); } -TEST_F(FileUtilTest, CreateAndOpenTemporaryFileNameTest) { +TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) { FilePath names[3]; FILE *fps[3]; int i; diff --git a/base/file_util_win.cc b/base/file_util_win.cc index c83322e..cffe72e 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -445,14 +445,14 @@ bool GetShmemTempDir(FilePath* path) { return GetTempDir(path); } -bool CreateTemporaryFileName(FilePath* path) { - std::wstring temp_path, temp_file; +bool CreateTemporaryFile(FilePath* path) { + FilePath temp_file; - if (!GetTempDir(&temp_path)) + if (!GetTempDir(path)) return false; - if (CreateTemporaryFileNameInDir(temp_path, &temp_file)) { - *path = FilePath(temp_file); + if (CreateTemporaryFileInDir(*path, &temp_file)) { + *path = temp_file; return true; } @@ -468,29 +468,29 @@ FILE* CreateAndOpenTemporaryShmemFile(FilePath* path) { // TODO(jrg): is there equivalent call to use on Windows instead of // going 2-step? FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) { - std::wstring wstring_path; - if (!CreateTemporaryFileNameInDir(dir.value(), &wstring_path)) { + if (!CreateTemporaryFileInDir(dir, path)) { return NULL; } - *path = FilePath(wstring_path); // 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+"); } -bool CreateTemporaryFileNameInDir(const std::wstring& dir, - std::wstring* temp_file) { +bool CreateTemporaryFileInDir(const FilePath& dir, + FilePath* temp_file) { wchar_t temp_name[MAX_PATH + 1]; - if (!GetTempFileName(dir.c_str(), L"", 0, temp_name)) + if (!GetTempFileName(dir.value().c_str(), L"", 0, temp_name)) return false; // fail! DWORD path_len = GetLongPathName(temp_name, temp_name, MAX_PATH); if (path_len > MAX_PATH + 1 || path_len == 0) return false; // fail! - temp_file->assign(temp_name, path_len); + std::wstring temp_file_str; + temp_file_str.assign(temp_name, path_len); + *temp_file = FilePath(temp_file_str); return true; } diff --git a/chrome/browser/download/download_file.cc b/chrome/browser/download/download_file.cc index 6d8b675..970cc49 100644 --- a/chrome/browser/download/download_file.cc +++ b/chrome/browser/download/download_file.cc @@ -73,7 +73,7 @@ DownloadFile::~DownloadFile() { } bool DownloadFile::Initialize() { - if (file_util::CreateTemporaryFileName(&full_path_)) + if (file_util::CreateTemporaryFile(&full_path_)) return Open("wb"); return false; } diff --git a/chrome/browser/download/save_file.cc b/chrome/browser/download/save_file.cc index cb83a87..b4755ff 100644 --- a/chrome/browser/download/save_file.cc +++ b/chrome/browser/download/save_file.cc @@ -22,7 +22,7 @@ SaveFile::SaveFile(const SaveFileCreateInfo* info) in_progress_(true) { DCHECK(info); DCHECK(info->path.empty()); - if (file_util::CreateTemporaryFileName(&full_path_)) + if (file_util::CreateTemporaryFile(&full_path_)) Open("wb"); } diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index 452a2ba..cfd6e05 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -345,7 +345,7 @@ bool SavePackage::GenerateFilename(const std::string& disposition, if (ordinal_number > (kMaxFileOrdinalNumber - 1)) { // Use a random file from temporary file. FilePath temp_file; - file_util::CreateTemporaryFileName(&temp_file); + file_util::CreateTemporaryFile(&temp_file); file_name = temp_file.RemoveExtension().BaseName().value(); // Get safe pure file name. if (!GetSafePureFileName(saved_main_directory_path_, diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 6ae956d..ad3e6f3 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -72,7 +72,7 @@ class ExtensionUpdaterFileHandler DCHECK(MessageLoop::current() == file_io_loop_); FilePath path; - if (!file_util::CreateTemporaryFileName(&path)) { + if (!file_util::CreateTemporaryFile(&path)) { LOG(WARNING) << "Failed to create temporary file path"; return; } diff --git a/chrome/browser/jumplist.cc b/chrome/browser/jumplist.cc index 81342aa..26b0e75 100644 --- a/chrome/browser/jumplist.cc +++ b/chrome/browser/jumplist.cc @@ -243,18 +243,18 @@ bool CreateIconFile(const SkBitmap& bitmap, // Retrieve the path to a temporary file. // We don't have to care about the extension of this temporary file because // JumpList does not care about it. - std::wstring path; - if (!file_util::CreateTemporaryFileNameInDir(icon_dir, &path)) + FilePath path; + if (!file_util::CreateTemporaryFileInDir(FilePath(icon_dir), &path)) return false; // Create an icon file from the favicon attached to the given |page|, and // save it as the temporary file. - if (!IconUtil::CreateIconFileFromSkBitmap(bitmap, path)) + if (!IconUtil::CreateIconFileFromSkBitmap(bitmap, path.value())) return false; // Add this icon file to the list and return its absolute path. // The IShellLink::SetIcon() function needs the absolute path to an icon. - icon_path->assign(path); + icon_path->assign(path.value()); return true; } diff --git a/chrome/browser/renderer_host/file_system_accessor_unittest.cc b/chrome/browser/renderer_host/file_system_accessor_unittest.cc index ad60112..81b8b94 100644 --- a/chrome/browser/renderer_host/file_system_accessor_unittest.cc +++ b/chrome/browser/renderer_host/file_system_accessor_unittest.cc @@ -101,7 +101,7 @@ TEST_F(FileSystemAccessorTest, GetFileSizeWithParam) { TEST_F(FileSystemAccessorTest, GetFileSizeEmptyFile) { FilePath path; - EXPECT_TRUE(file_util::CreateTemporaryFileName(&path)); + EXPECT_TRUE(file_util::CreateTemporaryFile(&path)); FileAutoDeleter deleter(path); TestGetFileSize(path, NULL, 0, NULL); diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index 6223f37..39003bc 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -66,8 +66,8 @@ TEST_F(SetupUtilTest, ApplyDiffPatchTest) { // Test that we are parsing master preferences correctly. TEST_F(SetupUtilTest, GetInstallPreferencesTest) { // Create a temporary prefs file. - std::wstring prefs_file; - ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs_file)); + FilePath prefs_file; + ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file)); const char text[] = "{ \n" " \"distribution\": { \n" @@ -81,7 +81,8 @@ TEST_F(SetupUtilTest, GetInstallPreferencesTest) { EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); // Make sure command line values override the values in master preferences. - std::wstring cmd_str(L"setup.exe --installerdata=\"" + prefs_file + L"\""); + std::wstring cmd_str( + L"setup.exe --installerdata=\"" + prefs_file.value() + L"\""); cmd_str.append(L" --create-all-shortcuts"); cmd_str.append(L" --do-not-launch-chrome"); cmd_str.append(L" --alt-desktop-shortcut"); diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 460c4a2..206cf72 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -158,22 +158,25 @@ bool DeleteFilesAndFolders(const std::wstring& exe_path, bool system_uninstall, install_path, installed_version.GetString())); file_util::AppendToPath(&setup_exe, file_util::GetFilenameFromPath(exe_path)); - std::wstring temp_file; - if (!file_util::CreateTemporaryFileName(&temp_file)) + FilePath temp_file; + if (!file_util::CreateTemporaryFile(&temp_file)) { LOG(ERROR) << "Failed to create temporary file for setup.exe."; - else - file_util::Move(setup_exe, temp_file); + } else { + FilePath setup_exe_path = FilePath::FromWStringHack(setup_exe); + file_util::Move(setup_exe_path, temp_file); + } // Move the browser's persisted local state FilePath user_local_state; if (chrome::GetDefaultUserDataDirectory(&user_local_state)) { - std::wstring user_local_file( - user_local_state.Append(chrome::kLocalStateFilename).value()); + FilePath user_local_file( + user_local_state.Append(chrome::kLocalStateFilename)); - if (!file_util::CreateTemporaryFileName(local_state_path)) + FilePath path = FilePath::FromWStringHack(*local_state_path); + if (!file_util::CreateTemporaryFile(&path)) LOG(ERROR) << "Failed to create temporary file for Local State."; - else - file_util::CopyFile(user_local_file, *local_state_path); + else + file_util::CopyFile(user_local_file, path); } LOG(INFO) << "Deleting install path " << install_path; @@ -317,7 +320,7 @@ bool installer_setup::DeleteChromeRegistrationKeys(HKEY root, file_util::AppendToPath(&app_path_key, installer_util::kChromeExe); DeleteRegistryKey(key, app_path_key); - //Cleanup OpenWithList + // Cleanup OpenWithList for (int i = 0; ShellUtil::kFileAssociations[i] != NULL; i++) { std::wstring open_with_key(ShellUtil::kRegClasses); file_util::AppendToPath(&open_with_key, ShellUtil::kFileAssociations[i]); diff --git a/chrome/installer/util/master_preferences_unittest.cc b/chrome/installer/util/master_preferences_unittest.cc index 8132374..24eacae 100644 --- a/chrome/installer/util/master_preferences_unittest.cc +++ b/chrome/installer/util/master_preferences_unittest.cc @@ -24,8 +24,8 @@ class MasterPreferencesTest : public testing::Test { } // namespace TEST(MasterPreferencesTest, ParseDistroParams) { - std::wstring prefs_file; - ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs_file)); + FilePath prefs_file; + ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file)); const char text[] = "{ \n" " \"distribution\": { \n" @@ -54,8 +54,7 @@ TEST(MasterPreferencesTest, ParseDistroParams) { EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); scoped_ptr<DictionaryValue> prefs( - installer_util::ParseDistributionPreferences( - FilePath::FromWStringHack(prefs_file))); + installer_util::ParseDistributionPreferences(prefs_file)); EXPECT_TRUE(prefs.get() != NULL); EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), installer_util::master_preferences::kDistroSkipFirstRunPref)); @@ -104,8 +103,8 @@ TEST(MasterPreferencesTest, ParseDistroParams) { } TEST(MasterPreferencesTest, ParseMissingDistroParams) { - std::wstring prefs_file; - ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs_file)); + FilePath prefs_file; + ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file)); const char text[] = "{ \n" " \"distribution\": { \n" @@ -120,8 +119,7 @@ TEST(MasterPreferencesTest, ParseMissingDistroParams) { EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); scoped_ptr<DictionaryValue> prefs( - installer_util::ParseDistributionPreferences( - FilePath::FromWStringHack(prefs_file))); + installer_util::ParseDistributionPreferences(prefs_file)); EXPECT_TRUE(prefs.get() != NULL); EXPECT_TRUE(installer_util::GetDistroBooleanPreference(prefs.get(), installer_util::master_preferences::kDistroSkipFirstRunPref)); @@ -159,8 +157,8 @@ TEST(MasterPreferencesTest, ParseMissingDistroParams) { } TEST(MasterPreferencesTest, FirstRunTabs) { - std::wstring prefs_file; - ASSERT_TRUE(file_util::CreateTemporaryFileName(&prefs_file)); + FilePath prefs_file; + ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file)); const char text[] = "{ \n" " \"distribution\": { \n" @@ -175,8 +173,7 @@ TEST(MasterPreferencesTest, FirstRunTabs) { EXPECT_TRUE(file_util::WriteFile(prefs_file, text, sizeof(text))); scoped_ptr<DictionaryValue> prefs( - installer_util::ParseDistributionPreferences( - FilePath::FromWStringHack(prefs_file))); + installer_util::ParseDistributionPreferences(prefs_file)); EXPECT_TRUE(prefs.get() != NULL); typedef std::vector<std::wstring> TabsVector; diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index da35ec1..b90665e 100644 --- a/chrome/installer/util/move_tree_work_item.cc +++ b/chrome/installer/util/move_tree_work_item.cc @@ -30,20 +30,26 @@ bool MoveTreeWorkItem::Do() { return false; } + FilePath backup_path; + // If dest_path_ exists, move destination to a backup path. if (file_util::PathExists(dest_path_)) { // Generate a backup path that can keep the original files under dest_path_. - if (!file_util::CreateTemporaryFileNameInDir(temp_dir_, &backup_path_)) { + if (!file_util::CreateTemporaryFileInDir(FilePath(temp_dir_), + &backup_path)) { LOG(ERROR) << "Failed to get backup path in folder " << temp_dir_; return false; } + backup_path_ = backup_path.value(); + if (file_util::Move(dest_path_, backup_path_)) { moved_to_backup_ = true; LOG(INFO) << "Moved destination " << dest_path_ << " to backup path " << backup_path_; } else { - LOG(ERROR) << "failed moving " << dest_path_ << " to " << backup_path_; + LOG(ERROR) << "failed moving " << dest_path_ + << " to " << backup_path_; return false; } } diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc index 24bfe2d..f09b361 100644 --- a/chrome/renderer/render_view_unittest.cc +++ b/chrome/renderer/render_view_unittest.cc @@ -478,11 +478,11 @@ TEST_F(RenderViewTest, PrintLayoutTest) { // Save the source data and the bitmap data into temporary files to // create base-line results. FilePath source_path; - file_util::CreateTemporaryFileName(&source_path); + file_util::CreateTemporaryFile(&source_path); render_thread_.printer()->SaveSource(0, source_path.value()); FilePath bitmap_path; - file_util::CreateTemporaryFileName(&bitmap_path); + file_util::CreateTemporaryFile(&bitmap_path); render_thread_.printer()->SaveBitmap(0, bitmap_path.value()); } } diff --git a/net/base/file_stream_unittest.cc b/net/base/file_stream_unittest.cc index f430d8e..76909eb 100644 --- a/net/base/file_stream_unittest.cc +++ b/net/base/file_stream_unittest.cc @@ -21,7 +21,7 @@ class FileStreamTest : public PlatformTest { virtual void SetUp() { PlatformTest::SetUp(); - file_util::CreateTemporaryFileName(&temp_file_path_); + file_util::CreateTemporaryFile(&temp_file_path_); file_util::WriteFile(temp_file_path_.ToWStringHack(), kTestData, kTestDataSize); } diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 7a56d29..93c29f2 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -664,7 +664,7 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { FillBuffer(buffer.get(), buffer_size); FilePath temp_path; - EXPECT_TRUE(file_util::CreateTemporaryFileName(&temp_path)); + EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path)); GURL temp_url = net::FilePathToFileURL(temp_path); file_util::WriteFile(temp_path, buffer.get(), buffer_size); @@ -708,7 +708,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) { FillBuffer(buffer.get(), buffer_size); FilePath temp_path; - EXPECT_TRUE(file_util::CreateTemporaryFileName(&temp_path)); + EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path)); GURL temp_url = net::FilePathToFileURL(temp_path); file_util::WriteFile(temp_path, buffer.get(), buffer_size); @@ -751,7 +751,7 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) { FillBuffer(buffer.get(), buffer_size); FilePath temp_path; - EXPECT_TRUE(file_util::CreateTemporaryFileName(&temp_path)); + EXPECT_TRUE(file_util::CreateTemporaryFile(&temp_path)); GURL temp_url = net::FilePathToFileURL(temp_path); file_util::WriteFile(temp_path, buffer.get(), buffer_size); diff --git a/webkit/glue/plugins/plugin_stream_posix.cc b/webkit/glue/plugins/plugin_stream_posix.cc index 102db78..d0e2291 100644 --- a/webkit/glue/plugins/plugin_stream_posix.cc +++ b/webkit/glue/plugins/plugin_stream_posix.cc @@ -51,7 +51,7 @@ size_t PluginStream::WriteBytes(const char *buf, size_t length) { bool PluginStream::OpenTempFile() { DCHECK(temp_file_ == NULL); - if (file_util::CreateTemporaryFileName(&temp_file_path_)) + if (file_util::CreateTemporaryFile(&temp_file_path_)) temp_file_ = file_util::OpenFile(temp_file_path_, "a"); if (!temp_file_) { diff --git a/webkit/tools/test_shell/test_shell_gtk.cc b/webkit/tools/test_shell/test_shell_gtk.cc index 1f5931b..501aadd 100644 --- a/webkit/tools/test_shell/test_shell_gtk.cc +++ b/webkit/tools/test_shell/test_shell_gtk.cc @@ -184,7 +184,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode) { StringPiece font_config_xml; g_resource_data_pack->Get(IDR_LINUX_FONT_CONFIG, &font_config_xml); FilePath fontconfig_path; - if (!file_util::CreateTemporaryFileName(&fontconfig_path)) { + if (!file_util::CreateTemporaryFile(&fontconfig_path)) { LOG(FATAL) << "failed to create temp font config file"; } if (-1 == file_util::WriteFile(fontconfig_path.ToWStringHack(), @@ -273,7 +273,7 @@ void TestShell::InitializeTestShell(bool layout_test_mode) { StringPiece ahem_font; g_resource_data_pack->Get(IDR_AHEM_FONT, &ahem_font); g_ahem_path = new FilePath; - if (!file_util::CreateTemporaryFileName(g_ahem_path)) { + if (!file_util::CreateTemporaryFile(g_ahem_path)) { LOG(FATAL) << "failed to create temp ahem font"; } if (-1 == file_util::WriteFile(g_ahem_path->ToWStringHack(), ahem_font.data(), |