ServiceWorker: Consolidate version manipulation functions in SWProviderContext
[chromium-blink-merge.git] / device / hid / hid_service_win.h
blob902d431fe2cb345ccdd4b0e271f0718c42faa305
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_WIN_H_
6 #define DEVICE_HID_HID_SERVICE_WIN_H_
8 #include <windows.h>
9 #include <hidclass.h>
11 extern "C" {
12 #include <hidsdi.h>
13 #include <hidpi.h>
16 #include "base/memory/scoped_ptr.h"
17 #include "base/scoped_observer.h"
18 #include "base/win/scoped_handle.h"
19 #include "device/core/device_monitor_win.h"
20 #include "device/hid/hid_device_info.h"
21 #include "device/hid/hid_service.h"
23 namespace base {
24 namespace win {
25 class MessageWindow;
29 namespace device {
31 class HidServiceWin : public HidService, public DeviceMonitorWin::Observer {
32 public:
33 HidServiceWin();
35 virtual void Connect(const HidDeviceId& device_id,
36 const ConnectCallback& callback) override;
38 private:
39 virtual ~HidServiceWin();
41 void DoInitialEnumeration();
42 static void CollectInfoFromButtonCaps(PHIDP_PREPARSED_DATA preparsed_data,
43 HIDP_REPORT_TYPE report_type,
44 USHORT button_caps_length,
45 HidCollectionInfo* collection_info);
46 static void CollectInfoFromValueCaps(PHIDP_PREPARSED_DATA preparsed_data,
47 HIDP_REPORT_TYPE report_type,
48 USHORT value_caps_length,
49 HidCollectionInfo* collection_info);
51 // DeviceMonitorWin::Observer implementation:
52 void OnDeviceAdded(const std::string& device_path) override;
53 void OnDeviceRemoved(const std::string& device_path) override;
55 // Tries to open the device read-write and falls back to read-only.
56 base::win::ScopedHandle OpenDevice(const std::string& device_path);
58 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
59 ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_;
61 DISALLOW_COPY_AND_ASSIGN(HidServiceWin);
64 } // namespace device
66 #endif // DEVICE_HID_HID_SERVICE_WIN_H_