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

Side by Side Diff: trunk/src/device/hid/hid_connection_mac.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
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_MAC_H_ 5 #ifndef DEVICE_HID_HID_CONNECTION_MAC_H_
6 #define DEVICE_HID_HID_CONNECTION_MAC_H_ 6 #define DEVICE_HID_HID_CONNECTION_MAC_H_
7 7
8 #include <CoreFoundation/CoreFoundation.h> 8 #include <CoreFoundation/CoreFoundation.h>
9 #include <IOKit/hid/IOHIDManager.h> 9 #include <IOKit/hid/IOHIDManager.h>
10 10
11 #include <queue> 11 #include <queue>
12 12
13 #include "base/mac/foundation_util.h" 13 #include "base/mac/foundation_util.h"
14 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/threading/thread_checker.h"
15 #include "device/hid/hid_connection.h" 17 #include "device/hid/hid_connection.h"
18 #include "device/hid/hid_device_info.h"
16 19
17 namespace base { 20 namespace base {
18 class MessageLoopProxy; 21 class MessageLoopProxy;
19 } 22 }
20 23
21 namespace net { 24 namespace net {
22 class IOBuffer; 25 class IOBuffer;
23 } 26 }
24 27
25 namespace device { 28 namespace device {
26 29
27 class HidConnectionMac : public HidConnection { 30 class HidConnectionMac : public HidConnection {
28 public: 31 public:
29 explicit HidConnectionMac(HidDeviceInfo device_info); 32 explicit HidConnectionMac(HidDeviceInfo device_info);
30 33
31 // HidConnection implementation. 34 virtual void Read(scoped_refptr<net::IOBufferWithSize> buffer,
32 virtual void PlatformRead(scoped_refptr<net::IOBufferWithSize> buffer, 35 const IOCallback& callback) OVERRIDE;
33 const IOCallback& callback) OVERRIDE; 36 virtual void Write(uint8_t report_id,
34 virtual void PlatformWrite(uint8_t report_id, 37 scoped_refptr<net::IOBufferWithSize> buffer,
35 scoped_refptr<net::IOBufferWithSize> buffer, 38 const IOCallback& callback) OVERRIDE;
36 const IOCallback& callback) OVERRIDE; 39 virtual void GetFeatureReport(uint8_t report_id,
37 virtual void PlatformGetFeatureReport( 40 scoped_refptr<net::IOBufferWithSize> buffer,
38 uint8_t report_id, 41 const IOCallback& callback) OVERRIDE;
39 scoped_refptr<net::IOBufferWithSize> buffer, 42 virtual void SendFeatureReport(uint8_t report_id,
40 const IOCallback& callback) OVERRIDE; 43 scoped_refptr<net::IOBufferWithSize> buffer,
41 virtual void PlatformSendFeatureReport( 44 const IOCallback& callback) OVERRIDE;
42 uint8_t report_id,
43 scoped_refptr<net::IOBufferWithSize> buffer,
44 const IOCallback& callback) OVERRIDE;
45 45
46 private: 46 private:
47 virtual ~HidConnectionMac(); 47 virtual ~HidConnectionMac();
48 48
49 static void InputReportCallback(void* context, 49 static void InputReportCallback(void* context,
50 IOReturn result, 50 IOReturn result,
51 void* sender, 51 void* sender,
52 IOHIDReportType type, 52 IOHIDReportType type,
53 uint32_t report_id, 53 uint32_t report_id,
54 uint8_t* report_bytes, 54 uint8_t* report_bytes,
55 CFIndex report_length); 55 CFIndex report_length);
56 void ProcessReadQueue();
57 void ProcessInputReport(IOHIDReportType type,
58 scoped_refptr<net::IOBufferWithSize> buffer);
56 59
57 void WriteReport(IOHIDReportType type, 60 void WriteReport(IOHIDReportType type,
58 uint8_t report_id, 61 uint8_t report_id,
59 scoped_refptr<net::IOBufferWithSize> buffer, 62 scoped_refptr<net::IOBufferWithSize> buffer,
60 const IOCallback& callback); 63 const IOCallback& callback);
61 64
62 void Flush(); 65 scoped_refptr<base::MessageLoopProxy> message_loop_;
63 void ProcessInputReport(scoped_refptr<net::IOBufferWithSize> buffer);
64 void ProcessReadQueue();
65 66
66 base::ScopedCFTypeRef<IOHIDDeviceRef> device_; 67 base::ScopedCFTypeRef<IOHIDDeviceRef> device_;
67 scoped_refptr<base::MessageLoopProxy> message_loop_;
68 scoped_ptr<uint8_t, base::FreeDeleter> inbound_buffer_; 68 scoped_ptr<uint8_t, base::FreeDeleter> inbound_buffer_;
69 69
70 std::queue<PendingHidReport> pending_reports_; 70 std::queue<PendingHidReport> pending_reports_;
71 std::queue<PendingHidRead> pending_reads_; 71 std::queue<PendingHidRead> pending_reads_;
72 72
73 base::ThreadChecker thread_checker_;
74
73 DISALLOW_COPY_AND_ASSIGN(HidConnectionMac); 75 DISALLOW_COPY_AND_ASSIGN(HidConnectionMac);
74 }; 76 };
75 77
78
76 } // namespace device 79 } // namespace device
77 80
78 #endif // DEVICE_HID_HID_CONNECTION_MAC_H_ 81 #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