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/accelerators/accelerator_controller_registrar.h" | 5 #include "ash/mus/accelerators/accelerator_controller_registrar.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
10 #include "ash/accelerators/accelerator_router.h" | 10 #include "ash/accelerators/accelerator_router.h" |
11 #include "ash/mus/accelerators/accelerator_ids.h" | 11 #include "ash/mus/accelerators/accelerator_ids.h" |
12 #include "ash/mus/window_manager.h" | 12 #include "ash/mus/window_manager.h" |
13 #include "ash/public/interfaces/event_properties.mojom.h" | 13 #include "ash/public/interfaces/event_properties.mojom.h" |
14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
15 #include "ash/wm/window_cycle_controller.h" | 15 #include "ash/wm/window_cycle_controller.h" |
16 #include "ash/wm/window_util.h" | 16 #include "ash/wm/window_util.h" |
17 #include "ash/wm_window.h" | |
18 #include "base/logging.h" | 17 #include "base/logging.h" |
19 #include "services/ui/common/accelerator_util.h" | 18 #include "services/ui/common/accelerator_util.h" |
20 #include "services/ui/public/cpp/property_type_converters.h" | 19 #include "services/ui/public/cpp/property_type_converters.h" |
21 #include "ui/base/accelerators/accelerator.h" | 20 #include "ui/base/accelerators/accelerator.h" |
22 #include "ui/base/accelerators/accelerator_history.h" | 21 #include "ui/base/accelerators/accelerator_history.h" |
23 | 22 |
24 namespace ash { | 23 namespace ash { |
25 namespace mus { | 24 namespace mus { |
26 namespace { | 25 namespace { |
27 | 26 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // accelerators, or make WS send the previous accelerator. | 88 // accelerators, or make WS send the previous accelerator. |
90 // http://crbug.com/630683. | 89 // http://crbug.com/630683. |
91 accelerator_controller->accelerator_history()->StoreCurrentAccelerator( | 90 accelerator_controller->accelerator_history()->StoreCurrentAccelerator( |
92 accelerator); | 91 accelerator); |
93 if (HandleWindowCycleAccelerator(accelerator)) | 92 if (HandleWindowCycleAccelerator(accelerator)) |
94 return ui::mojom::EventResult::HANDLED; | 93 return ui::mojom::EventResult::HANDLED; |
95 aura::Window* target_window = wm::GetFocusedWindow(); | 94 aura::Window* target_window = wm::GetFocusedWindow(); |
96 if (!target_window) | 95 if (!target_window) |
97 target_window = Shell::GetRootWindowForNewWindows(); | 96 target_window = Shell::GetRootWindowForNewWindows(); |
98 DCHECK(target_window); | 97 DCHECK(target_window); |
99 if (router_->ProcessAccelerator(WmWindow::Get(target_window), | 98 if (router_->ProcessAccelerator(target_window, *(event.AsKeyEvent()), |
100 *(event.AsKeyEvent()), accelerator)) { | 99 accelerator)) { |
101 return ui::mojom::EventResult::HANDLED; | 100 return ui::mojom::EventResult::HANDLED; |
102 } | 101 } |
103 if (accelerator_controller->IsActionForAcceleratorEnabled(accelerator)) { | 102 if (accelerator_controller->IsActionForAcceleratorEnabled(accelerator)) { |
104 // We do have an accelerator for the key. Set a property so that the real | 103 // We do have an accelerator for the key. Set a property so that the real |
105 // target knows we have an accelerator. | 104 // target knows we have an accelerator. |
106 (*properties)[mojom::kWillProcessAccelerator_KeyEventProperty] = | 105 (*properties)[mojom::kWillProcessAccelerator_KeyEventProperty] = |
107 std::vector<uint8_t>(); | 106 std::vector<uint8_t>(); |
108 } | 107 } |
109 return ui::mojom::EventResult::UNHANDLED; | 108 return ui::mojom::EventResult::UNHANDLED; |
110 } | 109 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (accelerator == window_cycle_cancel_accelerator_) { | 216 if (accelerator == window_cycle_cancel_accelerator_) { |
218 window_cycle_controller->CancelCycling(); | 217 window_cycle_controller->CancelCycling(); |
219 return true; | 218 return true; |
220 } | 219 } |
221 | 220 |
222 return false; | 221 return false; |
223 } | 222 } |
224 | 223 |
225 } // namespace mus | 224 } // namespace mus |
226 } // namespace ash | 225 } // namespace ash |
OLD | NEW |