| OLD | NEW | 
|---|
|  | (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_ |  | 
| OLD | NEW | 
|---|