summaryrefslogtreecommitdiffstats
path: root/chromium/components/mus/public/cpp/input_devices
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/components/mus/public/cpp/input_devices')
-rw-r--r--chromium/components/mus/public/cpp/input_devices/input_device_client.cc112
-rw-r--r--chromium/components/mus/public/cpp/input_devices/input_device_client.h84
2 files changed, 0 insertions, 196 deletions
diff --git a/chromium/components/mus/public/cpp/input_devices/input_device_client.cc b/chromium/components/mus/public/cpp/input_devices/input_device_client.cc
deleted file mode 100644
index 6b55d778f58..00000000000
--- a/chromium/components/mus/public/cpp/input_devices/input_device_client.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// 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.
-
-#include "components/mus/public/cpp/input_devices/input_device_client.h"
-
-#include "base/logging.h"
-
-namespace mus {
-
-InputDeviceClient::InputDeviceClient() : binding_(this) {
- InputDeviceManager::SetInstance(this);
-}
-
-InputDeviceClient::~InputDeviceClient() {
- InputDeviceManager::ClearInstance();
-}
-
-void InputDeviceClient::Connect(mojom::InputDeviceServerPtr server) {
- DCHECK(server.is_bound());
-
- server->AddObserver(binding_.CreateInterfacePtrAndBind());
-}
-
-void InputDeviceClient::OnKeyboardDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) {
- keyboard_devices_ = devices.To<std::vector<ui::InputDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnKeyboardDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnTouchscreenDeviceConfigurationChanged(
- mojo::Array<ui::TouchscreenDevice> devices) {
- touchscreen_devices_ = devices.To<std::vector<ui::TouchscreenDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnTouchscreenDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnMouseDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) {
- mouse_devices_ = devices.To<std::vector<ui::InputDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnMouseDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnTouchpadDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) {
- touchpad_devices_ = devices.To<std::vector<ui::InputDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnTouchpadDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnDeviceListsComplete(
- mojo::Array<ui::InputDevice> keyboard_devices,
- mojo::Array<ui::TouchscreenDevice> touchscreen_devices,
- mojo::Array<ui::InputDevice> mouse_devices,
- mojo::Array<ui::InputDevice> touchpad_devices) {
- // Update the cached device lists if the received list isn't empty.
- if (!keyboard_devices.empty())
- OnKeyboardDeviceConfigurationChanged(std::move(keyboard_devices));
- if (!touchscreen_devices.empty())
- OnTouchscreenDeviceConfigurationChanged(std::move(touchscreen_devices));
- if (!mouse_devices.empty())
- OnMouseDeviceConfigurationChanged(std::move(mouse_devices));
- if (!touchpad_devices.empty())
- OnTouchpadDeviceConfigurationChanged(std::move(touchpad_devices));
-
- if (!device_lists_complete_) {
- device_lists_complete_ = true;
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnDeviceListsComplete());
- }
-}
-
-void InputDeviceClient::AddObserver(ui::InputDeviceEventObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void InputDeviceClient::RemoveObserver(ui::InputDeviceEventObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-const std::vector<ui::InputDevice>& InputDeviceClient::GetKeyboardDevices()
- const {
- return keyboard_devices_;
-}
-
-const std::vector<ui::TouchscreenDevice>&
-InputDeviceClient::GetTouchscreenDevices() const {
- return touchscreen_devices_;
-}
-
-const std::vector<ui::InputDevice>& InputDeviceClient::GetMouseDevices() const {
- return mouse_devices_;
-}
-
-const std::vector<ui::InputDevice>& InputDeviceClient::GetTouchpadDevices()
- const {
- return touchpad_devices_;
-}
-
-bool InputDeviceClient::AreDeviceListsComplete() const {
- return device_lists_complete_;
-}
-
-bool InputDeviceClient::AreTouchscreensEnabled() const {
- // TODO(kylechar): This obviously isn't right. We either need to pass this
- // state around or modify the interface.
- return true;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/input_devices/input_device_client.h b/chromium/components/mus/public/cpp/input_devices/input_device_client.h
deleted file mode 100644
index 88fa41d750f..00000000000
--- a/chromium/components/mus/public/cpp/input_devices/input_device_client.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// 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_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
-
-#include <vector>
-
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "components/mus/public/interfaces/input_devices/input_device_server.mojom.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "ui/events/devices/input_device.h"
-#include "ui/events/devices/input_device_event_observer.h"
-#include "ui/events/devices/input_device_manager.h"
-#include "ui/events/devices/touchscreen_device.h"
-
-namespace mus {
-
-// Allows in-process client code to register as a InputDeviceEventObserver and
-// get information about input-devices. InputDeviceClient itself acts as an
-// InputDeviceObserverMojo and registers to get updates from InputDeviceServer.
-// Essentially, InputDeviceClient forwards input-device events and caches
-// input-device state.
-class InputDeviceClient : public mojom::InputDeviceObserverMojo,
- public ui::InputDeviceManager {
- public:
- InputDeviceClient();
- ~InputDeviceClient() override;
-
- // Connects to mojo:mus as an observer on InputDeviceServer to receive input
- // device updates.
- void Connect(mojom::InputDeviceServerPtr server);
-
- // ui::InputDeviceManager:
- const std::vector<ui::InputDevice>& GetKeyboardDevices() const override;
- const std::vector<ui::TouchscreenDevice>& GetTouchscreenDevices()
- const override;
- const std::vector<ui::InputDevice>& GetMouseDevices() const override;
- const std::vector<ui::InputDevice>& GetTouchpadDevices() const override;
-
- bool AreDeviceListsComplete() const override;
- bool AreTouchscreensEnabled() const override;
-
- void AddObserver(ui::InputDeviceEventObserver* observer) override;
- void RemoveObserver(ui::InputDeviceEventObserver* observer) override;
-
- private:
- // mojom::InputDeviceObserverMojo:
- void OnKeyboardDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) override;
- void OnTouchscreenDeviceConfigurationChanged(
- mojo::Array<ui::TouchscreenDevice> devices) override;
- void OnMouseDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) override;
- void OnTouchpadDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) override;
- void OnDeviceListsComplete(
- mojo::Array<ui::InputDevice> keyboard_devices,
- mojo::Array<ui::TouchscreenDevice> touchscreen_devices,
- mojo::Array<ui::InputDevice> mouse_devices,
- mojo::Array<ui::InputDevice> touchpad_devices) override;
-
- mojo::Binding<mojom::InputDeviceObserverMojo> binding_;
-
- // Holds the list of input devices and signal that we have received the lists
- // after initialization.
- std::vector<ui::InputDevice> keyboard_devices_;
- std::vector<ui::TouchscreenDevice> touchscreen_devices_;
- std::vector<ui::InputDevice> mouse_devices_;
- std::vector<ui::InputDevice> touchpad_devices_;
- bool device_lists_complete_ = false;
-
- // List of in-process observers.
- base::ObserverList<ui::InputDeviceEventObserver> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(InputDeviceClient);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_