Chromium Code Reviews| Index: webkit/tools/test_shell/foreground_helper.h |
| =================================================================== |
| --- webkit/tools/test_shell/foreground_helper.h (revision 22832) |
| +++ webkit/tools/test_shell/foreground_helper.h (working copy) |
| @@ -1,11 +1,14 @@ |
| -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include <atlbase.h> |
| -#include <atlwin.h> |
| +#ifndef WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ |
| +#define WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ |
| +#include <atlcrack.h> |
|
Peter Kasting
2009/08/08 00:33:49
Nit: Don't think you need this
|
| + |
| #include "base/logging.h" |
| +#include "base/window_impl.h" |
| // Helper class for moving a window to the foreground. |
| // Windows XP and later will not allow a window which is in the background to |
| @@ -14,9 +17,9 @@ |
| // to be capable of moving to the foreground. |
| // |
| // This is probably leveraging a windows bug. |
| -class ForegroundHelper : public CWindowImpl<ForegroundHelper> { |
| +class ForegroundHelper : public base::WindowImpl { |
| public: |
| - BEGIN_MSG_MAP(ForegroundHelper) |
| + BEGIN_MSG_MAP_EX(ForegroundHelper) |
| MESSAGE_HANDLER(WM_HOTKEY, OnHotKey) |
| END_MSG_MAP() |
| @@ -37,15 +40,16 @@ |
| // be in the foreground and allowed to move the target window |
| // into the foreground too. |
| - if (NULL == Create(NULL, NULL, NULL, WS_POPUP)) |
| - return AtlHresultFromLastError(); |
| + set_window_ex_style(WS_POPUP); |
| + Init(NULL, gfx::Rect()); |
| static const int hotkey_id = 0x0000baba; |
| // Store the target window into our USERDATA for use in our |
| // HotKey handler. |
| - SetWindowLongPtr(GWLP_USERDATA, reinterpret_cast<ULONG_PTR>(window)); |
| - RegisterHotKey(m_hWnd, hotkey_id, 0, VK_F22); |
| + SetWindowLongPtr(GetNativeView(), GWLP_USERDATA, |
| + reinterpret_cast<ULONG_PTR>(window)); |
| + RegisterHotKey(GetNativeView(), hotkey_id, 0, VK_F22); |
| // If the calling thread is not yet a UI thread, call PeekMessage |
| // to ensure creation of its message queue. |
| @@ -70,7 +74,7 @@ |
| break; |
| } |
| - UnregisterHotKey(m_hWnd, hotkey_id); |
| + UnregisterHotKey(GetNativeView(), hotkey_id); |
| DestroyWindow(); |
| return S_OK; |
| @@ -81,8 +85,11 @@ |
| WPARAM wparam, |
| LPARAM lparam, |
| BOOL& handled) { |
| - HWND window = reinterpret_cast<HWND>(GetWindowLongPtr(GWLP_USERDATA)); |
| + HWND window = reinterpret_cast<HWND>(GetWindowLongPtr(GetNativeView(), |
| + GWLP_USERDATA)); |
| SetForegroundWindow(window); |
| return 1; |
| } |
| }; |
| + |
| +#endif // WEBKIT_TOOLS_TEST_SHELL_FOREGROUND_HELPER_H_ |