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

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

Issue 1182303005: Fixed the Touchscreen.TouchEventsEnabled histogram to record the correct values on X11 and Ozone ba… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added Touchscreen.TouchEventsEnabled histogram to public histograms.xml. Created 5 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
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 <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 #include "ui/events/devices/device_hotplug_event_observer.h" 15 #include "ui/events/devices/device_hotplug_event_observer.h"
16 #include "ui/events/devices/events_devices_export.h" 16 #include "ui/events/devices/events_devices_export.h"
17 #include "ui/events/devices/keyboard_device.h" 17 #include "ui/events/devices/keyboard_device.h"
18 #include "ui/events/devices/touchscreen_device.h" 18 #include "ui/events/devices/touchscreen_device.h"
19 #include "ui/gfx/transform.h" 19 #include "ui/gfx/transform.h"
20 20
21 namespace ui { 21 namespace ui {
22 22
23 namespace test {
24 class DeviceDataManagerTestAPI;
25 } // namespace test
26
23 class InputDeviceEventObserver; 27 class InputDeviceEventObserver;
24 28
25 // Keeps track of device mappings and event transformations. 29 // Keeps track of device mappings and event transformations.
26 class EVENTS_DEVICES_EXPORT DeviceDataManager 30 class EVENTS_DEVICES_EXPORT DeviceDataManager
27 : public DeviceHotplugEventObserver { 31 : public DeviceHotplugEventObserver {
28 public: 32 public:
29 static const int kMaxDeviceNum = 128; 33 static const int kMaxDeviceNum = 128;
30 ~DeviceDataManager() override; 34 ~DeviceDataManager() override;
31 35
32 static void CreateInstance(); 36 static void CreateInstance();
37 static void DeleteInstance();
33 static DeviceDataManager* GetInstance(); 38 static DeviceDataManager* GetInstance();
34 static bool HasInstance(); 39 static bool HasInstance();
35 40
36 void ClearTouchDeviceAssociations(); 41 void ClearTouchDeviceAssociations();
37 void UpdateTouchInfoForDisplay(int64_t target_display_id, 42 void UpdateTouchInfoForDisplay(int64_t target_display_id,
38 int touch_device_id, 43 int touch_device_id,
39 const gfx::Transform& touch_transformer); 44 const gfx::Transform& touch_transformer);
40 void ApplyTouchTransformer(int touch_device_id, float* x, float* y); 45 void ApplyTouchTransformer(int touch_device_id, float* x, float* y);
41 46
42 // Gets the display that touches from |touch_device_id| should be sent to. 47 // Gets the display that touches from |touch_device_id| should be sent to.
(...skipping 13 matching lines...) Expand all
56 bool device_lists_complete() const { return device_lists_complete_; } 61 bool device_lists_complete() const { return device_lists_complete_; }
57 62
58 void AddObserver(InputDeviceEventObserver* observer); 63 void AddObserver(InputDeviceEventObserver* observer);
59 void RemoveObserver(InputDeviceEventObserver* observer); 64 void RemoveObserver(InputDeviceEventObserver* observer);
60 65
61 protected: 66 protected:
62 DeviceDataManager(); 67 DeviceDataManager();
63 68
64 static DeviceDataManager* instance(); 69 static DeviceDataManager* instance();
65 70
71 static void set_instance(DeviceDataManager* instance);
72
66 // DeviceHotplugEventObserver: 73 // DeviceHotplugEventObserver:
67 void OnTouchscreenDevicesUpdated( 74 void OnTouchscreenDevicesUpdated(
68 const std::vector<TouchscreenDevice>& devices) override; 75 const std::vector<TouchscreenDevice>& devices) override;
69 void OnKeyboardDevicesUpdated( 76 void OnKeyboardDevicesUpdated(
70 const std::vector<KeyboardDevice>& devices) override; 77 const std::vector<KeyboardDevice>& devices) override;
71 void OnMouseDevicesUpdated( 78 void OnMouseDevicesUpdated(
72 const std::vector<InputDevice>& devices) override; 79 const std::vector<InputDevice>& devices) override;
73 void OnTouchpadDevicesUpdated( 80 void OnTouchpadDevicesUpdated(
74 const std::vector<InputDevice>& devices) override; 81 const std::vector<InputDevice>& devices) override;
75 void OnDeviceListsComplete() override; 82 void OnDeviceListsComplete() override;
76 83
77 private: 84 private:
85 friend class test::DeviceDataManagerTestAPI;
86
78 static DeviceDataManager* instance_; 87 static DeviceDataManager* instance_;
79 88
80 bool IsTouchDeviceIdValid(int touch_device_id) const; 89 bool IsTouchDeviceIdValid(int touch_device_id) const;
81 90
91 void NotifyObserversTouchscreenDeviceConfigurationChanged();
92 void NotifyObserversKeyboardDeviceConfigurationChanged();
93 void NotifyObserversMouseDeviceConfigurationChanged();
94 void NotifyObserversTouchpadDeviceConfigurationChanged();
95 void NotifyObserversDeviceListsComplete();
96
82 double touch_radius_scale_map_[kMaxDeviceNum]; 97 double touch_radius_scale_map_[kMaxDeviceNum];
83 98
84 // Index table to find the target display id for a touch device. 99 // Index table to find the target display id for a touch device.
85 int64_t touch_device_to_target_display_map_[kMaxDeviceNum]; 100 int64_t touch_device_to_target_display_map_[kMaxDeviceNum];
86 // Index table to find the TouchTransformer for a touch device. 101 // Index table to find the TouchTransformer for a touch device.
87 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum]; 102 gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
88 103
89 std::vector<TouchscreenDevice> touchscreen_devices_; 104 std::vector<TouchscreenDevice> touchscreen_devices_;
90 std::vector<KeyboardDevice> keyboard_devices_; 105 std::vector<KeyboardDevice> keyboard_devices_;
91 std::vector<InputDevice> mouse_devices_; 106 std::vector<InputDevice> mouse_devices_;
92 std::vector<InputDevice> touchpad_devices_; 107 std::vector<InputDevice> touchpad_devices_;
93 bool device_lists_complete_ = false; 108 bool device_lists_complete_ = false;
94 109
95 base::ObserverList<InputDeviceEventObserver> observers_; 110 base::ObserverList<InputDeviceEventObserver> observers_;
96 111
97 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); 112 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
98 }; 113 };
99 114
100 } // namespace ui 115 } // namespace ui
101 116
102 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ 117 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698