| 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" |
| 11 #include "base/run_loop.h" |
| 11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/views/controls/message_box_view.h" | 16 #include "ui/views/controls/message_box_view.h" |
| 16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 17 #include "ui/views/window/dialog_delegate.h" | 18 #include "ui/views/window/dialog_delegate.h" |
| 18 | 19 |
| 19 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
| 20 #include "ui/aura/client/dispatcher_client.h" | 21 #include "ui/aura/client/dispatcher_client.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 // Use the widget's window itself so that the message loop | 173 // Use the widget's window itself so that the message loop |
| 173 // exists when the dialog is closed by some other means than | 174 // exists when the dialog is closed by some other means than |
| 174 // |Cancel| or |Accept|. | 175 // |Cancel| or |Accept|. |
| 175 aura::Window* anchor = parent ? | 176 aura::Window* anchor = parent ? |
| 176 parent : dialog->GetWidget()->GetNativeWindow(); | 177 parent : dialog->GetWidget()->GetNativeWindow(); |
| 177 aura::client::GetDispatcherClient(anchor->GetRootWindow())-> | 178 aura::client::GetDispatcherClient(anchor->GetRootWindow())-> |
| 178 RunWithDispatcher(dialog, anchor, true); | 179 RunWithDispatcher(dialog, anchor, true); |
| 179 #else | 180 #else |
| 180 { | 181 { |
| 181 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); | 182 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); |
| 182 MessageLoopForUI::current()->RunWithDispatcher(dialog); | 183 base::RunLoop run_loop(dialog); |
| 184 run_loop.Run(); |
| 183 } | 185 } |
| 184 #endif | 186 #endif |
| 185 return dialog->result(); | 187 return dialog->result(); |
| 186 } | 188 } |
| 187 | 189 |
| 188 } // namespace browser | 190 } // namespace browser |
| OLD | NEW |