Implement actions for desktop automation.
[chromium-blink-merge.git] / device / hid / hid_service_mac.h
blob7c4323412ccd69cfbba8b41c87456930c33ac01e
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>
11 #include <string>
13 #include "base/mac/foundation_util.h"
14 #include "base/memory/ref_counted.h"
15 #include "device/hid/hid_service.h"
17 namespace base {
18 class MessageLoopProxy;
21 namespace device {
23 class HidConnection;
25 class HidServiceMac : public HidService {
26 public:
27 HidServiceMac();
29 virtual scoped_refptr<HidConnection> Connect(const HidDeviceId& device_id)
30 OVERRIDE;
32 private:
33 virtual ~HidServiceMac();
35 void StartWatchingDevices();
36 void StopWatchingDevices();
38 // Device changing callbacks.
39 static void AddDeviceCallback(void* context,
40 IOReturn result,
41 void* sender,
42 IOHIDDeviceRef hid_device);
43 static void RemoveDeviceCallback(void* context,
44 IOReturn result,
45 void* sender,
46 IOHIDDeviceRef hid_device);
48 void Enumerate();
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);
62 } // namespace device
64 #endif // DEVICE_HID_HID_SERVICE_MAC_H_