| 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/public/cpp/config.h" | 8 #include "ash/public/cpp/config.h" |
| 8 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 9 #include "ash/shell_port.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 "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/input_device_manager.h" | 16 #include "ui/events/devices/input_device_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 // 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. |
| 27 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) | 28 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) |
| 28 ash::Shell::Get()->cursor_manager()->AddObserver(this); | 29 ash::Shell::Get()->cursor_manager()->AddObserver(this); |
| 29 ash::ShellPort::Get()->AddDisplayObserver(this); | 30 ash::ShellPort::Get()->AddDisplayObserver(this); |
| 30 aura::client::FocusClient* focus_client = | 31 aura::client::FocusClient* focus_client = |
| 31 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); | 32 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); |
| 32 focus_client->AddObserver(this); | 33 focus_client->AddObserver(this); |
| 33 ui::InputDeviceManager::GetInstance()->AddObserver(this); | 34 ui::InputDeviceManager::GetInstance()->AddObserver(this); |
| 35 ash::Shell::Get()->system_tray_notifier()->AddAccessibilityObserver(this); |
| 34 } | 36 } |
| 35 | 37 |
| 36 WMHelperAsh::~WMHelperAsh() { | 38 WMHelperAsh::~WMHelperAsh() { |
| 37 if (!ash::Shell::HasInstance()) | 39 if (!ash::Shell::HasInstance()) |
| 38 return; | 40 return; |
| 39 aura::client::FocusClient* focus_client = | 41 aura::client::FocusClient* focus_client = |
| 40 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); | 42 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); |
| 41 focus_client->RemoveObserver(this); | 43 focus_client->RemoveObserver(this); |
| 42 ash::ShellPort::Get()->RemoveDisplayObserver(this); | 44 ash::ShellPort::Get()->RemoveDisplayObserver(this); |
| 43 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. | 45 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. |
| 44 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) | 46 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) |
| 45 ash::Shell::Get()->cursor_manager()->RemoveObserver(this); | 47 ash::Shell::Get()->cursor_manager()->RemoveObserver(this); |
| 46 ash::Shell::Get()->activation_client()->RemoveObserver(this); | 48 ash::Shell::Get()->activation_client()->RemoveObserver(this); |
| 47 ash::Shell::Get()->RemoveShellObserver(this); | 49 ash::Shell::Get()->RemoveShellObserver(this); |
| 48 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); | 50 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); |
| 51 ash::Shell::Get()->system_tray_notifier()->RemoveAccessibilityObserver(this); |
| 49 } | 52 } |
| 50 | 53 |
| 51 //////////////////////////////////////////////////////////////////////////////// | 54 //////////////////////////////////////////////////////////////////////////////// |
| 52 // WMHelperAsh, private: | 55 // WMHelperAsh, private: |
| 53 | 56 |
| 54 const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo( | 57 const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo( |
| 55 int64_t display_id) const { | 58 int64_t display_id) const { |
| 56 return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id); | 59 return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id); |
| 57 } | 60 } |
| 58 | 61 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void WMHelperAsh::RemovePostTargetHandler(ui::EventHandler* handler) { | 102 void WMHelperAsh::RemovePostTargetHandler(ui::EventHandler* handler) { |
| 100 ash::Shell::Get()->RemovePostTargetHandler(handler); | 103 ash::Shell::Get()->RemovePostTargetHandler(handler); |
| 101 } | 104 } |
| 102 | 105 |
| 103 bool WMHelperAsh::IsMaximizeModeWindowManagerEnabled() const { | 106 bool WMHelperAsh::IsMaximizeModeWindowManagerEnabled() const { |
| 104 return ash::Shell::Get() | 107 return ash::Shell::Get() |
| 105 ->maximize_mode_controller() | 108 ->maximize_mode_controller() |
| 106 ->IsMaximizeModeWindowManagerEnabled(); | 109 ->IsMaximizeModeWindowManagerEnabled(); |
| 107 } | 110 } |
| 108 | 111 |
| 112 bool WMHelperAsh::IsSpokenFeedbackEnabled() const { |
| 113 return ash::Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); |
| 114 } |
| 115 |
| 116 void WMHelperAsh::PlayEarcon(int sound_key) const { |
| 117 return ash::Shell::Get()->accessibility_delegate()->PlayEarcon(sound_key); |
| 118 } |
| 119 |
| 109 void WMHelperAsh::OnWindowActivated( | 120 void WMHelperAsh::OnWindowActivated( |
| 110 aura::client::ActivationChangeObserver::ActivationReason reason, | 121 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 111 aura::Window* gained_active, | 122 aura::Window* gained_active, |
| 112 aura::Window* lost_active) { | 123 aura::Window* lost_active) { |
| 113 NotifyWindowActivated(gained_active, lost_active); | 124 NotifyWindowActivated(gained_active, lost_active); |
| 114 } | 125 } |
| 115 | 126 |
| 116 void WMHelperAsh::OnWindowFocused(aura::Window* gained_focus, | 127 void WMHelperAsh::OnWindowFocused(aura::Window* gained_focus, |
| 117 aura::Window* lost_focus) { | 128 aura::Window* lost_focus) { |
| 118 NotifyWindowFocused(gained_focus, lost_focus); | 129 NotifyWindowFocused(gained_focus, lost_focus); |
| 119 } | 130 } |
| 120 | 131 |
| 121 void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) { | 132 void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) { |
| 122 NotifyCursorVisibilityChanged(is_visible); | 133 NotifyCursorVisibilityChanged(is_visible); |
| 123 } | 134 } |
| 124 | 135 |
| 125 void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) { | 136 void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) { |
| 126 NotifyCursorSetChanged(cursor_set); | 137 NotifyCursorSetChanged(cursor_set); |
| 127 } | 138 } |
| 128 | 139 |
| 140 void WMHelperAsh::OnAccessibilityModeChanged( |
| 141 ash::AccessibilityNotificationVisibility notify) { |
| 142 NotifyAccessibilityModeChanged(); |
| 143 } |
| 144 |
| 129 void WMHelperAsh::OnMaximizeModeStarted() { | 145 void WMHelperAsh::OnMaximizeModeStarted() { |
| 130 NotifyMaximizeModeStarted(); | 146 NotifyMaximizeModeStarted(); |
| 131 } | 147 } |
| 132 | 148 |
| 133 void WMHelperAsh::OnMaximizeModeEnding() { | 149 void WMHelperAsh::OnMaximizeModeEnding() { |
| 134 NotifyMaximizeModeEnding(); | 150 NotifyMaximizeModeEnding(); |
| 135 } | 151 } |
| 136 | 152 |
| 137 void WMHelperAsh::OnMaximizeModeEnded() { | 153 void WMHelperAsh::OnMaximizeModeEnded() { |
| 138 NotifyMaximizeModeEnded(); | 154 NotifyMaximizeModeEnded(); |
| 139 } | 155 } |
| 140 | 156 |
| 141 void WMHelperAsh::OnDisplayConfigurationChanged() { | 157 void WMHelperAsh::OnDisplayConfigurationChanged() { |
| 142 NotifyDisplayConfigurationChanged(); | 158 NotifyDisplayConfigurationChanged(); |
| 143 } | 159 } |
| 144 | 160 |
| 145 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() { | 161 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() { |
| 146 NotifyKeyboardDeviceConfigurationChanged(); | 162 NotifyKeyboardDeviceConfigurationChanged(); |
| 147 } | 163 } |
| 148 | 164 |
| 149 } // namespace exo | 165 } // namespace exo |
| OLD | NEW |