| 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/gamepad_platform_data_fetcher_mac.h" | 5 #include "content/browser/gamepad/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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 void GamepadPlatformDataFetcherMac::GetGamepadData( | 294 void GamepadPlatformDataFetcherMac::GetGamepadData( |
| 295 WebKit::WebGamepads* pads, | 295 WebKit::WebGamepads* pads, |
| 296 bool) { | 296 bool) { |
| 297 if (!enabled_) { | 297 if (!enabled_) { |
| 298 pads->length = 0; | 298 pads->length = 0; |
| 299 return; | 299 return; |
| 300 } | 300 } |
| 301 | 301 |
| 302 // Copy to the current state to the output buffer, using the mapping | 302 // Copy to the current state to the output buffer, using the mapping |
| 303 // function, if there is one available. | 303 // function, if there is one available. |
| 304 pads->length = data_.length; | 304 pads->length = WebKit::WebGamepads::itemsLengthCap; |
| 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 |