1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h"
8 #include "base/thread_task_runner_handle.h"
9 #include "ui/events/ozone/evdev/input_device_factory_evdev.h"
15 void ForwardGetTouchDeviceStatusReply(
16 scoped_refptr
<base::SingleThreadTaskRunner
> reply_runner
,
17 const GetTouchDeviceStatusReply
& reply
,
18 scoped_ptr
<std::string
> status
) {
19 // Thread hop back to UI for reply.
20 reply_runner
->PostTask(FROM_HERE
, base::Bind(reply
, base::Passed(&status
)));
25 InputDeviceFactoryEvdevProxy::InputDeviceFactoryEvdevProxy(
26 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
,
27 base::WeakPtr
<InputDeviceFactoryEvdev
> input_device_factory
)
28 : task_runner_(task_runner
), input_device_factory_(input_device_factory
) {
31 InputDeviceFactoryEvdevProxy::~InputDeviceFactoryEvdevProxy() {
34 void InputDeviceFactoryEvdevProxy::AddInputDevice(int id
,
35 const base::FilePath
& path
) {
36 task_runner_
->PostTask(FROM_HERE
,
37 base::Bind(&InputDeviceFactoryEvdev::AddInputDevice
,
38 input_device_factory_
, id
, path
));
41 void InputDeviceFactoryEvdevProxy::RemoveInputDevice(
42 const base::FilePath
& path
) {
43 task_runner_
->PostTask(FROM_HERE
,
44 base::Bind(&InputDeviceFactoryEvdev::RemoveInputDevice
,
45 input_device_factory_
, path
));
48 void InputDeviceFactoryEvdevProxy::DisableInternalTouchpad() {
49 task_runner_
->PostTask(
50 FROM_HERE
, base::Bind(&InputDeviceFactoryEvdev::DisableInternalTouchpad
,
51 input_device_factory_
));
54 void InputDeviceFactoryEvdevProxy::EnableInternalTouchpad() {
55 task_runner_
->PostTask(
56 FROM_HERE
, base::Bind(&InputDeviceFactoryEvdev::EnableInternalTouchpad
,
57 input_device_factory_
));
60 void InputDeviceFactoryEvdevProxy::DisableInternalKeyboardExceptKeys(
61 scoped_ptr
<std::set
<DomCode
>> excepted_keys
) {
62 task_runner_
->PostTask(
64 base::Bind(&InputDeviceFactoryEvdev::DisableInternalKeyboardExceptKeys
,
65 input_device_factory_
, base::Passed(&excepted_keys
)));
68 void InputDeviceFactoryEvdevProxy::EnableInternalKeyboard() {
69 task_runner_
->PostTask(
70 FROM_HERE
, base::Bind(&InputDeviceFactoryEvdev::EnableInternalKeyboard
,
71 input_device_factory_
));
74 void InputDeviceFactoryEvdevProxy::SetTouchpadSensitivity(int value
) {
75 task_runner_
->PostTask(
76 FROM_HERE
, base::Bind(&InputDeviceFactoryEvdev::SetTouchpadSensitivity
,
77 input_device_factory_
, value
));
80 void InputDeviceFactoryEvdevProxy::SetTapToClick(bool enabled
) {
81 task_runner_
->PostTask(FROM_HERE
,
82 base::Bind(&InputDeviceFactoryEvdev::SetTapToClick
,
83 input_device_factory_
, enabled
));
86 void InputDeviceFactoryEvdevProxy::SetThreeFingerClick(bool enabled
) {
87 task_runner_
->PostTask(
88 FROM_HERE
, base::Bind(&InputDeviceFactoryEvdev::SetThreeFingerClick
,
89 input_device_factory_
, enabled
));
92 void InputDeviceFactoryEvdevProxy::SetTapDragging(bool enabled
) {
93 task_runner_
->PostTask(FROM_HERE
,
94 base::Bind(&InputDeviceFactoryEvdev::SetTapDragging
,
95 input_device_factory_
, enabled
));
98 void InputDeviceFactoryEvdevProxy::SetNaturalScroll(bool enabled
) {
99 task_runner_
->PostTask(FROM_HERE
,
100 base::Bind(&InputDeviceFactoryEvdev::SetNaturalScroll
,
101 input_device_factory_
, enabled
));
104 void InputDeviceFactoryEvdevProxy::SetMouseSensitivity(int value
) {
105 task_runner_
->PostTask(
106 FROM_HERE
, base::Bind(&InputDeviceFactoryEvdev::SetMouseSensitivity
,
107 input_device_factory_
, value
));
110 void InputDeviceFactoryEvdevProxy::SetTapToClickPaused(bool state
) {
111 task_runner_
->PostTask(
112 FROM_HERE
, base::Bind(&InputDeviceFactoryEvdev::SetTapToClickPaused
,
113 input_device_factory_
, state
));
116 void InputDeviceFactoryEvdevProxy::GetTouchDeviceStatus(
117 const GetTouchDeviceStatusReply
& reply
) {
118 task_runner_
->PostTask(
120 base::Bind(&InputDeviceFactoryEvdev::GetTouchDeviceStatus
,
121 input_device_factory_
,
122 base::Bind(&ForwardGetTouchDeviceStatusReply
,
123 base::ThreadTaskRunnerHandle::Get(), reply
)));