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

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

Issue 369923002: Revert 281133 "chrome.hid: enrich model with report IDs" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/device/hid/hid_connection_mac.cc ('k') | trunk/src/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/win/scoped_handle.h" 12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/message_loop/message_loop.h"
15 #include "base/threading/thread_checker.h"
13 #include "device/hid/hid_connection.h" 16 #include "device/hid/hid_connection.h"
17 #include "device/hid/hid_device_info.h"
14 18
15 namespace device { 19 namespace device {
16 20
17 struct PendingHidTransfer; 21 struct PendingHidTransfer;
18 22
19 class HidConnectionWin : public HidConnection { 23 class HidConnectionWin : public HidConnection {
20 public: 24 public:
21 explicit HidConnectionWin(const HidDeviceInfo& device_info); 25 explicit HidConnectionWin(const HidDeviceInfo& device_info);
22 26
23 // HidConnection implementation. 27 bool available() const;
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;
37 28
38 private: 29 virtual void Read(scoped_refptr<net::IOBufferWithSize> buffer,
39 friend class HidServiceWin; 30 const IOCallback& callback) OVERRIDE;
40 friend struct PendingHidTransfer; 31 virtual void Write(uint8_t report_id,
41 32 scoped_refptr<net::IOBufferWithSize> buffer,
42 ~HidConnectionWin(); 33 const IOCallback& callback) OVERRIDE;
43 34 virtual void GetFeatureReport(uint8_t report_id,
44 bool available() const { return file_.IsValid(); } 35 scoped_refptr<net::IOBufferWithSize> buffer,
36 const IOCallback& callback) OVERRIDE;
37 virtual void SendFeatureReport(uint8_t report_id,
38 scoped_refptr<net::IOBufferWithSize> buffer,
39 const IOCallback& callback) OVERRIDE;
45 40
46 void OnTransferFinished(scoped_refptr<PendingHidTransfer> transfer); 41 void OnTransferFinished(scoped_refptr<PendingHidTransfer> transfer);
47 void OnTransferCanceled(scoped_refptr<PendingHidTransfer> transfer); 42 void OnTransferCanceled(scoped_refptr<PendingHidTransfer> transfer);
48 43
44 private:
45 ~HidConnectionWin();
46
49 base::win::ScopedHandle file_; 47 base::win::ScopedHandle file_;
48 std::set<scoped_refptr<PendingHidTransfer> > transfers_;
50 49
51 std::set<scoped_refptr<PendingHidTransfer> > transfers_; 50 base::ThreadChecker thread_checker_;
52 51
53 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin); 52 DISALLOW_COPY_AND_ASSIGN(HidConnectionWin);
54 }; 53 };
55 54
56 } // namespace device 55 } // namespace device
57 56
58 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_ 57 #endif // DEVICE_HID_HID_CONNECTION_WIN_H_
OLDNEW
« no previous file with comments | « trunk/src/device/hid/hid_connection_mac.cc ('k') | trunk/src/device/hid/hid_connection_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698