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

Unified Diff: components/mus/input_devices/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: Change namespace. Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/input_devices/input_device_server.h
diff --git a/components/mus/input_devices/input_device_server.h b/components/mus/input_devices/input_device_server.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f98a6634779e3af8d534f855033f12a8649c53b
--- /dev/null
+++ b/components/mus/input_devices/input_device_server.h
@@ -0,0 +1,67 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
+#define COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
+
+#include "base/macros.h"
+#include "components/mus/public/interfaces/input_devices/input_device_server.mojom.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/public/cpp/bindings/interface_ptr_set.h"
+#include "services/shell/public/cpp/connection.h"
+#include "services/shell/public/cpp/interface_factory.h"
+#include "ui/events/devices/device_data_manager.h"
+#include "ui/events/devices/input_device_event_observer.h"
+
+namespace mus {
+
+// Listens to DeviceDataManager for updates on input-devices and forwards those
+// updates to any registered InputDeviceObserverMojo in other processes via
+// Mojo IPC. This runs in the mus-ws process.
+class InputDeviceServer
+ : public shell::InterfaceFactory<mojom::InputDeviceServer>,
+ public mojom::InputDeviceServer,
+ public ui::InputDeviceEventObserver {
+ public:
+ InputDeviceServer();
+ ~InputDeviceServer() override;
+
+ // Registers this instance as a local observer with DeviceDataManager.
+ void RegisterAsObserver();
+
+ // Registers interface with the shell connection so remote observers can
+ // connect. You should have already called RegisterAsObserver() to get
+ // local input-device event updates.
+ void RegisterInterface(shell::Connection* connection);
+
+ // mojom::InputDeviceServer:
+ void AddObserver(mojom::InputDeviceObserverMojoPtr observer) override;
+
+ // ui::InputDeviceEventObserver:
+ void OnKeyboardDeviceConfigurationChanged() override;
+ void OnTouchscreenDeviceConfigurationChanged() override;
+ void OnMouseDeviceConfigurationChanged() override;
+ void OnTouchpadDeviceConfigurationChanged() override;
+ void OnDeviceListsComplete() override;
+
+ private:
+ // Sends the current state of all input-devices to an observer.
+ void SendDeviceListsComplete(mojom::InputDeviceObserverMojo* observer);
+
+ // mojo::InterfaceFactory<mojom::InputDeviceServer>:
+ void Create(shell::Connection* connection,
+ mojom::InputDeviceServerRequest request) override;
+
+ mojo::BindingSet<mojom::InputDeviceServer> bindings_;
+ mojo::InterfacePtrSet<mojom::InputDeviceObserverMojo> observers_;
+
+ // DeviceDataManager instance we are registered as an observer with.
+ ui::DeviceDataManager* manager_ = nullptr;
+
+ DISALLOW_COPY_AND_ASSIGN(InputDeviceServer);
+};
+
+} // namespace mus
+
+#endif // COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
« 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