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

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

Issue 148183015: Revert 247926 "HID backend" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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
OLDNEW
(Empty)
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.
4
5 #ifndef DEVICE_HID_HID_CONNECTION_MAC_H_
6 #define DEVICE_HID_HID_CONNECTION_MAC_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/tuple.h"
11 #include "device/hid/hid_connection.h"
12 #include "device/hid/hid_device_info.h"
13 #include "device/hid/hid_service_mac.h"
14
15 namespace net {
16 class IOBuffer;
17 }
18
19 namespace device {
20
21 class HidConnectionMac : public HidConnection {
22 public:
23 HidConnectionMac(HidServiceMac* service,
24 HidDeviceInfo device_info,
25 IOHIDDeviceRef device);
26
27 virtual void Read(scoped_refptr<net::IOBuffer> buffer,
28 size_t size,
29 const IOCallback& callback) OVERRIDE;
30 virtual void Write(scoped_refptr<net::IOBuffer> buffer,
31 size_t size,
32 const IOCallback& callback) OVERRIDE;
33 virtual void GetFeatureReport(scoped_refptr<net::IOBuffer> buffer,
34 size_t size,
35 const IOCallback& callback) OVERRIDE;
36 virtual void SendFeatureReport(scoped_refptr<net::IOBuffer> buffer,
37 size_t size,
38 const IOCallback& callback) OVERRIDE;
39
40 private:
41 virtual ~HidConnectionMac();
42
43 static void InputReportCallback(void * context,
44 IOReturn result,
45 void * sender,
46 IOHIDReportType type,
47 uint32_t reportID,
48 uint8_t * report,
49 CFIndex reportLength);
50 void ProcessReadQueue();
51 void ProcessInputReport(IOHIDReportType type,
52 scoped_refptr<net::IOBuffer> report,
53 CFIndex reportLength);
54
55 void WriteReport(IOHIDReportType type,
56 scoped_refptr<net::IOBuffer> buffer,
57 size_t size,
58 const IOCallback& callback);
59
60 HidServiceMac* service_;
61 scoped_refptr<base::MessageLoopProxy> message_loop_;
62 base::ScopedCFTypeRef<IOHIDDeviceRef> device_;
63 scoped_ptr_malloc<uint8_t> inbound_buffer_;
64 bool disconnected_;
65
66 typedef std::pair<scoped_refptr<net::IOBuffer>, size_t> PendingReport;
67 std::queue<PendingReport> input_reports_;
68 typedef Tuple3<scoped_refptr<net::IOBuffer>, size_t, IOCallback> PendingRead;
69 std::queue<PendingRead> read_queue_;
70
71 DISALLOW_COPY_AND_ASSIGN(HidConnectionMac);
72 };
73
74
75 } // namespace device
76
77 #endif // DEVICE_HID_HID_CONNECTION_MAC_H_
OLDNEW
« no previous file with comments | « trunk/src/device/hid/hid_connection_linux.cc ('k') | trunk/src/device/hid/hid_connection_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698