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

Side by Side Diff: components/mus/public/cpp/input_devices/input_device_client.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
7
8 #include <vector>
9
10 #include "base/macros.h"
11 #include "base/observer_list.h"
12 #include "components/mus/public/interfaces/input_devices/input_device_server.moj om.h"
13 #include "mojo/public/cpp/bindings/array.h"
14 #include "mojo/public/cpp/bindings/binding.h"
15 #include "ui/events/devices/input_device.h"
16 #include "ui/events/devices/input_device_event_observer.h"
17 #include "ui/events/devices/input_device_manager.h"
18 #include "ui/events/devices/touchscreen_device.h"
19
20 namespace mus {
21
22 // Allows in-process client code to register as a InputDeviceEventObserver and
23 // get information about input-devices. InputDeviceClient itself acts as an
24 // InputDeviceObserverMojo and registers to get updates from InputDeviceServer.
25 // Essentially, InputDeviceClient forwards input-device events and caches
26 // input-device state.
27 class InputDeviceClient : public mojom::InputDeviceObserverMojo,
28 public ui::InputDeviceManager {
29 public:
30 InputDeviceClient();
31 ~InputDeviceClient() override;
32
33 // Connects to mojo:mus as an observer on InputDeviceServer to receive input
34 // device updates.
35 void Connect(mojom::InputDeviceServerPtr server);
36
37 // ui::InputDeviceManager:
38 const std::vector<ui::InputDevice>& GetKeyboardDevices() const override;
39 const std::vector<ui::TouchscreenDevice>& GetTouchscreenDevices()
40 const override;
41 const std::vector<ui::InputDevice>& GetMouseDevices() const override;
42 const std::vector<ui::InputDevice>& GetTouchpadDevices() const override;
43
44 bool AreDeviceListsComplete() const override;
45 bool AreTouchscreensEnabled() const override;
46
47 void AddObserver(ui::InputDeviceEventObserver* observer) override;
48 void RemoveObserver(ui::InputDeviceEventObserver* observer) override;
49
50 private:
51 // mojom::InputDeviceObserverMojo:
52 void OnKeyboardDeviceConfigurationChanged(
53 mojo::Array<ui::InputDevice> devices) override;
54 void OnTouchscreenDeviceConfigurationChanged(
55 mojo::Array<ui::TouchscreenDevice> devices) override;
56 void OnMouseDeviceConfigurationChanged(
57 mojo::Array<ui::InputDevice> devices) override;
58 void OnTouchpadDeviceConfigurationChanged(
59 mojo::Array<ui::InputDevice> devices) override;
60 void OnDeviceListsComplete(
61 mojo::Array<ui::InputDevice> keyboard_devices,
62 mojo::Array<ui::TouchscreenDevice> touchscreen_devices,
63 mojo::Array<ui::InputDevice> mouse_devices,
64 mojo::Array<ui::InputDevice> touchpad_devices) override;
65
66 mojo::Binding<mojom::InputDeviceObserverMojo> binding_;
67
68 // Holds the list of input devices and signal that we have received the lists
69 // after initialization.
70 std::vector<ui::InputDevice> keyboard_devices_;
71 std::vector<ui::TouchscreenDevice> touchscreen_devices_;
72 std::vector<ui::InputDevice> mouse_devices_;
73 std::vector<ui::InputDevice> touchpad_devices_;
74 bool device_lists_complete_ = false;
75
76 // List of in-process observers.
77 base::ObserverList<ui::InputDeviceEventObserver> observers_;
78
79 DISALLOW_COPY_AND_ASSIGN(InputDeviceClient);
80 };
81
82 } // namespace mus
83
84 #endif // COMPONENTS_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/input_devices/BUILD.gn ('k') | components/mus/public/cpp/input_devices/input_device_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698