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

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: Rebased 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
(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 "base/memory/scoped_ptr.h"
12 #include "ui/events/events_base_export.h"
13 #include "ui/gfx/transform.h"
14
15 namespace ui {
16
17 // Keeps track of device mappings and event transformations.
18 class EVENTS_BASE_EXPORT DeviceDataManager {
19 public:
20 virtual ~DeviceDataManager();
21
22 static DeviceDataManager* GetInstance();
23
24 void ClearTouchTransformerRecord();
25 void UpdateTouchInfoForDisplay(int64_t display_id,
26 int touch_device_id,
27 const gfx::Transform& touch_transformer);
28 void ApplyTouchTransformer(int touch_device_id, float* x, float* y);
29 int64_t GetDisplayForTouchDevice(int touch_device_id) const;
30
31 protected:
32 DeviceDataManager();
33
34 static DeviceDataManager* instance_;
35
36 bool IsTouchDeviceIdValid(int touch_device_id) const;
37
38 static const int kMaxDeviceNum = 128;
39
40 // Table to keep track of which display id is mapped to which touch device.
41 int64_t touch_device_to_display_map_[kMaxDeviceNum];
42 // Index table to find the TouchTransformer for a touch device.
43 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
44
45 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
46 };
47
48 } // namespace ui
49
50 #endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698