diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-23 11:05:00 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-23 11:05:00 +0000 |
commit | 94354a8557587906b9601ca10fd514cd7fad2a8e (patch) | |
tree | bbc0a54a2b4725cd99a77ae70ce0301f6555f79b /chrome/browser/download | |
parent | 1b34b6c1adca80677a5edea423c03142db8c95ce (diff) | |
download | chromium_src-94354a8557587906b9601ca10fd514cd7fad2a8e.zip chromium_src-94354a8557587906b9601ca10fd514cd7fad2a8e.tar.gz chromium_src-94354a8557587906b9601ca10fd514cd7fad2a8e.tar.bz2 |
download: Move GenerateFileNameFromRequest() into chrome_download_manager_delegate.cc
BUG=104549
R=asanka@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10809030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/chrome_download_manager_delegate.cc | 19 | ||||
-rw-r--r-- | chrome/browser/download/download_util.cc | 13 | ||||
-rw-r--r-- | chrome/browser/download/download_util.h | 6 |
3 files changed, 18 insertions, 20 deletions
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index cffda03..644b3d9 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -44,6 +44,7 @@ #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_intents_dispatcher.h" #include "grit/generated_resources.h" +#include "net/base/net_util.h" #include "ui/base/l10n/l10n_util.h" #include "webkit/glue/web_intent_data.h" @@ -101,6 +102,22 @@ class SafeBrowsingState : public DownloadCompletionBlocker { SafeBrowsingState::~SafeBrowsingState() {} +// Generate a filename based on the response from the server. Similar +// in operation to net::GenerateFileName(), but uses a localized +// default name. +void GenerateFileNameFromRequest(const DownloadItem& download_item, + FilePath* generated_name) { + std::string default_file_name( + l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); + + *generated_name = net::GenerateFileName(download_item.GetURL(), + download_item.GetContentDisposition(), + download_item.GetReferrerCharset(), + download_item.GetSuggestedFilename(), + download_item.GetMimeType(), + default_file_name); +} + } // namespace ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile) @@ -634,7 +651,7 @@ void ChromeDownloadManagerDelegate::CheckVisitedReferrerBeforeDone( // Allow extensions to be explicitly saved. if (!is_forced_path) { FilePath generated_name; - download_util::GenerateFileNameFromRequest(*download, &generated_name); + GenerateFileNameFromRequest(*download, &generated_name); // Freeze the user's preference for showing a Save As dialog. We're going // to bounce around a bunch of threads and we don't want to worry about race diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index d28f4e1..f4fe085 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -174,19 +174,6 @@ bool DownloadPathIsDangerous(const FilePath& download_path) { return (download_path == desktop_dir); } -void GenerateFileNameFromRequest(const DownloadItem& download_item, - FilePath* generated_name) { - std::string default_file_name( - l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME)); - - *generated_name = net::GenerateFileName(download_item.GetURL(), - download_item.GetContentDisposition(), - download_item.GetReferrerCharset(), - download_item.GetSuggestedFilename(), - download_item.GetMimeType(), - default_file_name); -} - // Download progress painting -------------------------------------------------- // Common images used for download progress animations. We load them once the diff --git a/chrome/browser/download/download_util.h b/chrome/browser/download/download_util.h index f0c4edc..cb1bdac 100644 --- a/chrome/browser/download/download_util.h +++ b/chrome/browser/download/download_util.h @@ -44,12 +44,6 @@ const FilePath& GetDefaultDownloadDirectory(); // Return true if the |download_path| is dangerous path. bool DownloadPathIsDangerous(const FilePath& download_path); -// Generate a filename based on the response from the server. Similar -// in operation to net::GenerateFileName(), but uses a localized -// default name. -void GenerateFileNameFromRequest(const content::DownloadItem& download_item, - FilePath* generated_name); - // Download progress animations ------------------------------------------------ // Arc sweep angle for use with downloads of unknown size |