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