| 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/download_file_picker.h" | 5 #include "chrome/browser/download/download_file_picker.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "chrome/browser/download/download_prefs.h" | 8 #include "chrome/browser/download/download_prefs.h" |
| 9 #include "chrome/browser/platform_util.h" | 9 #include "chrome/browser/platform_util.h" |
| 10 #include "chrome/browser/ui/chrome_select_file_policy.h" | 10 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 extension.erase(extension.begin()); // drop the . | 79 extension.erase(extension.begin()); // drop the . |
| 80 file_type_info.extensions.resize(1); | 80 file_type_info.extensions.resize(1); |
| 81 file_type_info.extensions[0].push_back(extension); | 81 file_type_info.extensions[0].push_back(extension); |
| 82 } | 82 } |
| 83 file_type_info.include_all_files = true; | 83 file_type_info.include_all_files = true; |
| 84 file_type_info.support_drive = true; | 84 file_type_info.support_drive = true; |
| 85 gfx::NativeWindow owning_window = web_contents ? | 85 gfx::NativeWindow owning_window = web_contents ? |
| 86 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) : | 86 platform_util::GetTopLevel(web_contents->GetView()->GetNativeView()) : |
| 87 NULL; | 87 NULL; |
| 88 | 88 |
| 89 select_file_dialog_->SelectFile( | 89 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_SAVEAS_FILE, |
| 90 ui::SelectFileDialog::SELECT_SAVEAS_FILE, | 90 string16(), |
| 91 string16(), | 91 suggested_path_, |
| 92 suggested_path_, | 92 &file_type_info, |
| 93 &file_type_info, | 93 0, |
| 94 0, | 94 base::FilePath::StringType(), |
| 95 FILE_PATH_LITERAL(""), | 95 owning_window, |
| 96 owning_window, | 96 NULL); |
| 97 NULL); | |
| 98 } | 97 } |
| 99 | 98 |
| 100 DownloadFilePicker::~DownloadFilePicker() { | 99 DownloadFilePicker::~DownloadFilePicker() { |
| 101 } | 100 } |
| 102 | 101 |
| 103 void DownloadFilePicker::InitSuggestedPath( | 102 void DownloadFilePicker::InitSuggestedPath( |
| 104 DownloadItem* item, | 103 DownloadItem* item, |
| 105 const base::FilePath& suggested_path) { | 104 const base::FilePath& suggested_path) { |
| 106 set_suggested_path(suggested_path); | 105 set_suggested_path(suggested_path); |
| 107 } | 106 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 122 RecordFileSelected(path); | 121 RecordFileSelected(path); |
| 123 OnFileSelected(path); | 122 OnFileSelected(path); |
| 124 // Deletes |this| | 123 // Deletes |this| |
| 125 } | 124 } |
| 126 | 125 |
| 127 void DownloadFilePicker::FileSelectionCanceled(void* params) { | 126 void DownloadFilePicker::FileSelectionCanceled(void* params) { |
| 128 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); | 127 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); |
| 129 OnFileSelected(base::FilePath()); | 128 OnFileSelected(base::FilePath()); |
| 130 // Deletes |this| | 129 // Deletes |this| |
| 131 } | 130 } |
| OLD | NEW |