Index: chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc |
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc |
index 7857c4b90b70be4048ef4d047e4b36ddccc98460..8eac87ba3c4d537c5ce5b42f3ccef09784fb7c23 100644 |
--- a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc |
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc |
@@ -16,7 +16,6 @@ |
#include "base/threading/thread.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/bookmarks/bookmark_node_data.h" |
-#include "chrome/browser/download/download_util.h" |
#include "chrome/browser/tab_contents/web_drag_source_win.h" |
#include "chrome/browser/tab_contents/web_drag_utils_win.h" |
#include "chrome/browser/tab_contents/web_drop_target_win.h" |
@@ -26,6 +25,7 @@ |
#include "content/browser/download/drag_download_file.h" |
#include "content/browser/download/drag_download_util.h" |
#include "content/browser/tab_contents/tab_contents.h" |
+#include "content/public/browser/content_browser_client.h" |
#include "net/base/net_util.h" |
#include "views/drag_utils.h" |
#include "webkit/glue/webdropdata.h" |
@@ -197,19 +197,22 @@ void TabContentsDragWin::PrepareDragForDownload( |
&download_url)) |
return; |
- // Generate the download filename. |
- FilePath generated_file_name; |
- download_util::GenerateFileNameFromSuggestedName( |
- download_url, |
- UTF16ToUTF8(file_name.value()), |
- UTF16ToUTF8(mime_type), |
- &generated_file_name); |
+ // Generate the file name based on both mime type and proposed file name. |
+ std::string default_name = |
+ content::GetContentClient()->browser()->GetDefaultDownloadName(); |
+ FilePath generated_download_file_name = |
+ net::GenerateFileName(download_url, |
+ std::string(), |
+ std::string(), |
+ UTF16ToUTF8(file_name.value()), |
+ UTF16ToUTF8(mime_type), |
+ default_name); |
// Provide the data as file (CF_HDROP). A temporary download file with the |
// Zone.Identifier ADS (Alternate Data Stream) attached will be created. |
linked_ptr<net::FileStream> empty_file_stream; |
scoped_refptr<DragDownloadFile> download_file = |
- new DragDownloadFile(generated_file_name, |
+ new DragDownloadFile(generated_download_file_name, |
empty_file_stream, |
download_url, |
page_url, |