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 |
11 #include <algorithm> | 11 #include <algorithm> |
12 #include <set> | 12 #include <set> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/i18n/case_conversion.h" | 17 #include "base/i18n/case_conversion.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/message_loop_proxy.h" | 19 #include "base/message_loop_proxy.h" |
20 #include "base/string_split.h" | 20 #include "base/string_split.h" |
21 #include "base/threading/thread.h" | 21 #include "base/threading/thread.h" |
22 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
23 #include "base/win/metro.h" | 23 #include "base/win/metro.h" |
24 #include "base/win/registry.h" | 24 #include "base/win/registry.h" |
25 #include "base/win/scoped_comptr.h" | 25 #include "base/win/scoped_comptr.h" |
| 26 #include "base/win/shortcut.h" |
26 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
27 #include "grit/ui_strings.h" | 28 #include "grit/ui_strings.h" |
28 #include "ui/base/dialogs/base_shell_dialog_win.h" | 29 #include "ui/base/dialogs/base_shell_dialog_win.h" |
29 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/gfx/native_widget_types.h" | 31 #include "ui/gfx/native_widget_types.h" |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 // Given |extension|, if it's not empty, then remove the leading dot. | 35 // Given |extension|, if it's not empty, then remove the leading dot. |
35 std::wstring GetExtensionWithoutLeadingDot(const std::wstring& extension) { | 36 std::wstring GetExtensionWithoutLeadingDot(const std::wstring& extension) { |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 // Use old way if we don't get what we want. | 693 // Use old way if we don't get what we want. |
693 wchar_t old_out_dir_buffer[MAX_PATH + 1]; | 694 wchar_t old_out_dir_buffer[MAX_PATH + 1]; |
694 if (SHGetPathFromIDList(list, old_out_dir_buffer)) { | 695 if (SHGetPathFromIDList(list, old_out_dir_buffer)) { |
695 *path = FilePath(old_out_dir_buffer); | 696 *path = FilePath(old_out_dir_buffer); |
696 result = true; | 697 result = true; |
697 } | 698 } |
698 } | 699 } |
699 | 700 |
700 // According to MSDN, win2000 will not resolve shortcuts, so we do it | 701 // According to MSDN, win2000 will not resolve shortcuts, so we do it |
701 // ourself. | 702 // ourself. |
702 file_util::ResolveShortcut(*path, path, NULL); | 703 base::win::ResolveShortcut(*path, path, NULL); |
703 } | 704 } |
704 CoTaskMemFree(list); | 705 CoTaskMemFree(list); |
705 } | 706 } |
706 return result; | 707 return result; |
707 } | 708 } |
708 | 709 |
709 bool SelectFileDialogImpl::RunOpenFileDialog( | 710 bool SelectFileDialogImpl::RunOpenFileDialog( |
710 const std::wstring& title, | 711 const std::wstring& title, |
711 const std::wstring& filter, | 712 const std::wstring& filter, |
712 HWND owner, | 713 HWND owner, |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 return return_value; | 855 return return_value; |
855 } | 856 } |
856 | 857 |
857 SelectFileDialog* CreateWinSelectFileDialog( | 858 SelectFileDialog* CreateWinSelectFileDialog( |
858 SelectFileDialog::Listener* listener, | 859 SelectFileDialog::Listener* listener, |
859 SelectFilePolicy* policy) { | 860 SelectFilePolicy* policy) { |
860 return new SelectFileDialogImpl(listener, policy); | 861 return new SelectFileDialogImpl(listener, policy); |
861 } | 862 } |
862 | 863 |
863 } // namespace ui | 864 } // namespace ui |
OLD | NEW |