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

Unified Diff: ui/events/device_data_manager.h

Issue 508303002: Move touchscreen device caching to DeviceDataManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove PlatformEventObserver Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/device_data_manager.h
diff --git a/ui/events/device_data_manager.h b/ui/events/device_data_manager.h
index 838ce67210f1dc669e9cbc079d46967e4be34293..5ab79c83d861f8f20709fd6d09bac0da815f4de7 100644
--- a/ui/events/device_data_manager.h
+++ b/ui/events/device_data_manager.h
@@ -7,15 +7,22 @@
#include <stdint.h>
+#include <vector>
+
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
+#include "base/observer_list.h"
+#include "ui/events/device_hotplug_event_observer.h"
#include "ui/events/events_base_export.h"
+#include "ui/events/touchscreen_device.h"
#include "ui/gfx/transform.h"
namespace ui {
+class InputDeviceEventObserver;
+
// Keeps track of device mappings and event transformations.
-class EVENTS_BASE_EXPORT DeviceDataManager {
+class EVENTS_BASE_EXPORT DeviceDataManager : public DeviceHotplugEventObserver {
public:
virtual ~DeviceDataManager();
@@ -33,6 +40,11 @@ class EVENTS_BASE_EXPORT DeviceDataManager {
void UpdateTouchRadiusScale(int touch_device_id, double scale);
void ApplyTouchRadiusScale(int touch_device_id, double* radius);
+ std::vector<TouchscreenDevice> GetTouchscreenDevices() const;
Daniel Erat 2014/09/10 16:51:25 can this instead be a simple inlined accessor that
dnicoara 2014/09/10 18:05:36 Done.
+
+ void AddObserver(InputDeviceEventObserver* observer);
+ void RemoveObserver(InputDeviceEventObserver* observer);
+
protected:
DeviceDataManager();
@@ -45,6 +57,10 @@ class EVENTS_BASE_EXPORT DeviceDataManager {
bool IsTouchDeviceIdValid(int touch_device_id) const;
+ // DeviceHotplugEventObserver:
+ virtual void OnTouchscreenDevices(
+ const std::vector<TouchscreenDevice>& devices) OVERRIDE;
+
double touch_radius_scale_map_[kMaxDeviceNum];
// Table to keep track of which display id is mapped to which touch device.
@@ -52,6 +68,10 @@ class EVENTS_BASE_EXPORT DeviceDataManager {
// Index table to find the TouchTransformer for a touch device.
gfx::Transform touch_device_transformer_map_[kMaxDeviceNum];
+ std::vector<TouchscreenDevice> touchscreen_devices_;
+
+ ObserverList<InputDeviceEventObserver> observers_;
+
DISALLOW_COPY_AND_ASSIGN(DeviceDataManager);
};

Powered by Google App Engine
This is Rietveld 408576698