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

Side by Side Diff: components/input_device_service/input_device_server.h

Issue 1992443002: Add Mojo IPC based input-device service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_ddm
Patch Set: Clean up/move files. Created 4 years, 7 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_INPUT_DEVICE_SERVICE_INPUT_DEVICE_SERVER_H_
6 #define COMPONENTS_INPUT_DEVICE_SERVICE_INPUT_DEVICE_SERVER_H_
7
8 #include "base/macros.h"
9 #include "components/input_device_service/input_device_service.mojom.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/input_device_event_observer.h"
15
16 namespace input_device {
17
18 // Acts as an intermediate, listening to DeviceDataManager for updates on input
19 // devices and forwards those updates via Mojo IPC to any InputDeviceClients
20 // in different processes that are registered as observers.
21 class InputDeviceServer
22 : public shell::InterfaceFactory<mojom::InputDeviceService>,
23 public mojom::InputDeviceService,
24 public ui::InputDeviceEventObserver {
25 public:
26 InputDeviceServer();
27 ~InputDeviceServer() override;
28
29 // Registers as an observer with DeviceDataManager.
30 void RegisterAsObserver();
31
32 // Registers mojo interfaces with shell connection.
33 void RegisterInterface(shell::Connection* connection);
34
35 // mojo::InterfaceFactory<mojom::InputDeviceService>:
36 void Create(shell::Connection* connection,
37 mojom::InputDeviceServiceRequest request) override;
38
39 // mojom::InputDeviceService:
40 void AddObserver(mojom::InputDeviceObserverPtr observer) override;
41
42 void GetKeyboardDevices(const GetKeyboardDevicesCallback& callback) override;
43 void GetTouchscreenDevices(
44 const GetTouchscreenDevicesCallback& callback) override;
45 void GetMouseDevices(const GetMouseDevicesCallback& callback) override;
46 void GetTouchpadDevices(const GetTouchpadDevicesCallback& callback) override;
47
48 // ui::InputDeviceEventObserver:
49 void OnKeyboardDeviceConfigurationChanged() override;
50 void OnTouchscreenDeviceConfigurationChanged() override;
51 void OnMouseDeviceConfigurationChanged() override;
52 void OnTouchpadDeviceConfigurationChanged() override;
53
54 private:
55 mojo::BindingSet<mojom::InputDeviceService> bindings_;
56 mojo::InterfacePtrSet<mojom::InputDeviceObserver> observers_;
57
58 // Are we registered as an observer with DeviceDataManager.
59 bool is_observing_ = false;
60
61 DISALLOW_COPY_AND_ASSIGN(InputDeviceServer);
62 };
63
64 } // namespace input_device
65
66 #endif // COMPONENTS_INPUT_DEVICE_SERVICE_INPUT_DEVICE_SERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698