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 DEVICE_HID_HID_SERVICE_H_
6 #define DEVICE_HID_HID_SERVICE_H_
12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop/message_loop_proxy.h"
14 #include "base/threading/thread_checker.h"
15 #include "device/hid/hid_device_info.h"
23 static HidService* Create(
24 scoped_refptr<base::MessageLoopProxy> ui_message_loop);
26 virtual ~HidService();
28 // Enumerates and returns a list of device identifiers.
29 virtual void GetDevices(std::vector<HidDeviceInfo>* devices);
31 // Fills in a DeviceInfo struct with info for the given device_id.
32 // Returns |true| if successful or |false| if |device_id| is invalid.
33 bool GetDeviceInfo(const HidDeviceId& device_id, HidDeviceInfo* info) const;
35 virtual scoped_refptr<HidConnection> Connect(
36 const HidDeviceId& device_id) = 0;
39 friend class HidConnectionTest;
41 typedef std::map<HidDeviceId, HidDeviceInfo> DeviceMap;
45 void AddDevice(const HidDeviceInfo& info);
46 void RemoveDevice(const HidDeviceId& device_id);
47 const DeviceMap& GetDevicesNoEnumerate() const;
49 base::ThreadChecker thread_checker_;
54 DISALLOW_COPY_AND_ASSIGN(HidService);
59 #endif // DEVICE_HID_HID_SERVICE_H_