blob: 80239c4bdeae6ffe7df9969ab9f20eccdc966004 [file] [log] [blame]
[email protected]26958d12014-02-27 17:29:101// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]125724f2014-01-31 20:13:232// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef DEVICE_HID_HID_SERVICE_LINUX_H_
6#define DEVICE_HID_HID_SERVICE_LINUX_H_
7
[email protected]bca53b02014-04-10 15:11:148#include "base/compiler_specific.h"
[email protected]125724f2014-01-31 20:13:239#include "base/macros.h"
[email protected]03b640fd2014-07-26 18:25:3810#include "base/memory/weak_ptr.h"
[email protected]bca53b02014-04-10 15:11:1411#include "device/hid/device_monitor_linux.h"
[email protected]125724f2014-01-31 20:13:2312#include "device/hid/hid_device_info.h"
13#include "device/hid/hid_service.h"
14
[email protected]bca53b02014-04-10 15:11:1415struct udev_device;
16
[email protected]125724f2014-01-31 20:13:2317namespace device {
18
19class HidConnection;
20
[email protected]125724f2014-01-31 20:13:2321class HidServiceLinux : public HidService,
[email protected]bca53b02014-04-10 15:11:1422 public DeviceMonitorLinux::Observer {
[email protected]125724f2014-01-31 20:13:2323 public:
rockot1a51b922014-09-05 08:02:4424 HidServiceLinux(scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
[email protected]125724f2014-01-31 20:13:2325
dcheng07c34a12014-10-29 18:55:1026 void Connect(const HidDeviceId& device_id,
27 const ConnectCallback& callback) override;
[email protected]125724f2014-01-31 20:13:2328
[email protected]eedae132014-04-12 22:02:3729 // Implements DeviceMonitorLinux::Observer:
dcheng07c34a12014-10-29 18:55:1030 void OnDeviceAdded(udev_device* device) override;
31 void OnDeviceRemoved(udev_device* device) override;
[email protected]125724f2014-01-31 20:13:2332
33 private:
dcheng07c34a12014-10-29 18:55:1034 ~HidServiceLinux() override;
[email protected]125724f2014-01-31 20:13:2335
reillyg7f4f5082014-10-16 19:19:1436 void FinishConnect(const HidDeviceId& device_id,
37 const std::string device_node,
38 const ConnectCallback& callback,
39 bool success);
[email protected]03b640fd2014-07-26 18:25:3840
reillyg7832a4e2014-10-11 01:52:4741 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
rockot1a51b922014-09-05 08:02:4442 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
[email protected]03b640fd2014-07-26 18:25:3843
44 base::WeakPtrFactory<HidServiceLinux> weak_factory_;
45
[email protected]125724f2014-01-31 20:13:2346 DISALLOW_COPY_AND_ASSIGN(HidServiceLinux);
47};
48
49} // namespace device
50
51#endif // DEVICE_HID_HID_SERVICE_LINUX_H_