summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm14
-rw-r--r--chrome/browser/ui/gtk/tab_contents_drag_source.cc13
-rw-r--r--chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc14
3 files changed, 17 insertions, 24 deletions
diff --git a/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm b/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm
index 24ef3b4..b3283b5 100644
--- a/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm
+++ b/chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm
@@ -69,7 +69,7 @@ FilePath GetFileNameFromDragData(const WebDropData& drop_data) {
if (file_name.empty()) {
// Retrieve the name from the URL.
string16 suggested_filename =
- net::GetSuggestedFilename(drop_data.url, "", "", string16());
+ net::GetSuggestedFilename(drop_data.url, "", "", "", string16());
file_name = FilePathFromFilename(suggested_filename);
}
@@ -402,13 +402,11 @@ void PromiseWriterTask::Run() {
&mimeType,
&fileName,
&downloadURL_)) {
- std::string contentDisposition =
- "attachment; filename=" + fileName.value();
- download_util::GenerateFileName(downloadURL_,
- contentDisposition,
- std::string(),
- UTF16ToUTF8(mimeType),
- &downloadFileName_);
+ download_util::GenerateFileNameFromSuggestedName(
+ downloadURL_,
+ fileName.value(),
+ UTF16ToUTF8(mimeType),
+ &downloadFileName_);
fileExtension = SysUTF8ToNSString(downloadFileName_.Extension());
}
}
diff --git a/chrome/browser/ui/gtk/tab_contents_drag_source.cc b/chrome/browser/ui/gtk/tab_contents_drag_source.cc
index 4ae83bb..1da585e 100644
--- a/chrome/browser/ui/gtk/tab_contents_drag_source.cc
+++ b/chrome/browser/ui/gtk/tab_contents_drag_source.cc
@@ -291,15 +291,12 @@ void TabContentsDragSource::OnDragBegin(GtkWidget* sender,
GdkDragContext* drag_context) {
if (!download_url_.is_empty()) {
// Generate the file name based on both mime type and proposed file name.
- std::string download_mime_type = UTF16ToUTF8(wide_download_mime_type_);
- std::string content_disposition("attachment; filename=");
- content_disposition += download_file_name_.value();
FilePath generated_download_file_name;
- download_util::GenerateFileName(download_url_,
- content_disposition,
- std::string(),
- download_mime_type,
- &generated_download_file_name);
+ download_util::GenerateFileNameFromSuggestedName(
+ download_url_,
+ download_file_name_.value(),
+ UTF16ToUTF8(wide_download_mime_type_),
+ &generated_download_file_name);
// Pass the file name to the drop target by setting the source window's
// XdndDirectSave0 property.
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 1a45e4d..71480b2 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
@@ -196,14 +196,12 @@ void TabContentsDragWin::PrepareDragForDownload(
return;
// Generate the download filename.
- std::string content_disposition =
- "attachment; filename=" + UTF16ToUTF8(file_name.value());
FilePath generated_file_name;
- download_util::GenerateFileName(download_url,
- content_disposition,
- std::string(),
- UTF16ToUTF8(mime_type),
- &generated_file_name);
+ download_util::GenerateFileNameFromSuggestedName(
+ download_url,
+ UTF16ToUTF8(file_name.value()),
+ UTF16ToUTF8(mime_type),
+ &generated_file_name);
// Provide the data as file (CF_HDROP). A temporary download file with the
// Zone.Identifier ADS (Alternate Data Stream) attached will be created.
@@ -232,7 +230,7 @@ void TabContentsDragWin::PrepareDragForFileContents(
if (file_name.value().empty()) {
// Retrieve the name from the URL.
file_name = FilePath(
- net::GetSuggestedFilename(drop_data.url, "", "", string16()));
+ net::GetSuggestedFilename(drop_data.url, "", "", "", string16()));
if (file_name.value().size() + drop_data.file_extension.size() + 1 >
MAX_PATH) {
file_name = FilePath(file_name.value().substr(