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

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

Issue 7300005: Move filename determination to net_util (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 4 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/chrome_tests.gypi ('k') | net/base/net_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/save_package.cc
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index f1e31a183db61c938d3a8a0c1b1b5b06fbf14a72..67a88d94ae57157ecd5d2e978dc4c59a9b200ca1 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -365,21 +365,9 @@ bool SavePackage::GenerateFileName(const std::string& disposition,
bool need_html_ext,
FilePath::StringType* generated_name) {
// TODO(jungshik): Figure out the referrer charset when having one
- // makes sense and pass it to GetSuggestedFilename.
- string16 suggested_name =
- net::GetSuggestedFilename(url, disposition, "", "",
- ASCIIToUTF16(kDefaultSaveName));
-
- // 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)
- FilePath file_path = FilePath(suggested_name);
-#else
- FilePath file_path = FilePath(
- base::SysWideToNativeMB(UTF16ToWide(suggested_name)));
-#endif
+ // makes sense and pass it to GenerateFileName.
+ FilePath file_path = net::GenerateFileName(url, disposition, "", "", "",
+ ASCIIToUTF16(kDefaultSaveName));
DCHECK(!file_path.empty());
FilePath::StringType pure_file_name =
@@ -1234,8 +1222,10 @@ void SavePackage::OnPathPicked(const FilePath& final_name,
SavePackageType type) {
// Ensure the filename is safe.
saved_main_file_path_ = final_name;
- download_util::GenerateSafeFileName(tab_contents()->contents_mime_type(),
- &saved_main_file_path_);
+ // TODO(asanka): This call may block on IO and shouldn't be made
+ // from the UI thread. See http://crbug.com/61827.
+ net::GenerateSafeFileName(tab_contents()->contents_mime_type(),
+ &saved_main_file_path_);
saved_main_directory_path_ = saved_main_file_path_.DirName();
save_type_ = type;
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698