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

Unified Diff: chrome/browser/ui/download/download_tab_helper.cc

Issue 6973052: When the download folder does not exist, change the download folder to a user's "Downloads" (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Remove PathServiceWrapper and add DefaultDownloadDirectory Created 9 years, 6 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: chrome/browser/ui/download/download_tab_helper.cc
diff --git a/chrome/browser/ui/download/download_tab_helper.cc b/chrome/browser/ui/download/download_tab_helper.cc
index 54a95de7cb309ef8540421f3420cc00d67d88237..e40252328f4cc5cf606220b81b01c9fac1130c43 100644
--- a/chrome/browser/ui/download/download_tab_helper.cc
+++ b/chrome/browser/ui/download/download_tab_helper.cc
@@ -54,9 +54,6 @@ void DownloadTabHelper::OnSaveURL(const GURL& url) {
dlm->DownloadUrl(url, tab_contents()->GetURL(), "", tab_contents());
}
-// Used in automated testing to bypass prompting the user for file names.
-// Instead, the names and paths are hard coded rather than running them through
-// file name sanitation and extension / mime checking.
bool DownloadTabHelper::SavePage(const FilePath& main_file,
const FilePath& dir_path,
SavePackage::SavePackageType save_type) {
@@ -65,9 +62,23 @@ bool DownloadTabHelper::SavePage(const FilePath& main_file,
save_package_ =
new SavePackage(tab_contents_wrapper_, save_type, main_file, dir_path);
+ // Skips GetSaveInfo() and directly calls Init().
+ // We do not have to explicitly disable the select file dialog
+ // since we skip the process that can show the dialog.
return save_package_->Init();
}
+string16 DownloadTabHelper::SavePageBasedOnDefaultPrefs() {
+ tab_contents()->Stop();
+
+ save_package_ = new SavePackage(tab_contents_wrapper_);
+ // Disables the select file dialog.
+ save_package_->SetShouldPromptUser(false);
+ // This GetSaveInfo() calls save_package_->Init() in the background.
+ save_package_->GetSaveInfo();
+ return tab_contents()->GetTitle();
+}
+
bool DownloadTabHelper::CanDownload(int request_id) {
if (delegate_)
return delegate_->CanDownload(request_id);

Powered by Google App Engine
This is Rietveld 408576698