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

Unified Diff: ui/events/ozone/evdev/input_device_factory_evdev.h

Issue 863353003: [PATCH 6/11] ozone: evdev: Factor device I/O out of EventFactoryOzone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile with USE_EVDEV_GESTURES Created 5 years, 11 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/ozone/evdev/input_device_factory_evdev.h
diff --git a/ui/events/ozone/evdev/input_device_factory_evdev.h b/ui/events/ozone/evdev/input_device_factory_evdev.h
new file mode 100644
index 0000000000000000000000000000000000000000..895d76f4b6aa9edcdd86b227c46a3432fee5630b
--- /dev/null
+++ b/ui/events/ozone/evdev/input_device_factory_evdev.h
@@ -0,0 +1,107 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
+#define UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
+
+#include <map>
+#include <set>
+#include <vector>
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "base/files/file_path.h"
+#include "base/memory/ref_counted.h"
+#include "base/task_runner.h"
+#include "ui/events/ozone/evdev/event_converter_evdev.h"
+#include "ui/events/ozone/evdev/event_device_info.h"
+#include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
+
+namespace ui {
+
+class CursorDelegateEvdev;
+class DeviceEventDispatcherEvdev;
+
+#if !defined(USE_EVDEV)
+#error Missing dependency on ui/events/ozone:events_ozone_evdev
+#endif
+
+#if defined(USE_EVDEV_GESTURES)
+class GesturePropertyProvider;
+#endif
+
+// Manager for event device objects. All device I/O starts here.
+class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
+ public:
+ InputDeviceFactoryEvdev(
+ DeviceEventDispatcherEvdev* dispatcher,
+ scoped_refptr<base::SingleThreadTaskRunner> dispatch_runner,
+#if defined(USE_EVDEV_GESTURES)
+ GesturePropertyProvider* gesture_property_provider_,
+#endif
+ CursorDelegateEvdev* cursor);
+ ~InputDeviceFactoryEvdev();
+
+ // Open & start reading a newly plugged-in input device.
+ void AddInputDevice(int id, const base::FilePath& path);
+
+ // Stop reading & close an unplugged input device.
+ void RemoveInputDevice(const base::FilePath& path);
+
+ // Get a list of device ids that matches a device type. Return true if the
+ // list is not empty. |device_ids| can be NULL.
+ bool GetDeviceIdsByType(const EventDeviceType type,
+ std::vector<int>* device_ids);
+
+ // Disables the internal touchpad.
+ void DisableInternalTouchpad();
+
+ // Enables the internal touchpad.
+ void EnableInternalTouchpad();
+
+ // Disables all keys on the internal keyboard except |excepted_keys|.
+ void DisableInternalKeyboardExceptKeys(
+ scoped_ptr<std::set<DomCode>> excepted_keys);
+
+ // Enables all keys on the internal keyboard.
+ void EnableInternalKeyboard();
+
+ private:
+ // Open device at path & starting processing events (on UI thread).
+ void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter);
+
+ // Close device at path (on UI thread).
+ void DetachInputDevice(const base::FilePath& file_path);
+
+ // Update observers on device changes.
+ void NotifyDeviceChange(const EventConverterEvdev& converter);
+ void NotifyKeyboardsUpdated();
+ void NotifyTouchscreensUpdated();
+
+ // Owned per-device event converters (by path).
+ std::map<base::FilePath, EventConverterEvdev*> converters_;
+
+ // Task runner for event dispatch.
+ scoped_refptr<base::TaskRunner> ui_task_runner_;
+
+ // Cursor movement.
+ CursorDelegateEvdev* cursor_;
+
+#if defined(USE_EVDEV_GESTURES)
+ // Gesture library property provider (used by touchpads/mice).
+ GesturePropertyProvider* gesture_property_provider_;
+#endif
+
+ // Dispatcher for events.
+ DeviceEventDispatcherEvdev* dispatcher_;
+
+ // Support weak pointers for attach & detach callbacks.
+ base::WeakPtrFactory<InputDeviceFactoryEvdev> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdev);
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
« no previous file with comments | « ui/events/ozone/evdev/input_controller_evdev.cc ('k') | ui/events/ozone/evdev/input_device_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698