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

Unified Diff: ui/events/x/device_data_manager.h

Issue 313913004: Block internal PlatformEvents before they are dispatched in touchview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Block events from disabled devices through DeviceDataManager. 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/x/device_data_manager.h
diff --git a/ui/events/x/device_data_manager.h b/ui/events/x/device_data_manager.h
index 1135ec222b89ee5d491f5fae7e130aced0c64bc2..d1b956966783115ae8c9f4de4caf633cf2e93098 100644
--- a/ui/events/x/device_data_manager.h
+++ b/ui/events/x/device_data_manager.h
@@ -16,6 +16,7 @@
#include <bitset>
#include <map>
+#include <set>
#include <vector>
#include "base/basictypes.h"
@@ -229,6 +230,20 @@ class EVENTS_BASE_EXPORT DeviceDataManager {
int64 GetDisplayForTouchDevice(int touch_device_id) const;
bool TouchEventNeedsCalibrate(int touch_device_id) const;
+ // Disables the physical keyboard except for the |excepted_keys| provided.
+ void DisableKeyboard(scoped_ptr<std::set<KeyboardCode> > excepted_keys);
+ // Re-enables the keyboard after a previous call to DisableKeyboard.
+ void EnableKeyboard();
+
+ // Disables and enables events from devices by device id.
+ void DisableDevice(unsigned int deviceid);
+ void EnableDevice(unsigned int deviceid);
+
+ // Returns true if the passed in event should be blocked. For mouse events
+ // this also has the side effect of returning the mouse cursor to the last
+ // known location from an unblocked event.
sadrul 2014/06/12 21:02:27 Can you clarify the comment about mouse events? (c
flackr 2014/06/18 05:28:32 Done.
+ bool EventBlocked(const base::NativeEvent& native_event);
sadrul 2014/06/12 21:02:27 IsEventBlocked()?
flackr 2014/06/18 05:28:32 Done.
+
private:
// Requirement for Singleton.
friend struct DefaultSingletonTraits<DeviceDataManager>;
@@ -265,6 +280,18 @@ class EVENTS_BASE_EXPORT DeviceDataManager {
std::bitset<kMaxDeviceNum> cmt_devices_;
std::bitset<kMaxDeviceNum> touchpads_;
+ // A quick lookup table for determining if events from the XI device
+ // be blocked.
sadrul 2014/06/12 21:02:27 +should
flackr 2014/06/18 05:28:32 Done.
+ std::bitset<kMaxDeviceNum> blocked_devices_;
+
+ // When true, keyboard events will be blocked.
+ // TODO(flackr): Only block the internal keyboard when XI2 is used for key
+ // events. http://crbug.com/362881.
+ bool blocked_keyboard_;
+
+ // The set of keys allowed while the keyboard is blocked.
+ scoped_ptr<std::set<KeyboardCode> > blocked_keyboard_allowed_keys_;
+
// Number of valuators on the specific device.
int valuator_count_[kMaxDeviceNum];

Powered by Google App Engine
This is Rietveld 408576698