Commit 5a1a4d91 authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Hide the Legacy HWND when the RWHVA is destroyed.

BUG=437701

Review URL: https://codereview.chromium.org/784553002

Cr-Commit-Position: refs/heads/master@{#307167}
parent 409df145
...@@ -745,7 +745,8 @@ class WebContentsViewAura::WindowObserver ...@@ -745,7 +745,8 @@ class WebContentsViewAura::WindowObserver
WebContentsViewAura::WebContentsViewAura( WebContentsViewAura::WebContentsViewAura(
WebContentsImpl* web_contents, WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate) WebContentsViewDelegate* delegate)
: web_contents_(web_contents), : WebContentsObserver(web_contents),
web_contents_(web_contents),
delegate_(delegate), delegate_(delegate),
current_drag_op_(blink::WebDragOperationNone), current_drag_op_(blink::WebDragOperationNone),
drag_dest_delegate_(NULL), drag_dest_delegate_(NULL),
...@@ -1657,6 +1658,12 @@ int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) { ...@@ -1657,6 +1658,12 @@ int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) {
return ConvertFromWeb(current_drag_op_); return ConvertFromWeb(current_drag_op_);
} }
void WebContentsViewAura::RenderProcessGone(base::TerminationStatus status) {
#if defined(OS_WIN)
UpdateLegacyHwndVisibility();
#endif
}
void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window, void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window,
bool visible) { bool visible) {
// Ignore any visibility changes in the hierarchy below. // Ignore any visibility changes in the hierarchy below.
...@@ -1689,9 +1696,18 @@ void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) { ...@@ -1689,9 +1696,18 @@ void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) {
} }
#if defined(OS_WIN) #if defined(OS_WIN)
UpdateLegacyHwndVisibility();
#endif
}
#if defined(OS_WIN)
void WebContentsViewAura::UpdateLegacyHwndVisibility() {
if (!legacy_hwnd_) if (!legacy_hwnd_)
return; return;
bool visible = (window_->IsVisible() &&
web_contents_->GetRenderWidgetHostView());
if (visible && GetNativeView() && GetNativeView()->GetHost()) { if (visible && GetNativeView() && GetNativeView()->GetHost()) {
legacy_hwnd_->UpdateParent( legacy_hwnd_->UpdateParent(
GetNativeView()->GetHost()->GetAcceleratedWidget()); GetNativeView()->GetHost()->GetAcceleratedWidget());
...@@ -1703,10 +1719,8 @@ void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) { ...@@ -1703,10 +1719,8 @@ void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) {
legacy_hwnd_->UpdateParent(ui::GetHiddenWindow()); legacy_hwnd_->UpdateParent(ui::GetHiddenWindow());
legacy_hwnd_->Hide(); legacy_hwnd_->Hide();
} }
#endif
} }
#if defined(OS_WIN)
gfx::NativeViewAccessible gfx::NativeViewAccessible
WebContentsViewAura::GetNativeViewAccessible() { WebContentsViewAura::GetNativeViewAccessible() {
BrowserAccessibilityManager* manager = BrowserAccessibilityManager* manager =
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "content/browser/renderer_host/render_view_host_delegate_view.h" #include "content/browser/renderer_host/render_view_host_delegate_view.h"
#include "content/browser/web_contents/web_contents_view.h" #include "content/browser/web_contents/web_contents_view.h"
#include "content/common/content_export.h" #include "content/common/content_export.h"
#include "content/public/browser/web_contents_observer.h"
#include "ui/aura/window_delegate.h" #include "ui/aura/window_delegate.h"
#include "ui/aura/window_observer.h" #include "ui/aura/window_observer.h"
#include "ui/compositor/layer_animation_observer.h" #include "ui/compositor/layer_animation_observer.h"
...@@ -56,7 +57,8 @@ class WebContentsViewAura ...@@ -56,7 +57,8 @@ class WebContentsViewAura
public ui::ImplicitAnimationObserver, public ui::ImplicitAnimationObserver,
public aura::WindowDelegate, public aura::WindowDelegate,
public aura::client::DragDropDelegate, public aura::client::DragDropDelegate,
public aura::WindowObserver { public aura::WindowObserver,
public WebContentsObserver {
public: public:
WebContentsViewAura(WebContentsImpl* web_contents, WebContentsViewAura(WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate); WebContentsViewDelegate* delegate);
...@@ -196,6 +198,9 @@ class WebContentsViewAura ...@@ -196,6 +198,9 @@ class WebContentsViewAura
void OnDragExited() override; void OnDragExited() override;
int OnPerformDrop(const ui::DropTargetEvent& event) override; int OnPerformDrop(const ui::DropTargetEvent& event) override;
// Overridden from WebContentsObserver:
void RenderProcessGone(base::TerminationStatus status) override;
// Overridden from aura::WindowObserver: // Overridden from aura::WindowObserver:
void OnWindowVisibilityChanged(aura::Window* window, bool visible) override; void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
...@@ -205,6 +210,8 @@ class WebContentsViewAura ...@@ -205,6 +210,8 @@ class WebContentsViewAura
#if defined(OS_WIN) #if defined(OS_WIN)
// Overridden from LegacyRenderWidgetHostHWNDDelegate: // Overridden from LegacyRenderWidgetHostHWNDDelegate:
virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; virtual gfx::NativeViewAccessible GetNativeViewAccessible() override;
void UpdateLegacyHwndVisibility();
#endif #endif
scoped_ptr<aura::Window> window_; scoped_ptr<aura::Window> window_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment