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 d8bdf9246a66feaf4b9f3d45b643c5d255a49267..124a9b4289b3d900669835e897bd6f7d951ad7fb 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -671,6 +671,13 @@ int WebContentsImpl::GetRoutingID() const { |
return GetRenderViewHost()->GetRoutingID(); |
} |
+void WebContentsImpl::CancelActiveAndPendingDialogs() { |
+ if (dialog_manager_) |
+ dialog_manager_->CancelActiveAndPendingDialogs(this); |
+ if (browser_plugin_embedder_) |
+ browser_plugin_embedder_->CancelGuestDialogs(); |
+} |
+ |
int WebContentsImpl::GetFullscreenWidgetRoutingID() const { |
return fullscreen_widget_routing_id_; |
} |
@@ -1989,8 +1996,7 @@ void WebContentsImpl::AttachInterstitialPage( |
// Cancel any visible dialogs so that they don't interfere with the |
// interstitial. |
- if (dialog_manager_) |
- dialog_manager_->CancelActiveAndPendingDialogs(this); |
+ CancelActiveAndPendingDialogs(); |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
DidAttachInterstitialPage()); |
@@ -2755,8 +2761,8 @@ void WebContentsImpl::DidNavigateAnyFramePostCommit( |
has_accessed_initial_document_ = false; |
// If we navigate off the page, close all JavaScript dialogs. |
- if (dialog_manager_ && !details.is_in_page) |
- dialog_manager_->CancelActiveAndPendingDialogs(this); |
+ if (!details.is_in_page) |
+ CancelActiveAndPendingDialogs(); |
// Notify observers about navigation. |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
@@ -3607,8 +3613,7 @@ void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh, |
ExitFullscreenMode(); |
// Cancel any visible dialogs so they are not left dangling over the sad tab. |
- if (dialog_manager_) |
- dialog_manager_->CancelActiveAndPendingDialogs(this); |
+ CancelActiveAndPendingDialogs(); |
if (delegate_) |
delegate_->HideValidationMessage(this); |
@@ -4073,6 +4078,10 @@ void WebContentsImpl::CancelModalDialogsForRenderManager() { |
// deferrer would prevent us from swapping out. We also clear the state |
// because this is a cross-process navigation, which means that it's a new |
// site that should not have to pay for the sins of its predecessor. |
+ // |
+ // Note that we don't bother telling browser_plugin_embedder_ because the |
+ // cross-process navigation will either destroy the browser plugins or not |
+ // require their dialogs to close. |
if (dialog_manager_) |
dialog_manager_->ResetDialogState(this); |
} |