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

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

Issue 12091075: Fix the issue introduced by hooking window.onbeforeunload in WebDialogView which breaks WebDialogUI… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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 | « ui/views/controls/webview/web_dialog_view.h ('k') | 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 b717cbe02fca944f5ecdf3cda19a3b73823585af..94d842e486ede6f7deba9dafd462a5837c3cc02c 100644
--- a/ui/views/controls/webview/web_dialog_view.cc
+++ b/ui/views/controls/webview/web_dialog_view.cc
@@ -49,7 +49,8 @@ WebDialogView::WebDialogView(
delegate_(delegate),
web_view_(new views::WebView(context)),
is_attempting_close_dialog_(false),
- before_unload_fired_(false) {
+ before_unload_fired_(false),
+ closed_via_webui_(false) {
web_view_->set_allow_accelerators(true);
AddChildView(web_view_);
set_contents_view(web_view_);
@@ -225,6 +226,13 @@ void WebDialogView::OnDialogClosed(const std::string& json_retval) {
}
}
+void WebDialogView::OnDialogCloseFromWebUI(const std::string& json_retval) {
+ closed_via_webui_ = true;
+ dialog_close_retval_ = json_retval;
+ if (GetWidget())
+ GetWidget()->Close();
+}
+
void WebDialogView::OnCloseContents(WebContents* source,
bool* out_close_dialog) {
if (delegate_)
@@ -275,7 +283,7 @@ void WebDialogView::CloseContents(WebContents* source) {
bool close_dialog = false;
OnCloseContents(source, &close_dialog);
if (close_dialog)
- OnDialogClosed(std::string());
+ OnDialogClosed(closed_via_webui_ ? dialog_close_retval_ : std::string());
}
content::WebContents* WebDialogView::OpenURLFromTab(
« no previous file with comments | « ui/views/controls/webview/web_dialog_view.h ('k') | ui/web_dialogs/web_dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698