diff options
Diffstat (limited to 'components')
3 files changed, 21 insertions, 9 deletions
diff --git a/components/web_modal/web_contents_modal_dialog_manager.cc b/components/web_modal/web_contents_modal_dialog_manager.cc index f454445..85b0448 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.cc +++ b/components/web_modal/web_contents_modal_dialog_manager.cc @@ -51,7 +51,7 @@ void WebContentsModalDialogManager::FocusTopmostDialog() { native_manager_->FocusDialog(child_dialogs_.front().dialog); } -void WebContentsModalDialogManager::SetCloseOnInterstitialWebUI( +void WebContentsModalDialogManager::SetCloseOnInterstitialPage( NativeWebContentsModalDialog dialog, bool close) { WebContentsModalDialogList::iterator loc = FindDialogState(dialog); @@ -93,7 +93,14 @@ WebContentsModalDialogManager::WebContentsModalDialogManager( WebContentsModalDialogManager::DialogState::DialogState( NativeWebContentsModalDialog dialog) : dialog(dialog), - close_on_interstitial_webui(false) { +#if defined(OS_WIN) || defined(USE_AURA) + close_on_interstitial_webui(true) +#else + // TODO(wittman): Test that closing on interstitial webui works properly + // on Mac and use the true default for all platforms. + close_on_interstitial_webui(false) +#endif + { } WebContentsModalDialogManager::WebContentsModalDialogList::iterator diff --git a/components/web_modal/web_contents_modal_dialog_manager.h b/components/web_modal/web_contents_modal_dialog_manager.h index 253de18..dc326741 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.h +++ b/components/web_modal/web_contents_modal_dialog_manager.h @@ -43,8 +43,8 @@ class WebContentsModalDialogManager void FocusTopmostDialog(); // Set to true to close the window when a page load starts on the WebContents. - void SetCloseOnInterstitialWebUI(NativeWebContentsModalDialog dialog, - bool close); + void SetCloseOnInterstitialPage(NativeWebContentsModalDialog dialog, + bool close); // Overriden from NativeWebContentsModalDialogManagerDelegate: virtual content::WebContents* GetWebContents() const OVERRIDE; diff --git a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc index 7095498..1353f10 100644 --- a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc +++ b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc @@ -198,9 +198,8 @@ TEST_F(WebContentsModalDialogManagerTest, VisibilityObservation) { native_manager->GetDialogState(dialog1)); } -// Test that attaching an interstitial WebUI page closes dialogs configured to -// close on interstitial WebUI. -TEST_F(WebContentsModalDialogManagerTest, InterstitialWebUI) { +// Test that attaching an interstitial page closes dialogs configured to close. +TEST_F(WebContentsModalDialogManagerTest, InterstitialPage) { const NativeWebContentsModalDialog dialog1 = MakeFakeDialog(); const NativeWebContentsModalDialog dialog2 = MakeFakeDialog(); const NativeWebContentsModalDialog dialog3 = MakeFakeDialog(); @@ -209,8 +208,14 @@ TEST_F(WebContentsModalDialogManagerTest, InterstitialWebUI) { manager->ShowDialog(dialog2); manager->ShowDialog(dialog3); - manager->SetCloseOnInterstitialWebUI(dialog1, true); - manager->SetCloseOnInterstitialWebUI(dialog3, true); +#if defined(OS_WIN) || defined(USE_AURA) + manager->SetCloseOnInterstitialPage(dialog2, false); +#else + // TODO(wittman): Remove this section once Mac is changed to close on + // interstitial pages by default. + manager->SetCloseOnInterstitialPage(dialog1, true); + manager->SetCloseOnInterstitialPage(dialog3, true); +#endif test_api->DidAttachInterstitialPage(); EXPECT_EQ(TestNativeWebContentsModalDialogManager::CLOSED, |