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

Unified Diff: content/browser/tab_contents/tab_contents.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: Added URLRequestMockHTTPJob.test_dir_ and URLRequestMockHTTPJob.temp_dir_ Created 9 years, 5 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: content/browser/tab_contents/tab_contents.cc
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 04a11986b4efce7052049284eb852a8c68f1b56d..a315419735c74b65ca694a5f2d4fb347430f53b8 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/download/download_request_limiter.h"
#include "chrome/browser/download/download_util.h"
#include "content/browser/browser_context.h"
+#include "chrome/browser/download/save_package_file_picker.h"
#include "content/browser/child_process_security_policy.h"
#include "content/browser/content_browser_client.h"
#include "content/browser/debugger/devtools_manager.h"
@@ -740,18 +741,29 @@ void TabContents::OnSavePage() {
save_package_->GetSaveInfo();
}
-// 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 TabContents::SavePage(const FilePath& main_file, const FilePath& dir_path,
SavePackage::SavePackageType save_type) {
// Stop the page from navigating.
Stop();
save_package_ = new SavePackage(this, 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 TabContents::SavePageBasedOnDefaultPrefs() {
+ Stop();
+
+ save_package_ = new SavePackage(this);
+ // Disables the select file dialog.
+ SavePackageFilePicker::SetShouldPromptUser(false);
+ // This GetSaveInfo() calls save_package_->Init() in the background.
+ save_package_->GetSaveInfo();
+ return GetTitle();
+}
+
void TabContents::OnSaveURL(const GURL& url) {
DownloadManager* dlm = browser_context()->GetDownloadManager();
dlm->DownloadUrl(url, GetURL(), "", this);

Powered by Google App Engine
This is Rietveld 408576698