Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(551)

Side by Side Diff: components/exo/wm_helper_ash.cc

Issue 2780623002: exo: Fix multi-display hardware cursor (Closed)
Patch Set: Fix accessibility test Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/public/cpp/config.h" 7 #include "ash/public/cpp/config.h"
8 #include "ash/root_window_controller.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"
12 #include "ash/wm/ash_native_cursor_manager.h"
11 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 13 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
12 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
13 #include "ui/aura/client/focus_client.h" 15 #include "ui/aura/client/focus_client.h"
14 #include "ui/display/manager/display_manager.h" 16 #include "ui/display/manager/display_manager.h"
15 #include "ui/events/devices/input_device_manager.h" 17 #include "ui/events/devices/input_device_manager.h"
16 #include "ui/wm/public/activation_client.h" 18 #include "ui/wm/public/activation_client.h"
17 19
18 namespace exo { 20 namespace exo {
19 21
20 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
21 // WMHelperAsh, public: 23 // WMHelperAsh, public:
22 24
23 WMHelperAsh::WMHelperAsh() { 25 WMHelperAsh::WMHelperAsh() {
24 ash::Shell::Get()->AddShellObserver(this); 26 ash::Shell::Get()->AddShellObserver(this);
25 ash::Shell::Get()->activation_client()->AddObserver(this); 27 ash::Shell::Get()->activation_client()->AddObserver(this);
26 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet. 28 // TODO(crbug.com/631103): Mushrome doesn't have a cursor manager yet.
27 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) 29 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) {
28 ash::Shell::Get()->cursor_manager()->AddObserver(this); 30 ash::Shell::Get()->cursor_manager()->AddObserver(this);
31 ash::Shell::Get()->native_cursor_manager()->AddObserver(this);
32 }
29 ash::ShellPort::Get()->AddDisplayObserver(this); 33 ash::ShellPort::Get()->AddDisplayObserver(this);
30 aura::client::FocusClient* focus_client = 34 aura::client::FocusClient* focus_client =
31 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); 35 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
32 focus_client->AddObserver(this); 36 focus_client->AddObserver(this);
33 ui::InputDeviceManager::GetInstance()->AddObserver(this); 37 ui::InputDeviceManager::GetInstance()->AddObserver(this);
34 } 38 }
35 39
36 WMHelperAsh::~WMHelperAsh() { 40 WMHelperAsh::~WMHelperAsh() {
37 if (!ash::Shell::HasInstance()) 41 if (!ash::Shell::HasInstance())
38 return; 42 return;
39 aura::client::FocusClient* focus_client = 43 aura::client::FocusClient* focus_client =
40 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); 44 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
41 focus_client->RemoveObserver(this); 45 focus_client->RemoveObserver(this);
42 ash::ShellPort::Get()->RemoveDisplayObserver(this); 46 ash::ShellPort::Get()->RemoveDisplayObserver(this);
43 // 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.
44 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) 48 if (ash::ShellPort::Get()->GetAshConfig() != ash::Config::MUS) {
45 ash::Shell::Get()->cursor_manager()->RemoveObserver(this); 49 ash::Shell::Get()->cursor_manager()->RemoveObserver(this);
50 ash::Shell::Get()->native_cursor_manager()->RemoveObserver(this);
51 }
46 ash::Shell::Get()->activation_client()->RemoveObserver(this); 52 ash::Shell::Get()->activation_client()->RemoveObserver(this);
47 ash::Shell::Get()->RemoveShellObserver(this); 53 ash::Shell::Get()->RemoveShellObserver(this);
48 ui::InputDeviceManager::GetInstance()->RemoveObserver(this); 54 ui::InputDeviceManager::GetInstance()->RemoveObserver(this);
49 } 55 }
50 56
51 //////////////////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////////////////
52 // WMHelperAsh, private: 58 // WMHelperAsh, private:
53 59
54 const display::ManagedDisplayInfo WMHelperAsh::GetDisplayInfo( 60 const display::ManagedDisplayInfo& WMHelperAsh::GetDisplayInfo(
55 int64_t display_id) const { 61 int64_t display_id) const {
56 return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id); 62 return ash::Shell::Get()->display_manager()->GetDisplayInfo(display_id);
57 } 63 }
58 64
59 aura::Window* WMHelperAsh::GetContainer(int container_id) { 65 aura::Window* WMHelperAsh::GetContainer(int64_t display_id, int container_id) {
60 // TODO(domlaskowski): Use target root window once multi-display support lands 66 ash::RootWindowController* controller =
61 // in ARC. See crbug.com/718627. 67 ash::Shell::GetRootWindowControllerWithDisplayId(display_id);
62 return ash::Shell::GetContainer(ash::Shell::GetPrimaryRootWindow(), 68 if (!controller)
63 container_id); 69 return nullptr;
70 return ash::Shell::GetContainer(controller->GetRootWindow(), container_id);
64 } 71 }
65 72
66 aura::Window* WMHelperAsh::GetActiveWindow() const { 73 aura::Window* WMHelperAsh::GetActiveWindow() const {
67 return ash::Shell::Get()->activation_client()->GetActiveWindow(); 74 return ash::Shell::Get()->activation_client()->GetActiveWindow();
68 } 75 }
69 76
70 aura::Window* WMHelperAsh::GetFocusedWindow() const { 77 aura::Window* WMHelperAsh::GetFocusedWindow() const {
71 aura::client::FocusClient* focus_client = 78 aura::client::FocusClient* focus_client =
72 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow()); 79 aura::client::GetFocusClient(ash::Shell::GetPrimaryRootWindow());
73 return focus_client->GetFocusedWindow(); 80 return focus_client->GetFocusedWindow();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 126 }
120 127
121 void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) { 128 void WMHelperAsh::OnCursorVisibilityChanged(bool is_visible) {
122 NotifyCursorVisibilityChanged(is_visible); 129 NotifyCursorVisibilityChanged(is_visible);
123 } 130 }
124 131
125 void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) { 132 void WMHelperAsh::OnCursorSetChanged(ui::CursorSetType cursor_set) {
126 NotifyCursorSetChanged(cursor_set); 133 NotifyCursorSetChanged(cursor_set);
127 } 134 }
128 135
136 void WMHelperAsh::OnCursorDisplayChanging(const display::Display& display) {
137 NotifyCursorDisplayChanging(display);
138 }
139
129 void WMHelperAsh::OnMaximizeModeStarted() { 140 void WMHelperAsh::OnMaximizeModeStarted() {
130 NotifyMaximizeModeStarted(); 141 NotifyMaximizeModeStarted();
131 } 142 }
132 143
133 void WMHelperAsh::OnMaximizeModeEnding() { 144 void WMHelperAsh::OnMaximizeModeEnding() {
134 NotifyMaximizeModeEnding(); 145 NotifyMaximizeModeEnding();
135 } 146 }
136 147
137 void WMHelperAsh::OnMaximizeModeEnded() { 148 void WMHelperAsh::OnMaximizeModeEnded() {
138 NotifyMaximizeModeEnded(); 149 NotifyMaximizeModeEnded();
139 } 150 }
140 151
141 void WMHelperAsh::OnDisplayConfigurationChanged() { 152 void WMHelperAsh::OnDisplayConfigurationChanged() {
142 NotifyDisplayConfigurationChanged(); 153 NotifyDisplayConfigurationChanged();
143 } 154 }
144 155
145 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() { 156 void WMHelperAsh::OnKeyboardDeviceConfigurationChanged() {
146 NotifyKeyboardDeviceConfigurationChanged(); 157 NotifyKeyboardDeviceConfigurationChanged();
147 } 158 }
148 159
149 } // namespace exo 160 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698