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

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

Issue 1202383002: Changed DeviceDataManager to be able to create multiple instances for the purposes of test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed DeviceDataManagerX11 singleton instance to be deleted at exit. Created 5 years, 5 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>
(...skipping 12 matching lines...) Expand all
23 class InputDeviceEventObserver; 23 class InputDeviceEventObserver;
24 24
25 // Keeps track of device mappings and event transformations. 25 // Keeps track of device mappings and event transformations.
26 class EVENTS_DEVICES_EXPORT DeviceDataManager 26 class EVENTS_DEVICES_EXPORT DeviceDataManager
27 : public DeviceHotplugEventObserver { 27 : public DeviceHotplugEventObserver {
28 public: 28 public:
29 static const int kMaxDeviceNum = 128; 29 static const int kMaxDeviceNum = 128;
30 ~DeviceDataManager() override; 30 ~DeviceDataManager() override;
31 31
32 static void CreateInstance(); 32 static void CreateInstance();
33 static void DeleteInstance();
33 static DeviceDataManager* GetInstance(); 34 static DeviceDataManager* GetInstance();
34 static bool HasInstance(); 35 static bool HasInstance();
35 36
36 void ClearTouchDeviceAssociations(); 37 void ClearTouchDeviceAssociations();
37 void UpdateTouchInfoForDisplay(int64_t target_display_id, 38 void UpdateTouchInfoForDisplay(int64_t target_display_id,
38 int touch_device_id, 39 int touch_device_id,
39 const gfx::Transform& touch_transformer); 40 const gfx::Transform& touch_transformer);
40 void ApplyTouchTransformer(int touch_device_id, float* x, float* y); 41 void ApplyTouchTransformer(int touch_device_id, float* x, float* y);
41 42
42 // Gets the display that touches from |touch_device_id| should be sent to. 43 // 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_; } 57 bool device_lists_complete() const { return device_lists_complete_; }
57 58
58 void AddObserver(InputDeviceEventObserver* observer); 59 void AddObserver(InputDeviceEventObserver* observer);
59 void RemoveObserver(InputDeviceEventObserver* observer); 60 void RemoveObserver(InputDeviceEventObserver* observer);
60 61
61 protected: 62 protected:
62 DeviceDataManager(); 63 DeviceDataManager();
63 64
64 static DeviceDataManager* instance(); 65 static DeviceDataManager* instance();
65 66
67 static void set_instance(DeviceDataManager* instance);
68
66 // DeviceHotplugEventObserver: 69 // DeviceHotplugEventObserver:
67 void OnTouchscreenDevicesUpdated( 70 void OnTouchscreenDevicesUpdated(
68 const std::vector<TouchscreenDevice>& devices) override; 71 const std::vector<TouchscreenDevice>& devices) override;
69 void OnKeyboardDevicesUpdated( 72 void OnKeyboardDevicesUpdated(
70 const std::vector<KeyboardDevice>& devices) override; 73 const std::vector<KeyboardDevice>& devices) override;
71 void OnMouseDevicesUpdated( 74 void OnMouseDevicesUpdated(
72 const std::vector<InputDevice>& devices) override; 75 const std::vector<InputDevice>& devices) override;
73 void OnTouchpadDevicesUpdated( 76 void OnTouchpadDevicesUpdated(
74 const std::vector<InputDevice>& devices) override; 77 const std::vector<InputDevice>& devices) override;
75 void OnDeviceListsComplete() override; 78 void OnDeviceListsComplete() override;
(...skipping 17 matching lines...) Expand all
93 bool device_lists_complete_ = false; 96 bool device_lists_complete_ = false;
94 97
95 base::ObserverList<InputDeviceEventObserver> observers_; 98 base::ObserverList<InputDeviceEventObserver> observers_;
96 99
97 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager); 100 DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
98 }; 101 };
99 102
100 } // namespace ui 103 } // namespace ui
101 104
102 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_ 105 #endif // UI_EVENTS_DEVICES_DEVICE_DATA_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | ui/events/devices/device_data_manager.cc » ('j') | ui/events/devices/x11/device_data_manager_x11.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698