Chromium Code Reviews| 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 "ash/mus/bridge/shell_port_mash.h" | 5 #include "ash/mus/bridge/shell_port_mash.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
| 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 return window_manager_->config(); | 124 return window_manager_->config(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 std::unique_ptr<display::TouchTransformSetter> | 127 std::unique_ptr<display::TouchTransformSetter> |
| 128 ShellPortMash::CreateTouchTransformDelegate() { | 128 ShellPortMash::CreateTouchTransformDelegate() { |
| 129 return base::MakeUnique<TouchTransformSetterMus>( | 129 return base::MakeUnique<TouchTransformSetterMus>( |
| 130 window_manager_->connector()); | 130 window_manager_->connector()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 void ShellPortMash::LockCursor() { | 133 void ShellPortMash::LockCursor() { |
| 134 window_manager_->window_manager_client()->LockCursor(); | 134 // When we are running in mus, we need to keep track of state not just in the |
| 135 // window server, but also locally in ash because ash treats the cursor | |
| 136 // manager as the canonical state for now. NativeCursorManagerAsh will keep | |
| 137 // this state, while also forwarding it to the window manager for us. | |
| 138 if (mus_state_) | |
|
James Cook
2017/06/29 19:43:24
nit: I think these if()s would be clearer if they
Elliot Glaysher
2017/06/29 21:39:36
Done.
| |
| 139 Shell::Get()->cursor_manager()->LockCursor(); | |
| 140 else | |
| 141 window_manager_->window_manager_client()->LockCursor(); | |
| 135 } | 142 } |
| 136 | 143 |
| 137 void ShellPortMash::UnlockCursor() { | 144 void ShellPortMash::UnlockCursor() { |
| 138 window_manager_->window_manager_client()->UnlockCursor(); | 145 if (mus_state_) |
| 146 Shell::Get()->cursor_manager()->UnlockCursor(); | |
| 147 else | |
| 148 window_manager_->window_manager_client()->UnlockCursor(); | |
| 139 } | 149 } |
| 140 | 150 |
| 141 void ShellPortMash::ShowCursor() { | 151 void ShellPortMash::ShowCursor() { |
| 142 window_manager_->window_manager_client()->SetCursorVisible(true); | 152 if (mus_state_) |
| 153 Shell::Get()->cursor_manager()->ShowCursor(); | |
| 154 else | |
| 155 window_manager_->window_manager_client()->SetCursorVisible(true); | |
| 143 } | 156 } |
| 144 | 157 |
| 145 void ShellPortMash::HideCursor() { | 158 void ShellPortMash::HideCursor() { |
| 146 window_manager_->window_manager_client()->SetCursorVisible(false); | 159 if (mus_state_) |
| 160 Shell::Get()->cursor_manager()->HideCursor(); | |
| 161 else | |
| 162 window_manager_->window_manager_client()->SetCursorVisible(false); | |
| 147 } | 163 } |
| 148 | 164 |
| 149 void ShellPortMash::SetCursorSize(ui::CursorSize cursor_size) { | 165 void ShellPortMash::SetCursorSize(ui::CursorSize cursor_size) { |
| 150 window_manager_->window_manager_client()->SetCursorSize(cursor_size); | 166 if (mus_state_) |
| 167 Shell::Get()->cursor_manager()->SetCursorSize(cursor_size); | |
| 168 else | |
| 169 window_manager_->window_manager_client()->SetCursorSize(cursor_size); | |
| 151 } | 170 } |
| 152 | 171 |
| 153 void ShellPortMash::SetGlobalOverrideCursor( | 172 void ShellPortMash::SetGlobalOverrideCursor( |
| 154 base::Optional<ui::CursorData> cursor) { | 173 base::Optional<ui::CursorData> cursor) { |
| 174 DCHECK(mash_state_); | |
| 155 window_manager_->window_manager_client()->SetGlobalOverrideCursor( | 175 window_manager_->window_manager_client()->SetGlobalOverrideCursor( |
| 156 std::move(cursor)); | 176 std::move(cursor)); |
| 157 } | 177 } |
| 158 | 178 |
| 159 bool ShellPortMash::IsMouseEventsEnabled() { | 179 bool ShellPortMash::IsMouseEventsEnabled() { |
| 160 // TODO: http://crbug.com/637853 | 180 // TODO: http://crbug.com/637853 |
| 161 NOTIMPLEMENTED(); | 181 NOTIMPLEMENTED(); |
| 162 return true; | 182 return true; |
| 163 } | 183 } |
| 164 | 184 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 mash_state_->accelerator_controller_registrar = | 392 mash_state_->accelerator_controller_registrar = |
| 373 base ::MakeUnique<AcceleratorControllerRegistrar>( | 393 base ::MakeUnique<AcceleratorControllerRegistrar>( |
| 374 window_manager_, accelerator_namespace_id); | 394 window_manager_, accelerator_namespace_id); |
| 375 return base::MakeUnique<AcceleratorController>( | 395 return base::MakeUnique<AcceleratorController>( |
| 376 mash_state_->accelerator_controller_delegate.get(), | 396 mash_state_->accelerator_controller_delegate.get(), |
| 377 mash_state_->accelerator_controller_registrar.get()); | 397 mash_state_->accelerator_controller_registrar.get()); |
| 378 } | 398 } |
| 379 | 399 |
| 380 } // namespace mus | 400 } // namespace mus |
| 381 } // namespace ash | 401 } // namespace ash |
| OLD | NEW |