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

Unified Diff: chrome/browser/download/save_package_file_picker_chromeos.cc

Issue 12084075: SavePackageFilePickerChromeOS should only force MHTML when saving HTML, not when saving text/image/… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r185696 Created 7 years, 10 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/download/save_package_file_picker_chromeos.cc
diff --git a/chrome/browser/download/save_package_file_picker_chromeos.cc b/chrome/browser/download/save_package_file_picker_chromeos.cc
index f9f8ab11eef504795d498440f5e2c513f7639534..31a4f6460fead9636716c79dedf8ca2114c1cd30 100644
--- a/chrome/browser/download/save_package_file_picker_chromeos.cc
+++ b/chrome/browser/download/save_package_file_picker_chromeos.cc
@@ -27,6 +27,7 @@ bool g_should_prompt_for_filename = true;
// Trampoline callback between SubstituteDriveDownloadPath() and |callback|.
void ContinueSettingUpDriveDownload(
const content::SavePackagePathPickedCallback& callback,
+ bool is_html,
Profile* profile,
const base::FilePath& drive_path,
const base::FilePath& drive_tmp_download_path) {
@@ -34,7 +35,10 @@ void ContinueSettingUpDriveDownload(
return;
callback.Run(
- drive_tmp_download_path, content::SAVE_PAGE_TYPE_AS_MHTML,
+ drive_tmp_download_path,
+ (is_html ?
+ content::SAVE_PAGE_TYPE_AS_MHTML :
+ content::SAVE_PAGE_TYPE_AS_ONLY_HTML),
base::Bind(&drive::DriveDownloadHandler::SetDownloadParams,
base::Unretained(
drive::DriveDownloadHandler::GetForProfile(profile)),
@@ -46,9 +50,14 @@ void ContinueSettingUpDriveDownload(
SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS(
content::WebContents* web_contents,
const base::FilePath& suggested_path,
+ bool is_html,
const content::SavePackagePathPickedCallback& callback)
: content::WebContentsObserver(web_contents),
- callback_(callback) {
+ callback_(callback),
+ is_html_(is_html) {
+ base::FilePath suggested_path_copy(is_html_ ?
+ suggested_path.ReplaceExtension("mhtml") :
+ suggested_path);
if (g_should_prompt_for_filename) {
select_file_dialog_ = ui::SelectFileDialog::Create(
this, new ChromeSelectFilePolicy(web_contents));
@@ -57,14 +66,14 @@ SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS(
select_file_dialog_->SelectFile(
ui::SelectFileDialog::SELECT_SAVEAS_FILE,
string16(),
- suggested_path.ReplaceExtension("mhtml"),
+ suggested_path_copy,
&file_types,
0,
- "mhtml",
+ suggested_path_copy.Extension(),
platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()),
NULL);
} else {
- FileSelected(suggested_path.ReplaceExtension("mhtml"), 0, NULL);
+ FileSelected(suggested_path_copy, 0, NULL);
}
}
@@ -112,10 +121,14 @@ void SavePackageFilePickerChromeOS::FileSelectedWithExtraInfo(
SubstituteDriveDownloadPath(selected_path, NULL,
base::Bind(&ContinueSettingUpDriveDownload,
callback_,
+ is_html_,
profile,
selected_path));
} else {
- callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML,
+ callback_.Run(selected_path,
+ (is_html_ ?
+ content::SAVE_PAGE_TYPE_AS_MHTML :
+ content::SAVE_PAGE_TYPE_AS_ONLY_HTML),
content::SavePackageDownloadCreatedCallback());
}
delete this;
« no previous file with comments | « chrome/browser/download/save_package_file_picker_chromeos.h ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698