diff options
author | wittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 17:49:42 +0000 |
---|---|---|
committer | wittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 17:49:42 +0000 |
commit | eba5d06b35c6c530eea0c89fd4345ba586e2271f (patch) | |
tree | df742fac22912e73c9ede2d186e10f72e2767c65 /components/web_modal/web_contents_modal_dialog_manager.cc | |
parent | 7aca69951b5ad05f7708f87cbed903daf6741bae (diff) | |
download | chromium_src-eba5d06b35c6c530eea0c89fd4345ba586e2271f.zip chromium_src-eba5d06b35c6c530eea0c89fd4345ba586e2271f.tar.gz chromium_src-eba5d06b35c6c530eea0c89fd4345ba586e2271f.tar.bz2 |
Revert 211058 "Close web contents modal dialogs on content load ..."
This change breaks autocheckout.
> Close web contents modal dialogs on content load start
>
> Address the failure of some web contents modal dialogs to close when
> interstitial WebUI is displayed by closing the dialogs on content load start.
> Remove existing ad hoc support in dialogs for closing on page loading in favor
> of a uniform approach.
>
> I'm using load start as the trigger for dialog close as this seems to be the
> point in time at which the user first perceives the page to be changing.
>
> Notes on the print preview changes: with this change the dialog is closed when
> load starts and the initiator tab gets removed via RemovePreviewDialog, so there
> is no longer a need to handle NOTIFICATION_NAV_ENTRY_COMITTED for the initiator
> tab. The PrintViewManager::PrintPreviewDone() DCHECK is removed since now
> PrintViewManager::RenderViewGone() may be invoked and print_preview_state_ reset
> due to WebContents closure before the dialog is destroyed and PrintPreviewDone()
> is invoked.
>
> BUG=240575
>
> Review URL: https://chromiumcodereview.appspot.com/17500003
TBR=wittman@chromium.org
Review URL: https://codereview.chromium.org/18560008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211420 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/web_modal/web_contents_modal_dialog_manager.cc')
-rw-r--r-- | components/web_modal/web_contents_modal_dialog_manager.cc | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/components/web_modal/web_contents_modal_dialog_manager.cc b/components/web_modal/web_contents_modal_dialog_manager.cc index 84d213d..0e07f8d 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.cc +++ b/components/web_modal/web_contents_modal_dialog_manager.cc @@ -74,19 +74,16 @@ void WebContentsModalDialogManager::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { - if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) { - if (child_dialogs_.empty()) - return; - - bool visible = *content::Details<bool>(details).ptr(); - if (visible) - native_manager_->ShowDialog(child_dialogs_.front()); - else - native_manager_->HideDialog(child_dialogs_.front()); - } else if (type == content::NOTIFICATION_LOAD_START) { - if (!child_dialogs_.empty()) - native_manager_->CloseDialog(child_dialogs_.front()); - } + DCHECK(type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED); + + if (child_dialogs_.empty()) + return; + + bool visible = *content::Details<bool>(details).ptr(); + if (visible) + native_manager_->ShowDialog(child_dialogs_.front()); + else + native_manager_->HideDialog(child_dialogs_.front()); } WebContentsModalDialogManager::WebContentsModalDialogManager( @@ -96,11 +93,6 @@ WebContentsModalDialogManager::WebContentsModalDialogManager( native_manager_(CreateNativeManager(this)), closing_all_dialogs_(false) { DCHECK(native_manager_); - content::NavigationController* controller = - &GetWebContents()->GetController(); - registrar_.Add(this, - content::NOTIFICATION_LOAD_START, - content::Source<content::NavigationController>(controller)); registrar_.Add(this, content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED, content::Source<content::WebContents>(web_contents)); @@ -131,6 +123,16 @@ void WebContentsModalDialogManager::CloseAllDialogs() { closing_all_dialogs_ = false; } +void WebContentsModalDialogManager::DidNavigateMainFrame( + const content::LoadCommittedDetails& details, + const content::FrameNavigateParams& params) { + // Close constrained windows if necessary. + if (!net::registry_controlled_domains::SameDomainOrHost( + details.previous_url, details.entry->GetURL(), + net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) + CloseAllDialogs(); +} + void WebContentsModalDialogManager::DidGetIgnoredUIEvent() { if (!child_dialogs_.empty()) native_manager_->FocusDialog(child_dialogs_.front()); |