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

Side by Side Diff: ui/events/device_data_manager.h

Issue 618283003: Adds special support to the device manager for keyboards devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
OLDNEW
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_DEVICE_DATA_MANAGER_H_ 5 #ifndef UI_EVENTS_DEVICE_DATA_MANAGER_H_
6 #define UI_EVENTS_DEVICE_DATA_MANAGER_H_ 6 #define UI_EVENTS_DEVICE_DATA_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "ui/events/device_hotplug_event_observer.h" 15 #include "ui/events/device_hotplug_event_observer.h"
16 #include "ui/events/events_base_export.h" 16 #include "ui/events/events_base_export.h"
17 #include "ui/events/keyboard_device.h"
17 #include "ui/events/touchscreen_device.h" 18 #include "ui/events/touchscreen_device.h"
18 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
19 20
20 namespace ui { 21 namespace ui {
21 22
22 class InputDeviceEventObserver; 23 class InputDeviceEventObserver;
23 24
24 // Keeps track of device mappings and event transformations. 25 // Keeps track of device mappings and event transformations.
25 class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver { 26 class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver {
26 public: 27 public:
(...skipping 10 matching lines...) Expand all
37 void ApplyTouchTransformer(int touch_device_id, float* x, float* y); 38 void ApplyTouchTransformer(int touch_device_id, float* x, float* y);
38 int64_t GetDisplayForTouchDevice(int touch_device_id) const; 39 int64_t GetDisplayForTouchDevice(int touch_device_id) const;
39 40
40 void UpdateTouchRadiusScale(int touch_device_id, double scale); 41 void UpdateTouchRadiusScale(int touch_device_id, double scale);
41 void ApplyTouchRadiusScale(int touch_device_id, double* radius); 42 void ApplyTouchRadiusScale(int touch_device_id, double* radius);
42 43
43 const std::vector<TouchscreenDevice>& touchscreen_devices() const { 44 const std::vector<TouchscreenDevice>& touchscreen_devices() const {
44 return touchscreen_devices_; 45 return touchscreen_devices_;
45 } 46 }
46 47
48 const std::vector<KeyboardDevice>& keyboard_devices() const {
49 return keyboard_devices_;
50 }
51
47 void AddObserver(InputDeviceEventObserver* observer); 52 void AddObserver(InputDeviceEventObserver* observer);
48 void RemoveObserver(InputDeviceEventObserver* observer); 53 void RemoveObserver(InputDeviceEventObserver* observer);
49 54
50 protected: 55 protected:
51 DeviceDataManager(); 56 DeviceDataManager();
52 57
53 static DeviceDataManager* instance(); 58 static DeviceDataManager* instance();
54 59
55 static const int kMaxDeviceNum = 128; 60 static const int kMaxDeviceNum = 128;
56 61
57 private: 62 private:
58 static DeviceDataManager* instance_; 63 static DeviceDataManager* instance_;
59 64
60 bool IsTouchDeviceIdValid(int touch_device_id) const; 65 bool IsTouchDeviceIdValid(int touch_device_id) const;
61 66
62 // DeviceHotplugEventObserver: 67 // DeviceHotplugEventObserver:
63 virtual void OnTouchscreenDevicesUpdated( 68 virtual void OnTouchscreenDevicesUpdated(
64 const std::vector<TouchscreenDevice>& devices) OVERRIDE; 69 const std::vector<TouchscreenDevice>& devices) OVERRIDE;
70 virtual void OnKeyboardDevicesUpdated(
71 const std::vector<KeyboardDevice>& devices) OVERRIDE;
flackr 2014/10/04 00:51:31 Can you override this in DeviceDataManagerX11 to r
rsadam 2014/10/04 18:46:27 Done.
65 72
66 double touch_radius_scale_map_[kMaxDeviceNum]; 73 double touch_radius_scale_map_[kMaxDeviceNum];
67 74
68 // Table to keep track of which display id is mapped to which touch device. 75 // Table to keep track of which display id is mapped to which touch device.
69 int64_t touch_device_to_display_map_[kMaxDeviceNum]; 76 int64_t touch_device_to_display_map_[kMaxDeviceNum];
70 // Index table to find the TouchTransformer for a touch device. 77 // Index table to find the TouchTransformer for a touch device.
71 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; 78 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
72 79
73 std::vector<TouchscreenDevice> touchscreen_devices_; 80 std::vector<TouchscreenDevice> touchscreen_devices_;
81 std::vector<KeyboardDevice> keyboard_devices_;
74 82
75 ObserverList<InputDeviceEventObserver> observers_; 83 ObserverList<InputDeviceEventObserver> observers_;
76 84
77 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); 85 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
78 }; 86 };
79 87
80 } // namespace ui 88 } // namespace ui
81 89
82 #endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_ 90 #endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698