Index: chrome/common/win_util.cc |
=================================================================== |
--- chrome/common/win_util.cc (revision 12379) |
+++ chrome/common/win_util.cc (working copy) |
@@ -159,72 +159,6 @@ |
return !!f; |
} |
-void ShowItemInFolder(const std::wstring& full_path) { |
- std::wstring dir = file_util::GetDirectoryFromPath(full_path); |
- if (dir == L"" || !file_util::PathExists(full_path)) |
- return; |
- |
- // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". |
- FilePath dir_path(dir); |
- file_util::EnsureEndsWithSeparator(&dir_path); |
- dir = dir_path.value(); |
- |
- typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( |
- PCIDLIST_ABSOLUTE pidl_Folder, |
- UINT cidl, |
- PCUITEMID_CHILD_ARRAY pidls, |
- DWORD flags); |
- |
- static SHOpenFolderAndSelectItemsFuncPtr open_folder_and_select_itemsPtr = |
- NULL; |
- static bool initialize_open_folder_proc = true; |
- if (initialize_open_folder_proc) { |
- initialize_open_folder_proc = false; |
- // The SHOpenFolderAndSelectItems API is exposed by shell32 version 6 |
- // and does not exist in Win2K. We attempt to retrieve this function export |
- // from shell32 and if it does not exist, we just invoke ShellExecute to |
- // open the folder thus losing the functionality to select the item in |
- // the process. |
- HMODULE shell32_base = GetModuleHandle(L"shell32.dll"); |
- if (!shell32_base) { |
- NOTREACHED(); |
- return; |
- } |
- open_folder_and_select_itemsPtr = |
- reinterpret_cast<SHOpenFolderAndSelectItemsFuncPtr> |
- (GetProcAddress(shell32_base, "SHOpenFolderAndSelectItems")); |
- } |
- if (!open_folder_and_select_itemsPtr) { |
- ShellExecute(NULL, _T("open"), dir.c_str(), NULL, NULL, SW_SHOW); |
- return; |
- } |
- |
- CComPtr<IShellFolder> desktop; |
- HRESULT hr = SHGetDesktopFolder(&desktop); |
- if (FAILED(hr)) |
- return; |
- |
- CoMemReleaser<ITEMIDLIST> dir_item; |
- hr = desktop->ParseDisplayName(NULL, NULL, |
- const_cast<wchar_t *>(dir.c_str()), |
- NULL, &dir_item, NULL); |
- if (FAILED(hr)) |
- return; |
- |
- CoMemReleaser<ITEMIDLIST> file_item; |
- hr = desktop->ParseDisplayName(NULL, NULL, |
- const_cast<wchar_t *>(full_path.c_str()), |
- NULL, &file_item, NULL); |
- if (FAILED(hr)) |
- return; |
- |
- const ITEMIDLIST* highlight[] = { |
- {file_item}, |
- }; |
- (*open_folder_and_select_itemsPtr)(dir_item, arraysize(highlight), |
- highlight, NULL); |
-} |
- |
// Open an item via a shell execute command. Error code checking and casting |
// explanation: http://msdn2.microsoft.com/en-us/library/ms647732.aspx |
bool OpenItemViaShell(const FilePath& full_path, bool ask_for_app) { |