From 15787f8f3946a513d39a1f0d9a12925f447fa18d Mon Sep 17 00:00:00 2001 From: "brettw@google.com" Date: Fri, 17 Oct 2008 15:29:03 +0000 Subject: Separate out most view creation from WebContents. This adds a new sub-delegate to RenderViewHostDelegate which is implemented by WebContentsView. I did a lot of plumbing and moving around as a result. Review URL: http://codereview.chromium.org/6608 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3527 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/render_widget_host_view_win.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'chrome/browser/render_widget_host_view_win.cc') diff --git a/chrome/browser/render_widget_host_view_win.cc b/chrome/browser/render_widget_host_view_win.cc index db70018..32d6d55 100644 --- a/chrome/browser/render_widget_host_view_win.cc +++ b/chrome/browser/render_widget_host_view_win.cc @@ -50,13 +50,21 @@ BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) { } // namespace +// RenderWidgetHostView -------------------------------------------------------- + +// static +RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( + RenderWidgetHost* widget) { + return new RenderWidgetHostViewWin(widget); +} + /////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostViewWin, public: RenderWidgetHostViewWin::RenderWidgetHostViewWin( - RenderWidgetHost* render_widget_host) + RenderWidgetHost* widget) : RenderWidgetHostView(), - render_widget_host_(render_widget_host), + render_widget_host_(widget), real_cursor_(LoadCursor(NULL, IDC_ARROW)), real_cursor_type_(WebCursor::ARROW), track_mouse_leave_(false), @@ -68,6 +76,13 @@ RenderWidgetHostViewWin::RenderWidgetHostViewWin( shutdown_factory_(this), parent_hwnd_(NULL), is_loading_(false) { + render_widget_host_->set_view(this); + + // We set the parent HWND explicitly as pop-up HWNDs are parented and owned by + // the first non-child HWND of the HWND that was specified to the CreateWindow + // call. + set_parent_hwnd(GetPluginHWND()); + set_close_on_deactivate(true); } RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { @@ -79,6 +94,10 @@ RenderWidgetHostViewWin::~RenderWidgetHostViewWin() { /////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostViewWin, RenderWidgetHostView implementation: +RenderWidgetHost* RenderWidgetHostViewWin::GetRenderWidgetHost() const { + return render_widget_host_; +} + void RenderWidgetHostViewWin::DidBecomeSelected() { if (!is_hidden_) return; -- cgit v1.1