Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: ui/views/controls/webview/web_dialog_view.cc

Issue 82913007: Add CanCloseDialog to WebDialogDelegate to allow blocking closing of dialog if needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/web_dialogs/web_dialog_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/webview/web_dialog_view.cc
diff --git a/ui/views/controls/webview/web_dialog_view.cc b/ui/views/controls/webview/web_dialog_view.cc
index 079200cfac01d53b2c671055169a1042c178c9be..7f88f022f555aded4b77ba86ed6897e59fcc02f9 100644
--- a/ui/views/controls/webview/web_dialog_view.cc
+++ b/ui/views/controls/webview/web_dialog_view.cc
@@ -100,6 +100,11 @@ void WebDialogView::ViewHierarchyChanged(
}
bool WebDialogView::CanClose() {
+ // Don't close UI if |delegate_| does not allow users to close it by
+ // clicking on "x" button or pressing Esc shortcut key on hosting dialog.
+ if (!delegate_->CanCloseDialog() && !close_contents_called_)
+ return false;
+
// If CloseContents() is called before CanClose(), which is called by
// RenderViewHostImpl::ClosePageIgnoringUnloadEvents, it indicates
// beforeunload event should not be fired during closing.
« no previous file with comments | « no previous file | ui/web_dialogs/web_dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698