summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 20:39:34 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 20:39:34 +0000
commitc0d5fc9424a062dd51b90854b461bd4a9c309dad (patch)
tree1d1ad1b72c9e17689b6cb19dffcadd13b70168dc
parentfa8b44910eb051f9a6d9bb7955afa8e0b6482268 (diff)
downloadchromium_src-c0d5fc9424a062dd51b90854b461bd4a9c309dad.zip
chromium_src-c0d5fc9424a062dd51b90854b461bd4a9c309dad.tar.gz
chromium_src-c0d5fc9424a062dd51b90854b461bd4a9c309dad.tar.bz2
Revert "Reverting 23406" as it didn't break any tests.
Change PluginInstallImpl to use base::WindowImpl instead of CWindowImpl to reduce a dependency on ATL. BUG=5023 TEST=Uninstall flash. Visit hulu.com and install the flash plugin. Original review: http://codereview.chromium.org/165469 TBR=levin Review URL: http://codereview.chromium.org/165543 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23454 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/window_impl.cc18
-rw-r--r--base/window_impl.h34
-rw-r--r--views/widget/widget_win.cc66
-rw-r--r--webkit/default_plugin/default_plugin.gyp1
-rw-r--r--webkit/default_plugin/plugin_impl_win.cc75
-rw-r--r--webkit/default_plugin/plugin_impl_win.h10
-rw-r--r--webkit/tools/test_shell/foreground_helper.h12
-rw-r--r--webkit/webkit.gyp3
8 files changed, 110 insertions, 109 deletions
diff --git a/base/window_impl.cc b/base/window_impl.cc
index 4a37f7b..c3b3ad4 100644
--- a/base/window_impl.cc
+++ b/base/window_impl.cc
@@ -96,7 +96,7 @@ class ClassRegistrar {
typedef std::list<RegisteredClass> RegisteredClasses;
RegisteredClasses registered_classes_;
- // Counter of how many classes have ben registered so far.
+ // Counter of how many classes have been registered so far.
int registered_count_;
DISALLOW_COPY_AND_ASSIGN(ClassRegistrar);
@@ -136,7 +136,7 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) {
height = bounds.height();
}
- hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), L"",
+ hwnd_ = CreateWindowEx(window_ex_style_, GetWindowClassName().c_str(), NULL,
window_style_, x, y, width, height,
parent, NULL, NULL, this);
DCHECK(hwnd_);
@@ -145,27 +145,17 @@ void WindowImpl::Init(HWND parent, const gfx::Rect& bounds) {
DCHECK(win_util::GetWindowUserData(hwnd_) == this);
}
-gfx::NativeView WindowImpl::GetNativeView() const {
- return hwnd_;
-}
-
HICON WindowImpl::GetDefaultWindowIcon() const {
return NULL;
}
-BOOL WindowImpl::DestroyWindow() {
- DCHECK(::IsWindow(GetNativeView()));
- return ::DestroyWindow(GetNativeView());
-}
-
LRESULT WindowImpl::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) {
- HWND window = GetNativeView();
LRESULT result = 0;
// Handle the message if it's in our message map; otherwise, let the system
// handle it.
- if (!ProcessWindowMessage(window, message, w_param, l_param, result))
- result = DefWindowProc(window, message, w_param, l_param);
+ if (!ProcessWindowMessage(hwnd_, message, w_param, l_param, result))
+ result = DefWindowProc(hwnd_, message, w_param, l_param);
return result;
}
diff --git a/base/window_impl.h b/base/window_impl.h
index 30c6298..2941c3d9 100644
--- a/base/window_impl.h
+++ b/base/window_impl.h
@@ -18,6 +18,19 @@
namespace base {
+// An interface implemented by classes that use message maps.
+// ProcessWindowMessage is implemented by the BEGIN_MESSAGE_MAP_EX macro.
+class MessageMapInterface {
+ public:
+ // Processes one message from the window's message queue.
+ virtual BOOL ProcessWindowMessage(HWND window,
+ UINT message,
+ WPARAM w_param,
+ LPARAM l_param,
+ LRESULT& result,
+ DWORD msg_mad_id = 0) = 0;
+};
+
///////////////////////////////////////////////////////////////////////////////
//
// WindowImpl
@@ -26,24 +39,20 @@ namespace base {
// Windows.
//
///////////////////////////////////////////////////////////////////////////////
-class WindowImpl {
+class WindowImpl : public MessageMapInterface {
public:
WindowImpl();
virtual ~WindowImpl();
- BEGIN_MSG_MAP_EX(WindowImpl)
- // No messages to handle
- END_MSG_MAP()
-
- // Initialize the Window with a parent and an initial desired size.
- virtual void Init(HWND parent, const gfx::Rect& bounds);
-
- // Returns the gfx::NativeView associated with this Window.
- virtual gfx::NativeView GetNativeView() const;
+ // Initializes the Window with a parent and an initial desired size.
+ void Init(HWND parent, const gfx::Rect& bounds);
// Retrieves the default window icon to use for windows if none is specified.
virtual HICON GetDefaultWindowIcon() const;
+ // Returns the HWND associated with this Window.
+ HWND hwnd() const { return hwnd_; }
+
// Sets the window styles. This is ONLY used when the window is created.
// In other words, if you invoke this after invoking Init, nothing happens.
void set_window_style(DWORD style) { window_style_ = style; }
@@ -62,16 +71,13 @@ class WindowImpl {
UINT initial_class_style() { return class_style_; }
protected:
- // Call close instead of this to Destroy the window.
- BOOL DestroyWindow();
-
// Handles the WndProc callback for this object.
virtual LRESULT OnWndProc(UINT message, WPARAM w_param, LPARAM l_param);
private:
friend class ClassRegistrar;
- // The windows procedure used by all Windows.
+ // The window procedure used by all Windows.
static LRESULT CALLBACK WndProc(HWND window,
UINT message,
WPARAM w_param,
diff --git a/views/widget/widget_win.cc b/views/widget/widget_win.cc
index f431fc7..f54da9a 100644
--- a/views/widget/widget_win.cc
+++ b/views/widget/widget_win.cc
@@ -27,7 +27,7 @@ namespace views {
static const wchar_t* const kRootViewWindowProperty = L"__ROOT_VIEW__";
bool SetRootViewForHWND(HWND hwnd, RootView* root_view) {
- return ::SetProp(hwnd, kRootViewWindowProperty, root_view) ? true : false;
+ return SetProp(hwnd, kRootViewWindowProperty, root_view) ? true : false;
}
RootView* GetRootViewForHWND(HWND hwnd) {
@@ -36,7 +36,7 @@ RootView* GetRootViewForHWND(HWND hwnd) {
NativeControlWin* GetNativeControlWinForHWND(HWND hwnd) {
return reinterpret_cast<NativeControlWin*>(
- ::GetProp(hwnd, NativeControlWin::kNativeControlWinKey));
+ GetProp(hwnd, NativeControlWin::kNativeControlWinKey));
}
///////////////////////////////////////////////////////////////////////////////
@@ -77,7 +77,7 @@ void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
default_theme_provider_.reset(new DefaultThemeProvider());
- SetWindowSupportsRerouteMouseWheel(GetNativeView());
+ SetWindowSupportsRerouteMouseWheel(hwnd());
drop_target_ = new DropTargetWin(root_view_.get());
@@ -87,7 +87,7 @@ void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
}
// Sets the RootView as a property, so the automation can introspect windows.
- SetRootViewForHWND(GetNativeView(), root_view_.get());
+ SetRootViewForHWND(hwnd(), root_view_.get());
MessageLoopForUI::current()->AddObserver(this);
@@ -102,14 +102,14 @@ void WidgetWin::Init(gfx::NativeView parent, const gfx::Rect& bounds) {
// This message initializes the window so that focus border are shown for
// windows.
- ::SendMessage(GetNativeView(),
- WM_CHANGEUISTATE,
- MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
- 0);
+ SendMessage(hwnd(),
+ WM_CHANGEUISTATE,
+ MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
+ 0);
// Bug 964884: detach the IME attached to this window.
// We should attach IMEs only when we need to input CJK strings.
- ::ImmAssociateContextEx(GetNativeView(), NULL, 0);
+ ImmAssociateContextEx(hwnd(), NULL, 0);
}
void WidgetWin::SetContentsView(View* view) {
@@ -126,7 +126,7 @@ void WidgetWin::GetBounds(gfx::Rect* out, bool including_frame) const {
GetClientRect(&crect);
POINT p = {0, 0};
- ::ClientToScreen(GetNativeView(), &p);
+ ClientToScreen(hwnd(), &p);
out->SetRect(crect.left + p.x, crect.top + p.y,
crect.Width(), crect.Height());
}
@@ -164,7 +164,7 @@ void WidgetWin::CloseNow() {
// we need to check to see if we're still a window before trying to destroy
// ourself.
if (IsWindow())
- DestroyWindow();
+ DestroyWindow(hwnd());
}
void WidgetWin::Show() {
@@ -185,7 +185,7 @@ void WidgetWin::Hide() {
}
gfx::NativeView WidgetWin::GetNativeView() const {
- return WindowImpl::GetNativeView();
+ return WindowImpl::hwnd();
}
static BOOL CALLBACK EnumChildProcForRedraw(HWND hwnd, LPARAM lparam) {
@@ -212,10 +212,10 @@ void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
// We're transparent. Need to force painting to occur from our parent.
CRect parent_update_rect = update_rect.ToRECT();
POINT location_in_parent = { 0, 0 };
- ClientToScreen(GetNativeView(), &location_in_parent);
- ::ScreenToClient(GetParent(), &location_in_parent);
+ ClientToScreen(hwnd(), &location_in_parent);
+ ScreenToClient(GetParent(), &location_in_parent);
parent_update_rect.OffsetRect(location_in_parent);
- ::RedrawWindow(GetParent(), parent_update_rect, NULL,
+ RedrawWindow(GetParent(), parent_update_rect, NULL,
RDW_UPDATENOW | RDW_INVALIDATE | RDW_ALLCHILDREN);
} else {
// Paint child windows that are in a different process asynchronously.
@@ -230,11 +230,11 @@ void WidgetWin::PaintNow(const gfx::Rect& update_rect) {
gfx::Rect invalid_screen_rect = update_rect;
invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y());
- ::RedrawWindow(GetNativeView(), &update_rect.ToRECT(), NULL,
- RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
+ RedrawWindow(hwnd(), &update_rect.ToRECT(), NULL,
+ RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN);
LPARAM lparam = reinterpret_cast<LPARAM>(&invalid_screen_rect);
- EnumChildWindows(GetNativeView(), EnumChildProcForRedraw, lparam);
+ EnumChildWindows(hwnd(), EnumChildProcForRedraw, lparam);
}
// As we were created with a style of WS_CLIPCHILDREN redraw requests may
// result in an empty paint rect in WM_PAINT (this'll happen if a
@@ -261,15 +261,15 @@ RootView* WidgetWin::GetRootView() {
Widget* WidgetWin::GetRootWidget() const {
return reinterpret_cast<WidgetWin*>(
- win_util::GetWindowUserData(GetAncestor(GetNativeView(), GA_ROOT)));
+ win_util::GetWindowUserData(GetAncestor(hwnd(), GA_ROOT)));
}
bool WidgetWin::IsVisible() const {
- return !!::IsWindowVisible(GetNativeView());
+ return !!::IsWindowVisible(hwnd());
}
bool WidgetWin::IsActive() const {
- return win_util::IsWindowActive(GetNativeView());
+ return win_util::IsWindowActive(hwnd());
}
void WidgetWin::GenerateMousePressedForView(View* view,
@@ -301,11 +301,11 @@ ThemeProvider* WidgetWin::GetThemeProvider() const {
}
Window* WidgetWin::GetWindow() {
- return GetWindowImpl(GetNativeView());
+ return GetWindowImpl(hwnd());
}
const Window* WidgetWin::GetWindow() const {
- return GetWindowImpl(GetNativeView());
+ return GetWindowImpl(hwnd());
}
FocusManager* WidgetWin::GetFocusManager() {
@@ -332,7 +332,7 @@ void WidgetWin::SetUseLayeredBuffer(bool use_layered_buffer) {
return;
use_layered_buffer_ = use_layered_buffer;
- if (!GetNativeView())
+ if (!hwnd())
return;
if (use_layered_buffer_) {
@@ -440,11 +440,11 @@ void WidgetWin::OnClose() {
void WidgetWin::OnDestroy() {
if (drop_target_.get()) {
- RevokeDragDrop(GetNativeView());
+ RevokeDragDrop(hwnd());
drop_target_ = NULL;
}
- RemoveProp(GetNativeView(), kRootViewWindowProperty);
+ RemoveProp(hwnd(), kRootViewWindowProperty);
}
LRESULT WidgetWin::OnEraseBkgnd(HDC dc) {
@@ -548,7 +548,7 @@ LRESULT WidgetWin::OnMouseWheel(UINT message, WPARAM w_param, LPARAM l_param) {
// Reroute the mouse-wheel to the window under the mouse pointer if
// applicable.
if (message == WM_MOUSEWHEEL &&
- views::RerouteMouseWheel(GetNativeView(), w_param, l_param)) {
+ views::RerouteMouseWheel(hwnd(), w_param, l_param)) {
return 0;
}
@@ -598,7 +598,7 @@ LRESULT WidgetWin::OnNCMouseLeave(UINT uMsg, WPARAM w_param, LPARAM l_param) {
LRESULT WidgetWin::OnNCMouseMove(UINT flags, const CPoint& point) {
// NC points are in screen coordinates.
CPoint temp = point;
- MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1);
+ MapWindowPoints(HWND_DESKTOP, hwnd(), &temp, 1);
ProcessMouseMoved(temp, 0, true);
// We need to process this message to stop Windows from drawing the window
@@ -634,7 +634,7 @@ LRESULT WidgetWin::OnNotify(int w_param, NMHDR* l_param) {
}
void WidgetWin::OnPaint(HDC dc) {
- root_view_->OnPaint(GetNativeView());
+ root_view_->OnPaint(hwnd());
}
void WidgetWin::OnRButtonDown(UINT flags, const CPoint& point) {
@@ -681,7 +681,7 @@ void WidgetWin::TrackMouseEvents(DWORD mouse_tracking_flags) {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = mouse_tracking_flags;
- tme.hwndTrack = GetNativeView();
+ tme.hwndTrack = hwnd();
tme.dwHoverTime = 0;
TrackMouseEvent(&tme);
} else if (mouse_tracking_flags != active_mouse_tracking_flags_) {
@@ -848,8 +848,8 @@ void WidgetWin::UpdateWindowFromContents(HDC dib_dc) {
CPoint window_position = wr.TopLeft();
BLENDFUNCTION blend = {AC_SRC_OVER, 0, layered_alpha_, AC_SRC_ALPHA};
- ::UpdateLayeredWindow(
- GetNativeView(), NULL, &window_position, &size, dib_dc, &zero_origin,
+ UpdateLayeredWindow(
+ hwnd(), NULL, &window_position, &size, dib_dc, &zero_origin,
RGB(0xFF, 0xFF, 0xFF), &blend, ULW_ALPHA);
}
}
@@ -904,7 +904,7 @@ bool ProcessNativeControlMessage(UINT message,
}
LRESULT WidgetWin::OnWndProc(UINT message, WPARAM w_param, LPARAM l_param) {
- HWND window = GetNativeView();
+ HWND window = hwnd();
LRESULT result = 0;
// First allow messages sent by child controls to be processed directly by
diff --git a/webkit/default_plugin/default_plugin.gyp b/webkit/default_plugin/default_plugin.gyp
index 2aeac4e..375431a 100644
--- a/webkit/default_plugin/default_plugin.gyp
+++ b/webkit/default_plugin/default_plugin.gyp
@@ -26,6 +26,7 @@
],
'include_dirs': [
'../..',
+ '../../chrome/third_party/wtl/include',
# TODO(bradnelson): this should fall out of the dependencies.
'<(SHARED_INTERMEDIATE_DIR)/webkit',
],
diff --git a/webkit/default_plugin/plugin_impl_win.cc b/webkit/default_plugin/plugin_impl_win.cc
index a940927..904aa7f 100644
--- a/webkit/default_plugin/plugin_impl_win.cc
+++ b/webkit/default_plugin/plugin_impl_win.cc
@@ -44,10 +44,10 @@ PluginInstallerImpl::~PluginInstallerImpl() {
installation_job_monitor_thread_->Stop();
if (bold_font_)
- ::DeleteObject(bold_font_);
+ DeleteObject(bold_font_);
if (underline_font_)
- ::DeleteObject(underline_font_);
+ DeleteObject(underline_font_);
if (activex_installer_) {
activex_installer_->Cleanup();
@@ -55,7 +55,7 @@ PluginInstallerImpl::~PluginInstallerImpl() {
}
if (tooltip_)
- ::DestroyWindow(tooltip_);
+ DestroyWindow(tooltip_);
}
bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance,
@@ -118,8 +118,8 @@ void PluginInstallerImpl::Shutdown() {
if (install_dialog_.IsWindow()) {
install_dialog_.DestroyWindow();
}
- if (IsWindow()) {
- DestroyWindow();
+ if (IsWindow(hwnd())) {
+ DestroyWindow(hwnd());
}
}
@@ -168,12 +168,12 @@ void PluginInstallerImpl::ClearDisplay() {
}
void PluginInstallerImpl::RefreshDisplay() {
- if (!IsWindow())
+ if (!IsWindow(hwnd()))
return;
UpdateToolTip();
- InvalidateRect(NULL, TRUE);
- UpdateWindow();
+ InvalidateRect(hwnd(), NULL, TRUE);
+ UpdateWindow(hwnd());
}
bool PluginInstallerImpl::CreateToolTip() {
@@ -182,16 +182,16 @@ bool PluginInstallerImpl::CreateToolTip() {
WS_POPUP | TTS_ALWAYSTIP,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- m_hWnd, NULL, NULL, NULL);
+ hwnd(), NULL, NULL, NULL);
if (!tooltip_)
return false;
// Associate the ToolTip with the tool.
TOOLINFO tool_info = {0};
tool_info.cbSize = sizeof(tool_info);
- tool_info.hwnd = m_hWnd;
+ tool_info.hwnd = hwnd();
tool_info.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
- tool_info.uId = reinterpret_cast<UINT_PTR>(m_hWnd);
+ tool_info.uId = reinterpret_cast<UINT_PTR>(hwnd());
tool_info.lpszText = NULL;
SendMessage(tooltip_, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&tool_info));
SendMessage(tooltip_, TTM_SETMAXTIPWIDTH, 0, TOOLTIP_MAX_WIDTH);
@@ -207,9 +207,9 @@ void PluginInstallerImpl::UpdateToolTip() {
TOOLINFO tool_info = {0};
tool_info.cbSize = sizeof(tool_info);
- tool_info.hwnd = m_hWnd;
+ tool_info.hwnd = hwnd();
tool_info.uFlags = TTF_IDISHWND;
- tool_info.uId = reinterpret_cast<UINT_PTR>(m_hWnd);
+ tool_info.uId = reinterpret_cast<UINT_PTR>(hwnd());
tool_info.lpszText = const_cast<LPWSTR>(tip.c_str());
SendMessage(tooltip_, TTM_UPDATETIPTEXT, 0, (LPARAM)&tool_info);
}
@@ -316,9 +316,9 @@ std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement(
}
bool PluginInstallerImpl::SetWindow(HWND parent_window) {
- if (!::IsWindow(parent_window)) {
+ if (!IsWindow(parent_window)) {
// No window created yet. Ignore this call.
- if (!IsWindow())
+ if (!IsWindow(hwnd()))
return true;
// Parent window has been destroyed.
Shutdown();
@@ -327,22 +327,25 @@ bool PluginInstallerImpl::SetWindow(HWND parent_window) {
RECT parent_rect = {0};
- if (IsWindow()) {
- ::GetClientRect(parent_window, &parent_rect);
- SetWindowPos(NULL, &parent_rect, SWP_SHOWWINDOW);
+ if (IsWindow(hwnd())) {
+ GetClientRect(parent_window, &parent_rect);
+ SetWindowPos(hwnd(), NULL, parent_rect.left, parent_rect.top,
+ parent_rect.right - parent_rect.left,
+ parent_rect.bottom - parent_rect.top, SWP_SHOWWINDOW);
return true;
}
// First time in -- no window created by plugin yet.
- ::GetClientRect(parent_window, &parent_rect);
- Create(parent_window, parent_rect, NULL, WS_CHILD | WS_BORDER);
- DCHECK(IsWindow());
- installation_job_monitor_thread_->set_plugin_window(m_hWnd);
+ GetClientRect(parent_window, &parent_rect);
+ set_window_style(WS_CHILD | WS_BORDER);
+ Init(parent_window, gfx::Rect(parent_rect));
+ DCHECK(IsWindow(hwnd()));
+ installation_job_monitor_thread_->set_plugin_window(hwnd());
CreateToolTip();
UpdateToolTip();
- UpdateWindow();
- ShowWindow(SW_SHOW);
+ UpdateWindow(hwnd());
+ ShowWindow(hwnd(), SW_SHOW);
return true;
}
@@ -360,11 +363,11 @@ void PluginInstallerImpl::DownloadPlugin() {
CComObject<ActiveXInstaller>::CreateInstance(&activex_installer_);
activex_installer_->AddRef();
}
- activex_installer_->StartDownload(activex_clsid_, activex_codebase_, m_hWnd,
- kActivexInstallResult);
+ activex_installer_->StartDownload(activex_clsid_, activex_codebase_,
+ hwnd(), kActivexInstallResult);
} else {
if (!plugin_download_url_for_display_) {
- webkit_glue::DownloadUrl(plugin_download_url_, m_hWnd);
+ webkit_glue::DownloadUrl(plugin_download_url_, hwnd());
} else {
default_plugin::g_browser->geturl(instance(),
plugin_download_url_.c_str(),
@@ -385,11 +388,11 @@ LRESULT PluginInstallerImpl::OnEraseBackGround(UINT message, WPARAM wparam,
LPARAM lparam, BOOL& handled) {
HDC paint_device_context = reinterpret_cast<HDC>(wparam);
RECT erase_rect = {0};
- ::GetClipBox(paint_device_context, &erase_rect);
+ GetClipBox(paint_device_context, &erase_rect);
HBRUSH brush = ::CreateSolidBrush(RGB(252, 235, 162));
DCHECK(brush);
- ::FillRect(paint_device_context, &erase_rect, brush);
- ::DeleteObject(brush);
+ FillRect(paint_device_context, &erase_rect, brush);
+ DeleteObject(brush);
return 1;
}
@@ -414,7 +417,7 @@ bool PluginInstallerImpl::IsRTLLayout() const {
LRESULT PluginInstallerImpl::OnPaint(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled) {
PAINTSTRUCT paint_struct = {0};
- BeginPaint(&paint_struct);
+ BeginPaint(hwnd(), &paint_struct);
int save_dc_context = SaveDC(paint_struct.hdc);
// The drawing order is as below:-
@@ -441,7 +444,7 @@ LRESULT PluginInstallerImpl::OnPaint(UINT message, WPARAM wparam, LPARAM lparam,
text_rect.bottom = text_rect.top + device_point.y;
RECT client_rect = {0};
- GetClientRect(&client_rect);
+ GetClientRect(hwnd(), &client_rect);
int icon_width = GetSystemMetrics(SM_CXICON);
int icon_height = GetSystemMetrics(SM_CYICON);
@@ -491,7 +494,7 @@ LRESULT PluginInstallerImpl::OnPaint(UINT message, WPARAM wparam, LPARAM lparam,
}
RestoreDC(paint_struct.hdc, save_dc_context);
- EndPaint(&paint_struct);
+ EndPaint(hwnd(), &paint_struct);
return 0;
}
@@ -551,7 +554,7 @@ void PluginInstallerImpl::PaintUserActionInformation(HDC paint_dc,
void PluginInstallerImpl::ShowInstallDialog() {
enable_click_ = false;
install_dialog_.Initialize(this, plugin_name_);
- install_dialog_.Create(m_hWnd, NULL);
+ install_dialog_.Create(hwnd(), NULL);
install_dialog_.ShowWindow(SW_SHOW);
}
@@ -581,7 +584,7 @@ LRESULT PluginInstallerImpl::OnLButtonDown(UINT message, WPARAM wparam,
LRESULT PluginInstallerImpl::OnSetCursor(UINT message, WPARAM wparam,
LPARAM lparam, BOOL& handled) {
if (enable_click_) {
- ::SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
+ SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)));
return 1;
}
handled = FALSE;
@@ -657,7 +660,7 @@ LRESULT PluginInstallerImpl::OnActiveXInstallResult(UINT message,
if (SUCCEEDED(wparam)) {
set_plugin_installer_state(PluginInstallerLaunchSuccess);
DisplayStatus(IDS_DEFAULT_PLUGIN_REFRESH_PLUGIN_MSG);
- PostMessage(kRefreshPluginsMessage, 0, 0);
+ PostMessage(hwnd(), kRefreshPluginsMessage, 0, 0);
} else if ((wparam == INET_E_UNKNOWN_PROTOCOL) ||
(wparam == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND))) {
set_plugin_installer_state(PluginDownloadFailed);
diff --git a/webkit/default_plugin/plugin_impl_win.h b/webkit/default_plugin/plugin_impl_win.h
index 66a97c6..a0e5596 100644
--- a/webkit/default_plugin/plugin_impl_win.h
+++ b/webkit/default_plugin/plugin_impl_win.h
@@ -5,11 +5,10 @@
#ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_
#define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_
-#include <atlbase.h>
-#include <atlwin.h>
#include <string>
#include <vector>
+#include "base/window_impl.h"
#include "third_party/npapi/bindings/npapi.h"
#include "webkit/default_plugin/install_dialog.h"
#include "webkit/default_plugin/plugin_database_handler.h"
@@ -36,7 +35,7 @@ class PluginDatabaseHandler;
// Provides the plugin installation functionality. This class is
// instantiated with the information like the mime type of the
// target plugin, the display mode, etc.
-class PluginInstallerImpl : public CWindowImpl<PluginInstallerImpl> {
+class PluginInstallerImpl : public base::WindowImpl {
public:
static const int kRefreshPluginsMessage = WM_APP + 1;
static const int kInstallMissingPluginMessage = WM_APP + 2;
@@ -47,7 +46,7 @@ class PluginInstallerImpl : public CWindowImpl<PluginInstallerImpl> {
explicit PluginInstallerImpl(int16 mode);
virtual ~PluginInstallerImpl();
- BEGIN_MSG_MAP(PluginInstallerImpl)
+ BEGIN_MSG_MAP_EX(PluginInstallerImpl)
MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround)
MESSAGE_HANDLER(WM_PAINT, OnPaint)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
@@ -151,7 +150,6 @@ class PluginInstallerImpl : public CWindowImpl<PluginInstallerImpl> {
// activex.
int16 NPP_HandleEvent(void* event);
- HWND window() const { return m_hWnd; }
const std::string& mime_type() const { return mime_type_; }
// Replaces a resource string with the placeholder passed in as an argument
@@ -375,7 +373,7 @@ class PluginInstallerImpl : public CWindowImpl<PluginInstallerImpl> {
std::string activex_clsid_;
CComObject<ActiveXInstaller>* activex_installer_;
- DISALLOW_EVIL_CONSTRUCTORS(PluginInstallerImpl);
+ DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl);
};
diff --git a/webkit/tools/test_shell/foreground_helper.h b/webkit/tools/test_shell/foreground_helper.h
index 9456ded..a687c0d 100644
--- a/webkit/tools/test_shell/foreground_helper.h
+++ b/webkit/tools/test_shell/foreground_helper.h
@@ -38,16 +38,16 @@ class ForegroundHelper : public base::WindowImpl {
// be in the foreground and allowed to move the target window
// into the foreground too.
- set_window_ex_style(WS_POPUP);
+ set_window_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(GetNativeView(), GWLP_USERDATA,
+ SetWindowLongPtr(hwnd(), GWLP_USERDATA,
reinterpret_cast<ULONG_PTR>(window));
- RegisterHotKey(GetNativeView(), hotkey_id, 0, VK_F22);
+ RegisterHotKey(hwnd(), hotkey_id, 0, VK_F22);
// If the calling thread is not yet a UI thread, call PeekMessage
// to ensure creation of its message queue.
@@ -72,8 +72,8 @@ class ForegroundHelper : public base::WindowImpl {
break;
}
- UnregisterHotKey(GetNativeView(), hotkey_id);
- DestroyWindow();
+ UnregisterHotKey(hwnd(), hotkey_id);
+ DestroyWindow(hwnd());
return S_OK;
}
@@ -83,7 +83,7 @@ class ForegroundHelper : public base::WindowImpl {
WPARAM wparam,
LPARAM lparam,
BOOL& handled) {
- HWND window = reinterpret_cast<HWND>(GetWindowLongPtr(GetNativeView(),
+ HWND window = reinterpret_cast<HWND>(GetWindowLongPtr(hwnd(),
GWLP_USERDATA));
SetForegroundWindow(window);
return 1;
diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp
index 9af9e28..a4c7857 100644
--- a/webkit/webkit.gyp
+++ b/webkit/webkit.gyp
@@ -1502,6 +1502,9 @@
],
}, { # else: OS=="win"
'sources/': [['exclude', '_posix\\.cc$']],
+ 'include_dirs': [
+ '../chrome/third_party/wtl/include',
+ ],
'dependencies': [
'../build/win/system.gyp:cygwin',
'activex_shim/activex_shim.gyp:activex_shim',