| 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 98efc51cbca27630cf64b965849ebfb11b124180..02b831113f92761ef89498144ec6f93d71e2963b 100644
|
| --- a/content/browser/web_contents/web_contents_view_aura.cc
|
| +++ b/content/browser/web_contents/web_contents_view_aura.cc
|
| @@ -69,10 +69,17 @@
|
| #include "ui/gfx/image/image.h"
|
| #include "ui/gfx/image/image_png_rep.h"
|
| #include "ui/gfx/image/image_skia.h"
|
| -#include "ui/touch_selection/touch_selection_controller.h"
|
| +#include "ui/gfx/native_widget_types.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,
|
| @@ -457,14 +464,26 @@ class WebContentsViewAura::WindowObserver
|
| }
|
|
|
| void OnWindowAddedToRootWindow(aura::Window* window) override {
|
| - if (window == view_->window_.get())
|
| + if (window == view_->window_.get()) {
|
| window->GetHost()->AddObserver(this);
|
| +#if defined(OS_WIN)
|
| + if (view_->legacy_hwnd_) {
|
| + view_->legacy_hwnd_->UpdateParent(
|
| + window->GetHost()->GetAcceleratedWidget());
|
| + }
|
| +#endif
|
| + }
|
| }
|
|
|
| void OnWindowRemovingFromRootWindow(aura::Window* window,
|
| aura::Window* new_root) override {
|
| - if (window == view_->window_.get())
|
| + if (window == view_->window_.get()) {
|
| window->GetHost()->RemoveObserver(this);
|
| +#if defined(OS_WIN)
|
| + if (view_->legacy_hwnd_)
|
| + view_->legacy_hwnd_->UpdateParent(ui::GetHiddenWindow());
|
| +#endif
|
| + }
|
| }
|
|
|
| // Overridden WindowTreeHostObserver:
|
| @@ -626,6 +645,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.
|
| @@ -719,6 +742,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(
|
| @@ -753,12 +784,23 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget(
|
| InstallOverscrollControllerDelegate(view);
|
| }
|
|
|
| +#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) {
|
| @@ -1125,6 +1167,35 @@ void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window,
|
| return;
|
|
|
| web_contents_->UpdateWebContentsVisibility(visible);
|
| +
|
| +#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 ToBrowserAccessibilityWin(manager->GetRoot());
|
| +}
|
| +#endif
|
| +
|
| } // namespace content
|
|
|