OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/exo/wm_helper_ash.h" | 5 #include "components/exo/wm_helper_ash.h" |
6 | 6 |
7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/public/cpp/config.h" | 8 #include "ash/public/cpp/config.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_port.h" |
10 #include "ash/system/tray/system_tray_notifier.h" | 11 #include "ash/system/tray/system_tray_notifier.h" |
11 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
12 #include "ash/wm_shell.h" | |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "ui/aura/client/focus_client.h" | 14 #include "ui/aura/client/focus_client.h" |
15 #include "ui/display/manager/display_manager.h" | 15 #include "ui/display/manager/display_manager.h" |
16 #include "ui/events/devices/device_data_manager.h" | 16 #include "ui/events/devices/device_data_manager.h" |
17 #include "ui/wm/public/activation_client.h" | 17 #include "ui/wm/public/activation_client.h" |
18 | 18 |
19 namespace exo { | 19 namespace exo { |
20 | 20 |
21 //////////////////////////////////////////////////////////////////////////////// | 21 //////////////////////////////////////////////////////////////////////////////// |
22 // WMHelperAsh, public: | 22 // WMHelperAsh, public: |
23 | 23 |
24 WMHelperAsh::WMHelperAsh() { | 24 WMHelperAsh::WMHelperAsh() { |
25 ash::Shell::Get()->AddShellObserver(this); | 25 ash::Shell::Get()->AddShellObserver(this); |
26 ash::Shell::Get()->activation_client()->AddObserver(this); | 26 ash::Shell::Get()->activation_client()->AddObserver(this); |
27 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. | 27 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. |
28 if (ash::WmShell::Get()->GetAshConfig() != ash::Config::MUS) | 28 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) |
29 ash::Shell::Get()->cursor_manager()->AddObserver(this); | 29 ash::Shell::Get()->cursor_manager()->AddObserver(this); |
30 ash::WmShell::Get()->AddDisplayObserver(this); | 30 ash::ShellPort::Get()->AddDisplayObserver(this); |
31 aura::client::FocusClient* focus_client = | 31 aura::client::FocusClient* focus_client = |
32 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); | 32 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); |
33 focus_client->AddObserver(this); | 33 focus_client->AddObserver(this); |
34 // TODO(crbug.com/709225): Mushrome doesn't have a DeviceDataManager. | 34 // TODO(crbug.com/709225): Mushrome doesn't have a DeviceDataManager. |
35 if (ash::WmShell::Get()->GetAshConfig() != ash::Config::MUS) | 35 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) |
36 ui::DeviceDataManager::GetInstance()->AddObserver(this); | 36 ui::DeviceDataManager::GetInstance()->AddObserver(this); |
37 ash::Shell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); | 37 ash::Shell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); |
38 } | 38 } |
39 | 39 |
40 WMHelperAsh::~WMHelperAsh() { | 40 WMHelperAsh::~WMHelperAsh() { |
41 if (!ash::Shell::HasInstance()) | 41 if (!ash::Shell::HasInstance()) |
42 return; | 42 return; |
43 aura::client::FocusClient* focus_client = | 43 aura::client::FocusClient* focus_client = |
44 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); | 44 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); |
45 focus_client->RemoveObserver(this); | 45 focus_client->RemoveObserver(this); |
46 ash::WmShell::Get()->RemoveDisplayObserver(this); | 46 ash::ShellPort::Get()->RemoveDisplayObserver(this); |
47 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. | 47 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. |
48 if (ash::WmShell::Get()->GetAshConfig() != ash::Config::MUS) | 48 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) |
49 ash::Shell::Get()->cursor_manager()->RemoveObserver(this); | 49 ash::Shell::Get()->cursor_manager()->RemoveObserver(this); |
50 ash::Shell::Get()->activation_client()->RemoveObserver(this); | 50 ash::Shell::Get()->activation_client()->RemoveObserver(this); |
51 ash::Shell::Get()->RemoveShellObserver(this); | 51 ash::Shell::Get()->RemoveShellObserver(this); |
52 // TODO(crbug.com/709225): Mushrome doesn't have a DeviceDataManager. | 52 // TODO(crbug.com/709225): Mushrome doesn't have a DeviceDataManager. |
53 if (ash::WmShell::Get()->GetAshConfig() != ash::Config::MUS) | 53 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) |
54 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); | 54 ui::DeviceDataManager::GetInstance()->RemoveObserver(this); |
55 ash::Shell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this); | 55 ash::Shell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this); |
56 } | 56 } |
57 | 57 |
58 //////////////////////////////////////////////////////////////////////////////// | 58 //////////////////////////////////////////////////////////////////////////////// |
59 // WMHelperAsh, private: | 59 // WMHelperAsh, private: |
60 | 60 |
61 const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo( | 61 const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo( |
62 int64_t display_id) const { | 62 int64_t display_id) const { |
63 return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id); | 63 return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id); |
64 } | 64 } |
65 | 65 |
66 aura::Window* WMHelperAsh::GetContainer(int container_id) { | 66 aura::Window* WMHelperAsh::GetContainer(int container_id) { |
67 return ash::Shell::GetContainer(ash::Shell::GetRootWindowForNewWindows(), | 67 return ash::Shell::GetContainer(ash::Shell::GetRootWindowForNewWindows(), |
68 container_id); | 68 container_id); |
69 } | 69 } |
70 | 70 |
71 aura::Window* WMHelperAsh::GetActiveWindow() const { | 71 aura::Window* WMHelperAsh::GetActiveWindow() const { |
72 return ash::Shell::Get()->activation_client()->GetActiveWindow(); | 72 return ash::Shell::Get()->activation_client()->GetActiveWindow(); |
73 } | 73 } |
74 | 74 |
75 aura::Window* WMHelperAsh::GetFocusedWindow() const { | 75 aura::Window* WMHelperAsh::GetFocusedWindow() const { |
76 aura::client::FocusClient* focus_client = | 76 aura::client::FocusClient* focus_client = |
77 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); | 77 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); |
78 return focus_client->GetFocusedWindow(); | 78 return focus_client->GetFocusedWindow(); |
79 } | 79 } |
80 | 80 |
81 ui::CursorSetType WMHelperAsh::GetCursorSet() const { | 81 ui::CursorSetType WMHelperAsh::GetCursorSet() const { |
82 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. | 82 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. |
83 if (ash::WmShell::Get()->GetAshConfig() == ash::Config::MUS) | 83 if (ash::ShellPort::Get()->GetAshConfig() == ash::Config::MUS) |
84 return ui::CURSOR_SET_NORMAL; | 84 return ui::CURSOR_SET_NORMAL; |
85 return ash::Shell::Get()->cursor_manager()->GetCursorSet(); | 85 return ash::Shell::Get()->cursor_manager()->GetCursorSet(); |
86 } | 86 } |
87 | 87 |
88 void WMHelperAsh::AddPreTargetHandler(ui::EventHandler* handler) { | 88 void WMHelperAsh::AddPreTargetHandler(ui::EventHandler* handler) { |
89 ash::Shell::Get()->AddPreTargetHandler(handler); | 89 ash::Shell::Get()->AddPreTargetHandler(handler); |
90 } | 90 } |
91 | 91 |
92 void WMHelperAsh::PrependPreTargetHandler(ui::EventHandler* handler) { | 92 void WMHelperAsh::PrependPreTargetHandler(ui::EventHandler* handler) { |
93 ash::Shell::Get()->PrependPreTargetHandler(handler); | 93 ash::Shell::Get()->PrependPreTargetHandler(handler); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 void WMHelperAsh::OnDisplayConfigurationChanged() { | 159 void WMHelperAsh::OnDisplayConfigurationChanged() { |
160 NotifyDisplayConfigurationChanged(); | 160 NotifyDisplayConfigurationChanged(); |
161 } | 161 } |
162 | 162 |
163 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() { | 163 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() { |
164 NotifyKeyboardDeviceConfigurationChanged(); | 164 NotifyKeyboardDeviceConfigurationChanged(); |
165 } | 165 } |
166 | 166 |
167 } // namespace exo | 167 } // namespace exo |
OLD | NEW |