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

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

Issue 875513005: [PATCH 10/11] ozone: evdev: Add a device factory proxy that forwards to device thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
« no previous file with comments | « ui/events/ozone/evdev/input_device_factory_evdev_proxy.h ('k') | ui/events/ozone/events_ozone.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/input_device_factory_evdev_proxy.cc
diff --git a/ui/events/ozone/evdev/input_device_factory_evdev_proxy.cc b/ui/events/ozone/evdev/input_device_factory_evdev_proxy.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7ee1d6e47a10a2077336d5f07231e53b8d574327
--- /dev/null
+++ b/ui/events/ozone/evdev/input_device_factory_evdev_proxy.cc
@@ -0,0 +1,126 @@
+// Copyright 2015 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.
+
+#include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h"
+
+#include "base/bind.h"
+#include "base/thread_task_runner_handle.h"
+#include "ui/events/ozone/evdev/input_device_factory_evdev.h"
+
+namespace ui {
+
+namespace {
+
+void ForwardGetTouchDeviceStatusReply(
+ scoped_refptr<base::SingleThreadTaskRunner> reply_runner,
+ const GetTouchDeviceStatusReply& reply,
+ scoped_ptr<std::string> status) {
+ // Thread hop back to UI for reply.
+ reply_runner->PostTask(FROM_HERE, base::Bind(reply, base::Passed(&status)));
+}
+
+} // namespace
+
+InputDeviceFactoryEvdevProxy::InputDeviceFactoryEvdevProxy(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ base::WeakPtr<InputDeviceFactoryEvdev> input_device_factory)
+ : task_runner_(task_runner), input_device_factory_(input_device_factory) {
+}
+
+InputDeviceFactoryEvdevProxy::~InputDeviceFactoryEvdevProxy() {
+}
+
+void InputDeviceFactoryEvdevProxy::AddInputDevice(int id,
+ const base::FilePath& path) {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&InputDeviceFactoryEvdev::AddInputDevice,
+ input_device_factory_, id, path));
+}
+
+void InputDeviceFactoryEvdevProxy::RemoveInputDevice(
+ const base::FilePath& path) {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&InputDeviceFactoryEvdev::RemoveInputDevice,
+ input_device_factory_, path));
+}
+
+void InputDeviceFactoryEvdevProxy::DisableInternalTouchpad() {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::DisableInternalTouchpad,
+ input_device_factory_));
+}
+
+void InputDeviceFactoryEvdevProxy::EnableInternalTouchpad() {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::EnableInternalTouchpad,
+ input_device_factory_));
+}
+
+void InputDeviceFactoryEvdevProxy::DisableInternalKeyboardExceptKeys(
+ scoped_ptr<std::set<DomCode>> excepted_keys) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputDeviceFactoryEvdev::DisableInternalKeyboardExceptKeys,
+ input_device_factory_, base::Passed(&excepted_keys)));
+}
+
+void InputDeviceFactoryEvdevProxy::EnableInternalKeyboard() {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::EnableInternalKeyboard,
+ input_device_factory_));
+}
+
+void InputDeviceFactoryEvdevProxy::SetTouchpadSensitivity(int value) {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetTouchpadSensitivity,
+ input_device_factory_, value));
+}
+
+void InputDeviceFactoryEvdevProxy::SetTapToClick(bool enabled) {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&InputDeviceFactoryEvdev::SetTapToClick,
+ input_device_factory_, enabled));
+}
+
+void InputDeviceFactoryEvdevProxy::SetThreeFingerClick(bool enabled) {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetThreeFingerClick,
+ input_device_factory_, enabled));
+}
+
+void InputDeviceFactoryEvdevProxy::SetTapDragging(bool enabled) {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&InputDeviceFactoryEvdev::SetTapDragging,
+ input_device_factory_, enabled));
+}
+
+void InputDeviceFactoryEvdevProxy::SetNaturalScroll(bool enabled) {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&InputDeviceFactoryEvdev::SetNaturalScroll,
+ input_device_factory_, enabled));
+}
+
+void InputDeviceFactoryEvdevProxy::SetMouseSensitivity(int value) {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetMouseSensitivity,
+ input_device_factory_, value));
+}
+
+void InputDeviceFactoryEvdevProxy::SetTapToClickPaused(bool state) {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetTapToClickPaused,
+ input_device_factory_, state));
+}
+
+void InputDeviceFactoryEvdevProxy::GetTouchDeviceStatus(
+ const GetTouchDeviceStatusReply& reply) {
+ task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&InputDeviceFactoryEvdev::GetTouchDeviceStatus,
+ input_device_factory_,
+ base::Bind(&ForwardGetTouchDeviceStatusReply,
+ base::ThreadTaskRunnerHandle::Get(), reply)));
+}
+
+} // namespace ui
« no previous file with comments | « ui/events/ozone/evdev/input_device_factory_evdev_proxy.h ('k') | ui/events/ozone/events_ozone.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698