diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 22:56:54 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-14 22:56:54 +0000 |
commit | e80eb5d77db328a9270a0c8caac467ab2345b914 (patch) | |
tree | 76aa032117b6d55c2c5a3e974f84aadb2dc7e4fa /chrome | |
parent | ddece899b99061860b28399b91dd6545d15ceecf (diff) | |
download | chromium_src-e80eb5d77db328a9270a0c8caac467ab2345b914.zip chromium_src-e80eb5d77db328a9270a0c8caac467ab2345b914.tar.gz chromium_src-e80eb5d77db328a9270a0c8caac467ab2345b914.tar.bz2 |
Rename RenderWidgetHostHWND to RenderWidgetHostViewWin for consistency with other view-related classes.
No logic change.
Review URL: http://codereview.chromium.org/7310
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.vcproj | 6 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_view.h | 13 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_view_win.cc (renamed from chrome/browser/render_widget_host_hwnd.cc) | 175 | ||||
-rw-r--r-- | chrome/browser/render_widget_host_view_win.h (renamed from chrome/browser/render_widget_host_hwnd.h) | 30 | ||||
-rw-r--r-- | chrome/browser/views/hwnd_html_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/web_contents.cc | 20 | ||||
-rw-r--r-- | chrome/browser/web_contents.h | 1 | ||||
-rw-r--r-- | chrome/browser/web_contents_view.h | 6 | ||||
-rw-r--r-- | chrome/browser/web_contents_view_win.cc | 6 | ||||
-rw-r--r-- | chrome/browser/web_contents_view_win.h | 2 |
10 files changed, 139 insertions, 124 deletions
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 8a83569..be4e198 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -530,15 +530,15 @@ > </File> <File - RelativePath=".\render_widget_host_hwnd.cc" + RelativePath=".\render_widget_host_view.h" > </File> <File - RelativePath=".\render_widget_host_hwnd.h" + RelativePath=".\render_widget_host_view_win.cc" > </File> <File - RelativePath=".\render_widget_host_view.h" + RelativePath=".\render_widget_host_view_win.h" > </File> <File diff --git a/chrome/browser/render_widget_host_view.h b/chrome/browser/render_widget_host_view.h index a50bbef..a94add7 100644 --- a/chrome/browser/render_widget_host_view.h +++ b/chrome/browser/render_widget_host_view.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_H__ -#define CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_H__ +#ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ +#define CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ #include <windows.h> @@ -97,7 +97,14 @@ class RenderWidgetHostView { // Tells the View that the tooltip text for the current mouse position over // the page has changed. virtual void SetTooltipText(const std::wstring& tooltip_text) = 0; + + protected: + // Interface class only, do not construct. + RenderWidgetHostView() {} + + private: + DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView); }; -#endif // #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_H__ +#endif // #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_H_ diff --git a/chrome/browser/render_widget_host_hwnd.cc b/chrome/browser/render_widget_host_view_win.cc index bc49e62..bc9c283 100644 --- a/chrome/browser/render_widget_host_hwnd.cc +++ b/chrome/browser/render_widget_host_view_win.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/render_widget_host_hwnd.h" +#include "chrome/browser/render_widget_host_view_win.h" #include "base/command_line.h" #include "base/gfx/gdi_util.h" @@ -24,16 +24,35 @@ #include "chrome/views/hwnd_view_container.h" #include "webkit/glue/webcursor.h" +namespace { + // Tooltips will wrap after this width. Yes, wrap. Imagine that! -static const int kTooltipMaxWidthPixels = 300; +const int kTooltipMaxWidthPixels = 300; // Maximum number of characters we allow in a tooltip. -static const int kMaxTooltipLength = 1024; +const int kMaxTooltipLength = 1024; + +// A callback function for EnumThreadWindows to enumerate and dismiss +// any owned popop windows +BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) { + const HWND toplevel_hwnd = reinterpret_cast<HWND>(arg); + + if (::IsWindowVisible(window)) { + const HWND owner = ::GetWindow(window, GW_OWNER); + if (toplevel_hwnd == owner) { + ::PostMessage(window, WM_CANCELMODE, 0, 0); + } + } + + return TRUE; +} + +} // namespace /////////////////////////////////////////////////////////////////////////////// -// RenderWidgetHostHWND, public: +// RenderWidgetHostViewWin, public: -RenderWidgetHostHWND::RenderWidgetHostHWND( +RenderWidgetHostViewWin::RenderWidgetHostViewWin( RenderWidgetHost* render_widget_host) : RenderWidgetHostView(), render_widget_host_(render_widget_host), @@ -50,16 +69,16 @@ RenderWidgetHostHWND::RenderWidgetHostHWND( is_loading_(false) { } -RenderWidgetHostHWND::~RenderWidgetHostHWND() { +RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { if (real_cursor_type_ == WebCursor::CUSTOM) DestroyIcon(real_cursor_); ResetTooltip(); } /////////////////////////////////////////////////////////////////////////////// -// RenderWidgetHostHWND, RenderWidgetHostView implementation: +// RenderWidgetHostViewWin, RenderWidgetHostView implementation: -void RenderWidgetHostHWND::DidBecomeSelected() { +void RenderWidgetHostViewWin::DidBecomeSelected() { if (!is_hidden_) return; @@ -68,7 +87,7 @@ void RenderWidgetHostHWND::DidBecomeSelected() { render_widget_host_->WasRestored(); } -void RenderWidgetHostHWND::WasHidden() { +void RenderWidgetHostViewWin::WasHidden() { if (is_hidden_) return; @@ -89,7 +108,7 @@ void RenderWidgetHostHWND::WasHidden() { // Windows messages. } -void RenderWidgetHostHWND::SetSize(const gfx::Size& size) { +void RenderWidgetHostViewWin::SetSize(const gfx::Size& size) { if (is_hidden_) return; @@ -101,13 +120,13 @@ void RenderWidgetHostHWND::SetSize(const gfx::Size& size) { EnsureTooltip(); } -HWND RenderWidgetHostHWND::GetPluginHWND() { +HWND RenderWidgetHostViewWin::GetPluginHWND() { return m_hWnd; } -void RenderWidgetHostHWND::ForwardMouseEventToRenderer(UINT message, - WPARAM wparam, - LPARAM lparam) { +void RenderWidgetHostViewWin::ForwardMouseEventToRenderer(UINT message, + WPARAM wparam, + LPARAM lparam) { WebMouseEvent event(m_hWnd, message, wparam, lparam); switch (event.type) { case WebInputEvent::MOUSE_MOVE: @@ -136,12 +155,12 @@ void RenderWidgetHostHWND::ForwardMouseEventToRenderer(UINT message, } } -void RenderWidgetHostHWND::Focus() { +void RenderWidgetHostViewWin::Focus() { if (IsWindow()) SetFocus(); } -void RenderWidgetHostHWND::Blur() { +void RenderWidgetHostViewWin::Blur() { ChromeViews::FocusManager* focus_manager = ChromeViews::FocusManager::GetFocusManager(GetParent()); // We don't have a FocusManager if we are hidden. @@ -149,11 +168,11 @@ void RenderWidgetHostHWND::Blur() { focus_manager->ClearFocus(); } -bool RenderWidgetHostHWND::HasFocus() { +bool RenderWidgetHostViewWin::HasFocus() { return ::GetFocus() == m_hWnd; } -void RenderWidgetHostHWND::Show() { +void RenderWidgetHostViewWin::Show() { DCHECK(parent_hwnd_); SetParent(parent_hwnd_); ShowWindow(SW_SHOW); @@ -161,7 +180,7 @@ void RenderWidgetHostHWND::Show() { DidBecomeSelected(); } -void RenderWidgetHostHWND::Hide() { +void RenderWidgetHostViewWin::Hide() { if (::GetFocus() == m_hWnd) ::SetFocus(NULL); ShowWindow(SW_HIDE); @@ -172,13 +191,13 @@ void RenderWidgetHostHWND::Hide() { WasHidden(); } -gfx::Rect RenderWidgetHostHWND::GetViewBounds() const { +gfx::Rect RenderWidgetHostViewWin::GetViewBounds() const { CRect window_rect; GetWindowRect(&window_rect); return gfx::Rect(window_rect); } -void RenderWidgetHostHWND::UpdateCursor(const WebCursor& cursor) { +void RenderWidgetHostViewWin::UpdateCursor(const WebCursor& cursor) { static HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); @@ -201,7 +220,7 @@ void RenderWidgetHostHWND::UpdateCursor(const WebCursor& cursor) { UpdateCursorIfOverSelf(); } -void RenderWidgetHostHWND::UpdateCursorIfOverSelf() { +void RenderWidgetHostViewWin::UpdateCursorIfOverSelf() { static HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); @@ -221,13 +240,13 @@ void RenderWidgetHostHWND::UpdateCursorIfOverSelf() { SetCursor(display_cursor); } -void RenderWidgetHostHWND::SetIsLoading(bool is_loading) { +void RenderWidgetHostViewWin::SetIsLoading(bool is_loading) { is_loading_ = is_loading; UpdateCursorIfOverSelf(); } -void RenderWidgetHostHWND::IMEUpdateStatus(ViewHostMsg_ImeControl control, - int x, int y) { +void RenderWidgetHostViewWin::IMEUpdateStatus(ViewHostMsg_ImeControl control, + int x, int y) { if (control == IME_DISABLE) { ime_input_.DisableIME(m_hWnd); } else { @@ -235,7 +254,7 @@ void RenderWidgetHostHWND::IMEUpdateStatus(ViewHostMsg_ImeControl control, } } -void RenderWidgetHostHWND::DidPaintRect(const gfx::Rect& rect) { +void RenderWidgetHostViewWin::DidPaintRect(const gfx::Rect& rect) { if (is_hidden_) return; @@ -246,14 +265,14 @@ void RenderWidgetHostHWND::DidPaintRect(const gfx::Rect& rect) { // rate-limiting of backing store updates. This helps a lot on pages that // have animations or fairly expensive layout (e.g., google maps). // - // Please refer to the RenderWidgetHostHWND::DidScrollRect function for the + // Please refer to the RenderWidgetHostViewWin::DidScrollRect function for the // reasoning behind the combination of flags passed to RedrawWindow. // RedrawWindow(&invalid_rect, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_FRAME); } -void RenderWidgetHostHWND::DidScrollRect( +void RenderWidgetHostViewWin::DidScrollRect( const gfx::Rect& rect, int dx, int dy) { if (is_hidden_) return; @@ -273,7 +292,7 @@ void RenderWidgetHostHWND::DidScrollRect( // rate-limiting of backing store updates. This helps a lot on pages that // have animations or fairly expensive layout (e.g., google maps). // - // Our RenderWidgetHostHWND does not have a non-client area, whereas the + // Our RenderWidgetHostViewWin does not have a non-client area, whereas the // children (plugin windows) may. If we don't pass in RDW_FRAME then the // children don't receive WM_NCPAINT messages while scrolling, which causes // painting problems (http://b/issue?id=923945). We need to pass @@ -283,13 +302,13 @@ void RenderWidgetHostHWND::DidScrollRect( RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN | RDW_FRAME); } -void RenderWidgetHostHWND::RendererGone() { +void RenderWidgetHostViewWin::RendererGone() { // TODO(darin): keep this around, and draw sad-tab into it. UpdateCursorIfOverSelf(); DestroyWindow(); } -void RenderWidgetHostHWND::Destroy() { +void RenderWidgetHostViewWin::Destroy() { // We've been told to destroy. // By clearing close_on_deactivate_, we prevent further deactivations // (caused by windows messages resulting from the DestroyWindow) from @@ -299,7 +318,7 @@ void RenderWidgetHostHWND::Destroy() { DestroyWindow(); } -void RenderWidgetHostHWND::SetTooltipText(const std::wstring& tooltip_text) { +void RenderWidgetHostViewWin::SetTooltipText(const std::wstring& tooltip_text) { if (tooltip_text != tooltip_text_) { tooltip_text_ = tooltip_text; @@ -328,17 +347,17 @@ void RenderWidgetHostHWND::SetTooltipText(const std::wstring& tooltip_text) { } /////////////////////////////////////////////////////////////////////////////// -// RenderWidgetHostHWND, private: +// RenderWidgetHostViewWin, private: -LRESULT RenderWidgetHostHWND::OnCreate(CREATESTRUCT* create_struct) { +LRESULT RenderWidgetHostViewWin::OnCreate(CREATESTRUCT* create_struct) { // Call the WM_INPUTLANGCHANGE message handler to initialize the input locale // of a browser process. OnInputLangChange(0, 0); return 0; } -void RenderWidgetHostHWND::OnActivate(UINT action, BOOL minimized, - HWND window) { +void RenderWidgetHostViewWin::OnActivate(UINT action, BOOL minimized, + HWND window) { // If the container is a popup, clicking elsewhere on screen should close the // popup. if (close_on_deactivate_ && action == WA_INACTIVE) { @@ -348,12 +367,12 @@ void RenderWidgetHostHWND::OnActivate(UINT action, BOOL minimized, } } -void RenderWidgetHostHWND::OnDestroy() { +void RenderWidgetHostViewWin::OnDestroy() { ResetTooltip(); TrackMouseLeave(false); } -void RenderWidgetHostHWND::OnPaint(HDC dc) { +void RenderWidgetHostViewWin::OnPaint(HDC dc) { DCHECK(render_widget_host_->process()->channel()); CPaintDC paint_dc(m_hWnd); @@ -412,34 +431,34 @@ void RenderWidgetHostHWND::OnPaint(HDC dc) { } } -void RenderWidgetHostHWND::OnNCPaint(HRGN update_region) { +void RenderWidgetHostViewWin::OnNCPaint(HRGN update_region) { // Do nothing. This suppresses the resize corner that Windows would // otherwise draw for us. } -LRESULT RenderWidgetHostHWND::OnEraseBkgnd(HDC dc) { +LRESULT RenderWidgetHostViewWin::OnEraseBkgnd(HDC dc) { return 1; } -LRESULT RenderWidgetHostHWND::OnSetCursor(HWND window, UINT hittest_code, - UINT mouse_message_id) { +LRESULT RenderWidgetHostViewWin::OnSetCursor(HWND window, UINT hittest_code, + UINT mouse_message_id) { UpdateCursorIfOverSelf(); return 0; } -void RenderWidgetHostHWND::OnSetFocus(HWND window) { +void RenderWidgetHostViewWin::OnSetFocus(HWND window) { render_widget_host_->Focus(); } -void RenderWidgetHostHWND::OnKillFocus(HWND window) { +void RenderWidgetHostViewWin::OnKillFocus(HWND window) { render_widget_host_->Blur(); } -void RenderWidgetHostHWND::OnCaptureChanged(HWND window) { +void RenderWidgetHostViewWin::OnCaptureChanged(HWND window) { render_widget_host_->LostCapture(); } -void RenderWidgetHostHWND::OnCancelMode() { +void RenderWidgetHostViewWin::OnCancelMode() { render_widget_host_->LostCapture(); if (close_on_deactivate_ && shutdown_factory_.empty()) { @@ -452,12 +471,12 @@ void RenderWidgetHostHWND::OnCancelMode() { SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); MessageLoop::current()->PostTask(FROM_HERE, shutdown_factory_.NewRunnableMethod( - &RenderWidgetHostHWND::ShutdownHost)); + &RenderWidgetHostViewWin::ShutdownHost)); } } -void RenderWidgetHostHWND::OnInputLangChange(DWORD character_set, - HKL input_language_id) { +void RenderWidgetHostViewWin::OnInputLangChange(DWORD character_set, + HKL input_language_id) { // Send the given Locale ID to the ImeInput object and retrieves whether // or not the current input context has IMEs. // If the current input context has IMEs, a browser process has to send a @@ -496,11 +515,11 @@ void RenderWidgetHostHWND::OnInputLangChange(DWORD character_set, } } -void RenderWidgetHostHWND::OnThemeChanged() { +void RenderWidgetHostViewWin::OnThemeChanged() { render_widget_host_->SystemThemeChanged(); } -LRESULT RenderWidgetHostHWND::OnNotify(int w_param, NMHDR* header) { +LRESULT RenderWidgetHostViewWin::OnNotify(int w_param, NMHDR* header) { if (tooltip_hwnd_ == NULL) return 0; @@ -526,7 +545,7 @@ LRESULT RenderWidgetHostHWND::OnNotify(int w_param, NMHDR* header) { return 0; } -LRESULT RenderWidgetHostHWND::OnImeSetContext( +LRESULT RenderWidgetHostViewWin::OnImeSetContext( UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { // We need status messages about the focused input control from a // renderer process when: @@ -551,7 +570,7 @@ LRESULT RenderWidgetHostHWND::OnImeSetContext( return 0; } -LRESULT RenderWidgetHostHWND::OnImeStartComposition( +LRESULT RenderWidgetHostViewWin::OnImeStartComposition( UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { // Reset the composition status and create IME windows. ime_input_.CreateImeWindow(m_hWnd); @@ -563,7 +582,7 @@ LRESULT RenderWidgetHostHWND::OnImeStartComposition( return 0; } -LRESULT RenderWidgetHostHWND::OnImeComposition( +LRESULT RenderWidgetHostViewWin::OnImeComposition( UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { // At first, update the position of the IME window. ime_input_.UpdateImeWindow(m_hWnd); @@ -600,7 +619,7 @@ LRESULT RenderWidgetHostHWND::OnImeComposition( return 0; } -LRESULT RenderWidgetHostHWND::OnImeEndComposition( +LRESULT RenderWidgetHostViewWin::OnImeEndComposition( UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled) { if (ime_input_.is_composing()) { // A composition has been ended while there is an ongoing composition, @@ -618,8 +637,8 @@ LRESULT RenderWidgetHostHWND::OnImeEndComposition( return 0; } -LRESULT RenderWidgetHostHWND::OnMouseEvent(UINT message, WPARAM wparam, - LPARAM lparam, BOOL& handled) { +LRESULT RenderWidgetHostViewWin::OnMouseEvent(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { handled = TRUE; if (::IsWindow(tooltip_hwnd_)) { @@ -663,8 +682,8 @@ LRESULT RenderWidgetHostHWND::OnMouseEvent(UINT message, WPARAM wparam, return 0; } -LRESULT RenderWidgetHostHWND::OnKeyEvent(UINT message, WPARAM wparam, - LPARAM lparam, BOOL& handled) { +LRESULT RenderWidgetHostViewWin::OnKeyEvent(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { handled = TRUE; // If we are a pop-up, forward tab related messages to our parent HWND, so @@ -687,8 +706,8 @@ LRESULT RenderWidgetHostHWND::OnKeyEvent(UINT message, WPARAM wparam, return 0; } -LRESULT RenderWidgetHostHWND::OnWheelEvent(UINT message, WPARAM wparam, - LPARAM lparam, BOOL& handled) { +LRESULT RenderWidgetHostViewWin::OnWheelEvent(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { // Workaround for Thinkpad mousewheel driver. We get mouse wheel/scroll // messages even if we are not in the foreground. So here we check if // we have any owned popup windows in the foreground and dismiss them. @@ -726,8 +745,8 @@ LRESULT RenderWidgetHostHWND::OnWheelEvent(UINT message, WPARAM wparam, return 0; } -LRESULT RenderWidgetHostHWND::OnMouseActivate(UINT, WPARAM, LPARAM, - BOOL& handled) { +LRESULT RenderWidgetHostViewWin::OnMouseActivate(UINT, WPARAM, LPARAM, + BOOL& handled) { // We handle WM_MOUSEACTIVATE to set focus to the underlying plugin // child window. This is to ensure that keyboard events are received // by the plugin. The correct way to fix this would be send over @@ -749,8 +768,8 @@ LRESULT RenderWidgetHostHWND::OnMouseActivate(UINT, WPARAM, LPARAM, } } -LRESULT RenderWidgetHostHWND::OnGetObject(UINT message, WPARAM wparam, - LPARAM lparam, BOOL& handled) { +LRESULT RenderWidgetHostViewWin::OnGetObject(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { LRESULT reference_result = static_cast<LRESULT>(0L); // Accessibility readers will send an OBJID_CLIENT message. @@ -799,12 +818,12 @@ LRESULT RenderWidgetHostHWND::OnGetObject(UINT message, WPARAM wparam, return reference_result; } -void RenderWidgetHostHWND::OnFinalMessage(HWND window) { +void RenderWidgetHostViewWin::OnFinalMessage(HWND window) { render_widget_host_->ViewDestroyed(); delete this; } -void RenderWidgetHostHWND::TrackMouseLeave(bool track) { +void RenderWidgetHostViewWin::TrackMouseLeave(bool track) { if (track == track_mouse_leave_) return; track_mouse_leave_ = track; @@ -821,11 +840,11 @@ void RenderWidgetHostHWND::TrackMouseLeave(bool track) { TrackMouseEvent(&tme); } -bool RenderWidgetHostHWND::Send(IPC::Message* message) { +bool RenderWidgetHostViewWin::Send(IPC::Message* message) { return render_widget_host_->Send(message); } -void RenderWidgetHostHWND::EnsureTooltip() { +void RenderWidgetHostViewWin::EnsureTooltip() { UINT message = TTM_NEWTOOLRECT; TOOLINFO ti; @@ -847,27 +866,13 @@ void RenderWidgetHostHWND::EnsureTooltip() { SendMessage(tooltip_hwnd_, message, NULL, reinterpret_cast<LPARAM>(&ti)); } -void RenderWidgetHostHWND::ResetTooltip() { +void RenderWidgetHostViewWin::ResetTooltip() { if (::IsWindow(tooltip_hwnd_)) ::DestroyWindow(tooltip_hwnd_); tooltip_hwnd_ = NULL; } -BOOL CALLBACK RenderWidgetHostHWND::DismissOwnedPopups(HWND window, - LPARAM arg) { - const HWND toplevel_hwnd = reinterpret_cast<HWND>(arg); - - if (::IsWindowVisible(window)) { - const HWND owner = ::GetWindow(window, GW_OWNER); - if (toplevel_hwnd == owner) { - ::PostMessage(window, WM_CANCELMODE, 0, 0); - } - } - - return TRUE; -} - -void RenderWidgetHostHWND::ShutdownHost() { +void RenderWidgetHostViewWin::ShutdownHost() { shutdown_factory_.RevokeAll(); render_widget_host_->Shutdown(); // Do not touch any members at this point, |this| has been deleted. diff --git a/chrome/browser/render_widget_host_hwnd.h b/chrome/browser/render_widget_host_view_win.h index c9a392b..d49b9de 100644 --- a/chrome/browser/render_widget_host_hwnd.h +++ b/chrome/browser/render_widget_host_view_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_CONTAINER_H__ -#define CHROME_BROWSER_RENDER_WIDGET_HOST_CONTAINER_H__ +#ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_WIN_H_ +#define CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_WIN_H_ #include <atlbase.h> #include <atlapp.h> @@ -40,8 +40,10 @@ static const wchar_t* const kRenderWidgetHostHWNDClass = // RenderWidgetHostHWND // // An object representing the "View" of a rendered web page. This object is -// responsible for displaying the content of the web page, receiving messages -// and containing plugins HWNDs. +// responsible for displaying the content of the web page, receiving windows +// messages, and containing plugins HWNDs. It is the implementation of the +// RenderWidgetHostView that the cross-platform RenderWidgetHost object uses +// to display the data. // // Comment excerpted from render_widget_host.h: // @@ -49,14 +51,14 @@ static const wchar_t* const kRenderWidgetHostHWNDClass = // If the render process dies, the RenderWidgetHostHWND goes away and all // references to it must become NULL." // -class RenderWidgetHostHWND : - public CWindowImpl<RenderWidgetHostHWND, +class RenderWidgetHostViewWin : + public CWindowImpl<RenderWidgetHostViewWin, CWindow, RenderWidgetHostHWNDTraits>, public RenderWidgetHostView { public: - RenderWidgetHostHWND(RenderWidgetHost* render_widget_host); - virtual ~RenderWidgetHostHWND(); + explicit RenderWidgetHostViewWin(RenderWidgetHost* render_widget_host); + virtual ~RenderWidgetHostViewWin(); void set_close_on_deactivate(bool close_on_deactivate) { close_on_deactivate_ = close_on_deactivate; @@ -110,7 +112,7 @@ class RenderWidgetHostHWND : MESSAGE_HANDLER(WM_GETOBJECT, OnGetObject) END_MSG_MAP() - // Overridden from RenderWidgetHostView: + // Implementation of RenderWidgetHostView: virtual void DidBecomeSelected(); virtual void WasHidden(); virtual void SetSize(const gfx::Size& size); @@ -194,10 +196,6 @@ class RenderWidgetHostHWND : LRESULT SynthesizeMouseWheel(bool is_vertical, int scroll_code, short scroll_position); - // A callback function for EnumThreadWindows to enumerate and dismiss - // any owned popop windows - static BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg); - // Shuts down the render_widget_host_. This is a separate function so we can // invoke it from the message loop. void ShutdownHost(); @@ -243,7 +241,7 @@ class RenderWidgetHostHWND : bool tooltip_showing_; // Factory used to safely scope delayed calls to ShutdownHost(). - ScopedRunnableMethodFactory<RenderWidgetHostHWND> shutdown_factory_; + ScopedRunnableMethodFactory<RenderWidgetHostViewWin> shutdown_factory_; // Our parent HWND. We keep a reference to it as we SetParent(NULL) when // hidden to prevent getting messages (Paint, Resize...), and we reattach @@ -259,8 +257,8 @@ class RenderWidgetHostHWND : // value returns true for is_null() if we are not recording whiteout times. TimeTicks whiteout_start_time_; - DISALLOW_EVIL_CONSTRUCTORS(RenderWidgetHostHWND); + DISALLOW_EVIL_CONSTRUCTORS(RenderWidgetHostViewWin); }; -#endif // #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_CONTAINER_H__ +#endif // #ifndef CHROME_BROWSER_RENDER_WIDGET_HOST_VIEW_WIN_H_ diff --git a/chrome/browser/views/hwnd_html_view.cc b/chrome/browser/views/hwnd_html_view.cc index ebb610b..07c37f4 100644 --- a/chrome/browser/views/hwnd_html_view.cc +++ b/chrome/browser/views/hwnd_html_view.cc @@ -5,7 +5,7 @@ #include "chrome/browser/views/hwnd_html_view.h" #include "chrome/browser/render_view_host.h" -#include "chrome/browser/render_widget_host_hwnd.h" +#include "chrome/browser/render_widget_host_view_win.h" #include "chrome/browser/render_view_host_delegate.h" #include "chrome/browser/site_instance.h" #include "chrome/views/view_container.h" @@ -25,7 +25,7 @@ void HWNDHtmlView::Init(HWND parent_hwnd) { delegate_, MSG_ROUTING_NONE, NULL); render_view_host_ = rvh; - RenderWidgetHostHWND* view = new RenderWidgetHostHWND(rvh); + RenderWidgetHostHWND* view = new RenderWidgetHostViewWin(rvh); rvh->set_view(view); // Create the HWND. Note: diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index 3b8e5086..1139393 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -29,7 +29,7 @@ #include "chrome/browser/plugin_service.h" #include "chrome/browser/printing/print_job.h" #include "chrome/browser/render_view_host.h" -#include "chrome/browser/render_widget_host_hwnd.h" +#include "chrome/browser/render_widget_host_view_win.h" // TODO(brettw) delete me. #include "chrome/browser/template_url_fetcher.h" #include "chrome/browser/template_url_model.h" #include "chrome/browser/views/hung_renderer_view.h" // TODO(brettw) delete me. @@ -738,7 +738,11 @@ void WebContents::CreateView(int route_id, HANDLE modal_dialog_event) { void WebContents::CreateWidget(int route_id) { RenderWidgetHost* widget_host = new RenderWidgetHost(process(), route_id); - RenderWidgetHostHWND* widget_view = new RenderWidgetHostHWND(widget_host); + // TODO(brettw) createe the view in some cross-platform way (probably move + // to the WebContentsView). CreatePageView seems to do this already? This + // is confusing. + RenderWidgetHostViewWin* widget_view = + new RenderWidgetHostViewWin(widget_host); widget_host->set_view(widget_view); // We set the parent HWDN explicitly as pop-up HWNDs are parented and owned by // the first non-child HWND of the HWND that was specified to the CreateWindow @@ -785,17 +789,17 @@ void WebContents::ShowWidget(int route_id, const gfx::Rect& initial_pos) { pending_widgets_.erase(route_id); // TODO(beng): (Cleanup) move all this windows-specific creation and showing - // code into RenderWidgetHostHWND behind some API that a + // code into RenderWidgetHostViewWin behind some API that a // ChromeView can also reasonably implement. - RenderWidgetHostHWND* widget_view = - static_cast<RenderWidgetHostHWND*>(widget_host->view()); + RenderWidgetHostViewWin* widget_view = + static_cast<RenderWidgetHostViewWin*>(widget_host->view()); if (!widget_view || !widget_host->process()->channel()) { // The view has gone away or the renderer crashed. Nothing to do. return; } - // This logic should be implemented by RenderWidgetHostHWND (as mentioned + // This logic should be implemented by RenderWidgetHostViewWin (as mentioned // above) in the ::Init function, which should take a parent and some initial // bounds. widget_view->Create(view_->GetContainerHWND(), NULL, NULL, @@ -1600,10 +1604,10 @@ void WebContents::UpdateRenderViewSizeForRenderManager() { bool WebContents::CreateRenderViewForRenderManager( RenderViewHost* render_view_host) { - // TODO(brettw) move this to the view. Probably the RenderWidgetHostHWNDs + // TODO(brettw) move this to the view. Probably the RenderWidgetHostViewWins // should be created by a factory somewhere that just returns a // RenderWidgetHostView*. - RenderWidgetHostHWND* rvh_view = view_->CreatePageView(render_view_host); + RenderWidgetHostViewWin* rvh_view = view_->CreatePageView(render_view_host); bool ok = render_view_host->CreateRenderView(); if (ok) { diff --git a/chrome/browser/web_contents.h b/chrome/browser/web_contents.h index d11457b..1724ea1 100644 --- a/chrome/browser/web_contents.h +++ b/chrome/browser/web_contents.h @@ -22,7 +22,6 @@ class PluginInstaller; class RenderViewHost; class RenderViewHostFactory; class RenderWidgetHost; -class RenderWidgetHostHWND; class SadTabView; class WebContentsView; diff --git a/chrome/browser/web_contents_view.h b/chrome/browser/web_contents_view.h index 55b16e9..e21726f 100644 --- a/chrome/browser/web_contents_view.h +++ b/chrome/browser/web_contents_view.h @@ -15,7 +15,8 @@ class InfoBarView; class RenderViewHost; -class RenderWidgetHostHWND; +class RenderWidgetHost; +class RenderWidgetHostViewWin; struct ViewHostMsg_ContextMenu_Params; class WebContents; struct WebDropData; @@ -33,7 +34,8 @@ class WebContentsView { // Sets up the View that holds the rendered web page, receives messages for // it and contains page plugins. - virtual RenderWidgetHostHWND* CreatePageView( + // TODO(brettw) this should be a RenderWidgetHostView instead. + virtual RenderWidgetHostViewWin* CreatePageView( RenderViewHost* render_view_host) = 0; // Returns the HWND that contains the contents of the tab. diff --git a/chrome/browser/web_contents_view_win.cc b/chrome/browser/web_contents_view_win.cc index c576bb0..82380cd 100644 --- a/chrome/browser/web_contents_view_win.cc +++ b/chrome/browser/web_contents_view_win.cc @@ -10,7 +10,7 @@ #include "chrome/browser/render_view_context_menu.h" #include "chrome/browser/render_view_context_menu_controller.h" #include "chrome/browser/render_view_host.h" -#include "chrome/browser/render_widget_host_hwnd.h" +#include "chrome/browser/render_widget_host_view_win.h" #include "chrome/browser/tab_contents_delegate.h" #include "chrome/browser/views/info_bar_message_view.h" #include "chrome/browser/views/info_bar_view.h" @@ -54,11 +54,11 @@ void WebContentsViewWin::CreateView(HWND parent_hwnd, drop_target_ = new WebDropTarget(GetHWND(), web_contents_); } -RenderWidgetHostHWND* WebContentsViewWin::CreatePageView( +RenderWidgetHostViewWin* WebContentsViewWin::CreatePageView( RenderViewHost* render_view_host) { // Create the View as well. Its lifetime matches the child process'. DCHECK(!render_view_host->view()); - RenderWidgetHostHWND* view = new RenderWidgetHostHWND(render_view_host); + RenderWidgetHostViewWin* view = new RenderWidgetHostViewWin(render_view_host); render_view_host->set_view(view); view->Create(GetHWND()); view->ShowWindow(SW_SHOW); diff --git a/chrome/browser/web_contents_view_win.h b/chrome/browser/web_contents_view_win.h index 75af28b..459dd6e 100644 --- a/chrome/browser/web_contents_view_win.h +++ b/chrome/browser/web_contents_view_win.h @@ -30,7 +30,7 @@ class WebContentsViewWin : public WebContentsView, // CreatePageView. Do we really need both? virtual void CreateView(HWND parent_hwnd, const gfx::Rect& initial_bounds); - virtual RenderWidgetHostHWND* CreatePageView( + virtual RenderWidgetHostViewWin* CreatePageView( RenderViewHost* render_view_host); virtual HWND GetContainerHWND() const; virtual HWND GetContentHWND() const; |