From 676a48ae286b2ac01d61ae9d688746532a63be68 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 12 Mar 2014 21:17:13 +0800 Subject: [PATCH] gtk: Make synchronous message box work. --- browser/ui/message_box_gtk.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/browser/ui/message_box_gtk.cc b/browser/ui/message_box_gtk.cc index f2988f6d5c18..0fbb156f7dd9 100644 --- a/browser/ui/message_box_gtk.cc +++ b/browser/ui/message_box_gtk.cc @@ -78,6 +78,7 @@ class MessageBox { CHROMEGTK_CALLBACK_1(MessageBox, void, OnResponseDialog, int); GtkWidget* dialog() const { return dialog_; } + int cancel_id() const { return cancel_id_; } private: GtkWidget* dialog_; @@ -107,7 +108,13 @@ int ShowMessageBox(NativeWindow* parent_window, const std::string& title, const std::string& message, const std::string& detail) { - return 0; + MessageBox message_box(parent_window, type, buttons, title, message, detail); + gtk_widget_show_all(message_box.dialog()); + int response = gtk_dialog_run(GTK_DIALOG(message_box.dialog())); + if (response < 0) + return message_box.cancel_id(); + else + return response; } void ShowMessageBox(NativeWindow* parent_window,