| 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 b14a4cc6bb49f2c6c1741bf15e495c018a3cc6e8..e88e3ade5d084d6ce33590ad774879596b3f0956 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"
|
| @@ -777,18 +778,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);
|
|
|