| Index: components/input_device_service/input_device_client.h
|
| diff --git a/components/input_device_service/input_device_client.h b/components/input_device_service/input_device_client.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0238defc528d076c87c5a06f7658deebdeb281db
|
| --- /dev/null
|
| +++ b/components/input_device_service/input_device_client.h
|
| @@ -0,0 +1,76 @@
|
| +// 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_CLIENT_H_
|
| +#define COMPONENTS_INPUT_DEVICE_SERVICE_INPUT_DEVICE_CLIENT_H_
|
| +
|
| +#include <array>
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/observer_list.h"
|
| +#include "components/input_device_service/input_device_service.mojom.h"
|
| +#include "mojo/public/cpp/bindings/array.h"
|
| +#include "mojo/public/cpp/bindings/binding.h"
|
| +#include "services/shell/public/cpp/connector.h"
|
| +#include "ui/events/devices/input_device.h"
|
| +#include "ui/events/devices/input_device_event_observer.h"
|
| +#include "ui/events/devices/input_device_service.h"
|
| +
|
| +namespace input_device {
|
| +
|
| +// Listens for input device updates over Mojo IPC. Mirrors input device
|
| +// information found in the mus-ws process.
|
| +class InputDeviceClient : public mojom::InputDeviceObserver,
|
| + public ui::InputDeviceService {
|
| + public:
|
| + InputDeviceClient();
|
| + ~InputDeviceClient() override;
|
| +
|
| + void Initialize(shell::Connector* connector);
|
| +
|
| + // mojom::InputDeviceObserver:
|
| + void OnKeyboardDeviceConfigurationChanged(
|
| + mojo::Array<ui::InputDevice> devices) override;
|
| + void OnTouchscreenDeviceConfigurationChanged(
|
| + mojo::Array<ui::InputDevice> devices) override;
|
| + void OnMouseDeviceConfigurationChanged(
|
| + mojo::Array<ui::InputDevice> devices) override;
|
| + void OnTouchpadDeviceConfigurationChanged(
|
| + mojo::Array<ui::InputDevice> devices) override;
|
| +
|
| + void AddObserver(ui::InputDeviceEventObserver* observer) override;
|
| + void RemoveObserver(ui::InputDeviceEventObserver* observer) override;
|
| +
|
| + const std::vector<ui::InputDevice>& keyboard_devices() override;
|
| + const std::vector<ui::InputDevice>& touchscreen_devices() override;
|
| + const std::vector<ui::InputDevice>& mouse_devices() override;
|
| + const std::vector<ui::InputDevice>& touchpad_devices() override;
|
| +
|
| + private:
|
| + void RequestDeviceUpdates();
|
| +
|
| + void UpdateKeyboardDevices(mojo::Array<ui::InputDevice> devices);
|
| + void UpdateTouchscreenDevices(mojo::Array<ui::InputDevice> devices);
|
| + void UpdateMouseDevices(mojo::Array<ui::InputDevice> devices);
|
| + void UpdateTouchpadDevices(mojo::Array<ui::InputDevice> devices);
|
| +
|
| + std::vector<ui::InputDevice> keyboard_devices_;
|
| + std::vector<ui::InputDevice> touchscreen_devices_;
|
| + std::vector<ui::InputDevice> mouse_devices_;
|
| + std::vector<ui::InputDevice> touchpad_devices_;
|
| +
|
| + mojom::InputDeviceServicePtr service_;
|
| + mojo::Binding<mojom::InputDeviceObserver> binding_;
|
| +
|
| + // List of observers in this process.
|
| + base::ObserverList<ui::InputDeviceEventObserver> observers_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(InputDeviceClient);
|
| +};
|
| +
|
| +} // namespace input_device
|
| +
|
| +#endif // COMPONENTS_INPUT_DEVICE_SERVICE_INPUT_DEVICE_CLIENT_H_
|
|
|