Index: ui/events/devices/input_device_manager.h |
diff --git a/ui/events/devices/input_device_manager.h b/ui/events/devices/input_device_manager.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dc32cf280d08fa3996fdbadf99bce949b9b55190 |
--- /dev/null |
+++ b/ui/events/devices/input_device_manager.h |
@@ -0,0 +1,56 @@ |
+// 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 UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ |
+#define UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ |
+ |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "ui/events/devices/events_devices_export.h" |
+#include "ui/events/devices/input_device.h" |
+#include "ui/events/devices/input_device_event_observer.h" |
+#include "ui/events/devices/touchscreen_device.h" |
+ |
+namespace ui { |
+ |
+// Interface to query available input devices. Holds a static pointer to an |
+// implementation that provides this service. The implementation could be |
+// DeviceDataManager or something that mirrors the necessary state if |
+// DeviceDataManager is in a different process. |
+class EVENTS_DEVICES_EXPORT InputDeviceManager { |
+ public: |
+ InputDeviceManager() {} |
+ |
+ static InputDeviceManager* GetInstance(); |
+ static bool HasInstance(); |
+ |
+ virtual const std::vector<InputDevice>& keyboard_devices() const = 0; |
+ virtual const std::vector<TouchscreenDevice>& touchscreen_devices() const = 0; |
+ virtual const std::vector<InputDevice>& mouse_devices() const = 0; |
+ virtual const std::vector<InputDevice>& touchpad_devices() const = 0; |
+ virtual bool device_lists_complete() const = 0; |
sadrul
2016/06/02 15:04:39
I believe virtual methods are to be NamedLikeThis(
kylechar
2016/06/02 15:23:50
Done.
|
+ |
+ virtual bool AreTouchscreensEnabled() const = 0; |
+ |
+ virtual void AddObserver(InputDeviceEventObserver* observer) = 0; |
+ virtual void RemoveObserver(InputDeviceEventObserver* observer) = 0; |
+ |
+ protected: |
+ // Sets the instance. This should only be set once per process. |
+ static void SetInstance(InputDeviceManager* instance); |
+ |
+ // Clears the instance. InputDeviceManager doesn't own the instance and won't |
+ // destroy it, so it should be cleared before it is destroyed elsewhere. |
+ static void ClearInstance(); |
+ |
+ private: |
+ static InputDeviceManager* instance_; // Not owned. |
+ |
+ DISALLOW_COPY_AND_ASSIGN(InputDeviceManager); |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_EVENTS_DEVICES_INPUT_DEVICE_MANAGER_H_ |