| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/simple_message_box.h" | 5 #include "chrome/browser/ui/simple_message_box.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/gtk/gtk_util.h" | 9 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 int g_dialog_response; | 34 int g_dialog_response; |
| 35 | 35 |
| 36 void OnDialogResponse(GtkWidget* widget, int response, void* user_data) { | 36 void OnDialogResponse(GtkWidget* widget, int response, void* user_data) { |
| 37 g_dialog_response = response; | 37 g_dialog_response = response; |
| 38 gtk_widget_destroy(widget); | 38 gtk_widget_destroy(widget); |
| 39 MessageLoop::current()->QuitNow(); | 39 MessageLoop::current()->QuitNow(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 namespace browser { | 44 namespace chrome { |
| 45 | 45 |
| 46 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, | 46 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, |
| 47 const string16& title, | 47 const string16& title, |
| 48 const string16& message, | 48 const string16& message, |
| 49 MessageBoxType type) { | 49 MessageBoxType type) { |
| 50 GtkMessageType gtk_message_type = GTK_MESSAGE_OTHER; | 50 GtkMessageType gtk_message_type = GTK_MESSAGE_OTHER; |
| 51 GtkButtonsType gtk_buttons_type = GTK_BUTTONS_OK; | 51 GtkButtonsType gtk_buttons_type = GTK_BUTTONS_OK; |
| 52 if (type == MESSAGE_BOX_TYPE_QUESTION) { | 52 if (type == MESSAGE_BOX_TYPE_QUESTION) { |
| 53 gtk_message_type = GTK_MESSAGE_QUESTION; | 53 gtk_message_type = GTK_MESSAGE_QUESTION; |
| 54 gtk_buttons_type = GTK_BUTTONS_YES_NO; | 54 gtk_buttons_type = GTK_BUTTONS_YES_NO; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 75 return g_dialog_response == GTK_RESPONSE_YES ? | 75 return g_dialog_response == GTK_RESPONSE_YES ? |
| 76 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO; | 76 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO; |
| 77 } | 77 } |
| 78 | 78 |
| 79 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); | 79 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); |
| 80 g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); | 80 g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); |
| 81 gtk_util::ShowDialog(dialog); | 81 gtk_util::ShowDialog(dialog); |
| 82 return MESSAGE_BOX_RESULT_YES; | 82 return MESSAGE_BOX_RESULT_YES; |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace browser | 85 } // namespace chrome |
| OLD | NEW |