OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/platform_util.h" | 5 #include "chrome/browser/platform_util.h" |
6 | 6 |
7 #include <commdlg.h> | 7 #include <commdlg.h> |
8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 if (FAILED(hr)) | 77 if (FAILED(hr)) |
78 return; | 78 return; |
79 | 79 |
80 base::win::ScopedCoMem<ITEMIDLIST> file_item; | 80 base::win::ScopedCoMem<ITEMIDLIST> file_item; |
81 hr = desktop->ParseDisplayName(NULL, NULL, | 81 hr = desktop->ParseDisplayName(NULL, NULL, |
82 const_cast<wchar_t *>(full_path.value().c_str()), | 82 const_cast<wchar_t *>(full_path.value().c_str()), |
83 NULL, &file_item, NULL); | 83 NULL, &file_item, NULL); |
84 if (FAILED(hr)) | 84 if (FAILED(hr)) |
85 return; | 85 return; |
86 | 86 |
87 const ITEMIDLIST* highlight[] = { | 87 const ITEMIDLIST* highlight[] = { file_item }; |
88 {file_item}, | |
89 }; | |
90 | 88 |
91 hr = (*open_folder_and_select_itemsPtr)(dir_item, arraysize(highlight), | 89 hr = (*open_folder_and_select_itemsPtr)(dir_item, arraysize(highlight), |
92 highlight, NULL); | 90 highlight, NULL); |
93 | 91 |
94 if (FAILED(hr)) { | 92 if (FAILED(hr)) { |
95 // On some systems, the above call mysteriously fails with "file not | 93 // On some systems, the above call mysteriously fails with "file not |
96 // found" even though the file is there. In these cases, ShellExecute() | 94 // found" even though the file is there. In these cases, ShellExecute() |
97 // seems to work as a fallback (although it won't select the file). | 95 // seems to work as a fallback (although it won't select the file). |
98 if (hr == ERROR_FILE_NOT_FOUND) { | 96 if (hr == ERROR_FILE_NOT_FOUND) { |
99 ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW); | 97 ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 ::SetForegroundWindow(window); | 194 ::SetForegroundWindow(window); |
197 } | 195 } |
198 | 196 |
199 bool IsVisible(gfx::NativeView view) { | 197 bool IsVisible(gfx::NativeView view) { |
200 // MSVC complains if we don't include != 0. | 198 // MSVC complains if we don't include != 0. |
201 return ::IsWindowVisible(view) != 0; | 199 return ::IsWindowVisible(view) != 0; |
202 } | 200 } |
203 #endif | 201 #endif |
204 | 202 |
205 } // namespace platform_util | 203 } // namespace platform_util |
OLD | NEW |