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

Side by Side Diff: mash/wm/accelerator_registrar_impl.h

Issue 1488713002: mus: Introduce AcceleratorRegistrar and AcceleratorHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MASH_WM_ACCELERATOR_REGISTRAR_IMPL_H_
6 #define MASH_WM_ACCELERATOR_REGISTRAR_IMPL_H_
7
8 #include <map>
9
10 #include "base/callback.h"
11 #include "base/macros.h"
12 #include "components/mus/public/interfaces/accelerator_registrar.mojom.h"
13 #include "mojo/public/cpp/bindings/strong_binding.h"
14
15 namespace mus {
16 namespace mojom {
17 class WindowTreeHost;
18 }
19 }
20
21 namespace mash {
22 namespace wm {
23
24 class WindowManagerApplication;
25
26 class AcceleratorRegistrarImpl : public mus::mojom::AcceleratorRegistrar {
27 public:
28 using DestroyCallback = base::Callback<void(AcceleratorRegistrarImpl*)>;
29 AcceleratorRegistrarImpl(mus::mojom::WindowTreeHost* host,
30 uint32_t accelerator_namespace,
31 mojo::InterfaceRequest<AcceleratorRegistrar> request,
32 const DestroyCallback& destroy_callback);
33 ~AcceleratorRegistrarImpl() override;
34
35 bool OwnsAccelerator(uint32_t accelerator_id) const;
36 void ProcessAccelerator(uint32_t accelerator_id, mus::mojom::EventPtr event);
37
38 private:
39 uint32_t ComputeAcceleratorId(uint32_t accelerator_id) const;
40
41 // mus::mojom::AcceleratorRegistrar:
42 void AddAccelerator(uint32_t accelerator_id,
43 mus::mojom::EventMatcherPtr matcher,
44 mus::mojom::AcceleratorHandlerPtr handler,
45 const AddAcceleratorCallback& callback) override;
46 void RemoveAccelerator(uint32_t accelerator_id) override;
47
48 mus::mojom::WindowTreeHost* host_;
49 uint32_t accelerator_namespace_;
50 mojo::StrongBinding<AcceleratorRegistrar> binding_;
51 std::map<uint32_t, mus::mojom::AcceleratorHandlerPtr> accelerator_handlers_;
52 DestroyCallback destroy_callback_;
53
54 DISALLOW_COPY_AND_ASSIGN(AcceleratorRegistrarImpl);
55 };
56
57 } // namespace wm
58 } // namespace mash
59
60 #endif // MASH_WM_ACCELERATOR_REGISTRAR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698