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 #ifndef WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ | 5 #ifndef WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ |
6 #define WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ | 6 #define WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ |
7 | 7 |
| 8 #include "app/win/window_impl.h" |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/window_impl.h" | |
10 | 10 |
11 // Helper class for moving a window to the foreground. | 11 // Helper class for moving a window to the foreground. |
12 // Windows XP and later will not allow a window which is in the background to | 12 // Windows XP and later will not allow a window which is in the background to |
13 // move to the foreground, unless requested by the current window in the | 13 // move to the foreground, unless requested by the current window in the |
14 // foreground. For automated testing, we really want some of our windows | 14 // foreground. For automated testing, we really want some of our windows |
15 // to be capable of moving to the foreground. | 15 // to be capable of moving to the foreground. |
16 // | 16 // |
17 // This is probably leveraging a windows bug. | 17 // This is probably leveraging a windows bug. |
18 class ForegroundHelper : public base::WindowImpl { | 18 class ForegroundHelper : public app::WindowImpl { |
19 public: | 19 public: |
20 BEGIN_MSG_MAP_EX(ForegroundHelper) | 20 BEGIN_MSG_MAP_EX(ForegroundHelper) |
21 MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) | 21 MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) |
22 END_MSG_MAP() | 22 END_MSG_MAP() |
23 | 23 |
24 // Brings a window into the foreground. | 24 // Brings a window into the foreground. |
25 // Can be called from any window, even if the caller is not the | 25 // Can be called from any window, even if the caller is not the |
26 // foreground window. | 26 // foreground window. |
27 static HRESULT SetForeground(HWND window) { | 27 static HRESULT SetForeground(HWND window) { |
28 DCHECK(::IsWindow(window)); | 28 DCHECK(::IsWindow(window)); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 LPARAM lparam, | 84 LPARAM lparam, |
85 BOOL& handled) { | 85 BOOL& handled) { |
86 HWND window = reinterpret_cast<HWND>(GetWindowLongPtr(hwnd(), | 86 HWND window = reinterpret_cast<HWND>(GetWindowLongPtr(hwnd(), |
87 GWLP_USERDATA)); | 87 GWLP_USERDATA)); |
88 SetForegroundWindow(window); | 88 SetForegroundWindow(window); |
89 return 1; | 89 return 1; |
90 } | 90 } |
91 }; | 91 }; |
92 | 92 |
93 #endif // WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ | 93 #endif // WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ |
OLD | NEW |