Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: device/hid/hid_connection_win.h

Issue 317783010: chrome.hid: enrich model with report IDs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix hid.idl comment Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/hid/hid_connection_mac.cc ('k') | device/hid/hid_connection_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_HID_HID_CONNECTION_WIN_H_ 5 #ifndef DEVICE_HID_HID_CONNECTION_WIN_H_
6 #define DEVICE_HID_HID_CONNECTION_WIN_H_ 6 #define DEVICE_HID_HID_CONNECTION_WIN_H_
7 7
8 #include <windows.h> 8 #include <windows.h>
9 9
10 #include <set> 10 #include <set>
11 11
12 #include "base/callback.h" 12 #include "base/win/scoped_handle.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/message_loop/message_loop.h"
15 #include "base/threading/thread_checker.h"
16 #include "device/hid/hid_connection.h" 13 #include "device/hid/hid_connection.h"
17 #include "device/hid/hid_device_info.h"
18 14
19 namespace device { 15 namespace device {
20 16
21 struct PendingHidTransfer; 17 struct PendingHidTransfer;
22 18
23 class HidConnectionWin : public HidConnection { 19 class HidConnectionWin : public HidConnection {
24 public: 20 public:
25 explicit HidConnectionWin(const HidDeviceInfo& device_info); 21 explicit HidConnectionWin(const HidDeviceInfo& device_info);
26 22
27 bool available() const; 23 // HidConnection implementation.
24 virtual void PlatformRead(scoped_refptr<net::IOBufferWithSize> buffer,
25 const IOCallback& callback) OVERRIDE;
26 virtual void PlatformWrite(uint8_t report_id,
27 scoped_refptr<net::IOBufferWithSize> buffer,
28 const IOCallback& callback) OVERRIDE;
29 virtual void PlatformGetFeatureReport(
30 uint8_t report_id,
31 scoped_refptr<net::IOBufferWithSize> buffer,
32 const IOCallback& callback) OVERRIDE;
33 virtual void PlatformSendFeatureReport(
34 uint8_t report_id,
35 scoped_refptr<net::IOBufferWithSize> buffer,
36 const IOCallback& callback) OVERRIDE;
28 37
29 virtual void Read(scoped_refptr<net::IOBufferWithSize> buffer, 38 private:
30 const IOCallback& callback) OVERRIDE; 39 friend class HidServiceWin;
31 virtual void Write(uint8_t report_id, 40 friend struct PendingHidTransfer;
32 scoped_refptr<net::IOBufferWithSize> buffer, 41
33 const IOCallback& callback) OVERRIDE; 42 ~HidConnectionWin();
34 virtual void GetFeatureReport(uint8_t report_id, 43
35 scoped_refptr<net::IOBufferWithSize> buffer, 44 bool available() const { return file_.IsValid(); }
36 const IOCallback& callback) OVERRIDE;
37 virtual void SendFeatureReport(uint8_t report_id,
38 scoped_refptr<net::IOBufferWithSize> buffer,
39 const IOCallback& callback) OVERRIDE;
40 45
41 void OnTransferFinished(scoped_refptr<PendingHidTransfer> transfer); 46 void OnTransferFinished(scoped_refptr<PendingHidTransfer> transfer);
42 void OnTransferCanceled(scoped_refptr<PendingHidTransfer> transfer); 47 void OnTransferCanceled(scoped_refptr<PendingHidTransfer> transfer);
43 48
44 private: 49 base::win::ScopedHandle file_;
45 ~HidConnectionWin();
46 50
47 base::win::ScopedHandle file_;
48 std::set<scoped_refptr<PendingHidTransfer> > transfers_; 51 std::set<scoped_refptr<PendingHidTransfer> > transfers_;
49 52
50 base::ThreadChecker thread_checker_;
51
52 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin); 53 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin);
53 }; 54 };
54 55
55 } // namespace device 56 } // namespace device
56 57
57 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_ 58 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_
OLDNEW
« no previous file with comments | « device/hid/hid_connection_mac.cc ('k') | device/hid/hid_connection_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698