OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "ui/events/ozone/evdev/input_device_factory_evdev_proxy.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 namespace { |
| 14 |
| 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))); |
| 21 } |
| 22 |
| 23 } // namespace |
| 24 |
| 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) { |
| 29 } |
| 30 |
| 31 InputDeviceFactoryEvdevProxy::~InputDeviceFactoryEvdevProxy() { |
| 32 } |
| 33 |
| 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)); |
| 39 } |
| 40 |
| 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)); |
| 46 } |
| 47 |
| 48 void InputDeviceFactoryEvdevProxy::DisableInternalTouchpad() { |
| 49 task_runner_->PostTask( |
| 50 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::DisableInternalTouchpad, |
| 51 input_device_factory_)); |
| 52 } |
| 53 |
| 54 void InputDeviceFactoryEvdevProxy::EnableInternalTouchpad() { |
| 55 task_runner_->PostTask( |
| 56 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::EnableInternalTouchpad, |
| 57 input_device_factory_)); |
| 58 } |
| 59 |
| 60 void InputDeviceFactoryEvdevProxy::DisableInternalKeyboardExceptKeys( |
| 61 scoped_ptr<std::set<DomCode>> excepted_keys) { |
| 62 task_runner_->PostTask( |
| 63 FROM_HERE, |
| 64 base::Bind(&InputDeviceFactoryEvdev::DisableInternalKeyboardExceptKeys, |
| 65 input_device_factory_, base::Passed(&excepted_keys))); |
| 66 } |
| 67 |
| 68 void InputDeviceFactoryEvdevProxy::EnableInternalKeyboard() { |
| 69 task_runner_->PostTask( |
| 70 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::EnableInternalKeyboard, |
| 71 input_device_factory_)); |
| 72 } |
| 73 |
| 74 void InputDeviceFactoryEvdevProxy::SetTouchpadSensitivity(int value) { |
| 75 task_runner_->PostTask( |
| 76 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetTouchpadSensitivity, |
| 77 input_device_factory_, value)); |
| 78 } |
| 79 |
| 80 void InputDeviceFactoryEvdevProxy::SetTapToClick(bool enabled) { |
| 81 task_runner_->PostTask(FROM_HERE, |
| 82 base::Bind(&InputDeviceFactoryEvdev::SetTapToClick, |
| 83 input_device_factory_, enabled)); |
| 84 } |
| 85 |
| 86 void InputDeviceFactoryEvdevProxy::SetThreeFingerClick(bool enabled) { |
| 87 task_runner_->PostTask( |
| 88 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetThreeFingerClick, |
| 89 input_device_factory_, enabled)); |
| 90 } |
| 91 |
| 92 void InputDeviceFactoryEvdevProxy::SetTapDragging(bool enabled) { |
| 93 task_runner_->PostTask(FROM_HERE, |
| 94 base::Bind(&InputDeviceFactoryEvdev::SetTapDragging, |
| 95 input_device_factory_, enabled)); |
| 96 } |
| 97 |
| 98 void InputDeviceFactoryEvdevProxy::SetNaturalScroll(bool enabled) { |
| 99 task_runner_->PostTask(FROM_HERE, |
| 100 base::Bind(&InputDeviceFactoryEvdev::SetNaturalScroll, |
| 101 input_device_factory_, enabled)); |
| 102 } |
| 103 |
| 104 void InputDeviceFactoryEvdevProxy::SetMouseSensitivity(int value) { |
| 105 task_runner_->PostTask( |
| 106 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetMouseSensitivity, |
| 107 input_device_factory_, value)); |
| 108 } |
| 109 |
| 110 void InputDeviceFactoryEvdevProxy::SetTapToClickPaused(bool state) { |
| 111 task_runner_->PostTask( |
| 112 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::SetTapToClickPaused, |
| 113 input_device_factory_, state)); |
| 114 } |
| 115 |
| 116 void InputDeviceFactoryEvdevProxy::GetTouchDeviceStatus( |
| 117 const GetTouchDeviceStatusReply& reply) { |
| 118 task_runner_->PostTask( |
| 119 FROM_HERE, |
| 120 base::Bind(&InputDeviceFactoryEvdev::GetTouchDeviceStatus, |
| 121 input_device_factory_, |
| 122 base::Bind(&ForwardGetTouchDeviceStatusReply, |
| 123 base::ThreadTaskRunnerHandle::Get(), reply))); |
| 124 } |
| 125 |
| 126 } // namespace ui |
OLD | NEW |