| 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 DEVICE_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ |
| 6 #define CONTENT_BROWSER_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ | 6 #define DEVICE_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 <memory> |
| 14 #include <set> | 14 #include <set> |
| 15 | 15 |
| 16 #include "base/mac/scoped_cftyperef.h" | 16 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 virtual void XboxDeviceRemove(XboxController* device) = 0; | 144 virtual void XboxDeviceRemove(XboxController* device) = 0; |
| 145 virtual void XboxValueChanged(XboxController* device, | 145 virtual void XboxValueChanged(XboxController* device, |
| 146 const XboxController::Data& data) = 0; | 146 const XboxController::Data& data) = 0; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 explicit XboxDataFetcher(Delegate* delegate); | 149 explicit XboxDataFetcher(Delegate* delegate); |
| 150 virtual ~XboxDataFetcher(); | 150 virtual ~XboxDataFetcher(); |
| 151 | 151 |
| 152 bool RegisterForNotifications(); | 152 bool RegisterForNotifications(); |
| 153 bool RegisterForDeviceNotifications( | 153 bool RegisterForDeviceNotifications( |
| 154 int vendor_id, | 154 int vendor_id, |
| 155 int product_id, | 155 int product_id, |
| 156 base::mac::ScopedIOObject<io_iterator_t>* added_iter, | 156 base::mac::ScopedIOObject<io_iterator_t>* added_iter, |
| 157 base::mac::ScopedIOObject<io_iterator_t>* removed_iter); | 157 base::mac::ScopedIOObject<io_iterator_t>* removed_iter); |
| 158 void UnregisterFromNotifications(); | 158 void UnregisterFromNotifications(); |
| 159 | 159 |
| 160 XboxController* ControllerForLocation(UInt32 location_id); | 160 XboxController* ControllerForLocation(UInt32 location_id); |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 static void DeviceAdded(void* context, io_iterator_t iterator); | 163 static void DeviceAdded(void* context, io_iterator_t iterator); |
| 164 static void DeviceRemoved(void* context, io_iterator_t iterator); | 164 static void DeviceRemoved(void* context, io_iterator_t iterator); |
| 165 void AddController(XboxController* controller); | 165 void AddController(XboxController* controller); |
| 166 void RemoveController(XboxController* controller); | 166 void RemoveController(XboxController* controller); |
| 167 void RemoveControllerByLocationID(uint32_t id); | 167 void RemoveControllerByLocationID(uint32_t id); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 180 CFRunLoopSourceRef source_; | 180 CFRunLoopSourceRef source_; |
| 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 // DEVICE_GAMEPAD_XBOX_DATA_FETCHER_MAC_H_ |
| OLD | NEW |