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 <array> | 10 #include <array> |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "ui/events/devices/device_hotplug_event_observer.h" | 16 #include "ui/events/devices/device_hotplug_event_observer.h" |
17 #include "ui/events/devices/events_devices_export.h" | 17 #include "ui/events/devices/events_devices_export.h" |
18 #include "ui/events/devices/keyboard_device.h" | |
19 #include "ui/events/devices/touchscreen_device.h" | 18 #include "ui/events/devices/touchscreen_device.h" |
20 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
21 | 20 |
22 namespace ui { | 21 namespace ui { |
23 | 22 |
24 namespace test { | 23 namespace test { |
25 class DeviceDataManagerTestAPI; | 24 class DeviceDataManagerTestAPI; |
26 } // namespace test | 25 } // namespace test |
27 | 26 |
28 class InputDeviceEventObserver; | 27 class InputDeviceEventObserver; |
(...skipping 19 matching lines...) Expand all Loading... |
48 // Gets the display that touches from |touch_device_id| should be sent to. | 47 // Gets the display that touches from |touch_device_id| should be sent to. |
49 int64_t GetTargetDisplayForTouchDevice(int touch_device_id) const; | 48 int64_t GetTargetDisplayForTouchDevice(int touch_device_id) const; |
50 | 49 |
51 void UpdateTouchRadiusScale(int touch_device_id, double scale); | 50 void UpdateTouchRadiusScale(int touch_device_id, double scale); |
52 void ApplyTouchRadiusScale(int touch_device_id, double* radius); | 51 void ApplyTouchRadiusScale(int touch_device_id, double* radius); |
53 | 52 |
54 const std::vector<TouchscreenDevice>& touchscreen_devices() const { | 53 const std::vector<TouchscreenDevice>& touchscreen_devices() const { |
55 return touchscreen_devices_; | 54 return touchscreen_devices_; |
56 } | 55 } |
57 | 56 |
58 const std::vector<KeyboardDevice>& keyboard_devices() const { | 57 const std::vector<InputDevice>& keyboard_devices() const { |
59 return keyboard_devices_; | 58 return keyboard_devices_; |
60 } | 59 } |
61 | 60 |
62 const std::vector<InputDevice>& mouse_devices() const { | 61 const std::vector<InputDevice>& mouse_devices() const { |
63 return mouse_devices_; | 62 return mouse_devices_; |
64 } | 63 } |
65 | 64 |
66 const std::vector<InputDevice>& touchpad_devices() const { | 65 const std::vector<InputDevice>& touchpad_devices() const { |
67 return touchpad_devices_; | 66 return touchpad_devices_; |
68 } | 67 } |
(...skipping 10 matching lines...) Expand all Loading... |
79 DeviceDataManager(); | 78 DeviceDataManager(); |
80 | 79 |
81 static DeviceDataManager* instance(); | 80 static DeviceDataManager* instance(); |
82 | 81 |
83 static void set_instance(DeviceDataManager* instance); | 82 static void set_instance(DeviceDataManager* instance); |
84 | 83 |
85 // DeviceHotplugEventObserver: | 84 // DeviceHotplugEventObserver: |
86 void OnTouchscreenDevicesUpdated( | 85 void OnTouchscreenDevicesUpdated( |
87 const std::vector<TouchscreenDevice>& devices) override; | 86 const std::vector<TouchscreenDevice>& devices) override; |
88 void OnKeyboardDevicesUpdated( | 87 void OnKeyboardDevicesUpdated( |
89 const std::vector<KeyboardDevice>& devices) override; | 88 const std::vector<InputDevice>& devices) override; |
90 void OnMouseDevicesUpdated( | 89 void OnMouseDevicesUpdated( |
91 const std::vector<InputDevice>& devices) override; | 90 const std::vector<InputDevice>& devices) override; |
92 void OnTouchpadDevicesUpdated( | 91 void OnTouchpadDevicesUpdated( |
93 const std::vector<InputDevice>& devices) override; | 92 const std::vector<InputDevice>& devices) override; |
94 void OnDeviceListsComplete() override; | 93 void OnDeviceListsComplete() override; |
95 | 94 |
96 private: | 95 private: |
97 // Information related to a touchscreen device. | 96 // Information related to a touchscreen device. |
98 struct TouchscreenInfo { | 97 struct TouchscreenInfo { |
99 TouchscreenInfo(); | 98 TouchscreenInfo(); |
(...skipping 10 matching lines...) Expand all Loading... |
110 | 109 |
111 bool IsTouchDeviceIdValid(int touch_device_id) const; | 110 bool IsTouchDeviceIdValid(int touch_device_id) const; |
112 | 111 |
113 void NotifyObserversTouchscreenDeviceConfigurationChanged(); | 112 void NotifyObserversTouchscreenDeviceConfigurationChanged(); |
114 void NotifyObserversKeyboardDeviceConfigurationChanged(); | 113 void NotifyObserversKeyboardDeviceConfigurationChanged(); |
115 void NotifyObserversMouseDeviceConfigurationChanged(); | 114 void NotifyObserversMouseDeviceConfigurationChanged(); |
116 void NotifyObserversTouchpadDeviceConfigurationChanged(); | 115 void NotifyObserversTouchpadDeviceConfigurationChanged(); |
117 void NotifyObserversDeviceListsComplete(); | 116 void NotifyObserversDeviceListsComplete(); |
118 | 117 |
119 std::vector<TouchscreenDevice> touchscreen_devices_; | 118 std::vector<TouchscreenDevice> touchscreen_devices_; |
120 std::vector<KeyboardDevice> keyboard_devices_; | 119 std::vector<InputDevice> keyboard_devices_; |
121 std::vector<InputDevice> mouse_devices_; | 120 std::vector<InputDevice> mouse_devices_; |
122 std::vector<InputDevice> touchpad_devices_; | 121 std::vector<InputDevice> touchpad_devices_; |
123 bool device_lists_complete_ = false; | 122 bool device_lists_complete_ = false; |
124 | 123 |
125 base::ObserverList<InputDeviceEventObserver> observers_; | 124 base::ObserverList<InputDeviceEventObserver> observers_; |
126 | 125 |
127 bool touch_screens_enabled_ = true; | 126 bool touch_screens_enabled_ = true; |
128 | 127 |
129 // Contains touchscreen device info for each device mapped by device ID. Will | 128 // Contains touchscreen device info for each device mapped by device ID. Will |
130 // have default values if the device with corresponding ID isn't a touchscreen | 129 // have default values if the device with corresponding ID isn't a touchscreen |
131 // or doesn't exist. | 130 // or doesn't exist. |
132 std::array<TouchscreenInfo, kMaxDeviceNum> touch_map_; | 131 std::array<TouchscreenInfo, kMaxDeviceNum> touch_map_; |
133 | 132 |
134 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); | 133 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); |
135 }; | 134 }; |
136 | 135 |
137 } // namespace ui | 136 } // namespace ui |
138 | 137 |
139 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ | 138 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ |
OLD | NEW |