OLD | NEW |
(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 UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ |
| 6 #define UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/macros.h" |
| 11 #include "ui/events/devices/events_devices_export.h" |
| 12 #include "ui/events/devices/input_device.h" |
| 13 #include "ui/events/devices/input_device_event_observer.h" |
| 14 #include "ui/events/devices/touchscreen_device.h" |
| 15 |
| 16 namespace ui { |
| 17 |
| 18 // Interface to query available input devices. Holds a static pointer to an |
| 19 // implementation that provides this service. The implementation could be |
| 20 // DeviceDataManager or something that mirrors the necessary state if |
| 21 // DeviceDataManager is in a different process. |
| 22 class EVENTS_DEVICES_EXPORT InputDeviceManager { |
| 23 public: |
| 24 InputDeviceManager() {} |
| 25 |
| 26 static InputDeviceManager* GetInstance(); |
| 27 static bool HasInstance(); |
| 28 |
| 29 virtual const std::vector<InputDevice>& GetKeyboardDevices() const = 0; |
| 30 virtual const std::vector<TouchscreenDevice>& GetTouchscreenDevices() |
| 31 const = 0; |
| 32 virtual const std::vector<InputDevice>& GetMouseDevices() const = 0; |
| 33 virtual const std::vector<InputDevice>& GetTouchpadDevices() const = 0; |
| 34 |
| 35 virtual bool AreDeviceListsComplete() const = 0; |
| 36 virtual bool AreTouchscreensEnabled() const = 0; |
| 37 |
| 38 virtual void AddObserver(InputDeviceEventObserver* observer) = 0; |
| 39 virtual void RemoveObserver(InputDeviceEventObserver* observer) = 0; |
| 40 |
| 41 protected: |
| 42 // Sets the instance. This should only be set once per process. |
| 43 static void SetInstance(InputDeviceManager* instance); |
| 44 |
| 45 // Clears the instance. InputDeviceManager doesn't own the instance and won't |
| 46 // destroy it, so it should be cleared before it is destroyed elsewhere. |
| 47 static void ClearInstance(); |
| 48 |
| 49 private: |
| 50 static InputDeviceManager* instance_; // Not owned. |
| 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(InputDeviceManager); |
| 53 }; |
| 54 |
| 55 } // namespace ui |
| 56 |
| 57 #endif // UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ |
OLD | NEW |