| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SERVICES_UI_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_ | 6 #define SERVICES_UI_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // Connects to mojo:ui as an observer on InputDeviceServer to receive input | 32 // Connects to mojo:ui as an observer on InputDeviceServer to receive input |
| 33 // device updates. | 33 // device updates. |
| 34 void Connect(mojom::InputDeviceServerPtr server); | 34 void Connect(mojom::InputDeviceServerPtr server); |
| 35 | 35 |
| 36 // ui::InputDeviceManager: | 36 // ui::InputDeviceManager: |
| 37 const std::vector<ui::InputDevice>& GetKeyboardDevices() const override; | 37 const std::vector<ui::InputDevice>& GetKeyboardDevices() const override; |
| 38 const std::vector<ui::TouchscreenDevice>& GetTouchscreenDevices() | 38 const std::vector<ui::TouchscreenDevice>& GetTouchscreenDevices() |
| 39 const override; | 39 const override; |
| 40 const std::vector<ui::InputDevice>& GetMouseDevices() const override; | 40 const std::vector<ui::InputDevice>& GetMouseDevices() const override; |
| 41 const std::vector<ui::InputDevice>& GetTouchpadDevices() const override; | 41 const std::vector<ui::InputDevice>& GetTouchpadDevices() const override; |
| 42 const std::vector<ui::InputDevice>& GetGamepadDevices() const override; |
| 42 | 43 |
| 43 bool AreDeviceListsComplete() const override; | 44 bool AreDeviceListsComplete() const override; |
| 44 bool AreTouchscreensEnabled() const override; | 45 bool AreTouchscreensEnabled() const override; |
| 45 | 46 |
| 46 void AddObserver(ui::InputDeviceEventObserver* observer) override; | 47 void AddObserver(ui::InputDeviceEventObserver* observer) override; |
| 47 void RemoveObserver(ui::InputDeviceEventObserver* observer) override; | 48 void RemoveObserver(ui::InputDeviceEventObserver* observer) override; |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 // Default constructor registers as InputDeviceManager. Can be subclassed in | 51 // Default constructor registers as InputDeviceManager. Can be subclassed in |
| 51 // tests to avoid this. | 52 // tests to avoid this. |
| 52 explicit InputDeviceClient(bool is_input_device_manager); | 53 explicit InputDeviceClient(bool is_input_device_manager); |
| 53 mojom::InputDeviceObserverMojoPtr GetIntefacePtr(); | 54 mojom::InputDeviceObserverMojoPtr GetIntefacePtr(); |
| 54 | 55 |
| 55 // mojom::InputDeviceObserverMojo: | 56 // mojom::InputDeviceObserverMojo: |
| 56 void OnKeyboardDeviceConfigurationChanged( | 57 void OnKeyboardDeviceConfigurationChanged( |
| 57 const std::vector<ui::InputDevice>& devices) override; | 58 const std::vector<ui::InputDevice>& devices) override; |
| 58 void OnTouchscreenDeviceConfigurationChanged( | 59 void OnTouchscreenDeviceConfigurationChanged( |
| 59 const std::vector<ui::TouchscreenDevice>& devices) override; | 60 const std::vector<ui::TouchscreenDevice>& devices) override; |
| 60 void OnMouseDeviceConfigurationChanged( | 61 void OnMouseDeviceConfigurationChanged( |
| 61 const std::vector<ui::InputDevice>& devices) override; | 62 const std::vector<ui::InputDevice>& devices) override; |
| 62 void OnTouchpadDeviceConfigurationChanged( | 63 void OnTouchpadDeviceConfigurationChanged( |
| 63 const std::vector<ui::InputDevice>& devices) override; | 64 const std::vector<ui::InputDevice>& devices) override; |
| 65 void OnGamepadDeviceConfigurationChanged( |
| 66 const std::vector<ui::InputDevice>& devices) override; |
| 64 void OnDeviceListsComplete( | 67 void OnDeviceListsComplete( |
| 65 const std::vector<ui::InputDevice>& keyboard_devices, | 68 const std::vector<ui::InputDevice>& keyboard_devices, |
| 66 const std::vector<ui::TouchscreenDevice>& touchscreen_devices, | 69 const std::vector<ui::TouchscreenDevice>& touchscreen_devices, |
| 67 const std::vector<ui::InputDevice>& mouse_devices, | 70 const std::vector<ui::InputDevice>& mouse_devices, |
| 68 const std::vector<ui::InputDevice>& touchpad_devices) override; | 71 const std::vector<ui::InputDevice>& touchpad_devices, |
| 72 const std::vector<ui::InputDevice>& gamepad_devices) override; |
| 69 void OnStylusStateChanged(StylusState state) override; | 73 void OnStylusStateChanged(StylusState state) override; |
| 70 | 74 |
| 71 private: | 75 private: |
| 72 mojo::Binding<mojom::InputDeviceObserverMojo> binding_; | 76 mojo::Binding<mojom::InputDeviceObserverMojo> binding_; |
| 73 | 77 |
| 74 bool is_input_device_manager_; | 78 bool is_input_device_manager_; |
| 75 | 79 |
| 76 // Holds the list of input devices and signal that we have received the lists | 80 // Holds the list of input devices and signal that we have received the lists |
| 77 // after initialization. | 81 // after initialization. |
| 78 std::vector<ui::InputDevice> keyboard_devices_; | 82 std::vector<ui::InputDevice> keyboard_devices_; |
| 79 std::vector<ui::TouchscreenDevice> touchscreen_devices_; | 83 std::vector<ui::TouchscreenDevice> touchscreen_devices_; |
| 80 std::vector<ui::InputDevice> mouse_devices_; | 84 std::vector<ui::InputDevice> mouse_devices_; |
| 81 std::vector<ui::InputDevice> touchpad_devices_; | 85 std::vector<ui::InputDevice> touchpad_devices_; |
| 86 std::vector<ui::InputDevice> gamepad_devices_; |
| 82 bool device_lists_complete_ = false; | 87 bool device_lists_complete_ = false; |
| 83 | 88 |
| 84 // List of in-process observers. | 89 // List of in-process observers. |
| 85 base::ObserverList<ui::InputDeviceEventObserver> observers_; | 90 base::ObserverList<ui::InputDeviceEventObserver> observers_; |
| 86 | 91 |
| 87 DISALLOW_COPY_AND_ASSIGN(InputDeviceClient); | 92 DISALLOW_COPY_AND_ASSIGN(InputDeviceClient); |
| 88 }; | 93 }; |
| 89 | 94 |
| 90 } // namespace ui | 95 } // namespace ui |
| 91 | 96 |
| 92 #endif // SERVICES_UI_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_ | 97 #endif // SERVICES_UI_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_ |
| OLD | NEW |