Roll DEPS for libelf clang compilation fix.
[chromium-blink-merge.git] / ui / events / device_data_manager.h
blob7b2feaaa57a6c971eed5154528df7a094e12f310
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.
5 #ifndef UI_EVENTS_DEVICE_DATA_MANAGER_H_
6 #define UI_EVENTS_DEVICE_DATA_MANAGER_H_
8 #include <stdint.h>
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"
15 namespace ui {
17 // Keeps track of device mappings and event transformations.
18 class EVENTS_BASE_EXPORT DeviceDataManager {
19 public:
20 virtual ~DeviceDataManager();
22 static void CreateInstance();
23 static DeviceDataManager* GetInstance();
24 static bool HasInstance();
26 void ClearTouchTransformerRecord();
27 void UpdateTouchInfoForDisplay(int64_t display_id,
28 int touch_device_id,
29 const gfx::Transform& touch_transformer);
30 void ApplyTouchTransformer(int touch_device_id, float* x, float* y);
31 int64_t GetDisplayForTouchDevice(int touch_device_id) const;
33 protected:
34 DeviceDataManager();
36 static DeviceDataManager* instance();
38 static const int kMaxDeviceNum = 128;
40 private:
41 static DeviceDataManager* instance_;
43 bool IsTouchDeviceIdValid(int touch_device_id) const;
45 // Table to keep track of which display id is mapped to which touch device.
46 int64_t touch_device_to_display_map_[kMaxDeviceNum];
47 // Index table to find the TouchTransformer for a touch device.
48 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
50 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
53 } // namespace ui
55 #endif // UI_EVENTS_DEVICE_DATA_MANAGER_H_