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 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 browse_info.lpfn = &BrowseCallbackProc; | 542 browse_info.lpfn = &BrowseCallbackProc; |
543 } | 543 } |
544 | 544 |
545 LPITEMIDLIST list = SHBrowseForFolder(&browse_info); | 545 LPITEMIDLIST list = SHBrowseForFolder(&browse_info); |
546 DisableOwner(owner); | 546 DisableOwner(owner); |
547 if (list) { | 547 if (list) { |
548 STRRET out_dir_buffer; | 548 STRRET out_dir_buffer; |
549 ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer)); | 549 ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer)); |
550 out_dir_buffer.uType = STRRET_WSTR; | 550 out_dir_buffer.uType = STRRET_WSTR; |
551 base::win::ScopedComPtr<IShellFolder> shell_folder; | 551 base::win::ScopedComPtr<IShellFolder> shell_folder; |
552 if (SHGetDesktopFolder(shell_folder.Receive()) == NOERROR) { | 552 if (SHGetDesktopFolder(shell_folder.GetAddressOf()) == NOERROR) { |
553 HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING, | 553 HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING, |
554 &out_dir_buffer); | 554 &out_dir_buffer); |
555 if (SUCCEEDED(hr) && out_dir_buffer.uType == STRRET_WSTR) { | 555 if (SUCCEEDED(hr) && out_dir_buffer.uType == STRRET_WSTR) { |
556 *path = base::FilePath(out_dir_buffer.pOleStr); | 556 *path = base::FilePath(out_dir_buffer.pOleStr); |
557 CoTaskMemFree(out_dir_buffer.pOleStr); | 557 CoTaskMemFree(out_dir_buffer.pOleStr); |
558 result = true; | 558 result = true; |
559 } else { | 559 } else { |
560 // Use old way if we don't get what we want. | 560 // Use old way if we don't get what we want. |
561 wchar_t old_out_dir_buffer[MAX_PATH + 1]; | 561 wchar_t old_out_dir_buffer[MAX_PATH + 1]; |
562 if (SHGetPathFromIDList(list, old_out_dir_buffer)) { | 562 if (SHGetPathFromIDList(list, old_out_dir_buffer)) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 710 |
711 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, | 711 SelectFileDialog* CreateSelectFileDialog(SelectFileDialog::Listener* listener, |
712 SelectFilePolicy* policy) { | 712 SelectFilePolicy* policy) { |
713 return CreateWinSelectFileDialog(listener, | 713 return CreateWinSelectFileDialog(listener, |
714 policy, | 714 policy, |
715 base::Bind(&CallBuiltinGetOpenFileName), | 715 base::Bind(&CallBuiltinGetOpenFileName), |
716 base::Bind(&CallBuiltinGetSaveFileName)); | 716 base::Bind(&CallBuiltinGetSaveFileName)); |
717 } | 717 } |
718 | 718 |
719 } // namespace ui | 719 } // namespace ui |
OLD | NEW |