| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // TODO(nsylvain): we should also add a dialog to warn on errors. See | 129 // TODO(nsylvain): we should also add a dialog to warn on errors. See |
| 130 // bug 1136923. | 130 // bug 1136923. |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { | 135 gfx::NativeWindow GetTopLevel(gfx::NativeView view) { |
| 136 return GetAncestor(view, GA_ROOT); | 136 return GetAncestor(view, GA_ROOT); |
| 137 } | 137 } |
| 138 | 138 |
| 139 string16 GetWindowTitle(gfx::NativeWindow window_handle) { | |
| 140 std::wstring result; | |
| 141 int length = ::GetWindowTextLength(window_handle) + 1; | |
| 142 ::GetWindowText(window_handle, WriteInto(&result, length), length); | |
| 143 return WideToUTF16(result); | |
| 144 } | |
| 145 | |
| 146 bool IsWindowActive(gfx::NativeWindow window) { | 139 bool IsWindowActive(gfx::NativeWindow window) { |
| 147 return ::GetForegroundWindow() == window; | 140 return ::GetForegroundWindow() == window; |
| 148 } | 141 } |
| 149 | 142 |
| 150 bool IsVisible(gfx::NativeView view) { | 143 bool IsVisible(gfx::NativeView view) { |
| 151 // MSVC complains if we don't include != 0. | 144 // MSVC complains if we don't include != 0. |
| 152 return ::IsWindowVisible(view) != 0; | 145 return ::IsWindowVisible(view) != 0; |
| 153 } | 146 } |
| 154 | 147 |
| 155 void SimpleErrorBox(gfx::NativeWindow parent, | 148 void SimpleErrorBox(gfx::NativeWindow parent, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 212 |
| 220 string16 GetVersionStringModifier() { | 213 string16 GetVersionStringModifier() { |
| 221 #if defined(GOOGLE_CHROME_BUILD) | 214 #if defined(GOOGLE_CHROME_BUILD) |
| 222 return CurrentChromeChannel(); | 215 return CurrentChromeChannel(); |
| 223 #else | 216 #else |
| 224 return string16(); | 217 return string16(); |
| 225 #endif | 218 #endif |
| 226 } | 219 } |
| 227 | 220 |
| 228 } // namespace platform_util | 221 } // namespace platform_util |
| OLD | NEW |