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/shell_dialogs/select_file_dialog_win.h" | 5 #include "ui/shell_dialogs/select_file_dialog_win.h" |
6 | 6 |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/i18n/case_conversion.h" | 15 #include "base/i18n/case_conversion.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/message_loop/message_loop_proxy.h" | 17 #include "base/message_loop/message_loop_proxy.h" |
18 #include "base/strings/utf_string_conversions.h" | |
19 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
20 #include "base/tuple.h" | 19 #include "base/tuple.h" |
21 #include "base/win/registry.h" | 20 #include "base/win/registry.h" |
22 #include "base/win/scoped_comptr.h" | 21 #include "base/win/scoped_comptr.h" |
23 #include "base/win/shortcut.h" | 22 #include "base/win/shortcut.h" |
24 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
25 #include "ui/aura/window_event_dispatcher.h" | 24 #include "ui/aura/window_event_dispatcher.h" |
26 #include "ui/aura/window_tree_host.h" | 25 #include "ui/aura/window_tree_host.h" |
27 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/base/win/open_file_name_win.h" | 27 #include "ui/base/win/open_file_name_win.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 std::wstring ext_name = first_extension; | 126 std::wstring ext_name = first_extension; |
128 size_t ext_index = ext_name.find_first_not_of(L'.'); | 127 size_t ext_index = ext_name.find_first_not_of(L'.'); |
129 if (ext_index != std::wstring::npos) | 128 if (ext_index != std::wstring::npos) |
130 ext_name = ext_name.substr(ext_index); | 129 ext_name = ext_name.substr(ext_index); |
131 | 130 |
132 if (!GetRegistryDescriptionFromExtension(first_extension, &desc)) { | 131 if (!GetRegistryDescriptionFromExtension(first_extension, &desc)) { |
133 // The extension doesn't exist in the registry. Create a description | 132 // The extension doesn't exist in the registry. Create a description |
134 // based on the unknown extension type (i.e. if the extension is .qqq, | 133 // based on the unknown extension type (i.e. if the extension is .qqq, |
135 // the we create a description "QQQ File (.qqq)"). | 134 // the we create a description "QQQ File (.qqq)"). |
136 include_all_files = true; | 135 include_all_files = true; |
137 desc = l10n_util::GetStringFUTF16( | 136 desc = l10n_util::GetStringFUTF16(IDS_APP_SAVEAS_EXTENSION_FORMAT, |
138 IDS_APP_SAVEAS_EXTENSION_FORMAT, | 137 base::i18n::ToUpper(ext_name), |
139 base::i18n::ToUpper(base::WideToUTF16(ext_name)), | 138 ext_name); |
140 ext_name); | |
141 } | 139 } |
142 if (desc.empty()) | 140 if (desc.empty()) |
143 desc = L"*." + ext_name; | 141 desc = L"*." + ext_name; |
144 } | 142 } |
145 | 143 |
146 result.append(desc.c_str(), desc.size() + 1); // Append NULL too. | 144 result.append(desc.c_str(), desc.size() + 1); // Append NULL too. |
147 result.append(ext.c_str(), ext.size() + 1); | 145 result.append(ext.c_str(), ext.size() + 1); |
148 } | 146 } |
149 | 147 |
150 if (include_all_files) { | 148 if (include_all_files) { |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 SelectFileDialog* CreateDefaultWinSelectFileDialog( | 766 SelectFileDialog* CreateDefaultWinSelectFileDialog( |
769 SelectFileDialog::Listener* listener, | 767 SelectFileDialog::Listener* listener, |
770 SelectFilePolicy* policy) { | 768 SelectFilePolicy* policy) { |
771 return CreateWinSelectFileDialog(listener, | 769 return CreateWinSelectFileDialog(listener, |
772 policy, | 770 policy, |
773 base::Bind(&CallBuiltinGetOpenFileName), | 771 base::Bind(&CallBuiltinGetOpenFileName), |
774 base::Bind(&CallBuiltinGetSaveFileName)); | 772 base::Bind(&CallBuiltinGetSaveFileName)); |
775 } | 773 } |
776 | 774 |
777 } // namespace ui | 775 } // namespace ui |
OLD | NEW |