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

Unified Diff: ui/events/devices/input_device_manager.h

Issue 2028593004: Add new InputDeviceManager interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_keyboard
Patch Set: Fix windows compile error. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/devices/events_devices.gyp ('k') | ui/events/devices/input_device_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..83835ad854ab3c20ffb0181eff417bad135c8115
--- /dev/null
+++ b/ui/events/devices/input_device_manager.h
@@ -0,0 +1,57 @@
+// 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>& GetKeyboardDevices() const = 0;
+ virtual const std::vector<TouchscreenDevice>& GetTouchscreenDevices()
+ const = 0;
+ virtual const std::vector<InputDevice>& GetMouseDevices() const = 0;
+ virtual const std::vector<InputDevice>& GetTouchpadDevices() const = 0;
+
+ virtual bool AreDeviceListsComplete() const = 0;
+ 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_
« no previous file with comments | « ui/events/devices/events_devices.gyp ('k') | ui/events/devices/input_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698