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

Unified Diff: chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc

Issue 5548001: It turns out the Cleanup() method in JsModalDialog is not (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: whoops Created 10 years 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
Index: chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc
diff --git a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc
index a1c72f0e8e3dec5a2ef9cd946f2efa57c3d6753b..d01333764d010b794aa6a9dea6e22e6b97d5600b 100644
--- a/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc
+++ b/chrome/browser/ui/app_modal_dialogs/js_modal_dialog.cc
@@ -110,46 +110,27 @@ void JavaScriptAppModalDialog::OnCancel(bool suppress_js_messages) {
// is a temporary workaround.
CompleteDialog();
- if (!skip_this_dialog_) {
- delegate_->OnMessageBoxClosed(reply_msg_, false, std::wstring());
- if (suppress_js_messages)
- delegate_->SetSuppressMessageBoxes(true);
- }
-
- Cleanup();
+ UpdateDelegate(false, L"", suppress_js_messages);
}
void JavaScriptAppModalDialog::OnAccept(const std::wstring& prompt_text,
bool suppress_js_messages) {
CompleteDialog();
-
- if (!skip_this_dialog_) {
- delegate_->OnMessageBoxClosed(reply_msg_, true, prompt_text);
- if (suppress_js_messages)
- delegate_->SetSuppressMessageBoxes(true);
- }
-
- Cleanup();
+ UpdateDelegate(true, prompt_text, suppress_js_messages);
}
void JavaScriptAppModalDialog::OnClose() {
- Cleanup();
+ // Should we be handling suppress here too? See crbug.com/65008.
+ UpdateDelegate(false, L"", false);
}
-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
- }
+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);
}

Powered by Google App Engine
This is Rietveld 408576698