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

Side by Side Diff: content/browser/gamepad/xbox_data_fetcher_mac.h

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 12 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
OLDNEW
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>
11 #include <stdint.h>
10 12
11 #include <set> 13 #include <set>
12 14
13 #include "base/basictypes.h"
14 #include "base/mac/scoped_cftyperef.h" 15 #include "base/mac/scoped_cftyperef.h"
15 #include "base/mac/scoped_ioobject.h" 16 #include "base/mac/scoped_ioobject.h"
16 #include "base/mac/scoped_ioplugininterface.h" 17 #include "base/mac/scoped_ioplugininterface.h"
18 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
18 20
19 class XboxController { 21 class XboxController {
20 public: 22 public:
21 enum ControllerType { 23 enum ControllerType {
22 UNKNOWN_CONTROLLER, 24 UNKNOWN_CONTROLLER,
23 XBOX_360_CONTROLLER, 25 XBOX_360_CONTROLLER,
24 XBOX_ONE_CONTROLLER 26 XBOX_ONE_CONTROLLER
25 }; 27 };
26 28
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 bool interface_is_open_; 111 bool interface_is_open_;
110 112
111 base::ScopedCFTypeRef<CFRunLoopSourceRef> source_; 113 base::ScopedCFTypeRef<CFRunLoopSourceRef> source_;
112 114
113 // 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
114 // 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
115 // somehow we still sometimes (rarely!) get packets off the interface which 117 // somehow we still sometimes (rarely!) get packets off the interface which
116 // 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
117 // 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
118 // ourselves. 120 // ourselves.
119 uint16 read_buffer_size_; 121 uint16_t read_buffer_size_;
120 scoped_ptr<uint8[]> read_buffer_; 122 scoped_ptr<uint8_t[]> read_buffer_;
121 123
122 // 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
123 // LED_NUM_PATTERNS if unknown. 125 // LED_NUM_PATTERNS if unknown.
124 LEDPattern led_pattern_; 126 LEDPattern led_pattern_;
125 127
126 UInt32 location_id_; 128 UInt32 location_id_;
127 129
128 Delegate* delegate_; 130 Delegate* delegate_;
129 131
130 ControllerType controller_type_; 132 ControllerType controller_type_;
(...skipping 24 matching lines...) Expand all
155 base::mac::ScopedIOObject<io_iterator_t>* removed_iter); 157 base::mac::ScopedIOObject<io_iterator_t>* removed_iter);
156 void UnregisterFromNotifications(); 158 void UnregisterFromNotifications();
157 159
158 XboxController* ControllerForLocation(UInt32 location_id); 160 XboxController* ControllerForLocation(UInt32 location_id);
159 161
160 private: 162 private:
161 static void DeviceAdded(void* context, io_iterator_t iterator); 163 static void DeviceAdded(void* context, io_iterator_t iterator);
162 static void DeviceRemoved(void* context, io_iterator_t iterator); 164 static void DeviceRemoved(void* context, io_iterator_t iterator);
163 void AddController(XboxController* controller); 165 void AddController(XboxController* controller);
164 void RemoveController(XboxController* controller); 166 void RemoveController(XboxController* controller);
165 void RemoveControllerByLocationID(uint32 id); 167 void RemoveControllerByLocationID(uint32_t id);
166 void XboxControllerGotData(XboxController* controller, 168 void XboxControllerGotData(XboxController* controller,
167 const XboxController::Data& data) override; 169 const XboxController::Data& data) override;
168 void XboxControllerError(XboxController* controller) override; 170 void XboxControllerError(XboxController* controller) override;
169 171
170 Delegate* delegate_; 172 Delegate* delegate_;
171 173
172 std::set<XboxController*> controllers_; 174 std::set<XboxController*> controllers_;
173 175
174 bool listening_; 176 bool listening_;
175 177
176 // port_ owns source_, so this doesn't need to be a ScopedCFTypeRef, but we 178 // port_ owns source_, so this doesn't need to be a ScopedCFTypeRef, but we
177 // do need to maintain a reference to it so we can invalidate it. 179 // do need to maintain a reference to it so we can invalidate it.
178 CFRunLoopSourceRef source_; 180 CFRunLoopSourceRef source_;
179 IONotificationPortRef port_; 181 IONotificationPortRef port_;
180 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_added_iter_; 182 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_added_iter_;
181 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_removed_iter_; 183 base::mac::ScopedIOObject<io_iterator_t> xbox_360_device_removed_iter_;
182 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_added_iter_; 184 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_added_iter_;
183 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_removed_iter_; 185 base::mac::ScopedIOObject<io_iterator_t> xbox_one_device_removed_iter_;
184 186
185 DISALLOW_COPY_AND_ASSIGN(XboxDataFetcher); 187 DISALLOW_COPY_AND_ASSIGN(XboxDataFetcher);
186 }; 188 };
187 189
188 #endif // CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ 190 #endif // CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_
OLDNEW
« no previous file with comments | « content/browser/gamepad/raw_input_data_fetcher_win.cc ('k') | content/browser/gamepad/xbox_data_fetcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698