| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/shell_dialogs.h" | 5 #include "chrome/browser/shell_dialogs.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 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 const std::wstring& filter, | 884 const std::wstring& filter, |
| 885 HWND owner, | 885 HWND owner, |
| 886 std::vector<FilePath>* paths) { | 886 std::vector<FilePath>* paths) { |
| 887 OPENFILENAME ofn; | 887 OPENFILENAME ofn; |
| 888 // We must do this otherwise the ofn's FlagsEx may be initialized to random | 888 // We must do this otherwise the ofn's FlagsEx may be initialized to random |
| 889 // junk in release builds which can cause the Places Bar not to show up! | 889 // junk in release builds which can cause the Places Bar not to show up! |
| 890 ZeroMemory(&ofn, sizeof(ofn)); | 890 ZeroMemory(&ofn, sizeof(ofn)); |
| 891 ofn.lStructSize = sizeof(ofn); | 891 ofn.lStructSize = sizeof(ofn); |
| 892 ofn.hwndOwner = owner; | 892 ofn.hwndOwner = owner; |
| 893 | 893 |
| 894 wchar_t filename[MAX_PATH] = L""; | 894 scoped_array<wchar_t> filename(new wchar_t[UNICODE_STRING_MAX_CHARS]); |
| 895 filename[0] = 0; |
| 895 | 896 |
| 896 ofn.lpstrFile = filename; | 897 ofn.lpstrFile = filename.get(); |
| 897 ofn.nMaxFile = MAX_PATH; | 898 ofn.nMaxFile = UNICODE_STRING_MAX_CHARS; |
| 898 // We use OFN_NOCHANGEDIR so that the user can rename or delete the directory | 899 // We use OFN_NOCHANGEDIR so that the user can rename or delete the directory |
| 899 // without having to close Chrome first. | 900 // without having to close Chrome first. |
| 900 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER | 901 ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_EXPLORER |
| 901 | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT; | 902 | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT; |
| 902 | 903 |
| 903 if (!filter.empty()) { | 904 if (!filter.empty()) { |
| 904 ofn.lpstrFilter = filter.c_str(); | 905 ofn.lpstrFilter = filter.c_str(); |
| 905 } | 906 } |
| 906 bool success = !!GetOpenFileName(&ofn); | 907 bool success = !!GetOpenFileName(&ofn); |
| 907 DisableOwner(owner); | 908 DisableOwner(owner); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) { | 1121 void SelectFontDialogImpl::FontNotSelected(void* params, RunState run_state) { |
| 1121 if (listener_) | 1122 if (listener_) |
| 1122 listener_->FontSelectionCanceled(params); | 1123 listener_->FontSelectionCanceled(params); |
| 1123 EndRun(run_state); | 1124 EndRun(run_state); |
| 1124 } | 1125 } |
| 1125 | 1126 |
| 1126 // static | 1127 // static |
| 1127 SelectFontDialog* SelectFontDialog::Create(Listener* listener) { | 1128 SelectFontDialog* SelectFontDialog::Create(Listener* listener) { |
| 1128 return new SelectFontDialogImpl(listener); | 1129 return new SelectFontDialogImpl(listener); |
| 1129 } | 1130 } |
| OLD | NEW |