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

Side by Side Diff: chrome/browser/ui/gtk/simple_message_box_gtk.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 29
30 if (width > req.width) 30 if (width > req.width)
31 gtk_widget_set_size_request(dialog, width, -1); 31 gtk_widget_set_size_request(dialog, width, -1);
32 } 32 }
33 33
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 base::MessageLoop::current()->QuitNow();
40 } 40 }
41 41
42 } // namespace 42 } // namespace
43 43
44 namespace chrome { 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) {
(...skipping 17 matching lines...) Expand all
67 "%s", 67 "%s",
68 UTF16ToUTF8(message).c_str()); 68 UTF16ToUTF8(message).c_str());
69 gtk_util::ApplyMessageDialogQuirks(dialog); 69 gtk_util::ApplyMessageDialogQuirks(dialog);
70 SetDialogTitle(dialog, title); 70 SetDialogTitle(dialog, title);
71 71
72 if (type == MESSAGE_BOX_TYPE_QUESTION) { 72 if (type == MESSAGE_BOX_TYPE_QUESTION) {
73 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES); 73 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
74 g_signal_connect(dialog, "response", G_CALLBACK(OnDialogResponse), NULL); 74 g_signal_connect(dialog, "response", G_CALLBACK(OnDialogResponse), NULL);
75 gtk_util::ShowDialog(dialog); 75 gtk_util::ShowDialog(dialog);
76 // Not gtk_dialog_run as it prevents timers from running in the unit tests. 76 // Not gtk_dialog_run as it prevents timers from running in the unit tests.
77 MessageLoop::current()->Run(); 77 base::MessageLoop::current()->Run();
78 return g_dialog_response == GTK_RESPONSE_YES ? 78 return g_dialog_response == GTK_RESPONSE_YES ? MESSAGE_BOX_RESULT_YES
79 MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO; 79 : MESSAGE_BOX_RESULT_NO;
80 } 80 }
81 81
82 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); 82 gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
83 g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); 83 g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL);
84 gtk_util::ShowDialog(dialog); 84 gtk_util::ShowDialog(dialog);
85 return MESSAGE_BOX_RESULT_YES; 85 return MESSAGE_BOX_RESULT_YES;
86 } 86 }
87 87
88 } // namespace chrome 88 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/reload_button_gtk_unittest.cc ('k') | chrome/browser/ui/gtk/tabs/tab_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698