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 d25617547e48687cb67ba6ff81e4bf13d482e9f0..37d6938d76d9e04005eb4fa8fff1d31eb54a21b6 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" |
@@ -752,18 +753,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); |