| 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 "base/run_loop.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/views/controls/message_box_view.h" | 16 #include "ui/views/controls/message_box_view.h" |
| 17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 18 #include "ui/views/window/dialog_delegate.h" | 18 #include "ui/views/window/dialog_delegate.h" |
| 19 | 19 |
| 20 #if defined(USE_AURA) | 20 #if defined(USE_AURA) |
| 21 #include "ui/aura/client/dispatcher_client.h" | 21 #include "ui/aura/client/dispatcher_client.h" |
| 22 #include "ui/aura/env.h" | 22 #include "ui/aura/env.h" |
| 23 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace browser { | 26 namespace chrome { |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 // Multiple SimpleMessageBoxViews can show up at the same time. Each of these | 30 // Multiple SimpleMessageBoxViews can show up at the same time. Each of these |
| 31 // start a nested message-loop. However, these SimpleMessageBoxViews can be | 31 // start a nested message-loop. However, these SimpleMessageBoxViews can be |
| 32 // deleted in any order. This creates problems if a box in an inner-loop gets | 32 // deleted in any order. This creates problems if a box in an inner-loop gets |
| 33 // destroyed before a box in an outer-loop. So to avoid this, ref-counting is | 33 // destroyed before a box in an outer-loop. So to avoid this, ref-counting is |
| 34 // used so that the SimpleMessageBoxViews gets deleted at the right time. | 34 // used so that the SimpleMessageBoxViews gets deleted at the right time. |
| 35 class SimpleMessageBoxViews : public views::DialogDelegate, | 35 class SimpleMessageBoxViews : public views::DialogDelegate, |
| 36 public MessageLoop::Dispatcher, | 36 public MessageLoop::Dispatcher, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 #else | 180 #else |
| 181 { | 181 { |
| 182 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); | 182 MessageLoop::ScopedNestableTaskAllower allow(MessageLoopForUI::current()); |
| 183 base::RunLoop run_loop(dialog); | 183 base::RunLoop run_loop(dialog); |
| 184 run_loop.Run(); | 184 run_loop.Run(); |
| 185 } | 185 } |
| 186 #endif | 186 #endif |
| 187 return dialog->result(); | 187 return dialog->result(); |
| 188 } | 188 } |
| 189 | 189 |
| 190 } // namespace browser | 190 } // namespace chrome |
| OLD | NEW |