| Index: content/browser/web_contents/web_contents_view_aura.cc
|
| diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
|
| index 3a9e7abef6deb7fcc81da206248f59d612280071..f1c0bbe64d268a0002fb9f9e33f8a270c66913d2 100644
|
| --- a/content/browser/web_contents/web_contents_view_aura.cc
|
| +++ b/content/browser/web_contents/web_contents_view_aura.cc
|
| @@ -67,10 +67,17 @@
|
| #include "ui/gfx/image/image.h"
|
| #include "ui/gfx/image/image_png_rep.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| +#include "ui/gfx/native_widget_types.h"
|
| #include "ui/gfx/screen.h"
|
| #include "ui/wm/public/drag_drop_client.h"
|
| #include "ui/wm/public/drag_drop_delegate.h"
|
|
|
| +#if defined(OS_WIN)
|
| +#include "content/browser/accessibility/browser_accessibility_manager.h"
|
| +#include "content/browser/accessibility/browser_accessibility_win.h"
|
| +#include "ui/base/win/hidden_window.h"
|
| +#endif
|
| +
|
| namespace content {
|
| WebContentsView* CreateWebContentsView(
|
| WebContentsImpl* web_contents,
|
| @@ -642,6 +649,10 @@ class WebContentsViewAura::WindowObserver
|
| #if defined(OS_WIN)
|
| if (!window->GetRootWindow()->HasObserver(this))
|
| window->GetRootWindow()->AddObserver(this);
|
| + if (view_->legacy_hwnd_) {
|
| + view_->legacy_hwnd_->UpdateParent(
|
| + window->GetHost()->GetAcceleratedWidget());
|
| + }
|
| #endif
|
| }
|
| }
|
| @@ -661,6 +672,9 @@ class WebContentsViewAura::WindowObserver
|
| root_children[i]->RemoveObserver(this);
|
| }
|
| }
|
| +
|
| + if (view_->legacy_hwnd_)
|
| + view_->legacy_hwnd_->UpdateParent(ui::GetHiddenWindow());
|
| #endif
|
| }
|
| }
|
| @@ -1017,6 +1031,10 @@ void WebContentsViewAura::SizeContents(const gfx::Size& size) {
|
| if (bounds.size() != size) {
|
| bounds.set_size(size);
|
| window_->SetBounds(bounds);
|
| +#if defined(OS_WIN)
|
| + if (legacy_hwnd_)
|
| + legacy_hwnd_->SetBounds(window_->GetBoundsInRootWindow());
|
| +#endif
|
| } else {
|
| // Our size matches what we want but the renderers size may not match.
|
| // Pretend we were resized so that the renderers size is updated too.
|
| @@ -1113,6 +1131,14 @@ void WebContentsViewAura::CreateView(
|
| // platforms as well.
|
| if (delegate_)
|
| drag_dest_delegate_ = delegate_->GetDragDestDelegate();
|
| +
|
| +#if defined(OS_WIN)
|
| + if (context && context->GetHost()) {
|
| + HWND parent_hwnd = context->GetHost()->GetAcceleratedWidget();
|
| + CHECK(parent_hwnd);
|
| + legacy_hwnd_.reset(LegacyRenderWidgetHostHWND::Create(parent_hwnd, this));
|
| + }
|
| +#endif
|
| }
|
|
|
| RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
|
| @@ -1153,12 +1179,24 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
|
| }
|
|
|
| AttachTouchEditableToRenderView();
|
| +
|
| +#if defined(OS_WIN)
|
| + if (legacy_hwnd_)
|
| + view->SetLegacyRenderWidgetHostHWND(legacy_hwnd_.get());
|
| +#endif
|
| +
|
| return view;
|
| }
|
|
|
| RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForPopupWidget(
|
| RenderWidgetHost* render_widget_host) {
|
| - return new RenderWidgetHostViewAura(render_widget_host, false);
|
| + RenderWidgetHostViewAura* view =
|
| + new RenderWidgetHostViewAura(render_widget_host, false);
|
| +#if defined(OS_WIN)
|
| + if (legacy_hwnd_)
|
| + view->SetLegacyRenderWidgetHostHWND(legacy_hwnd_.get());
|
| +#endif
|
| + return view;
|
| }
|
|
|
| void WebContentsViewAura::SetPageTitle(const base::string16& title) {
|
| @@ -1638,6 +1676,35 @@ void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) {
|
| if (web_contents_->should_normally_be_visible())
|
| web_contents_->WasHidden();
|
| }
|
| +
|
| +#if defined(OS_WIN)
|
| + if (!legacy_hwnd_)
|
| + return;
|
| +
|
| + if (visible && GetNativeView() && GetNativeView()->GetHost()) {
|
| + legacy_hwnd_->UpdateParent(
|
| + GetNativeView()->GetHost()->GetAcceleratedWidget());
|
| + legacy_hwnd_->SetBounds(window_->GetBoundsInRootWindow());
|
| + legacy_hwnd_->Show();
|
| + } else {
|
| + // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global
|
| + // hidden window on the same lines as Windowed plugin windows.
|
| + legacy_hwnd_->UpdateParent(ui::GetHiddenWindow());
|
| + legacy_hwnd_->Hide();
|
| + }
|
| +#endif
|
| }
|
|
|
| +#if defined(OS_WIN)
|
| +gfx::NativeViewAccessible
|
| +WebContentsViewAura::GetNativeViewAccessible() {
|
| + BrowserAccessibilityManager* manager =
|
| + web_contents_->GetRootBrowserAccessibilityManager();
|
| + if (!manager)
|
| + return nullptr;
|
| +
|
| + return manager->GetRoot()->ToBrowserAccessibilityWin();
|
| +}
|
| +#endif
|
| +
|
| } // namespace content
|
|
|