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 "ui/views/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "ui/aura/client/activation_change_observer.h" | 8 #include "ui/aura/client/activation_change_observer.h" |
9 #include "ui/aura/client/activation_client.h" | 9 #include "ui/aura/client/activation_client.h" |
10 #include "ui/aura/client/dispatcher_client.h" | 10 #include "ui/aura/client/dispatcher_client.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void MenuController::RunMessageLoop(bool nested_menu) { | 85 void MenuController::RunMessageLoop(bool nested_menu) { |
86 // |owner_| may be NULL. | 86 // |owner_| may be NULL. |
87 aura::RootWindow* root = GetOwnerRootWindow(owner_); | 87 aura::RootWindow* root = GetOwnerRootWindow(owner_); |
88 if (root) { | 88 if (root) { |
89 scoped_ptr<ActivationChangeObserverImpl> observer; | 89 scoped_ptr<ActivationChangeObserverImpl> observer; |
90 if (!nested_menu) | 90 if (!nested_menu) |
91 observer.reset(new ActivationChangeObserverImpl(this, root)); | 91 observer.reset(new ActivationChangeObserverImpl(this, root)); |
92 aura::client::GetDispatcherClient(root)-> | 92 aura::client::GetDispatcherClient(root)-> |
93 RunWithDispatcher(this, owner_->GetNativeWindow(), true); | 93 RunWithDispatcher(this, owner_->GetNativeWindow(), true); |
94 } else { | 94 } else { |
95 MessageLoopForUI* loop = MessageLoopForUI::current(); | 95 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); |
96 MessageLoop::ScopedNestableTaskAllower allow(loop); | 96 base::MessageLoop::ScopedNestableTaskAllower allow(loop); |
97 base::RunLoop run_loop(this); | 97 base::RunLoop run_loop(this); |
98 run_loop.Run(); | 98 run_loop.Run(); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 bool MenuController::ShouldQuitNow() const { | 102 bool MenuController::ShouldQuitNow() const { |
103 aura::RootWindow* root = GetOwnerRootWindow(owner_); | 103 aura::RootWindow* root = GetOwnerRootWindow(owner_); |
104 return !aura::client::GetDragDropClient(root) || | 104 return !aura::client::GetDragDropClient(root) || |
105 !aura::client::GetDragDropClient(root)->IsDragDropInProgress(); | 105 !aura::client::GetDragDropClient(root)->IsDragDropInProgress(); |
106 } | 106 } |
107 | 107 |
108 gfx::Screen* MenuController::GetScreen() { | 108 gfx::Screen* MenuController::GetScreen() { |
109 aura::RootWindow* root = GetOwnerRootWindow(owner_); | 109 aura::RootWindow* root = GetOwnerRootWindow(owner_); |
110 return root ? | 110 return root ? |
111 gfx::Screen::GetScreenFor(root) : gfx::Screen::GetNativeScreen(); | 111 gfx::Screen::GetScreenFor(root) : gfx::Screen::GetNativeScreen(); |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 } // namespace views | 115 } // namespace views |
OLD | NEW |