OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/views/simple_message_box_views.h" | 5 #include "chrome/browser/ui/views/simple_message_box_views.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/simple_message_box.h" | 9 #include "chrome/browser/simple_message_box.h" |
10 #include "chrome/browser/ui/views/window.h" | 10 #include "chrome/browser/ui/views/window.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // in the constructor plus an extra one below to ensure the dialog persists | 57 // in the constructor plus an extra one below to ensure the dialog persists |
58 // until we retrieve the user response.. | 58 // until we retrieve the user response.. |
59 scoped_refptr<SimpleMessageBoxViews> dialog = | 59 scoped_refptr<SimpleMessageBoxViews> dialog = |
60 new SimpleMessageBoxViews(parent_window, dialog_flags, title, message); | 60 new SimpleMessageBoxViews(parent_window, dialog_flags, title, message); |
61 | 61 |
62 // Make sure Chrome doesn't attempt to shut down with the dialog up. | 62 // Make sure Chrome doesn't attempt to shut down with the dialog up. |
63 g_browser_process->AddRefModule(); | 63 g_browser_process->AddRefModule(); |
64 | 64 |
65 bool old_state = MessageLoopForUI::current()->NestableTasksAllowed(); | 65 bool old_state = MessageLoopForUI::current()->NestableTasksAllowed(); |
66 MessageLoopForUI::current()->SetNestableTasksAllowed(true); | 66 MessageLoopForUI::current()->SetNestableTasksAllowed(true); |
67 MessageLoopForUI::current()->Run(dialog); | 67 MessageLoopForUI::current()->RunWithDispatcher(dialog); |
68 MessageLoopForUI::current()->SetNestableTasksAllowed(old_state); | 68 MessageLoopForUI::current()->SetNestableTasksAllowed(old_state); |
69 | 69 |
70 g_browser_process->ReleaseModule(); | 70 g_browser_process->ReleaseModule(); |
71 | 71 |
72 return dialog->Accepted(); | 72 return dialog->Accepted(); |
73 } | 73 } |
74 | 74 |
75 bool SimpleMessageBoxViews::Cancel() { | 75 bool SimpleMessageBoxViews::Cancel() { |
76 disposition_ = DISPOSITION_CANCEL; | 76 disposition_ = DISPOSITION_CANCEL; |
77 return true; | 77 return true; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 if (disposition_ == DISPOSITION_UNKNOWN) | 163 if (disposition_ == DISPOSITION_UNKNOWN) |
164 return base::MessagePumpDispatcher::EVENT_PROCESSED; | 164 return base::MessagePumpDispatcher::EVENT_PROCESSED; |
165 return base::MessagePumpDispatcher::EVENT_QUIT; | 165 return base::MessagePumpDispatcher::EVENT_QUIT; |
166 } | 166 } |
167 #else | 167 #else |
168 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { | 168 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { |
169 gtk_main_do_event(event); | 169 gtk_main_do_event(event); |
170 return disposition_ == DISPOSITION_UNKNOWN; | 170 return disposition_ == DISPOSITION_UNKNOWN; |
171 } | 171 } |
172 #endif | 172 #endif |
OLD | NEW |