OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/platform_util.h" | 5 #include "chrome/common/platform_util.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlapp.h> | 8 #include <atlapp.h> |
9 #include <commdlg.h> | 9 #include <commdlg.h> |
10 #include <dwmapi.h> | 10 #include <dwmapi.h> |
11 #include <shellapi.h> | 11 #include <shellapi.h> |
12 #include <shlobj.h> | 12 #include <shlobj.h> |
13 | 13 |
| 14 #include "app/win_util.h" |
14 #include "base/file_path.h" | 15 #include "base/file_path.h" |
15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
16 #include "base/gfx/native_widget_types.h" | 17 #include "base/gfx/native_widget_types.h" |
17 #include "base/logging.h" | 18 #include "base/logging.h" |
18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
19 #include "chrome/common/win_util.h" | |
20 | 20 |
21 namespace platform_util { | 21 namespace platform_util { |
22 | 22 |
23 void ShowItemInFolder(const FilePath& full_path) { | 23 void ShowItemInFolder(const FilePath& full_path) { |
24 FilePath dir = full_path.DirName(); | 24 FilePath dir = full_path.DirName(); |
25 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". | 25 // ParseDisplayName will fail if the directory is "C:", it must be "C:\\". |
26 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) | 26 if (dir.value() == L"" || !file_util::EnsureEndsWithSeparator(&dir)) |
27 return; | 27 return; |
28 | 28 |
29 typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( | 29 typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 int length = ::GetWindowTextLength(window_handle) + 1; | 91 int length = ::GetWindowTextLength(window_handle) + 1; |
92 ::GetWindowText(window_handle, WriteInto(&result, length), length); | 92 ::GetWindowText(window_handle, WriteInto(&result, length), length); |
93 return WideToUTF16(result); | 93 return WideToUTF16(result); |
94 } | 94 } |
95 | 95 |
96 bool IsWindowActive(gfx::NativeWindow window) { | 96 bool IsWindowActive(gfx::NativeWindow window) { |
97 return ::GetForegroundWindow() == window; | 97 return ::GetForegroundWindow() == window; |
98 } | 98 } |
99 | 99 |
100 } // namespace platform_util | 100 } // namespace platform_util |
OLD | NEW |