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

Unified Diff: chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc

Issue 8380021: Make all drag sources not depend on download_util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: header path Created 9 years, 2 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/ui/cocoa/tab_contents/web_drag_source.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chrome/browser/ui/cocoa/tab_contents/web_drag_source.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698