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

Side by Side Diff: content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm

Issue 14299003: Gamepad: Gamepads length should be maximum supported. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698