Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 #include "googleurl/src/gurl.h" | 24 #include "googleurl/src/gurl.h" |
| 25 #include "ui/base/win/shell.h" | 25 #include "ui/base/win/shell.h" |
| 26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
| 27 | 27 |
| 28 using content::BrowserThread; | 28 using content::BrowserThread; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 void ShowItemInFolderOnFileThread(const base::FilePath& full_path) { | 32 void ShowItemInFolderOnFileThread(const base::FilePath& full_path) { |
| 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 33 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 34 base::FilePath dir = full_path.DirName(); | 34 base::FilePath dir = full_path.DirName().AsEndingWithSeparator(); |
| 35 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". | 35 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". |
| 36 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) | 36 if (dir.empty()) |
|
rvargas (doing something else)
2013/04/02 01:39:56
The old code rejected empty paths while the new ve
brettw
2013/04/08 23:40:20
Good catch, I also added tests for this case.
| |
| 37 return; | 37 return; |
| 38 | 38 |
| 39 typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( | 39 typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( |
| 40 PCIDLIST_ABSOLUTE pidl_Folder, | 40 PCIDLIST_ABSOLUTE pidl_Folder, |
| 41 UINT cidl, | 41 UINT cidl, |
| 42 PCUITEMID_CHILD_ARRAY pidls, | 42 PCUITEMID_CHILD_ARRAY pidls, |
| 43 DWORD flags); | 43 DWORD flags); |
| 44 | 44 |
| 45 static SHOpenFolderAndSelectItemsFuncPtr open_folder_and_select_itemsPtr = | 45 static SHOpenFolderAndSelectItemsFuncPtr open_folder_and_select_itemsPtr = |
| 46 NULL; | 46 NULL; |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 ::SetForegroundWindow(window); | 197 ::SetForegroundWindow(window); |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool IsVisible(gfx::NativeView view) { | 200 bool IsVisible(gfx::NativeView view) { |
| 201 // MSVC complains if we don't include != 0. | 201 // MSVC complains if we don't include != 0. |
| 202 return ::IsWindowVisible(view) != 0; | 202 return ::IsWindowVisible(view) != 0; |
| 203 } | 203 } |
| 204 #endif | 204 #endif |
| 205 | 205 |
| 206 } // namespace platform_util | 206 } // namespace platform_util |
| OLD | NEW |