diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-08 06:17:55 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-08 06:17:55 +0000 |
commit | ce74a7c1c38c0b3c0569186e3bee172009bb61b3 (patch) | |
tree | 163f25f0b9ac6c9b503258b683c328e42ab2b4df | |
parent | f2d507199e85ca69b1449ef05cc2163f1340b3aa (diff) | |
download | chromium_src-ce74a7c1c38c0b3c0569186e3bee172009bb61b3.zip chromium_src-ce74a7c1c38c0b3c0569186e3bee172009bb61b3.tar.gz chromium_src-ce74a7c1c38c0b3c0569186e3bee172009bb61b3.tar.bz2 |
Use base::WindowImpl instead of CWindowImpl to reduce dependencies on ATL.
BUG=5022
TEST=test_shell_tests
Review URL: http://codereview.chromium.org/165188
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22864 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/window_impl.cc | 14 | ||||
-rw-r--r-- | base/window_impl.h | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/foreground_helper.h | 27 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gyp | 1 |
4 files changed, 30 insertions, 14 deletions
diff --git a/base/window_impl.cc b/base/window_impl.cc index d428ebe..4a37f7b 100644 --- a/base/window_impl.cc +++ b/base/window_impl.cc @@ -126,9 +126,19 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) { parent = NULL; } + int x, y, width, height; + if (bounds.IsEmpty()) { + x = y = width = height = CW_USEDEFAULT; + } else { + x = bounds.x(); + y = bounds.y(); + width = bounds.width(); + height = bounds.height(); + } + hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), L"", - window_style_, bounds.x(), bounds.y(), bounds.width(), - bounds.height(), parent, NULL, NULL, this); + window_style_, x, y, width, height, + parent, NULL, NULL, this); DCHECK(hwnd_); // The window procedure should have set the data for us. diff --git a/base/window_impl.h b/base/window_impl.h index eb1de35d..30c6298 100644 --- a/base/window_impl.h +++ b/base/window_impl.h @@ -31,7 +31,7 @@ class WindowImpl { WindowImpl(); virtual ~WindowImpl(); - BEGIN_MSG_MAP_EX(WidgetWin) + BEGIN_MSG_MAP_EX(WindowImpl) // No messages to handle END_MSG_MAP() diff --git a/webkit/tools/test_shell/foreground_helper.h b/webkit/tools/test_shell/foreground_helper.h index 458d471..9456ded 100644 --- a/webkit/tools/test_shell/foreground_helper.h +++ b/webkit/tools/test_shell/foreground_helper.h @@ -1,11 +1,12 @@ -// 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 "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 +15,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 +38,16 @@ class ForegroundHelper : public CWindowImpl<ForegroundHelper> { // 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 +72,7 @@ class ForegroundHelper : public CWindowImpl<ForegroundHelper> { break; } - UnregisterHotKey(m_hWnd, hotkey_id); + UnregisterHotKey(GetNativeView(), hotkey_id); DestroyWindow(); return S_OK; @@ -81,8 +83,11 @@ class ForegroundHelper : public CWindowImpl<ForegroundHelper> { 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_ diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp index b1ab3b6..7509cb9 100644 --- a/webkit/tools/test_shell/test_shell.gyp +++ b/webkit/tools/test_shell/test_shell.gyp @@ -153,6 +153,7 @@ ], }, 'include_dirs': [ + '../../../chrome/third_party/wtl/include', '.', ], 'dependencies': [ |