Replace remaining Tokenize calls to SplitString
[chromium-blink-merge.git] / ui / events / ozone / evdev / input_device_factory_evdev_proxy.cc
blob2ebf05782fab86233035f470307af1886dffb441
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"
7 #include "base/bind.h"
8 #include "base/thread_task_runner_handle.h"
9 #include "ui/events/ozone/evdev/input_device_factory_evdev.h"
11 namespace ui {
13 namespace {
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)));
23 void ForwardGetTouchEventLogReply(
24 scoped_refptr<base::SingleThreadTaskRunner> reply_runner,
25 const GetTouchEventLogReply& reply,
26 scoped_ptr<std::vector<base::FilePath>> log_paths) {
27 // Thread hop back to UI for reply.
28 reply_runner->PostTask(FROM_HERE,
29 base::Bind(reply, base::Passed(&log_paths)));
32 } // namespace
34 InputDeviceFactoryEvdevProxy::InputDeviceFactoryEvdevProxy(
35 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
36 base::WeakPtr<InputDeviceFactoryEvdev> input_device_factory)
37 : task_runner_(task_runner), input_device_factory_(input_device_factory) {
40 InputDeviceFactoryEvdevProxy::~InputDeviceFactoryEvdevProxy() {
43 void InputDeviceFactoryEvdevProxy::AddInputDevice(int id,
44 const base::FilePath& path) {
45 task_runner_->PostTask(FROM_HERE,
46 base::Bind(&InputDeviceFactoryEvdev::AddInputDevice,
47 input_device_factory_, id, path));
50 void InputDeviceFactoryEvdevProxy::RemoveInputDevice(
51 const base::FilePath& path) {
52 task_runner_->PostTask(FROM_HERE,
53 base::Bind(&InputDeviceFactoryEvdev::RemoveInputDevice,
54 input_device_factory_, path));
57 void InputDeviceFactoryEvdevProxy::OnStartupScanComplete() {
58 task_runner_->PostTask(
59 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::OnStartupScanComplete,
60 input_device_factory_));
63 void InputDeviceFactoryEvdevProxy::SetCapsLockLed(bool enabled) {
64 task_runner_->PostTask(FROM_HERE,
65 base::Bind(&InputDeviceFactoryEvdev::SetCapsLockLed,
66 input_device_factory_, enabled));
69 void InputDeviceFactoryEvdevProxy::UpdateInputDeviceSettings(
70 const InputDeviceSettingsEvdev& settings) {
71 task_runner_->PostTask(
72 FROM_HERE, base::Bind(&InputDeviceFactoryEvdev::UpdateInputDeviceSettings,
73 input_device_factory_, settings));
76 void InputDeviceFactoryEvdevProxy::GetTouchDeviceStatus(
77 const GetTouchDeviceStatusReply& reply) {
78 task_runner_->PostTask(
79 FROM_HERE,
80 base::Bind(&InputDeviceFactoryEvdev::GetTouchDeviceStatus,
81 input_device_factory_,
82 base::Bind(&ForwardGetTouchDeviceStatusReply,
83 base::ThreadTaskRunnerHandle::Get(), reply)));
86 void InputDeviceFactoryEvdevProxy::GetTouchEventLog(
87 const base::FilePath& out_dir,
88 const GetTouchEventLogReply& reply) {
89 task_runner_->PostTask(
90 FROM_HERE,
91 base::Bind(&InputDeviceFactoryEvdev::GetTouchEventLog,
92 input_device_factory_, out_dir,
93 base::Bind(&ForwardGetTouchEventLogReply,
94 base::ThreadTaskRunnerHandle::Get(), reply)));
97 } // namespace ui