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

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

Issue 2203003003: Get AcceleratorControllerTest working with mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 4 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
« no previous file with comments | « ash/mus/BUILD.gn ('k') | ash/mus/accelerators/accelerator_controller_registrar_test_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 11
12 #include "ash/mus/accelerators/accelerator_handler.h" 12 #include "ash/mus/accelerators/accelerator_handler.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "ui/base/accelerators/accelerator.h" 14 #include "ui/base/accelerators/accelerator.h"
15 #include "ui/base/accelerators/accelerator_manager_delegate.h" 15 #include "ui/base/accelerators/accelerator_manager_delegate.h"
16 #include "ui/events/mojo/event_constants.mojom.h" 16 #include "ui/events/mojo/event_constants.mojom.h"
17 17
18 namespace ash { 18 namespace ash {
19 19
20 class AcceleratorRouter; 20 class AcceleratorRouter;
21 21
22 namespace mus { 22 namespace mus {
23 23
24 class AcceleratorControllerRegistrarTestApi;
24 class WindowManager; 25 class WindowManager;
25 26
26 // Responsible for registering accelerators created by AcceleratorController 27 // Responsible for registering accelerators created by AcceleratorController
27 // with the WindowManager, as well as routing handling of accelerators to 28 // with the WindowManager, as well as routing handling of accelerators to
28 // the right place. 29 // the right place.
29 class AcceleratorControllerRegistrar : public AcceleratorHandler, 30 class AcceleratorControllerRegistrar : public AcceleratorHandler,
30 public ui::AcceleratorManagerDelegate { 31 public ui::AcceleratorManagerDelegate {
31 public: 32 public:
32 AcceleratorControllerRegistrar(WindowManager* window_manager, 33 AcceleratorControllerRegistrar(WindowManager* window_manager,
33 uint16_t id_namespace); 34 uint16_t id_namespace);
34 ~AcceleratorControllerRegistrar() override; 35 ~AcceleratorControllerRegistrar() override;
35 36
36 // AcceleratorHandler: 37 // AcceleratorHandler:
37 ui::mojom::EventResult OnAccelerator(uint32_t id, 38 ui::mojom::EventResult OnAccelerator(uint32_t id,
38 const ui::Event& event) override; 39 const ui::Event& event) override;
39 40
40 // ui::AcceleratorManagerDelegate: 41 // ui::AcceleratorManagerDelegate:
41 void OnAcceleratorRegistered(const ui::Accelerator& accelerator) override; 42 void OnAcceleratorRegistered(const ui::Accelerator& accelerator) override;
42 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override; 43 void OnAcceleratorUnregistered(const ui::Accelerator& accelerator) override;
43 44
44 private: 45 private:
46 friend class AcceleratorControllerRegistrarTestApi;
47
45 // The flow of accelerators in ash is: 48 // The flow of accelerators in ash is:
46 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler. 49 // . wm::AcceleratorFilter() sees events first as it's a pre-target handler.
47 // . AcceleratorFilter forwards to its delegate, which indirectly is 50 // . AcceleratorFilter forwards to its delegate, which indirectly is
48 // implemented by AcceleratorRouter. 51 // implemented by AcceleratorRouter.
49 // . AcceleratorRouter may early out, if not it calls through to 52 // . AcceleratorRouter may early out, if not it calls through to
50 // AcceleratorController. This stop may stop propagation entirely. 53 // AcceleratorController. This stop may stop propagation entirely.
51 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls 54 // . If focus is on a Widget, then NativeWidgetAura gets the key event, calls
52 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which 55 // to Widget::OnKeyEvent(), which calls to FocusManager::OnKeyEvent(), which
53 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally 56 // calls to AshFocusManagerFactory::Delegate::ProcessAccelerator() finally
54 // ending up in AcceleratorController::Process(). 57 // ending up in AcceleratorController::Process().
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Maps from accelerator to the two ids registered for it. 92 // Maps from accelerator to the two ids registered for it.
90 std::map<ui::Accelerator, Ids> accelerator_to_ids_; 93 std::map<ui::Accelerator, Ids> accelerator_to_ids_;
91 94
92 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar); 95 DISALLOW_COPY_AND_ASSIGN(AcceleratorControllerRegistrar);
93 }; 96 };
94 97
95 } // namespace mus 98 } // namespace mus
96 } // namespace ash 99 } // namespace ash
97 100
98 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_ 101 #endif // ASH_MUS_ACCELERATORS_ACCELERATOR_CONTROLLER_REGISTRAR_H_
OLDNEW
« no previous file with comments | « ash/mus/BUILD.gn ('k') | ash/mus/accelerators/accelerator_controller_registrar_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698