OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ | 5 #ifndef UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |
6 #define UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ | 6 #define UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 15 matching lines...) Expand all Loading... |
26 class EVENTS_DEVICES_EXPORT DeviceDataManager | 26 class EVENTS_DEVICES_EXPORT DeviceDataManager |
27 : public DeviceHotplugEventObserver { | 27 : public DeviceHotplugEventObserver { |
28 public: | 28 public: |
29 static const int kMaxDeviceNum = 128; | 29 static const int kMaxDeviceNum = 128; |
30 ~DeviceDataManager() override; | 30 ~DeviceDataManager() override; |
31 | 31 |
32 static void CreateInstance(); | 32 static void CreateInstance(); |
33 static DeviceDataManager* GetInstance(); | 33 static DeviceDataManager* GetInstance(); |
34 static bool HasInstance(); | 34 static bool HasInstance(); |
35 | 35 |
36 void ClearTouchTransformerRecord(); | 36 void ClearTouchDeviceAssociations(); |
37 void UpdateTouchInfoForDisplay(int64_t display_id, | 37 void UpdateTouchInfoForDisplay(int64_t target_display_id, |
38 unsigned int touch_device_id, | 38 unsigned int touch_device_id, |
39 const gfx::Transform& touch_transformer); | 39 const gfx::Transform& touch_transformer); |
40 void ApplyTouchTransformer(unsigned int touch_device_id, float* x, float* y); | 40 void ApplyTouchTransformer(unsigned int touch_device_id, float* x, float* y); |
41 int64_t GetDisplayForTouchDevice(unsigned int touch_device_id) const; | 41 |
| 42 // Gets the display that touches from |touch_device_id| should be sent to. |
| 43 int64_t GetTargetDisplayForTouchDevice(unsigned int touch_device_id) const; |
42 | 44 |
43 void UpdateTouchRadiusScale(unsigned int touch_device_id, double scale); | 45 void UpdateTouchRadiusScale(unsigned int touch_device_id, double scale); |
44 void ApplyTouchRadiusScale(unsigned int touch_device_id, double* radius); | 46 void ApplyTouchRadiusScale(unsigned int touch_device_id, double* radius); |
45 | 47 |
46 const std::vector<TouchscreenDevice>& touchscreen_devices() const { | 48 const std::vector<TouchscreenDevice>& touchscreen_devices() const { |
47 return touchscreen_devices_; | 49 return touchscreen_devices_; |
48 } | 50 } |
49 | 51 |
50 const std::vector<KeyboardDevice>& keyboard_devices() const { | 52 const std::vector<KeyboardDevice>& keyboard_devices() const { |
51 return keyboard_devices_; | 53 return keyboard_devices_; |
(...skipping 17 matching lines...) Expand all Loading... |
69 void OnTouchpadDevicesUpdated( | 71 void OnTouchpadDevicesUpdated( |
70 const std::vector<InputDevice>& devices) override; | 72 const std::vector<InputDevice>& devices) override; |
71 | 73 |
72 private: | 74 private: |
73 static DeviceDataManager* instance_; | 75 static DeviceDataManager* instance_; |
74 | 76 |
75 bool IsTouchDeviceIdValid(unsigned int touch_device_id) const; | 77 bool IsTouchDeviceIdValid(unsigned int touch_device_id) const; |
76 | 78 |
77 double touch_radius_scale_map_[kMaxDeviceNum]; | 79 double touch_radius_scale_map_[kMaxDeviceNum]; |
78 | 80 |
79 // Table to keep track of which display id is mapped to which touch device. | 81 // Index table to find the target display id for a touch device. |
80 int64_t touch_device_to_display_map_[kMaxDeviceNum]; | 82 int64_t touch_device_to_target_display_map_[kMaxDeviceNum]; |
81 // Index table to find the TouchTransformer for a touch device. | 83 // Index table to find the TouchTransformer for a touch device. |
82 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; | 84 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; |
83 | 85 |
84 std::vector<TouchscreenDevice> touchscreen_devices_; | 86 std::vector<TouchscreenDevice> touchscreen_devices_; |
85 std::vector<KeyboardDevice> keyboard_devices_; | 87 std::vector<KeyboardDevice> keyboard_devices_; |
86 std::vector<InputDevice> mouse_devices_; | 88 std::vector<InputDevice> mouse_devices_; |
87 std::vector<InputDevice> touchpad_devices_; | 89 std::vector<InputDevice> touchpad_devices_; |
88 | 90 |
89 ObserverList<InputDeviceEventObserver> observers_; | 91 ObserverList<InputDeviceEventObserver> observers_; |
90 | 92 |
91 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); | 93 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); |
92 }; | 94 }; |
93 | 95 |
94 } // namespace ui | 96 } // namespace ui |
95 | 97 |
96 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ | 98 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |
OLD | NEW |