From 63597e4ebc117bb561b93f4d775d787120e6728a Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Thu, 8 Jul 2010 17:49:05 +0000 Subject: Deprecate most of the remaining wstring file_util functions. These still exist on Windows due to being used by the installer, but by moving them into the Windows-only block we prevent them from being used in new code. (I am already finding new code using some of these! I am glad to be rid of them.) BUG=24672 Review URL: http://codereview.chromium.org/2850042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51862 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/download/download_manager.cc | 5 +++-- chrome/browser/download/download_util.cc | 3 +-- chrome/browser/download/save_package.cc | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'chrome/browser/download') diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index b41be08..fe4a463 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -1327,8 +1327,9 @@ void DownloadManager::GenerateExtension( FILE_PATH_LITERAL("download"); // See if our file name already contains an extension. - FilePath::StringType extension( - file_util::GetFileExtensionFromPath(file_name)); + FilePath::StringType extension = file_name.Extension(); + if (!extension.empty()) + extension.erase(extension.begin()); // Erase preceding '.'. #if defined(OS_WIN) // Rename shell-integrated extensions. diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 2da4c14..591eb83 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -490,8 +490,7 @@ void UpdateAppIconDownloadProgress(int download_count, // Appends the passed the number between parenthesis the path before the // extension. void AppendNumberToPath(FilePath* path, int number) { - file_util::InsertBeforeExtension(path, - StringPrintf(FILE_PATH_LITERAL(" (%d)"), number)); + *path = path->InsertBeforeExtensionASCII(StringPrintf(" (%d)", number)); } // Attempts to find a number that can be appended to that path to make it diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc index db34e35..f95ba7c 100644 --- a/chrome/browser/download/save_package.cc +++ b/chrome/browser/download/save_package.cc @@ -1084,7 +1084,9 @@ FilePath SavePackage::GetSuggestedNameForSaveAs(const FilePath& name, FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) { // If the file name doesn't have an extension suitable for HTML files, // append one. - FilePath::StringType ext = file_util::GetFileExtensionFromPath(name); + FilePath::StringType ext = name.Extension(); + if (!ext.empty()) + ext.erase(ext.begin()); // Erase preceding '.'. std::string mime_type; if (!net::GetMimeTypeFromExtension(ext, &mime_type) || !CanSaveAsComplete(mime_type)) { -- cgit v1.1