| Index: components/input_device_service/input_device_server.h
|
| diff --git a/components/input_device_service/input_device_server.h b/components/input_device_service/input_device_server.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7ea7d751e6cfe6c393811ef70e7a09ee206c3503
|
| --- /dev/null
|
| +++ b/components/input_device_service/input_device_server.h
|
| @@ -0,0 +1,66 @@
|
| +// 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_INPUT_DEVICE_SERVICE_INPUT_DEVICE_SERVER_H_
|
| +#define COMPONENTS_INPUT_DEVICE_SERVICE_INPUT_DEVICE_SERVER_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "components/input_device_service/input_device_service.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/input_device_event_observer.h"
|
| +
|
| +namespace input_device {
|
| +
|
| +// Acts as an intermediate, listening to DeviceDataManager for updates on input
|
| +// devices and forwards those updates via Mojo IPC to any InputDeviceClients
|
| +// in different processes that are registered as observers.
|
| +class InputDeviceServer
|
| + : public shell::InterfaceFactory<mojom::InputDeviceService>,
|
| + public mojom::InputDeviceService,
|
| + public ui::InputDeviceEventObserver {
|
| + public:
|
| + InputDeviceServer();
|
| + ~InputDeviceServer() override;
|
| +
|
| + // Registers as an observer with DeviceDataManager.
|
| + void RegisterAsObserver();
|
| +
|
| + // Registers mojo interfaces with shell connection.
|
| + void RegisterInterface(shell::Connection* connection);
|
| +
|
| + // mojo::InterfaceFactory<mojom::InputDeviceService>:
|
| + void Create(shell::Connection* connection,
|
| + mojom::InputDeviceServiceRequest request) override;
|
| +
|
| + // mojom::InputDeviceService:
|
| + void AddObserver(mojom::InputDeviceObserverPtr observer) override;
|
| +
|
| + void GetKeyboardDevices(const GetKeyboardDevicesCallback& callback) override;
|
| + void GetTouchscreenDevices(
|
| + const GetTouchscreenDevicesCallback& callback) override;
|
| + void GetMouseDevices(const GetMouseDevicesCallback& callback) override;
|
| + void GetTouchpadDevices(const GetTouchpadDevicesCallback& callback) override;
|
| +
|
| + // ui::InputDeviceEventObserver:
|
| + void OnKeyboardDeviceConfigurationChanged() override;
|
| + void OnTouchscreenDeviceConfigurationChanged() override;
|
| + void OnMouseDeviceConfigurationChanged() override;
|
| + void OnTouchpadDeviceConfigurationChanged() override;
|
| +
|
| + private:
|
| + mojo::BindingSet<mojom::InputDeviceService> bindings_;
|
| + mojo::InterfacePtrSet<mojom::InputDeviceObserver> observers_;
|
| +
|
| + // Are we registered as an observer with DeviceDataManager.
|
| + bool is_observing_ = false;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(InputDeviceServer);
|
| +};
|
| +
|
| +} // namespace input_device
|
| +
|
| +#endif // COMPONENTS_INPUT_DEVICE_SERVICE_INPUT_DEVICE_SERVER_H_
|
|
|