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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 | 170 |
171 } // namespace | 171 } // namespace |
172 | 172 |
173 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, | 173 MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, |
174 const string16& title, | 174 const string16& title, |
175 const string16& message, | 175 const string16& message, |
176 MessageBoxType type) { | 176 MessageBoxType type) { |
177 scoped_refptr<SimpleMessageBoxViews> dialog( | 177 scoped_refptr<SimpleMessageBoxViews> dialog( |
178 new SimpleMessageBoxViews(title, message, type)); | 178 new SimpleMessageBoxViews(title, message, type)); |
179 CreateBrowserModalDialogViews(dialog, parent)->Show(); | 179 CreateBrowserModalDialogViews(dialog.get(), parent)->Show(); |
180 | 180 |
181 #if defined(USE_AURA) | 181 #if defined(USE_AURA) |
182 // Use the widget's window itself so that the message loop | 182 // Use the widget's window itself so that the message loop |
183 // exists when the dialog is closed by some other means than | 183 // exists when the dialog is closed by some other means than |
184 // |Cancel| or |Accept|. | 184 // |Cancel| or |Accept|. |
185 aura::Window* anchor = parent ? | 185 aura::Window* anchor = parent ? |
186 parent : dialog->GetWidget()->GetNativeWindow(); | 186 parent : dialog->GetWidget()->GetNativeWindow(); |
187 aura::client::GetDispatcherClient(anchor->GetRootWindow())-> | 187 aura::client::GetDispatcherClient(anchor->GetRootWindow()) |
188 RunWithDispatcher(dialog, anchor, true); | 188 ->RunWithDispatcher(dialog.get(), anchor, true); |
189 #else | 189 #else |
190 { | 190 { |
191 base::MessageLoop::ScopedNestableTaskAllower allow( | 191 base::MessageLoop::ScopedNestableTaskAllower allow( |
192 base::MessageLoopForUI::current()); | 192 base::MessageLoopForUI::current()); |
193 base::RunLoop run_loop(dialog); | 193 base::RunLoop run_loop(dialog); |
194 run_loop.Run(); | 194 run_loop.Run(); |
195 } | 195 } |
196 #endif | 196 #endif |
197 return dialog->result(); | 197 return dialog->result(); |
198 } | 198 } |
199 | 199 |
200 } // namespace chrome | 200 } // namespace chrome |
OLD | NEW |