| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ |
| 6 #define CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ | 6 #define CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ |
| 7 | 7 |
| 8 #include <CoreFoundation/CoreFoundation.h> | 8 #include <CoreFoundation/CoreFoundation.h> |
| 9 #include <IOKit/IOKitLib.h> | 9 #include <IOKit/IOKitLib.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 | 12 |
| 13 #include <memory> |
| 13 #include <set> | 14 #include <set> |
| 14 | 15 |
| 15 #include "base/mac/scoped_cftyperef.h" | 16 #include "base/mac/scoped_cftyperef.h" |
| 16 #include "base/mac/scoped_ioobject.h" | 17 #include "base/mac/scoped_ioobject.h" |
| 17 #include "base/mac/scoped_ioplugininterface.h" | 18 #include "base/mac/scoped_ioplugininterface.h" |
| 18 #include "base/macros.h" | 19 #include "base/macros.h" |
| 19 #include "base/memory/scoped_ptr.h" | |
| 20 | 20 |
| 21 class XboxController { | 21 class XboxController { |
| 22 public: | 22 public: |
| 23 enum ControllerType { | 23 enum ControllerType { |
| 24 UNKNOWN_CONTROLLER, | 24 UNKNOWN_CONTROLLER, |
| 25 XBOX_360_CONTROLLER, | 25 XBOX_360_CONTROLLER, |
| 26 XBOX_ONE_CONTROLLER | 26 XBOX_ONE_CONTROLLER |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 enum LEDPattern { | 29 enum LEDPattern { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 base::ScopedCFTypeRef<CFRunLoopSourceRef> source_; | 113 base::ScopedCFTypeRef<CFRunLoopSourceRef> source_; |
| 114 | 114 |
| 115 // This will be set to the max packet size reported by the interface, which | 115 // This will be set to the max packet size reported by the interface, which |
| 116 // is 32 bytes. I would have expected USB to do message framing itself, but | 116 // is 32 bytes. I would have expected USB to do message framing itself, but |
| 117 // somehow we still sometimes (rarely!) get packets off the interface which | 117 // somehow we still sometimes (rarely!) get packets off the interface which |
| 118 // aren't correctly framed. The 360 controller frames its packets with a 2 | 118 // aren't correctly framed. The 360 controller frames its packets with a 2 |
| 119 // byte header (type, total length) so we can reframe the packet data | 119 // byte header (type, total length) so we can reframe the packet data |
| 120 // ourselves. | 120 // ourselves. |
| 121 uint16_t read_buffer_size_; | 121 uint16_t read_buffer_size_; |
| 122 scoped_ptr<uint8_t[]> read_buffer_; | 122 std::unique_ptr<uint8_t[]> read_buffer_; |
| 123 | 123 |
| 124 // The pattern that the LEDs on the device are currently displaying, or | 124 // The pattern that the LEDs on the device are currently displaying, or |
| 125 // LED_NUM_PATTERNS if unknown. | 125 // LED_NUM_PATTERNS if unknown. |
| 126 LEDPattern led_pattern_; | 126 LEDPattern led_pattern_; |
| 127 | 127 |
| 128 UInt32 location_id_; | 128 UInt32 location_id_; |
| 129 | 129 |
| 130 Delegate* delegate_; | 130 Delegate* delegate_; |
| 131 | 131 |
| 132 ControllerType controller_type_; | 132 ControllerType controller_type_; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 IONotificationPortRef port_; | 181 IONotificationPortRef port_; |
| 182 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_added_iter_; | 182 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_added_iter_; |
| 183 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_removed_iter_; | 183 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_removed_iter_; |
| 184 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_added_iter_; | 184 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_added_iter_; |
| 185 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_removed_iter_; | 185 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_removed_iter_; |
| 186 | 186 |
| 187 DISALLOW_COPY_AND_ASSIGN(XboxDataFetcher); | 187 DISALLOW_COPY_AND_ASSIGN(XboxDataFetcher); |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 #endif // CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ | 190 #endif // CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ |
| OLD | NEW |