| Index: content/browser/renderer_host/render_widget_host_view_aura.cc
|
| ===================================================================
|
| --- content/browser/renderer_host/render_widget_host_view_aura.cc (revision 249488)
|
| +++ content/browser/renderer_host/render_widget_host_view_aura.cc (working copy)
|
| @@ -82,6 +82,7 @@
|
| #if defined(OS_WIN)
|
| #include "content/browser/accessibility/browser_accessibility_manager_win.h"
|
| #include "content/browser/accessibility/browser_accessibility_win.h"
|
| +#include "content/browser/renderer_host/legacy_render_widget_host_win.h"
|
| #include "content/common/plugin_constants_win.h"
|
| #include "ui/base/win/hidden_window.h"
|
| #include "ui/gfx/gdi_util.h"
|
| @@ -486,9 +487,6 @@
|
| gfx::Screen::GetScreenFor(window_)->AddObserver(this);
|
| software_frame_manager_.reset(new SoftwareFrameManager(
|
| weak_ptr_factory_.GetWeakPtr()));
|
| -#if defined(OS_WIN)
|
| - plugin_parent_window_ = NULL;
|
| -#endif
|
| ImageTransportFactory::GetInstance()->AddObserver(this);
|
| }
|
|
|
| @@ -618,15 +616,18 @@
|
| }
|
|
|
| #if defined(OS_WIN)
|
| + if (legacy_render_widget_host_HWND_) {
|
| + // Reparent the legacy Chrome_RenderWidgetHostHWND window to the parent
|
| + // window before reparenting any plugins. This ensures that the plugin
|
| + // windows stay on top of the child Zorder in the parent and receive
|
| + // mouse events, etc.
|
| + legacy_render_widget_host_HWND_->UpdateParent(
|
| + GetNativeView()->GetDispatcher()->host()->GetAcceleratedWidget());
|
| + legacy_render_widget_host_HWND_->SetBounds(
|
| + window_->GetBoundsInRootWindow());
|
| + }
|
| LPARAM lparam = reinterpret_cast<LPARAM>(this);
|
| EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam);
|
| -
|
| - if (::IsWindow(plugin_parent_window_)) {
|
| - gfx::Rect window_bounds = window_->GetBoundsInRootWindow();
|
| - ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(),
|
| - window_bounds.y(), window_bounds.width(),
|
| - window_bounds.height(), 0);
|
| - }
|
| #endif
|
| }
|
|
|
| @@ -644,11 +645,12 @@
|
| if (dispatcher) {
|
| HWND parent = dispatcher->host()->GetAcceleratedWidget();
|
| LPARAM lparam = reinterpret_cast<LPARAM>(this);
|
| -
|
| EnumChildWindows(parent, HideWindowsCallback, lparam);
|
| + // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global
|
| + // hidden window on the same lines as Windowed plugin windows.
|
| + if (legacy_render_widget_host_HWND_)
|
| + legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow());
|
| }
|
| - if (::IsWindow(plugin_parent_window_))
|
| - ::SetWindowPos(plugin_parent_window_, NULL, 0, 0, 0, 0, 0);
|
| #endif
|
| }
|
|
|
| @@ -867,11 +869,19 @@
|
| void RenderWidgetHostViewAura::Show() {
|
| window_->Show();
|
| WasShown();
|
| +#if defined(OS_WIN)
|
| + if (legacy_render_widget_host_HWND_)
|
| + legacy_render_widget_host_HWND_->Show();
|
| +#endif
|
| }
|
|
|
| void RenderWidgetHostViewAura::Hide() {
|
| window_->Hide();
|
| WasHidden();
|
| +#if defined(OS_WIN)
|
| + if (legacy_render_widget_host_HWND_)
|
| + legacy_render_widget_host_HWND_->Hide();
|
| +#endif
|
| }
|
|
|
| bool RenderWidgetHostViewAura::IsShowing() {
|
| @@ -1213,27 +1223,26 @@
|
| selection_focus_rect_);
|
| }
|
| #if defined(OS_WIN)
|
| - // Create the dummy plugin parent window which will be passed as the
|
| - // container window to windowless plugins.
|
| + // Create the legacy dummy window which corresponds to the bounds of the
|
| + // webcontents. This will be passed as the container window for windowless
|
| + // plugins.
|
| // Plugins like Flash assume the container window which is returned via the
|
| // NPNVnetscapeWindow property corresponds to the bounds of the webpage.
|
| // This is not true in Aura where we have only HWND which is the main Aura
|
| // window. If we return this window to plugins like Flash then it causes the
|
| // coordinate translations done by these plugins to break.
|
| - if (!plugin_parent_window_ && GetNativeViewId()) {
|
| - plugin_parent_window_ = ::CreateWindowEx(
|
| - 0, L"Static", NULL, WS_CHILDWINDOW, 0, 0, 0, 0,
|
| - reinterpret_cast<HWND>(GetNativeViewId()), NULL, NULL, NULL);
|
| - if (::IsWindow(plugin_parent_window_))
|
| - ::SetProp(plugin_parent_window_, content::kPluginDummyParentProperty,
|
| - reinterpret_cast<HANDLE>(true));
|
| + // Additonally the legacy dummy window is needed for accessibility and for
|
| + // scrolling to work in legacy drivers for trackpoints/trackpads, etc.
|
| + if (GetNativeViewId()) {
|
| + if (!legacy_render_widget_host_HWND_) {
|
| + legacy_render_widget_host_HWND_ = LegacyRenderWidgetHostHWND::Create(
|
| + reinterpret_cast<HWND>(GetNativeViewId()));
|
| + }
|
| + if (legacy_render_widget_host_HWND_) {
|
| + legacy_render_widget_host_HWND_->SetBounds(
|
| + window_->GetBoundsInRootWindow());
|
| + }
|
| }
|
| - if (::IsWindow(plugin_parent_window_)) {
|
| - gfx::Rect window_bounds = window_->GetBoundsInRootWindow();
|
| - ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(),
|
| - window_bounds.y(), window_bounds.width(),
|
| - window_bounds.height(), 0);
|
| - }
|
| #endif
|
| }
|
|
|
| @@ -1700,7 +1709,11 @@
|
|
|
| gfx::NativeViewId RenderWidgetHostViewAura::GetParentForWindowlessPlugin()
|
| const {
|
| - return reinterpret_cast<gfx::NativeViewId>(plugin_parent_window_);
|
| + if (legacy_render_widget_host_HWND_) {
|
| + return reinterpret_cast<gfx::NativeViewId>(
|
| + legacy_render_widget_host_HWND_->hwnd());
|
| + }
|
| + return NULL;
|
| }
|
| #endif
|
|
|
| @@ -2192,6 +2205,7 @@
|
| if (GetBrowserAccessibilityManager())
|
| return;
|
|
|
| + BrowserAccessibilityManager* manager = NULL;
|
| #if defined(OS_WIN)
|
| aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
|
| if (!dispatcher)
|
| @@ -2205,14 +2219,15 @@
|
| gfx::NativeViewAccessible accessible_parent =
|
| host_->GetParentNativeViewAccessible();
|
|
|
| - BrowserAccessibilityManager* manager = new BrowserAccessibilityManagerWin(
|
| - hwnd, accessible_parent,
|
| - BrowserAccessibilityManagerWin::GetEmptyDocument(), this);
|
| + if (legacy_render_widget_host_HWND_) {
|
| + manager = new BrowserAccessibilityManagerWin(
|
| + legacy_render_widget_host_HWND_.get(), accessible_parent,
|
| + BrowserAccessibilityManagerWin::GetEmptyDocument(), this);
|
| + }
|
| #else
|
| - BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create(
|
| + manager = BrowserAccessibilityManager::Create(
|
| BrowserAccessibilityManager::GetEmptyDocument(), this);
|
| #endif
|
| -
|
| SetBrowserAccessibilityManager(manager);
|
| }
|
|
|
| @@ -3335,8 +3350,7 @@
|
| active_frame_subscriber_textures_.clear();
|
|
|
| #if defined(OS_WIN)
|
| - if (::IsWindow(plugin_parent_window_))
|
| - ::DestroyWindow(plugin_parent_window_);
|
| + legacy_render_widget_host_HWND_.reset(NULL);
|
| #endif
|
| }
|
|
|
| @@ -3483,7 +3497,6 @@
|
|
|
| void RenderWidgetHostViewAura::AddedToRootWindow() {
|
| window_->GetDispatcher()->AddRootWindowObserver(this);
|
| - host_->ParentChanged(GetNativeViewId());
|
| UpdateScreenInfo(window_);
|
|
|
| aura::client::CursorClient* cursor_client =
|
| @@ -3499,6 +3512,14 @@
|
| if (input_method)
|
| input_method->SetFocusedTextInputClient(this);
|
| }
|
| +
|
| +#if defined(OS_WIN)
|
| + // The parent may have changed here. Ensure that the legacy window is
|
| + // reparented accordingly.
|
| + if (legacy_render_widget_host_HWND_)
|
| + legacy_render_widget_host_HWND_->UpdateParent(
|
| + reinterpret_cast<HWND>(GetNativeViewId()));
|
| +#endif
|
| }
|
|
|
| void RenderWidgetHostViewAura::RemovingFromRootWindow() {
|
| @@ -3510,7 +3531,6 @@
|
| DetachFromInputMethod();
|
|
|
| window_->GetDispatcher()->RemoveRootWindowObserver(this);
|
| - host_->ParentChanged(0);
|
| ui::Compositor* compositor = GetCompositor();
|
| if (current_surface_.get()) {
|
| // We can't get notification for commits after this point, which would
|
| @@ -3525,6 +3545,13 @@
|
| host_->WasResized();
|
| if (compositor && compositor->HasObserver(this))
|
| compositor->RemoveObserver(this);
|
| +
|
| +#if defined(OS_WIN)
|
| + // Update the legacy window's parent temporarily to the desktop window. It
|
| + // will eventually get reparented to the right root.
|
| + if (legacy_render_widget_host_HWND_)
|
| + legacy_render_widget_host_HWND_->UpdateParent(::GetDesktopWindow());
|
| +#endif
|
| }
|
|
|
| ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const {
|
|
|