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

Unified Diff: ui/events/ozone/evdev/input_controller_evdev.cc

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: updates for events_unittests 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_controller_evdev.cc
diff --git a/ui/events/ozone/evdev/input_controller_evdev.cc b/ui/events/ozone/evdev/input_controller_evdev.cc
index 65ca67ec8cc4ebd86ff926c4fc819b87851ae2ce..8f135530f0f90670a7d34e2efddbdbb6921e27c8 100644
--- a/ui/events/ozone/evdev/input_controller_evdev.cc
+++ b/ui/events/ozone/evdev/input_controller_evdev.cc
@@ -7,7 +7,8 @@
#include <linux/input.h>
#include <vector>
-#include "ui/events/ozone/evdev/event_factory_evdev.h"
+#include "ui/events/ozone/evdev/input_device_factory_evdev.h"
+#include "ui/events/ozone/evdev/keyboard_evdev.h"
#include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
#if defined(USE_EVDEV_GESTURES)
@@ -45,7 +46,6 @@ void SetGestureBoolProperty(GesturePropertyProvider* provider,
} // namespace
InputControllerEvdev::InputControllerEvdev(
- EventFactoryEvdev* event_factory,
KeyboardEvdev* keyboard,
MouseButtonMapEvdev* button_map
#if defined(USE_EVDEV_GESTURES)
@@ -53,7 +53,7 @@ InputControllerEvdev::InputControllerEvdev(
GesturePropertyProvider* gesture_property_provider
#endif
)
- : event_factory_(event_factory),
+ : input_device_factory_(nullptr),
keyboard_(keyboard),
button_map_(button_map)
#if defined(USE_EVDEV_GESTURES)
@@ -66,12 +66,21 @@ InputControllerEvdev::InputControllerEvdev(
InputControllerEvdev::~InputControllerEvdev() {
}
+void InputControllerEvdev::SetInputDeviceFactory(
+ InputDeviceFactoryEvdev* input_device_factory) {
+ input_device_factory_ = input_device_factory;
+}
+
bool InputControllerEvdev::HasMouse() {
- return event_factory_->GetDeviceIdsByType(DT_MOUSE, NULL);
+ if (!input_device_factory_)
+ return false;
+ return input_device_factory_->GetDeviceIdsByType(DT_MOUSE, NULL);
}
bool InputControllerEvdev::HasTouchpad() {
- return event_factory_->GetDeviceIdsByType(DT_TOUCHPAD, NULL);
+ if (!input_device_factory_)
+ return false;
+ return input_device_factory_->GetDeviceIdsByType(DT_TOUCHPAD, NULL);
}
bool InputControllerEvdev::IsCapsLockEnabled() {
@@ -105,28 +114,35 @@ void InputControllerEvdev::GetAutoRepeatRate(base::TimeDelta* delay,
}
void InputControllerEvdev::DisableInternalTouchpad() {
- event_factory_->DisableInternalTouchpad();
+ if (input_device_factory_)
+ input_device_factory_->DisableInternalTouchpad();
}
void InputControllerEvdev::EnableInternalTouchpad() {
- event_factory_->EnableInternalTouchpad();
+ if (input_device_factory_)
+ input_device_factory_->EnableInternalTouchpad();
}
void InputControllerEvdev::DisableInternalKeyboardExceptKeys(
scoped_ptr<std::set<DomCode>> excepted_keys) {
- event_factory_->DisableInternalKeyboardExceptKeys(excepted_keys.Pass());
+ if (input_device_factory_)
+ input_device_factory_->DisableInternalKeyboardExceptKeys(
alexst (slow to review) 2015/01/27 19:31:41 nit: I prefer a set of curly braces once it become
spang 2015/01/28 01:40:46 Done.
+ excepted_keys.Pass());
}
void InputControllerEvdev::EnableInternalKeyboard() {
- event_factory_->EnableInternalKeyboard();
+ if (input_device_factory_)
+ input_device_factory_->EnableInternalKeyboard();
}
void InputControllerEvdev::SetIntPropertyForOneType(const EventDeviceType type,
const std::string& name,
int value) {
+ if (!input_device_factory_)
+ return;
#if defined(USE_EVDEV_GESTURES)
std::vector<int> ids;
- event_factory_->GetDeviceIdsByType(type, &ids);
+ input_device_factory_->GetDeviceIdsByType(type, &ids);
for (size_t i = 0; i < ids.size(); ++i) {
SetGestureIntProperty(gesture_property_provider_, ids[i], name, value);
}
@@ -139,9 +155,11 @@ void InputControllerEvdev::SetIntPropertyForOneType(const EventDeviceType type,
void InputControllerEvdev::SetBoolPropertyForOneType(const EventDeviceType type,
const std::string& name,
bool value) {
+ if (!input_device_factory_)
+ return;
#if defined(USE_EVDEV_GESTURES)
std::vector<int> ids;
- event_factory_->GetDeviceIdsByType(type, &ids);
+ input_device_factory_->GetDeviceIdsByType(type, &ids);
for (size_t i = 0; i < ids.size(); ++i) {
SetGestureBoolProperty(gesture_property_provider_, ids[i], name, value);
}

Powered by Google App Engine
This is Rietveld 408576698