| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 select_file_dialog_ = ui::SelectFileDialog::Create( | 73 select_file_dialog_ = ui::SelectFileDialog::Create( |
| 74 this, new ChromeSelectFilePolicy(web_contents)); | 74 this, new ChromeSelectFilePolicy(web_contents)); |
| 75 ui::SelectFileDialog::FileTypeInfo file_type_info; | 75 ui::SelectFileDialog::FileTypeInfo file_type_info; |
| 76 FilePath::StringType extension = suggested_path_.Extension(); | 76 FilePath::StringType extension = suggested_path_.Extension(); |
| 77 if (!extension.empty()) { | 77 if (!extension.empty()) { |
| 78 extension.erase(extension.begin()); // drop the . | 78 extension.erase(extension.begin()); // drop the . |
| 79 file_type_info.extensions.resize(1); | 79 file_type_info.extensions.resize(1); |
| 80 file_type_info.extensions[0].push_back(extension); | 80 file_type_info.extensions[0].push_back(extension); |
| 81 } | 81 } |
| 82 file_type_info.include_all_files = true; | 82 file_type_info.include_all_files = true; |
| 83 file_type_info.support_gdata = true; |
| 83 gfx::NativeWindow owning_window = web_contents ? | 84 gfx::NativeWindow owning_window = web_contents ? |
| 84 platform_util::GetTopLevel(web_contents->GetNativeView()) : NULL; | 85 platform_util::GetTopLevel(web_contents->GetNativeView()) : NULL; |
| 85 | 86 |
| 86 select_file_dialog_->SelectFile( | 87 select_file_dialog_->SelectFile( |
| 87 ui::SelectFileDialog::SELECT_SAVEAS_FILE, | 88 ui::SelectFileDialog::SELECT_SAVEAS_FILE, |
| 88 string16(), | 89 string16(), |
| 89 suggested_path_, | 90 suggested_path_, |
| 90 &file_type_info, | 91 &file_type_info, |
| 91 0, | 92 0, |
| 92 FILE_PATH_LITERAL(""), | 93 FILE_PATH_LITERAL(""), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 118 RecordFileSelected(path); | 119 RecordFileSelected(path); |
| 119 OnFileSelected(path); | 120 OnFileSelected(path); |
| 120 // Deletes |this| | 121 // Deletes |this| |
| 121 } | 122 } |
| 122 | 123 |
| 123 void DownloadFilePicker::FileSelectionCanceled(void* params) { | 124 void DownloadFilePicker::FileSelectionCanceled(void* params) { |
| 124 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); | 125 RecordFilePickerResult(download_manager_, FILE_PICKER_CANCEL); |
| 125 OnFileSelected(FilePath()); | 126 OnFileSelected(FilePath()); |
| 126 // Deletes |this| | 127 // Deletes |this| |
| 127 } | 128 } |
| OLD | NEW |