| 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 "ui/base/dialogs/select_file_dialog_win.h" | 5 #include "ui/base/dialogs/select_file_dialog_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <commdlg.h> | 8 #include <commdlg.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 | 10 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 std::wstring FormatFilterForExtensions( | 119 std::wstring FormatFilterForExtensions( |
| 120 const std::vector<std::wstring>& file_ext, | 120 const std::vector<std::wstring>& file_ext, |
| 121 const std::vector<std::wstring>& ext_desc, | 121 const std::vector<std::wstring>& ext_desc, |
| 122 bool include_all_files) { | 122 bool include_all_files) { |
| 123 const std::wstring all_ext = L"*.*"; | 123 const std::wstring all_ext = L"*.*"; |
| 124 const std::wstring all_desc = | 124 const std::wstring all_desc = |
| 125 l10n_util::GetStringUTF16(IDS_APP_SAVEAS_ALL_FILES); | 125 l10n_util::GetStringUTF16(IDS_APP_SAVEAS_ALL_FILES); |
| 126 | 126 |
| 127 DCHECK(file_ext.size() >= ext_desc.size()); | 127 DCHECK(file_ext.size() >= ext_desc.size()); |
| 128 | 128 |
| 129 if (file_ext.empty()) |
| 130 include_all_files = true; |
| 131 |
| 129 std::wstring result; | 132 std::wstring result; |
| 130 | 133 |
| 131 for (size_t i = 0; i < file_ext.size(); ++i) { | 134 for (size_t i = 0; i < file_ext.size(); ++i) { |
| 132 std::wstring ext = file_ext[i]; | 135 std::wstring ext = file_ext[i]; |
| 133 std::wstring desc; | 136 std::wstring desc; |
| 134 if (i < ext_desc.size()) | 137 if (i < ext_desc.size()) |
| 135 desc = ext_desc[i]; | 138 desc = ext_desc[i]; |
| 136 | 139 |
| 137 if (ext.empty()) { | 140 if (ext.empty()) { |
| 138 // Force something reasonable to appear in the dialog box if there is no | 141 // Force something reasonable to appear in the dialog box if there is no |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 void* params) | 437 void* params) |
| 435 : type(type), | 438 : type(type), |
| 436 title(title), | 439 title(title), |
| 437 default_path(default_path), | 440 default_path(default_path), |
| 438 file_type_index(file_type_index), | 441 file_type_index(file_type_index), |
| 439 default_extension(default_extension), | 442 default_extension(default_extension), |
| 440 run_state(run_state), | 443 run_state(run_state), |
| 441 ui_proxy(MessageLoopForUI::current()->message_loop_proxy()), | 444 ui_proxy(MessageLoopForUI::current()->message_loop_proxy()), |
| 442 owner(owner), | 445 owner(owner), |
| 443 params(params) { | 446 params(params) { |
| 444 if (file_types) { | 447 if (file_types) |
| 445 this->file_types = *file_types; | 448 this->file_types = *file_types; |
| 446 } else { | |
| 447 this->file_types.include_all_files = true; | |
| 448 } | |
| 449 } | 449 } |
| 450 SelectFileDialog::Type type; | 450 SelectFileDialog::Type type; |
| 451 std::wstring title; | 451 std::wstring title; |
| 452 FilePath default_path; | 452 FilePath default_path; |
| 453 FileTypeInfo file_types; | 453 FileTypeInfo file_types; |
| 454 int file_type_index; | 454 int file_type_index; |
| 455 std::wstring default_extension; | 455 std::wstring default_extension; |
| 456 RunState run_state; | 456 RunState run_state; |
| 457 scoped_refptr<base::MessageLoopProxy> ui_proxy; | 457 scoped_refptr<base::MessageLoopProxy> ui_proxy; |
| 458 HWND owner; | 458 HWND owner; |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 return return_value; | 855 return return_value; |
| 856 } | 856 } |
| 857 | 857 |
| 858 SelectFileDialog* CreateWinSelectFileDialog( | 858 SelectFileDialog* CreateWinSelectFileDialog( |
| 859 SelectFileDialog::Listener* listener, | 859 SelectFileDialog::Listener* listener, |
| 860 SelectFilePolicy* policy) { | 860 SelectFilePolicy* policy) { |
| 861 return new SelectFileDialogImpl(listener, policy); | 861 return new SelectFileDialogImpl(listener, policy); |
| 862 } | 862 } |
| 863 | 863 |
| 864 } // namespace ui | 864 } // namespace ui |
| OLD | NEW |