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

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

Issue 289283015: Extract touchscreen device management into a generic manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_DEVICE_DATA_MANAGER_H_
6 #define UI_EVENTS_DEVICE_DATA_MANAGER_H_
7
8 #include <stdint.h>
9
10 #include "base/macros.h"
11 #include "ui/events/events_base_export.h"
12 #include "ui/gfx/transform.h"
13
14 template <typename T> struct DefaultSingletonTraits;
15
16 namespace ui {
17
18 // Keeps track of device mappings and event transformations.
19 class EVENTS_BASE_EXPORT DeviceDataManager {
20 public:
21 static DeviceDataManager* GetInstance();
22
23 void ClearTouchTransformerRecord();
24 void UpdateTouchInfoForDisplay(int64_t display_id,
25 int touch_device_id,
26 const gfx::Transform& touch_transformer);
27 void ApplyTouchTransformer(int touch_device_id, float* x, float* y);
28 int64_t GetDisplayForTouchDevice(int touch_device_id) const;
29
30 protected:
31 // Requirement for Singleton.
32 friend struct DefaultSingletonTraits<DeviceDataManager>;
33
34 DeviceDataManager();
35 virtual ~DeviceDataManager();
36
37 bool IsTouchDeviceIdValid(int touch_device_id) const;
38
39 static const int kMaxDeviceNum = 128;
40
41 // Table to keep track of which display id is mapped to which touch device.
42 int64_t touch_device_to_display_map_[kMaxDeviceNum];
43 // Index table to find the TouchTransformer for a touch device.
44 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
45
46 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
47 };
48
49 } // namespace ui
50
51 #endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698