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

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

Issue 922843002: Fix software mirror mode on Ozone part 2/2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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_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 <map>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 15 #include "base/observer_list.h"
15 #include "ui/events/devices/device_hotplug_event_observer.h" 16 #include "ui/events/devices/device_hotplug_event_observer.h"
16 #include "ui/events/devices/events_devices_export.h" 17 #include "ui/events/devices/events_devices_export.h"
17 #include "ui/events/devices/keyboard_device.h" 18 #include "ui/events/devices/keyboard_device.h"
18 #include "ui/events/devices/touchscreen_device.h" 19 #include "ui/events/devices/touchscreen_device.h"
20 #include "ui/gfx/display.h"
19 #include "ui/gfx/transform.h" 21 #include "ui/gfx/transform.h"
20 22
21 namespace ui { 23 namespace ui {
22 24
23 class InputDeviceEventObserver; 25 class InputDeviceEventObserver;
24 26
25 // Keeps track of device mappings and event transformations. 27 // Keeps track of device mappings and event transformations.
26 class EVENTS_DEVICES_EXPORT DeviceDataManager 28 class EVENTS_DEVICES_EXPORT DeviceDataManager
27 : public DeviceHotplugEventObserver { 29 : public DeviceHotplugEventObserver {
28 public: 30 public:
29 static const int kMaxDeviceNum = 128; 31 static const int kMaxDeviceNum = 128;
30 ~DeviceDataManager() override; 32 ~DeviceDataManager() override;
31 33
32 static void CreateInstance(); 34 static void CreateInstance();
33 static DeviceDataManager* GetInstance(); 35 static DeviceDataManager* GetInstance();
34 static bool HasInstance(); 36 static bool HasInstance();
35 37
36 void ClearTouchTransformerRecord(); 38 void ClearTouchDeviceAssociations();
37 void UpdateTouchInfoForDisplay(int64_t display_id, 39 void UpdateTouchInfoForDisplay(const gfx::Display& display,
38 unsigned int touch_device_id, 40 unsigned int touch_device_id,
39 const gfx::Transform& touch_transformer); 41 const gfx::Transform& touch_transformer);
40 void ApplyTouchTransformer(unsigned int touch_device_id, float* x, float* y); 42 void ApplyTouchTransformer(unsigned int touch_device_id, float* x, float* y);
41 int64_t GetDisplayForTouchDevice(unsigned int touch_device_id) const; 43 gfx::Display GetDisplayForTouchDevice(
44 unsigned int touch_device_id) const;
42 45
43 void UpdateTouchRadiusScale(unsigned int touch_device_id, double scale); 46 void UpdateTouchRadiusScale(unsigned int touch_device_id, double scale);
44 void ApplyTouchRadiusScale(unsigned int touch_device_id, double* radius); 47 void ApplyTouchRadiusScale(unsigned int touch_device_id, double* radius);
45 48
46 const std::vector<TouchscreenDevice>& touchscreen_devices() const { 49 const std::vector<TouchscreenDevice>& touchscreen_devices() const {
47 return touchscreen_devices_; 50 return touchscreen_devices_;
48 } 51 }
49 52
50 const std::vector<KeyboardDevice>& keyboard_devices() const { 53 const std::vector<KeyboardDevice>& keyboard_devices() const {
51 return keyboard_devices_; 54 return keyboard_devices_;
(...skipping 18 matching lines...) Expand all
70 const std::vector<InputDevice>& devices) override; 73 const std::vector<InputDevice>& devices) override;
71 74
72 private: 75 private:
73 static DeviceDataManager* instance_; 76 static DeviceDataManager* instance_;
74 77
75 bool IsTouchDeviceIdValid(unsigned int touch_device_id) const; 78 bool IsTouchDeviceIdValid(unsigned int touch_device_id) const;
76 79
77 double touch_radius_scale_map_[kMaxDeviceNum]; 80 double touch_radius_scale_map_[kMaxDeviceNum];
78 81
79 // Table to keep track of which display id is mapped to which touch device. 82 // Table to keep track of which display id is mapped to which touch device.
80 int64_t touch_device_to_display_map_[kMaxDeviceNum]; 83 std::map<unsigned int, gfx::Display> touch_device_to_display_map_;
81 // Index table to find the TouchTransformer for a touch device. 84 // Index table to find the TouchTransformer for a touch device.
82 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; 85 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
83 86
84 std::vector<TouchscreenDevice> touchscreen_devices_; 87 std::vector<TouchscreenDevice> touchscreen_devices_;
85 std::vector<KeyboardDevice> keyboard_devices_; 88 std::vector<KeyboardDevice> keyboard_devices_;
86 89
87 ObserverList<InputDeviceEventObserver> observers_; 90 ObserverList<InputDeviceEventObserver> observers_;
88 91
89 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); 92 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
90 }; 93 };
91 94
92 } // namespace ui 95 } // namespace ui
93 96
94 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ 97 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698