Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: webkit/tools/test_shell/foreground_helper.h

Issue 165188: Use base::WindowImpl instead of CWindowImpl to reduce dependencies on ATL.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/window_impl.cc ('k') | webkit/tools/test_shell/test_shell.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « base/window_impl.cc ('k') | webkit/tools/test_shell/test_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698