Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index a19fcd9921d563c334e361a83b4689aad1dc658e..b1c64755938144bbb9f88bd435287d730b51f1d4 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -338,6 +338,7 @@ WebContentsImpl::WebContentsImpl( |
color_chooser_identifier_(0), |
render_view_message_source_(NULL), |
fullscreen_widget_routing_id_(MSG_ROUTING_NONE), |
+ current_popup_host_view_(NULL), |
is_subframe_(false) { |
for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) |
g_created_callbacks.Get().at(i).Run(this); |
@@ -987,6 +988,11 @@ void WebContentsImpl::WasHidden() { |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, WasHidden()); |
+ if (current_popup_host_view_) { |
+ current_popup_host_view_->Destroy(); |
+ current_popup_host_view_ = NULL; |
+ } |
+ |
should_normally_be_visible_ = false; |
} |
@@ -1030,6 +1036,9 @@ void WebContentsImpl::Observe(int type, |
break; |
} |
} |
+ if (host->GetView() == current_popup_host_view_) { |
+ current_popup_host_view_ = NULL; |
+ } |
break; |
} |
default: |
@@ -1565,6 +1574,8 @@ void WebContentsImpl::ShowCreatedWidget(int route_id, |
widget_host_view->Focus(); |
} else { |
widget_host_view->InitAsPopup(GetRenderWidgetHostViewPort(), initial_pos); |
+ DCHECK(!current_popup_host_view_); |
+ current_popup_host_view_ = widget_host_view; |
} |
RenderWidgetHostImpl* render_widget_host_impl = |