| Index: content/browser/renderer_host/render_widget_host_view_aura.cc
|
| ===================================================================
|
| --- content/browser/renderer_host/render_widget_host_view_aura.cc (revision 247284)
|
| +++ content/browser/renderer_host/render_widget_host_view_aura.cc (working copy)
|
| @@ -83,6 +83,7 @@
|
| #include "base/win/windows_version.h"
|
| #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"
|
| @@ -497,7 +498,7 @@
|
| software_frame_manager_.reset(new SoftwareFrameManager(
|
| weak_ptr_factory_.GetWeakPtr()));
|
| #if defined(OS_WIN)
|
| - plugin_parent_window_ = NULL;
|
| + legacy_render_widget_host_HWND_ = NULL;
|
| #endif
|
| ImageTransportFactory::GetInstance()->AddObserver(this);
|
| }
|
| @@ -629,10 +630,11 @@
|
| LPARAM lparam = reinterpret_cast<LPARAM>(this);
|
| EnumChildWindows(ui::GetHiddenWindow(), ShowWindowsCallback, lparam);
|
|
|
| - if (::IsWindow(plugin_parent_window_)) {
|
| + DCHECK(legacy_render_widget_host_HWND_);
|
| + if (::IsWindow(legacy_render_widget_host_HWND_->hwnd())) {
|
| gfx::Rect window_bounds = window_->GetBoundsInRootWindow();
|
| - ::SetWindowPos(plugin_parent_window_, NULL, window_bounds.x(),
|
| - window_bounds.y(), window_bounds.width(),
|
| + ::SetWindowPos(legacy_render_widget_host_HWND_->hwnd(), NULL,
|
| + window_bounds.x(), window_bounds.y(), window_bounds.width(),
|
| window_bounds.height(), 0);
|
| }
|
| #endif
|
| @@ -655,8 +657,6 @@
|
|
|
| EnumChildWindows(parent, HideWindowsCallback, lparam);
|
| }
|
| - if (::IsWindow(plugin_parent_window_))
|
| - ::SetWindowPos(plugin_parent_window_, NULL, 0, 0, 0, 0, 0);
|
| #endif
|
| }
|
|
|
| @@ -875,11 +875,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() {
|
| @@ -1221,27 +1229,28 @@
|
| 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_ = new LegacyRenderWidgetHostHWND(
|
| + reinterpret_cast<HWND>(GetNativeViewId()));
|
| + }
|
| + if (::IsWindow(legacy_render_widget_host_HWND_->hwnd())) {
|
| + gfx::Rect window_bounds = window_->GetBoundsInRootWindow();
|
| + ::SetWindowPos(legacy_render_widget_host_HWND_->hwnd(), NULL,
|
| + window_bounds.x(), window_bounds.y(),
|
| + window_bounds.width(), window_bounds.height(), 0);
|
| + }
|
| }
|
| - 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
|
| }
|
|
|
| @@ -1709,7 +1718,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
|
|
|
| @@ -2210,8 +2223,8 @@
|
| gfx::NativeViewAccessible accessible_parent =
|
| host_->GetParentNativeViewAccessible();
|
|
|
| - BrowserAccessibilityManager* manager = new BrowserAccessibilityManagerWin(
|
| - hwnd, accessible_parent,
|
| + BrowserAccessibilityManager* manager = new BrowserAccessibilityManagerWin(
|
| + legacy_render_widget_host_HWND_, accessible_parent,
|
| BrowserAccessibilityManagerWin::GetEmptyDocument(), this);
|
| #else
|
| BrowserAccessibilityManager* manager = BrowserAccessibilityManager::Create(
|
| @@ -3342,8 +3355,7 @@
|
| active_frame_subscriber_textures_.clear();
|
|
|
| #if defined(OS_WIN)
|
| - if (::IsWindow(plugin_parent_window_))
|
| - ::DestroyWindow(plugin_parent_window_);
|
| + legacy_render_widget_host_HWND_ = NULL;
|
| #endif
|
| }
|
|
|
|
|