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/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/dialog_style.h" | 10 #include "chrome/browser/ui/dialog_style.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 scoped_refptr<SimpleMessageBoxViews> dialog = | 56 scoped_refptr<SimpleMessageBoxViews> dialog = |
57 new SimpleMessageBoxViews(parent_window, DIALOG_YES_NO, title, message); | 57 new SimpleMessageBoxViews(parent_window, DIALOG_YES_NO, title, message); |
58 | 58 |
59 // Make sure Chrome doesn't attempt to shut down with the dialog up. | 59 // Make sure Chrome doesn't attempt to shut down with the dialog up. |
60 g_browser_process->AddRefModule(); | 60 g_browser_process->AddRefModule(); |
61 | 61 |
62 #if defined(USE_AURA) | 62 #if defined(USE_AURA) |
63 aura::client::GetDispatcherClient()->RunWithDispatcher(dialog, | 63 aura::client::GetDispatcherClient()->RunWithDispatcher(dialog, |
64 parent_window, true); | 64 parent_window, true); |
65 #else | 65 #else |
66 bool old_state = MessageLoopForUI::current()->NestableTasksAllowed(); | 66 { |
67 MessageLoopForUI::current()->SetNestableTasksAllowed(true); | 67 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); |
68 MessageLoopForUI::current()->RunWithDispatcher(dialog); | 68 MessageLoopForUI::current()->RunWithDispatcher(dialog); |
69 MessageLoopForUI::current()->SetNestableTasksAllowed(old_state); | 69 } |
70 #endif | 70 #endif |
71 | 71 |
72 g_browser_process->ReleaseModule(); | 72 g_browser_process->ReleaseModule(); |
73 | 73 |
74 return dialog->Accepted(); | 74 return dialog->Accepted(); |
75 } | 75 } |
76 | 76 |
77 bool SimpleMessageBoxViews::Cancel() { | 77 bool SimpleMessageBoxViews::Cancel() { |
78 disposition_ = DISPOSITION_CANCEL; | 78 disposition_ = DISPOSITION_CANCEL; |
79 return true; | 79 return true; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (disposition_ == DISPOSITION_UNKNOWN) | 162 if (disposition_ == DISPOSITION_UNKNOWN) |
163 return base::MessagePumpDispatcher::EVENT_PROCESSED; | 163 return base::MessagePumpDispatcher::EVENT_PROCESSED; |
164 return base::MessagePumpDispatcher::EVENT_QUIT; | 164 return base::MessagePumpDispatcher::EVENT_QUIT; |
165 } | 165 } |
166 #else | 166 #else |
167 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { | 167 bool SimpleMessageBoxViews::Dispatch(GdkEvent* event) { |
168 gtk_main_do_event(event); | 168 gtk_main_do_event(event); |
169 return disposition_ == DISPOSITION_UNKNOWN; | 169 return disposition_ == DISPOSITION_UNKNOWN; |
170 } | 170 } |
171 #endif | 171 #endif |
OLD | NEW |