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

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: Comments Created 9 years, 5 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
Index: content/browser/download/save_package.cc
diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc
index 8670bb831d5395cbdcddd3059dd57f8175d07f4f..9f9a2854566ce594f32ad3519ff345f0c6f61ae5 100644
--- a/content/browser/download/save_package.cc
+++ b/content/browser/download/save_package.cc
@@ -371,21 +371,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 =
@@ -1278,8 +1266,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 is going to block on IO and shouldn't be
+ // made from the UI thread.
rvargas (doing something else) 2011/07/26 22:25:41 Could you clarify (for me) what does this mean?. A
asanka 2011/07/28 20:04:38 This is documenting a pre-existing problem. net::
+ net::GenerateSafeFileName(tab_contents()->contents_mime_type(),
+ &saved_main_file_path_);
saved_main_directory_path_ = saved_main_file_path_.DirName();
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | net/base/net_util.h » ('j') | net/base/net_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698