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

Side by Side Diff: components/mus/input_devices/input_device_server.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
6 #define COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
7
8 #include "base/macros.h"
9 #include "components/mus/public/interfaces/input_devices/input_device_server.moj om.h"
10 #include "mojo/public/cpp/bindings/binding_set.h"
11 #include "mojo/public/cpp/bindings/interface_ptr_set.h"
12 #include "services/shell/public/cpp/connection.h"
13 #include "services/shell/public/cpp/interface_factory.h"
14 #include "ui/events/devices/device_data_manager.h"
15 #include "ui/events/devices/input_device_event_observer.h"
16
17 namespace mus {
18
19 // Listens to DeviceDataManager for updates on input-devices and forwards those
20 // updates to any registered InputDeviceObserverMojo in other processes via
21 // Mojo IPC. This runs in the mus-ws process.
22 class InputDeviceServer
23 : public shell::InterfaceFactory<mojom::InputDeviceServer>,
24 public mojom::InputDeviceServer,
25 public ui::InputDeviceEventObserver {
26 public:
27 InputDeviceServer();
28 ~InputDeviceServer() override;
29
30 // Registers this instance as a local observer with DeviceDataManager.
31 void RegisterAsObserver();
32 bool IsRegisteredAsObserver() const;
33
34 // Adds interface with the shell connection so remote observers can connect.
35 // You should have already called RegisterAsObserver() to get local
36 // input-device event updates and checked it was successful by calling
37 // IsRegisteredAsObserver().
38 void AddInterface(shell::Connection* connection);
39
40 // mojom::InputDeviceServer:
41 void AddObserver(mojom::InputDeviceObserverMojoPtr observer) override;
42
43 // ui::InputDeviceEventObserver:
44 void OnKeyboardDeviceConfigurationChanged() override;
45 void OnTouchscreenDeviceConfigurationChanged() override;
46 void OnMouseDeviceConfigurationChanged() override;
47 void OnTouchpadDeviceConfigurationChanged() override;
48 void OnDeviceListsComplete() override;
49
50 private:
51 // Sends the current state of all input-devices to an observer.
52 void SendDeviceListsComplete(mojom::InputDeviceObserverMojo* observer);
53
54 // mojo::InterfaceFactory<mojom::InputDeviceServer>:
55 void Create(shell::Connection* connection,
56 mojom::InputDeviceServerRequest request) override;
57
58 mojo::BindingSet<mojom::InputDeviceServer> bindings_;
59 mojo::InterfacePtrSet<mojom::InputDeviceObserverMojo> observers_;
60
61 // DeviceDataManager instance we are registered as an observer with.
62 ui::DeviceDataManager* manager_ = nullptr;
63
64 DISALLOW_COPY_AND_ASSIGN(InputDeviceServer);
65 };
66
67 } // namespace mus
68
69 #endif // COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
OLDNEW
« no previous file with comments | « components/mus/input_devices/BUILD.gn ('k') | components/mus/input_devices/input_device_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698