Index: ui/events/devices/device_data_manager.h |
diff --git a/ui/events/device_data_manager.h b/ui/events/devices/device_data_manager.h |
similarity index 55% |
rename from ui/events/device_data_manager.h |
rename to ui/events/devices/device_data_manager.h |
index f5bdf91a6bc3bcdd684287d0eadd34e4384aa690..d8ede81f22d885982daf0997bcbba8d56b94df00 100644 |
--- a/ui/events/device_data_manager.h |
+++ b/ui/events/devices/device_data_manager.h |
@@ -2,8 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef UI_EVENTS_DEVICE_DATA_MANAGER_H_ |
-#define UI_EVENTS_DEVICE_DATA_MANAGER_H_ |
+#ifndef UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |
+#define UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |
#include <stdint.h> |
@@ -12,9 +12,10 @@ |
#include "base/macros.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/observer_list.h" |
-#include "ui/events/device_hotplug_event_observer.h" |
-#include "ui/events/events_base_export.h" |
-#include "ui/events/touchscreen_device.h" |
+#include "ui/events/devices/device_hotplug_event_observer.h" |
+#include "ui/events/devices/events_devices_export.h" |
+#include "ui/events/devices/keyboard_device.h" |
+#include "ui/events/devices/touchscreen_device.h" |
#include "ui/gfx/transform.h" |
namespace ui { |
@@ -22,20 +23,24 @@ namespace ui { |
class InputDeviceEventObserver; |
// Keeps track of device mappings and event transformations. |
-class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver { |
+class EVENTS_DEVICES_EXPORT DeviceDataManager |
+ : public DeviceHotplugEventObserver { |
public: |
+ static const int kMaxDeviceNum = 128; |
~DeviceDataManager() override; |
static void CreateInstance(); |
static DeviceDataManager* GetInstance(); |
static bool HasInstance(); |
- void ClearTouchTransformerRecord(); |
- void UpdateTouchInfoForDisplay(int64_t display_id, |
+ void ClearTouchDeviceAssociations(); |
+ void UpdateTouchInfoForDisplay(int64_t target_display_id, |
int touch_device_id, |
const gfx::Transform& touch_transformer); |
void ApplyTouchTransformer(int touch_device_id, float* x, float* y); |
- int64_t GetDisplayForTouchDevice(int touch_device_id) const; |
+ |
+ // Gets the display that touches from |touch_device_id| should be sent to. |
+ int64_t GetTargetDisplayForTouchDevice(int touch_device_id) const; |
void UpdateTouchRadiusScale(int touch_device_id, double scale); |
void ApplyTouchRadiusScale(int touch_device_id, double* radius); |
@@ -44,6 +49,12 @@ class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver { |
return touchscreen_devices_; |
} |
+ const std::vector<KeyboardDevice>& keyboard_devices() const { |
+ return keyboard_devices_; |
+ } |
+ |
+ bool device_lists_complete() const { return device_lists_complete_; } |
+ |
void AddObserver(InputDeviceEventObserver* observer); |
void RemoveObserver(InputDeviceEventObserver* observer); |
@@ -52,25 +63,34 @@ class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver { |
static DeviceDataManager* instance(); |
- static const int kMaxDeviceNum = 128; |
+ // DeviceHotplugEventObserver: |
+ void OnTouchscreenDevicesUpdated( |
+ const std::vector<TouchscreenDevice>& devices) override; |
+ void OnKeyboardDevicesUpdated( |
+ const std::vector<KeyboardDevice>& devices) override; |
+ void OnMouseDevicesUpdated( |
+ const std::vector<InputDevice>& devices) override; |
+ void OnTouchpadDevicesUpdated( |
+ const std::vector<InputDevice>& devices) override; |
+ void OnDeviceListsComplete() override; |
private: |
static DeviceDataManager* instance_; |
bool IsTouchDeviceIdValid(int touch_device_id) const; |
- // DeviceHotplugEventObserver: |
- void OnTouchscreenDevicesUpdated( |
- const std::vector<TouchscreenDevice>& devices) override; |
- |
double touch_radius_scale_map_[kMaxDeviceNum]; |
- // Table to keep track of which display id is mapped to which touch device. |
- int64_t touch_device_to_display_map_[kMaxDeviceNum]; |
+ // Index table to find the target display id for a touch device. |
+ int64_t touch_device_to_target_display_map_[kMaxDeviceNum]; |
// Index table to find the TouchTransformer for a touch device. |
gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; |
std::vector<TouchscreenDevice> touchscreen_devices_; |
+ std::vector<KeyboardDevice> keyboard_devices_; |
+ std::vector<InputDevice> mouse_devices_; |
+ std::vector<InputDevice> touchpad_devices_; |
+ bool device_lists_complete_ = false; |
base::ObserverList<InputDeviceEventObserver> observers_; |
@@ -79,4 +99,4 @@ class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver { |
} // namespace ui |
-#endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_ |
+#endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |