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

Unified Diff: chrome/browser/js_modal_dialog.cc

Issue 6334002: Revert 71093 - Merging revision 68447... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/597/src/
Patch Set: Created 9 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 | « chrome/browser/js_modal_dialog.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/js_modal_dialog.cc
===================================================================
--- chrome/browser/js_modal_dialog.cc (revision 71385)
+++ chrome/browser/js_modal_dialog.cc (working copy)
@@ -109,27 +109,47 @@
// back to this one. The framework should be improved to handle this, so this
// is a temporary workaround.
CompleteDialog();
- UpdateDelegate(false, L"", suppress_js_messages);
+
+ if (!skip_this_dialog_) {
+ delegate_->OnMessageBoxClosed(reply_msg_, false, std::wstring());
+ if (suppress_js_messages)
+ delegate_->SetSuppressMessageBoxes(true);
+ }
+
+ Cleanup();
}
void JavaScriptAppModalDialog::OnAccept(const std::wstring& prompt_text,
bool suppress_js_messages) {
CompleteDialog();
- UpdateDelegate(true, prompt_text, suppress_js_messages);
+
+ if (!skip_this_dialog_) {
+ delegate_->OnMessageBoxClosed(reply_msg_, true, prompt_text);
+ if (suppress_js_messages)
+ delegate_->SetSuppressMessageBoxes(true);
+ }
+
+ Cleanup();
}
void JavaScriptAppModalDialog::OnClose() {
- // Should we be handling suppress here too? See crbug.com/65008.
- UpdateDelegate(false, L"", false);
+ Cleanup();
}
-void JavaScriptAppModalDialog::UpdateDelegate(bool success,
- const std::wstring& prompt_text,
- bool suppress_js_messages) {
- if (skip_this_dialog_)
- return;
-
- delegate_->OnMessageBoxClosed(reply_msg_, success, prompt_text);
- if (suppress_js_messages)
- delegate_->SetSuppressMessageBoxes(true);
+void JavaScriptAppModalDialog::Cleanup() {
+ if (skip_this_dialog_) {
+ // We can't use the |delegate_|, because we might be in the process of
+ // destroying it.
+ if (tab_contents_)
+ tab_contents_->OnMessageBoxClosed(reply_msg_, false, L"");
+// The extension_host_ will always be a dirty pointer on OS X because the alert
+// window will cause the extension popup to close since it is resigning its key
+// state, destroying the host. http://crbug.com/29355
+#if !defined(OS_MACOSX)
+ else if (extension_host_)
+ extension_host_->OnMessageBoxClosed(reply_msg_, false, L"");
+ else
+ NOTREACHED();
+#endif
+ }
}
« no previous file with comments | « chrome/browser/js_modal_dialog.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698