OLD | NEW |
---|---|
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/win/scoped_handle.h" | 12 #include "base/win/scoped_handle.h" |
13 #include "device/hid/hid_connection.h" | 13 #include "device/hid/hid_connection.h" |
14 | 14 |
15 namespace device { | 15 namespace device { |
16 | 16 |
17 struct PendingHidTransfer; | 17 struct PendingHidTransfer; |
18 | 18 |
19 class HidConnectionWin : public HidConnection { | 19 class HidConnectionWin : public HidConnection { |
20 public: | 20 public: |
21 explicit HidConnectionWin(const HidDeviceInfo& device_info); | 21 explicit HidConnectionWin(const HidDeviceInfo& device_info); |
22 | 22 |
23 // HidConnection implementation. | 23 // HidConnection implementation. |
Ken Rockot(use gerrit already)
2014/08/26 16:32:04
nit: Might as well make the Platform* methods priv
Reilly Grant (use Gerrit)
2014/08/26 17:17:22
Done.
| |
24 virtual void PlatformRead(scoped_refptr<net::IOBufferWithSize> buffer, | 24 virtual void PlatformRead(const ReadCallback& callback) OVERRIDE; |
25 const IOCallback& callback) OVERRIDE; | 25 virtual void PlatformWrite(scoped_refptr<net::IOBuffer> buffer, |
26 virtual void PlatformWrite(uint8_t report_id, | 26 size_t size, |
27 scoped_refptr<net::IOBufferWithSize> buffer, | 27 const WriteCallback& callback) OVERRIDE; |
28 const IOCallback& callback) OVERRIDE; | 28 virtual void PlatformGetFeatureReport(uint8_t report_id, |
29 virtual void PlatformGetFeatureReport( | 29 const ReadCallback& callback) OVERRIDE; |
30 uint8_t report_id, | |
31 scoped_refptr<net::IOBufferWithSize> buffer, | |
32 const IOCallback& callback) OVERRIDE; | |
33 virtual void PlatformSendFeatureReport( | 30 virtual void PlatformSendFeatureReport( |
34 uint8_t report_id, | 31 scoped_refptr<net::IOBuffer> buffer, |
35 scoped_refptr<net::IOBufferWithSize> buffer, | 32 size_t size, |
36 const IOCallback& callback) OVERRIDE; | 33 const WriteCallback& callback) OVERRIDE; |
37 | 34 |
38 private: | 35 private: |
39 friend class HidServiceWin; | 36 friend class HidServiceWin; |
40 friend struct PendingHidTransfer; | 37 friend struct PendingHidTransfer; |
41 | 38 |
42 ~HidConnectionWin(); | 39 ~HidConnectionWin(); |
43 | 40 |
44 bool available() const { return file_.IsValid(); } | 41 bool available() const { return file_.IsValid(); } |
45 | 42 |
46 void OnTransferFinished(scoped_refptr<PendingHidTransfer> transfer); | 43 void OnReadComplete(scoped_refptr<net::IOBuffer> buffer, |
47 void OnTransferCanceled(scoped_refptr<PendingHidTransfer> transfer); | 44 const ReadCallback& callback, |
45 PendingHidTransfer* transfer, | |
46 bool signaled); | |
47 void OnReadFeatureComplete(scoped_refptr<net::IOBuffer> buffer, | |
48 const ReadCallback& callback, | |
49 PendingHidTransfer* transfer, | |
50 bool signaled); | |
51 void OnWriteComplete(const WriteCallback& callback, | |
52 PendingHidTransfer* transfer, | |
53 bool signaled); | |
48 | 54 |
49 base::win::ScopedHandle file_; | 55 base::win::ScopedHandle file_; |
50 | 56 |
51 std::set<scoped_refptr<PendingHidTransfer> > transfers_; | 57 std::set<scoped_refptr<PendingHidTransfer> > transfers_; |
52 | 58 |
53 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin); | 59 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin); |
54 }; | 60 }; |
55 | 61 |
56 } // namespace device | 62 } // namespace device |
57 | 63 |
58 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_ | 64 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_ |
OLD | NEW |