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 43d74a22a2d2cfecd0401377b47c8d696772446e..8484d06c44dea57b34122ce30e3fa55d7b4df4d5 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_; |
} |
@@ -1984,8 +1991,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()); |
@@ -2741,8 +2747,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_, |
@@ -3593,8 +3599,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); |
@@ -4043,6 +4048,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); |
} |