| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/download/save_package_file_picker_chromeos.h" | 5 #include "chrome/browser/download/save_package_file_picker_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/i18n/file_util_icu.h" | 9 #include "base/i18n/file_util_icu.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS( | 39 SavePackageFilePickerChromeOS::SavePackageFilePickerChromeOS( |
| 40 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
| 41 const FilePath& suggested_path, | 41 const FilePath& suggested_path, |
| 42 const content::SavePackagePathPickedCallback& callback) | 42 const content::SavePackagePathPickedCallback& callback) |
| 43 : content::WebContentsObserver(web_contents), | 43 : content::WebContentsObserver(web_contents), |
| 44 callback_(callback) { | 44 callback_(callback) { |
| 45 if (g_should_prompt_for_filename) { | 45 if (g_should_prompt_for_filename) { |
| 46 select_file_dialog_ = ui::SelectFileDialog::Create( | 46 select_file_dialog_ = ui::SelectFileDialog::Create( |
| 47 this, new ChromeSelectFilePolicy(web_contents)); | 47 this, new ChromeSelectFilePolicy(web_contents)); |
| 48 ui::SelectFileDialog::FileTypeInfo file_types; |
| 49 file_types.support_gdata = true; |
| 48 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, | 50 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, |
| 49 string16(), | 51 string16(), |
| 50 suggested_path.ReplaceExtension("mhtml"), | 52 suggested_path.ReplaceExtension("mhtml"), |
| 51 NULL, | 53 &file_types, |
| 52 0, | 54 0, |
| 53 "mhtml", | 55 "mhtml", |
| 54 platform_util::GetTopLevel( | 56 platform_util::GetTopLevel( |
| 55 web_contents->GetNativeView()), | 57 web_contents->GetNativeView()), |
| 56 NULL); | 58 NULL); |
| 57 } else { | 59 } else { |
| 58 FileSelected(suggested_path.ReplaceExtension("mhtml"), 0, NULL); | 60 FileSelected(suggested_path.ReplaceExtension("mhtml"), 0, NULL); |
| 59 } | 61 } |
| 60 } | 62 } |
| 61 | 63 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } else { | 104 } else { |
| 103 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML, | 105 callback_.Run(selected_path, content::SAVE_PAGE_TYPE_AS_MHTML, |
| 104 content::SavePackageDownloadCreatedCallback()); | 106 content::SavePackageDownloadCreatedCallback()); |
| 105 } | 107 } |
| 106 delete this; | 108 delete this; |
| 107 } | 109 } |
| 108 | 110 |
| 109 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) { | 111 void SavePackageFilePickerChromeOS::FileSelectionCanceled(void* params) { |
| 110 delete this; | 112 delete this; |
| 111 } | 113 } |
| OLD | NEW |