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

Side by Side Diff: ash/mus/accelerators/accelerator_controller_registrar.h

Issue 2586333003: Make mash register initial batch of accelerators in single shot. (Closed)
Patch Set: Add unimplemented methods Created 4 years 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 #ifndef ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ 5 #ifndef ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_
6 #define ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ 6 #define ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <vector>
11 12
12 #include "ash/mus/accelerators/accelerator_handler.h" 13 #include "ash/mus/accelerators/accelerator_handler.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "ui/base/accelerators/accelerator.h" 15 #include "ui/base/accelerators/accelerator.h"
15 #include "ui/base/accelerators/accelerator_manager_delegate.h" 16 #include "ui/base/accelerators/accelerator_manager_delegate.h"
16 #include "ui/events/mojo/event_constants.mojom.h" 17 #include "ui/events/mojo/event_constants.mojom.h"
17 18
18 namespace ash { 19 namespace ash {
19 20
20 class AcceleratorRouter; 21 class AcceleratorRouter;
(...skipping 14 matching lines...) Expand all
35 ~AcceleratorControllerRegistrar() override; 36 ~AcceleratorControllerRegistrar() override;
36 37
37 // AcceleratorHandler: 38 // AcceleratorHandler:
38 ui::mojom::EventResult OnAccelerator(uint32_t id, 39 ui::mojom::EventResult OnAccelerator(uint32_t id,
39 const ui::Event& event) override; 40 const ui::Event& event) override;
40 41
41 // ui::AcceleratorManagerDelegate: 42 // ui::AcceleratorManagerDelegate:
42 void OnAcceleratorRegistered(const ui::Accelerator& accelerator) override; 43 void OnAcceleratorRegistered(const ui::Accelerator& accelerator) override;
43 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override; 44 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override;
44 45
46 void OnAcceleratorsRegistered(
47 std::vector<ui::Accelerator>& accelerators) override;
48 void OnAcceleratorsUnregistered(
49 std::vector<ui::Accelerator>& accelerators) override;
50
45 private: 51 private:
46 friend class AcceleratorControllerRegistrarTestApi; 52 friend class AcceleratorControllerRegistrarTestApi;
47 53
48 // The flow of accelerators in ash is: 54 // The flow of accelerators in ash is:
49 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler. 55 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler.
50 // . AcceleratorFilter forwards to its delegate, which indirectly is 56 // . AcceleratorFilter forwards to its delegate, which indirectly is
51 // implemented by AcceleratorRouter. 57 // implemented by AcceleratorRouter.
52 // . AcceleratorRouter may early out, if not it calls through to 58 // . AcceleratorRouter may early out, if not it calls through to
53 // AcceleratorController. This stop may stop propagation entirely. 59 // AcceleratorController. This stop may stop propagation entirely.
54 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls 60 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls
(...skipping 24 matching lines...) Expand all
79 85
80 WindowManager* window_manager_; 86 WindowManager* window_manager_;
81 87
82 const uint16_t id_namespace_; 88 const uint16_t id_namespace_;
83 89
84 // Id to use for the next accelerator. 90 // Id to use for the next accelerator.
85 uint16_t next_id_; 91 uint16_t next_id_;
86 92
87 std::unique_ptr<AcceleratorRouter> router_; 93 std::unique_ptr<AcceleratorRouter> router_;
88 94
95 std::vector<ui::mojom::AcceleratorPtr> accelerator_ptrs_;
96
89 // Set of registered local ids. 97 // Set of registered local ids.
90 std::set<uint16_t> ids_; 98 std::set<uint16_t> ids_;
91 99
92 // Maps from accelerator to the two ids registered for it. 100 // Maps from accelerator to the two ids registered for it.
93 std::map<ui::Accelerator, Ids> accelerator_to_ids_; 101 std::map<ui::Accelerator, Ids> accelerator_to_ids_;
94 102
95 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); 103 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar);
96 }; 104 };
97 105
98 } // namespace mus 106 } // namespace mus
99 } // namespace ash 107 } // namespace ash
100 108
101 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ 109 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698