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 17 matching lines...) Expand all Loading... |
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 ClearTouchDeviceAssociations(); | 36 void ClearTouchDeviceAssociations(); |
37 void UpdateTouchInfoForDisplay(int64_t target_display_id, | 37 void UpdateTouchInfoForDisplay(int64_t target_display_id, |
38 unsigned int touch_device_id, | 38 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(int touch_device_id, float* x, float* y); |
41 | 41 |
42 // Gets the display that touches from |touch_device_id| should be sent to. | 42 // Gets the display that touches from |touch_device_id| should be sent to. |
43 int64_t GetTargetDisplayForTouchDevice(unsigned int touch_device_id) const; | 43 int64_t GetTargetDisplayForTouchDevice(int touch_device_id) const; |
44 | 44 |
45 void UpdateTouchRadiusScale(unsigned int touch_device_id, double scale); | 45 void UpdateTouchRadiusScale(int touch_device_id, double scale); |
46 void ApplyTouchRadiusScale(unsigned int touch_device_id, double* radius); | 46 void ApplyTouchRadiusScale(int touch_device_id, double* radius); |
47 | 47 |
48 const std::vector<TouchscreenDevice>& touchscreen_devices() const { | 48 const std::vector<TouchscreenDevice>& touchscreen_devices() const { |
49 return touchscreen_devices_; | 49 return touchscreen_devices_; |
50 } | 50 } |
51 | 51 |
52 const std::vector<KeyboardDevice>& keyboard_devices() const { | 52 const std::vector<KeyboardDevice>& keyboard_devices() const { |
53 return keyboard_devices_; | 53 return keyboard_devices_; |
54 } | 54 } |
55 | 55 |
56 void AddObserver(InputDeviceEventObserver* observer); | 56 void AddObserver(InputDeviceEventObserver* observer); |
(...skipping 10 matching lines...) Expand all Loading... |
67 void OnKeyboardDevicesUpdated( | 67 void OnKeyboardDevicesUpdated( |
68 const std::vector<KeyboardDevice>& devices) override; | 68 const std::vector<KeyboardDevice>& devices) override; |
69 void OnMouseDevicesUpdated( | 69 void OnMouseDevicesUpdated( |
70 const std::vector<InputDevice>& devices) override; | 70 const std::vector<InputDevice>& devices) override; |
71 void OnTouchpadDevicesUpdated( | 71 void OnTouchpadDevicesUpdated( |
72 const std::vector<InputDevice>& devices) override; | 72 const std::vector<InputDevice>& devices) override; |
73 | 73 |
74 private: | 74 private: |
75 static DeviceDataManager* instance_; | 75 static DeviceDataManager* instance_; |
76 | 76 |
77 bool IsTouchDeviceIdValid(unsigned int touch_device_id) const; | 77 bool IsTouchDeviceIdValid(int touch_device_id) const; |
78 | 78 |
79 double touch_radius_scale_map_[kMaxDeviceNum]; | 79 double touch_radius_scale_map_[kMaxDeviceNum]; |
80 | 80 |
81 // Index table to find the target display id for a touch device. | 81 // Index table to find the target display id for a touch device. |
82 int64_t touch_device_to_target_display_map_[kMaxDeviceNum]; | 82 int64_t touch_device_to_target_display_map_[kMaxDeviceNum]; |
83 // Index table to find the TouchTransformer for a touch device. | 83 // Index table to find the TouchTransformer for a touch device. |
84 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; | 84 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; |
85 | 85 |
86 std::vector<TouchscreenDevice> touchscreen_devices_; | 86 std::vector<TouchscreenDevice> touchscreen_devices_; |
87 std::vector<KeyboardDevice> keyboard_devices_; | 87 std::vector<KeyboardDevice> keyboard_devices_; |
88 std::vector<InputDevice> mouse_devices_; | 88 std::vector<InputDevice> mouse_devices_; |
89 std::vector<InputDevice> touchpad_devices_; | 89 std::vector<InputDevice> touchpad_devices_; |
90 | 90 |
91 ObserverList<InputDeviceEventObserver> observers_; | 91 ObserverList<InputDeviceEventObserver> observers_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); | 93 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace ui | 96 } // namespace ui |
97 | 97 |
98 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ | 98 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |
OLD | NEW |