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" | |
9 #include "ui/aura/client/activation_client.h" | 8 #include "ui/aura/client/activation_client.h" |
10 #include "ui/aura/client/dispatcher_client.h" | 9 #include "ui/aura/client/dispatcher_client.h" |
11 #include "ui/aura/client/drag_drop_client.h" | 10 #include "ui/aura/client/drag_drop_client.h" |
12 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
13 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
14 #include "ui/gfx/screen.h" | 13 #include "ui/gfx/screen.h" |
| 14 #include "ui/views/corewm/activation_change_shim.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // ActivationChangeObserverImpl is used to observe activation changes and close | 21 // ActivationChangeObserverImpl is used to observe activation changes and close |
22 // the menu. Additionally it listens for the root window to be destroyed and | 22 // the menu. Additionally it listens for the root window to be destroyed and |
23 // cancel the menu as well. | 23 // cancel the menu as well. |
24 class ActivationChangeObserverImpl | 24 class ActivationChangeObserverImpl |
25 : public aura::client::ActivationChangeObserver, | 25 : public corewm::ActivationChangeShim, |
26 public aura::WindowObserver { | 26 public aura::WindowObserver { |
27 public: | 27 public: |
28 ActivationChangeObserverImpl(MenuController* controller, | 28 ActivationChangeObserverImpl(MenuController* controller, |
29 aura::RootWindow* root) | 29 aura::RootWindow* root) |
30 : controller_(controller), | 30 : ActivationChangeShim(root), |
| 31 controller_(controller), |
31 root_(root) { | 32 root_(root) { |
32 aura::client::GetActivationClient(root_)->AddObserver(this); | 33 aura::client::GetActivationClient(root_)->AddObserver(this); |
33 root_->AddObserver(this); | 34 root_->AddObserver(this); |
34 } | 35 } |
35 | 36 |
36 virtual ~ActivationChangeObserverImpl() { | 37 virtual ~ActivationChangeObserverImpl() { |
37 Cleanup(); | 38 Cleanup(); |
38 } | 39 } |
39 | 40 |
40 // aura::client::ActivationChangeObserver overrides: | 41 // aura::client::ActivationChangeObserver overrides: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 99 } |
99 | 100 |
100 gfx::Screen* MenuController::GetScreen() { | 101 gfx::Screen* MenuController::GetScreen() { |
101 aura::RootWindow* root = GetOwnerRootWindow(owner_); | 102 aura::RootWindow* root = GetOwnerRootWindow(owner_); |
102 return root ? | 103 return root ? |
103 gfx::Screen::GetScreenFor(root) : gfx::Screen::GetNativeScreen(); | 104 gfx::Screen::GetScreenFor(root) : gfx::Screen::GetNativeScreen(); |
104 } | 105 } |
105 | 106 |
106 | 107 |
107 } // namespace views | 108 } // namespace views |
OLD | NEW |