1 // Copyright 2014 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 #ifndef UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_PROXY_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_PROXY_EVDEV_H_
11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h"
15 #include "base/single_thread_task_runner.h"
16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
21 class InputDeviceFactoryEvdev
;
22 struct InputDeviceSettingsEvdev
;
24 typedef base::Callback
<void(scoped_ptr
<std::string
>)> GetTouchDeviceStatusReply
;
25 typedef base::Callback
<void(scoped_ptr
<std::vector
<base::FilePath
>>)>
26 GetTouchEventLogReply
;
28 // Thread safe proxy for InputDeviceFactoryEvdev.
30 // This is used on the UI thread to proxy calls to the real object on
31 // the device I/O thread.
32 class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdevProxy
{
34 InputDeviceFactoryEvdevProxy(
35 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner
,
36 base::WeakPtr
<InputDeviceFactoryEvdev
> input_device_factory
);
37 ~InputDeviceFactoryEvdevProxy();
39 // See InputDeviceFactoryEvdev for docs. These calls simply forward to
40 // that object on another thread.
41 void AddInputDevice(int id
, const base::FilePath
& path
);
42 void RemoveInputDevice(const base::FilePath
& path
);
43 void OnStartupScanComplete();
44 void SetCapsLockLed(bool enabled
);
45 void SetTouchEventLoggingEnabled(bool enabled
);
46 void UpdateInputDeviceSettings(const InputDeviceSettingsEvdev
& settings
);
47 void GetTouchDeviceStatus(const GetTouchDeviceStatusReply
& reply
);
48 void GetTouchEventLog(const base::FilePath
& out_dir
,
49 const GetTouchEventLogReply
& reply
);
52 scoped_refptr
<base::SingleThreadTaskRunner
> task_runner_
;
53 base::WeakPtr
<InputDeviceFactoryEvdev
> input_device_factory_
;
55 DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdevProxy
);
60 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_PROXY_EVDEV_H_