Commit 6762c8bc authored by msw@chromium.org's avatar msw@chromium.org

Remove the unused close_on_interstitial_webui setting.

BUG=374011,374011

Review URL: https://codereview.chromium.org/290693002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271250 0039d316-1c4b-4281-b951-d872f2087c98
parent deba10a2
......@@ -63,14 +63,6 @@ void WebContentsModalDialogManager::FocusTopmostDialog() {
child_dialogs_.front()->manager->Focus();
}
void WebContentsModalDialogManager::SetCloseOnInterstitialPage(
NativeWebContentsModalDialog dialog,
bool close) {
WebContentsModalDialogList::iterator loc = FindDialogState(dialog);
DCHECK(loc != child_dialogs_.end());
(*loc)->close_on_interstitial_webui = close;
}
content::WebContents* WebContentsModalDialogManager::GetWebContents() const {
return web_contents();
}
......@@ -106,15 +98,7 @@ WebContentsModalDialogManager::DialogState::DialogState(
NativeWebContentsModalDialog dialog,
scoped_ptr<SingleWebContentsDialogManager> mgr)
: dialog(dialog),
manager(mgr.release()),
#if 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
{
manager(mgr.release()) {
}
WebContentsModalDialogManager::DialogState::~DialogState() {}
......@@ -196,14 +180,10 @@ void WebContentsModalDialogManager::WebContentsDestroyed() {
}
void WebContentsModalDialogManager::DidAttachInterstitialPage() {
// Copy the dialogs so we can close and remove them while iterating over the
// list.
WebContentsModalDialogList dialogs(child_dialogs_);
for (WebContentsModalDialogList::iterator it = dialogs.begin();
it != dialogs.end(); ++it) {
if ((*it)->close_on_interstitial_webui)
(*it)->manager->Close();
}
// TODO(wittman): Test closing on interstitial webui works properly on Mac.
#if defined(USE_AURA)
CloseAllDialogs();
#endif
}
} // namespace web_modal
......@@ -49,10 +49,6 @@ class WebContentsModalDialogManager
// this function.
void FocusTopmostDialog();
// Set to true to close the window when a page load starts on the WebContents.
void SetCloseOnInterstitialPage(NativeWebContentsModalDialog dialog,
bool close);
// Overriden from SingleWebContentsDialogManagerDelegate:
virtual content::WebContents* GetWebContents() const OVERRIDE;
// Called when a WebContentsModalDialogs we own is about to be closed.
......@@ -86,7 +82,6 @@ class WebContentsModalDialogManager
NativeWebContentsModalDialog dialog;
scoped_ptr<SingleWebContentsDialogManager> manager;
bool close_on_interstitial_webui;
};
typedef std::deque<DialogState*> WebContentsModalDialogList;
......
......@@ -241,47 +241,39 @@ TEST_F(WebContentsModalDialogManagerTest, VisibilityObservation) {
native_manager->StopTracking();
}
// Test that attaching an interstitial page closes dialogs configured to close.
// Test that attaching an interstitial page closes all dialogs.
TEST_F(WebContentsModalDialogManagerTest, InterstitialPage) {
const NativeWebContentsModalDialog dialog1 = MakeFakeDialog();
const NativeWebContentsModalDialog dialog2 = MakeFakeDialog();
const NativeWebContentsModalDialog dialog3 = MakeFakeDialog();
NativeManagerTracker tracker1;
NativeManagerTracker tracker2;
NativeManagerTracker tracker3;
TestNativeWebContentsModalDialogManager* native_manager1 =
new TestNativeWebContentsModalDialogManager(dialog1, manager, &tracker1);
TestNativeWebContentsModalDialogManager* native_manager2 =
new TestNativeWebContentsModalDialogManager(dialog2, manager, &tracker2);
TestNativeWebContentsModalDialogManager* native_manager3 =
new TestNativeWebContentsModalDialogManager(dialog3, manager, &tracker3);
manager->ShowDialogWithManager(dialog1,
scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass());
manager->ShowDialogWithManager(dialog2,
scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass());
manager->ShowDialogWithManager(dialog3,
scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass());
#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();
#if defined(USE_AURA)
EXPECT_EQ(NativeManagerTracker::CLOSED, tracker1.state_);
EXPECT_EQ(NativeManagerTracker::SHOWN, tracker2.state_);
EXPECT_EQ(NativeManagerTracker::CLOSED, tracker3.state_);
EXPECT_EQ(NativeManagerTracker::CLOSED, tracker2.state_);
#else
EXPECT_EQ(NativeManagerTracker::SHOWN, tracker1.state_);
EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker2.state_);
#endif
EXPECT_TRUE(tracker1.was_shown_);
EXPECT_TRUE(tracker2.was_shown_);
EXPECT_FALSE(tracker3.was_shown_);
EXPECT_FALSE(tracker2.was_shown_);
#if !defined(USE_AURA)
native_manager1->StopTracking();
native_manager2->StopTracking();
#endif
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment