Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 151083002: Create a visible window with class name Chrome_RenderWidgetHostHWND which corresponds to the bounds… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
===================================================================
--- content/browser/renderer_host/render_widget_host_view_aura.cc (revision 248647)
+++ 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"
@@ -500,7 +501,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);
}
@@ -634,11 +635,9 @@
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);
+ if (legacy_render_widget_host_HWND_) {
+ legacy_render_widget_host_HWND_->SetBounds(
+ window_->GetBoundsInRootWindow());
}
#endif
}
@@ -660,8 +659,6 @@
EnumChildWindows(parent, HideWindowsCallback, lparam);
}
- if (::IsWindow(plugin_parent_window_))
- ::SetWindowPos(plugin_parent_window_, NULL, 0, 0, 0, 0, 0);
#endif
}
@@ -880,11 +877,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() {
@@ -1228,27 +1233,24 @@
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()));
+ }
+ 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
}
@@ -1717,7 +1719,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
@@ -2218,8 +2224,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(
@@ -3355,8 +3361,8 @@
active_frame_subscriber_textures_.clear();
#if defined(OS_WIN)
- if (::IsWindow(plugin_parent_window_))
- ::DestroyWindow(plugin_parent_window_);
+ if (legacy_render_widget_host_HWND_)
sky 2014/02/05 18:16:47 nit: no need for if.
ananta 2014/02/05 19:52:36 Code has been changed to call legacy_render_widget
+ delete legacy_render_widget_host_HWND_;
#endif
}
@@ -3519,6 +3525,14 @@
if (input_method)
input_method->SetFocusedTextInputClient(this);
}
+#if defined(OS_WIN)
+ if (legacy_render_widget_host_HWND_ && GetNativeViewId()) {
sky 2014/02/05 18:16:47 Can you instead destroy in RemoveFromRootWindow an
ananta 2014/02/05 19:52:36 I don't think destroying and creating would work g
sky 2014/02/05 21:56:15 My worry is that I don't know if you are guarantee
+ // The parent may have changed here. Ensure that the legacy window is
+ // reparented accordingly.
+ legacy_render_widget_host_HWND_->SetParentWindow(
+ reinterpret_cast<HWND>(GetNativeViewId()));
+ }
+#endif
}
void RenderWidgetHostViewAura::RemovingFromRootWindow() {

Powered by Google App Engine
This is Rietveld 408576698