summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordmazzoni <dmazzoni@chromium.org>2014-12-06 00:27:26 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-06 08:27:45 +0000
commit5a1a4d9160774ff982d4ecb0abb8d9c9e00b0ba1 (patch)
treea1194f06ba10064cdf8a6af1c756b655e1a3069e
parent409df145f7b58648b497642b8eba1ddae971ada1 (diff)
downloadchromium_src-5a1a4d9160774ff982d4ecb0abb8d9c9e00b0ba1.zip
chromium_src-5a1a4d9160774ff982d4ecb0abb8d9c9e00b0ba1.tar.gz
chromium_src-5a1a4d9160774ff982d4ecb0abb8d9c9e00b0ba1.tar.bz2
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}
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc20
-rw-r--r--content/browser/web_contents/web_contents_view_aura.h9
2 files changed, 25 insertions, 4 deletions
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index c3c26ea..8e6858d 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -745,7 +745,8 @@ class WebContentsViewAura::WindowObserver
WebContentsViewAura::WebContentsViewAura(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate)
- : web_contents_(web_contents),
+ : WebContentsObserver(web_contents),
+ web_contents_(web_contents),
delegate_(delegate),
current_drag_op_(blink::WebDragOperationNone),
drag_dest_delegate_(NULL),
@@ -1657,6 +1658,12 @@ int WebContentsViewAura::OnPerformDrop(const ui::DropTargetEvent& event) {
return ConvertFromWeb(current_drag_op_);
}
+void WebContentsViewAura::RenderProcessGone(base::TerminationStatus status) {
+#if defined(OS_WIN)
+ UpdateLegacyHwndVisibility();
+#endif
+}
+
void WebContentsViewAura::OnWindowVisibilityChanged(aura::Window* window,
bool visible) {
// Ignore any visibility changes in the hierarchy below.
@@ -1689,9 +1696,18 @@ void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) {
}
#if defined(OS_WIN)
+ UpdateLegacyHwndVisibility();
+#endif
+}
+
+#if defined(OS_WIN)
+void WebContentsViewAura::UpdateLegacyHwndVisibility() {
if (!legacy_hwnd_)
return;
+ bool visible = (window_->IsVisible() &&
+ web_contents_->GetRenderWidgetHostView());
+
if (visible && GetNativeView() && GetNativeView()->GetHost()) {
legacy_hwnd_->UpdateParent(
GetNativeView()->GetHost()->GetAcceleratedWidget());
@@ -1703,10 +1719,8 @@ void WebContentsViewAura::UpdateWebContentsVisibility(bool visible) {
legacy_hwnd_->UpdateParent(ui::GetHiddenWindow());
legacy_hwnd_->Hide();
}
-#endif
}
-#if defined(OS_WIN)
gfx::NativeViewAccessible
WebContentsViewAura::GetNativeViewAccessible() {
BrowserAccessibilityManager* manager =
diff --git a/content/browser/web_contents/web_contents_view_aura.h b/content/browser/web_contents/web_contents_view_aura.h
index cf51776..589573e 100644
--- a/content/browser/web_contents/web_contents_view_aura.h
+++ b/content/browser/web_contents/web_contents_view_aura.h
@@ -13,6 +13,7 @@
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
#include "content/browser/web_contents/web_contents_view.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_observer.h"
#include "ui/compositor/layer_animation_observer.h"
@@ -56,7 +57,8 @@ class WebContentsViewAura
public ui::ImplicitAnimationObserver,
public aura::WindowDelegate,
public aura::client::DragDropDelegate,
- public aura::WindowObserver {
+ public aura::WindowObserver,
+ public WebContentsObserver {
public:
WebContentsViewAura(WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate);
@@ -196,6 +198,9 @@ class WebContentsViewAura
void OnDragExited() override;
int OnPerformDrop(const ui::DropTargetEvent& event) override;
+ // Overridden from WebContentsObserver:
+ void RenderProcessGone(base::TerminationStatus status) override;
+
// Overridden from aura::WindowObserver:
void OnWindowVisibilityChanged(aura::Window* window, bool visible) override;
@@ -205,6 +210,8 @@ class WebContentsViewAura
#if defined(OS_WIN)
// Overridden from LegacyRenderWidgetHostHWNDDelegate:
virtual gfx::NativeViewAccessible GetNativeViewAccessible() override;
+
+ void UpdateLegacyHwndVisibility();
#endif
scoped_ptr<aura::Window> window_;