summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-11 21:18:12 +0000
committererikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-11 21:18:12 +0000
commitf13b7ec28d366eb0959604fc7eccf2be634d0864 (patch)
treec4234df59df2bd6cf1fb076d6713b563dbd5a4e4
parentba02479cfff23a041e352286aadf92561a952c64 (diff)
downloadchromium_src-f13b7ec28d366eb0959604fc7eccf2be634d0864.zip
chromium_src-f13b7ec28d366eb0959604fc7eccf2be634d0864.tar.gz
chromium_src-f13b7ec28d366eb0959604fc7eccf2be634d0864.tar.bz2
Fix a bug where the extension toolstrip could get reparented to the desktop.
BUG=11743 TEST=follow the steps described in the bug Review URL: http://codereview.chromium.org/113204 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15781 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xchrome/browser/extensions/extension_view.cc20
-rw-r--r--chrome/browser/renderer_host/render_widget_host_view_win.cc12
2 files changed, 22 insertions, 10 deletions
diff --git a/chrome/browser/extensions/extension_view.cc b/chrome/browser/extensions/extension_view.cc
index 9975a8c..38028d7 100755
--- a/chrome/browser/extensions/extension_view.cc
+++ b/chrome/browser/extensions/extension_view.cc
@@ -25,16 +25,18 @@ ExtensionView::~ExtensionView() {
}
void ExtensionView::SetVisible(bool is_visible) {
- HWNDView::SetVisible(is_visible);
+ if (is_visible != IsVisible()) {
+ HWNDView::SetVisible(is_visible);
- // Also tell RenderWidgetHostView the new visibility. Despite its name, it is
- // not part of the View heirarchy and does not know about the change unless we
- // tell it.
- if (render_view_host()->view()) {
- if (is_visible)
- render_view_host()->view()->Show();
- else
- render_view_host()->view()->Hide();
+ // Also tell RenderWidgetHostView the new visibility. Despite its name, it
+ // is not part of the View heirarchy and does not know about the change
+ // unless we tell it.
+ if (render_view_host()->view()) {
+ if (is_visible)
+ render_view_host()->view()->Show();
+ else
+ render_view_host()->view()->Hide();
+ }
}
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index b9290d4..09069ff 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -414,6 +414,7 @@ bool RenderWidgetHostViewWin::HasFocus() {
void RenderWidgetHostViewWin::Show() {
DCHECK(parent_hwnd_);
+ DCHECK(parent_hwnd_ != GetDesktopWindow());
SetParent(parent_hwnd_);
ShowWindow(SW_SHOW);
@@ -421,11 +422,20 @@ void RenderWidgetHostViewWin::Show() {
}
void RenderWidgetHostViewWin::Hide() {
+ if (GetParent() == GetDesktopWindow()) {
+ LOG(WARNING) << "Hide() called twice in a row: " << this << ":" <<
+ parent_hwnd_ << ":" << GetParent();
+ // TODO(erikkay) Perhaps it should be OK to call Hide multiple times.
+ DCHECK(false);
+ return;
+ }
+
if (::GetFocus() == m_hWnd)
::SetFocus(NULL);
ShowWindow(SW_HIDE);
+
+ // Cache the old parent, then orphan the window so we stop receiving messages
parent_hwnd_ = GetParent();
- // Orphan the window so we stop receiving messages.
SetParent(NULL);
WasHidden();