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

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

Issue 6241001: wstring: make net::GetSuggestedFilename return utf-16 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed Created 9 years, 11 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/bookmarks/bookmark_utils.cc ('k') | chrome/browser/download/download_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_util.cc
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index c958213eb636ff4648fb92da511303d4478aef29..9fa60b3a5670c44c967146a3825955f565bc56b9 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -217,20 +217,24 @@ void GenerateFileName(const GURL& url,
const std::string& referrer_charset,
const std::string& mime_type,
FilePath* generated_name) {
-#if defined(OS_WIN)
- FilePath default_file_path(
+ string16 default_file_name(
l10n_util::GetStringUTF16(IDS_DEFAULT_DOWNLOAD_FILENAME));
-#elif defined(OS_POSIX)
- std::string default_file =
- l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME);
- FilePath default_file_path(
- base::SysWideToNativeMB(base::SysUTF8ToWide(default_file)));
-#endif
- *generated_name = net::GetSuggestedFilename(GURL(url),
- content_disposition,
- referrer_charset,
- default_file_path);
+ string16 new_name = net::GetSuggestedFilename(GURL(url),
+ content_disposition,
+ referrer_charset,
+ default_file_name);
+
+ // TODO(evan): this code is totally wrong -- we should just generate
+ // Unicode filenames and do all this encoding switching at the end.
+ // However, I'm just shuffling wrong code around, at least not adding
+ // to it.
+#if defined(OS_WIN)
+ *generated_name = FilePath(new_name);
+#else
+ *generated_name = FilePath(
+ base::SysWideToNativeMB(UTF16ToWide(new_name)));
+#endif
DCHECK(!generated_name->empty());
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils.cc ('k') | chrome/browser/download/download_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698