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

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

Issue 336863002: Moving input device hotplug event processing outside of ui/display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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>
11
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h"
12 #include "ui/events/events_base_export.h" 15 #include "ui/events/events_base_export.h"
16 #include "ui/events/touchscreen_device.h"
13 #include "ui/gfx/transform.h" 17 #include "ui/gfx/transform.h"
14 18
15 namespace ui { 19 namespace ui {
16 20
21 class InputDeviceEventObserver;
22
17 // Keeps track of device mappings and event transformations. 23 // Keeps track of device mappings and event transformations.
18 class EVENTS_BASE_EXPORT DeviceDataManager { 24 class EVENTS_BASE_EXPORT DeviceDataManager {
19 public: 25 public:
20 virtual ~DeviceDataManager(); 26 virtual ~DeviceDataManager();
21 27
22 static DeviceDataManager* GetInstance(); 28 static DeviceDataManager* GetInstance();
23 29
24 void ClearTouchTransformerRecord(); 30 void ClearTouchTransformerRecord();
25 void UpdateTouchInfoForDisplay(int64_t display_id, 31 void UpdateTouchInfoForDisplay(int64_t display_id,
26 int touch_device_id, 32 int touch_device_id,
27 const gfx::Transform& touch_transformer); 33 const gfx::Transform& touch_transformer);
28 void ApplyTouchTransformer(int touch_device_id, float* x, float* y); 34 void ApplyTouchTransformer(int touch_device_id, float* x, float* y);
29 int64_t GetDisplayForTouchDevice(int touch_device_id) const; 35 int64_t GetDisplayForTouchDevice(int touch_device_id) const;
30 36
37 void AddObserver(InputDeviceEventObserver* observer);
38 void RemoveObserver(InputDeviceEventObserver* observer);
39
40 virtual std::vector<TouchscreenDevice> GetTouchscreenDevices();
Daniel Erat 2014/06/17 21:59:18 i think that there's still a general push to avoid
dnicoara 2014/06/20 17:01:05 I've been talking to sadrul@ and rjkroege@ a bit a
41
31 protected: 42 protected:
32 DeviceDataManager(); 43 DeviceDataManager();
33 44
34 static DeviceDataManager* instance_; 45 static DeviceDataManager* instance_;
35 46
36 bool IsTouchDeviceIdValid(int touch_device_id) const; 47 bool IsTouchDeviceIdValid(int touch_device_id) const;
37 48
38 static const int kMaxDeviceNum = 128; 49 static const int kMaxDeviceNum = 128;
39 50
40 // Table to keep track of which display id is mapped to which touch device. 51 // Table to keep track of which display id is mapped to which touch device.
41 int64_t touch_device_to_display_map_[kMaxDeviceNum]; 52 int64_t touch_device_to_display_map_[kMaxDeviceNum];
42 // Index table to find the TouchTransformer for a touch device. 53 // Index table to find the TouchTransformer for a touch device.
43 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; 54 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
44 55
56 ObserverList<InputDeviceEventObserver> observers_;
57
45 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); 58 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
46 }; 59 };
47 60
48 } // namespace ui 61 } // namespace ui
49 62
50 #endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_ 63 #endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698