OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/gamepad/platform_data_fetcher_mac.h" | 5 #include "content/browser/gamepad/platform_data_fetcher_mac.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 hid_manager_ref_, | 79 hid_manager_ref_, |
80 ValueChangedCallback, | 80 ValueChangedCallback, |
81 this); | 81 this); |
82 | 82 |
83 IOHIDManagerScheduleWithRunLoop( | 83 IOHIDManagerScheduleWithRunLoop( |
84 hid_manager_ref_, | 84 hid_manager_ref_, |
85 CFRunLoopGetMain(), | 85 CFRunLoopGetMain(), |
86 kCFRunLoopDefaultMode); | 86 kCFRunLoopDefaultMode); |
87 | 87 |
88 enabled_ = IOHIDManagerOpen(hid_manager_ref_, | 88 enabled_ = IOHIDManagerOpen(hid_manager_ref_, |
89 kIOHIDOptionsTypeSeizeDevice) == kIOReturnSuccess; | 89 kIOHIDOptionsTypeNone) == kIOReturnSuccess; |
90 } | 90 } |
91 | 91 |
92 void GamepadPlatformDataFetcherMac::UnregisterFromNotifications() { | 92 void GamepadPlatformDataFetcherMac::UnregisterFromNotifications() { |
93 IOHIDManagerUnscheduleFromRunLoop( | 93 IOHIDManagerUnscheduleFromRunLoop( |
94 hid_manager_ref_, | 94 hid_manager_ref_, |
95 CFRunLoopGetCurrent(), | 95 CFRunLoopGetCurrent(), |
96 kCFRunLoopDefaultMode); | 96 kCFRunLoopDefaultMode); |
97 IOHIDManagerClose(hid_manager_ref_, kIOHIDOptionsTypeNone); | 97 IOHIDManagerClose(hid_manager_ref_, kIOHIDOptionsTypeNone); |
98 } | 98 } |
99 | 99 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 pads->length = data_.length; | 304 pads->length = data_.length; |
305 for (size_t i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) { | 305 for (size_t i = 0; i < WebKit::WebGamepads::itemsLengthCap; ++i) { |
306 if (associated_[i].mapper) | 306 if (associated_[i].mapper) |
307 associated_[i].mapper(data_.items[i], &pads->items[i]); | 307 associated_[i].mapper(data_.items[i], &pads->items[i]); |
308 else | 308 else |
309 pads->items[i] = data_.items[i]; | 309 pads->items[i] = data_.items[i]; |
310 } | 310 } |
311 } | 311 } |
312 | 312 |
313 } // namespace content | 313 } // namespace content |
OLD | NEW |