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_MAC_H_
6 #define DEVICE_HID_HID_SERVICE_MAC_H_
8 #include <CoreFoundation/CoreFoundation.h>
9 #include <IOKit/hid/IOHIDManager.h>
13 #include "base/mac/foundation_util.h"
14 #include "base/memory/ref_counted.h"
15 #include "device/hid/hid_service.h"
18 class MessageLoopProxy
;
25 class HidServiceMac
: public HidService
{
29 virtual scoped_refptr
<HidConnection
> Connect(const HidDeviceId
& device_id
)
33 virtual ~HidServiceMac();
35 void StartWatchingDevices();
36 void StopWatchingDevices();
38 // Device changing callbacks.
39 static void AddDeviceCallback(void* context
,
42 IOHIDDeviceRef hid_device
);
43 static void RemoveDeviceCallback(void* context
,
46 IOHIDDeviceRef hid_device
);
50 void PlatformAddDevice(IOHIDDeviceRef hid_device
);
51 void PlatformRemoveDevice(IOHIDDeviceRef hid_device
);
53 // Platform HID Manager
54 base::ScopedCFTypeRef
<IOHIDManagerRef
> hid_manager_
;
56 // The message loop for the thread on which this service was created.
57 scoped_refptr
<base::MessageLoopProxy
> message_loop_
;
59 DISALLOW_COPY_AND_ASSIGN(HidServiceMac
);
64 #endif // DEVICE_HID_HID_SERVICE_MAC_H_