| 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> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (FAILED(hr)) | 75 if (FAILED(hr)) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 const ITEMIDLIST* highlight[] = { | 78 const ITEMIDLIST* highlight[] = { |
| 79 {file_item}, | 79 {file_item}, |
| 80 }; | 80 }; |
| 81 (*open_folder_and_select_itemsPtr)(dir_item, arraysize(highlight), | 81 (*open_folder_and_select_itemsPtr)(dir_item, arraysize(highlight), |
| 82 highlight, NULL); | 82 highlight, NULL); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void OpenItem(const FilePath& full_path) { |
| 86 win_util::OpenItemViaShell(full_path); |
| 87 } |
| 88 |
| 85 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | 89 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |
| 86 return GetAncestor(view, GA_ROOT); | 90 return GetAncestor(view, GA_ROOT); |
| 87 } | 91 } |
| 88 | 92 |
| 89 string16 GetWindowTitle(gfx::NativeWindow window_handle) { | 93 string16 GetWindowTitle(gfx::NativeWindow window_handle) { |
| 90 std::wstring result; | 94 std::wstring result; |
| 91 int length = ::GetWindowTextLength(window_handle) + 1; | 95 int length = ::GetWindowTextLength(window_handle) + 1; |
| 92 ::GetWindowText(window_handle, WriteInto(&result, length), length); | 96 ::GetWindowText(window_handle, WriteInto(&result, length), length); |
| 93 return WideToUTF16(result); | 97 return WideToUTF16(result); |
| 94 } | 98 } |
| 95 | 99 |
| 96 bool IsWindowActive(gfx::NativeWindow window) { | 100 bool IsWindowActive(gfx::NativeWindow window) { |
| 97 return ::GetForegroundWindow() == window; | 101 return ::GetForegroundWindow() == window; |
| 98 } | 102 } |
| 99 | 103 |
| 100 bool IsVisible(gfx::NativeView view) { | 104 bool IsVisible(gfx::NativeView view) { |
| 101 // MSVC complains if we don't include != 0. | 105 // MSVC complains if we don't include != 0. |
| 102 return ::IsWindowVisible(view) != 0; | 106 return ::IsWindowVisible(view) != 0; |
| 103 } | 107 } |
| 104 | 108 |
| 105 } // namespace platform_util | 109 } // namespace platform_util |
| OLD | NEW |