Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: chrome/browser/download/save_package.cc

Issue 271056: Do some cleanup of file path name handling. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/shell_integration_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/save_package.cc
===================================================================
--- chrome/browser/download/save_package.cc (revision 29772)
+++ chrome/browser/download/save_package.cc (working copy)
@@ -65,7 +65,7 @@
// Default name which will be used when we can not get proper name from
// resource URL.
-const wchar_t kDefaultSaveName[] = L"saved_resource";
+const char kDefaultSaveName[] = "saved_resource";
const FilePath::CharType kDefaultHtmlExtension[] =
#if defined(OS_WIN)
@@ -336,8 +336,8 @@
FilePath::StringType* generated_name) {
// TODO(jungshik): Figure out the referrer charset when having one
// makes sense and pass it to GetSuggestedFilename.
- FilePath file_path = FilePath::FromWStringHack(
- net::GetSuggestedFilename(url, disposition, "", kDefaultSaveName));
+ FilePath file_path = net::GetSuggestedFilename(url, disposition, "",
+ kDefaultSaveName);
DCHECK(!file_path.empty());
FilePath::StringType pure_file_name =
@@ -1033,13 +1033,9 @@
if (can_save_as_complete)
name_with_proper_ext = EnsureHtmlExtension(name_with_proper_ext);
- std::wstring file_name = name_with_proper_ext.ToWStringHack();
- // TODO(port): we need a version of ReplaceIllegalCharacters() that takes
- // FilePaths.
- file_util::ReplaceIllegalCharacters(&file_name, L' ');
- TrimWhitespace(file_name, TRIM_ALL, &file_name);
-
- return FilePath::FromWStringHack(file_name);
+ FilePath::StringType file_name = name_with_proper_ext.value();
+ file_util::ReplaceIllegalCharactersInPath(&file_name, ' ');
+ return FilePath(file_name);
}
FilePath SavePackage::EnsureHtmlExtension(const FilePath& name) {
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | chrome/browser/shell_integration_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698