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

Side by Side Diff: content/browser/gamepad/gamepad_platform_data_fetcher_win.cc

Issue 1136463002: Pass correct length value in WebGamepads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed pending comments Created 5 years, 7 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 | ppapi/examples/gamepad/gamepad.cc » ('j') | 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_win.h" 5 #include "content/browser/gamepad/gamepad_platform_data_fetcher_win.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "base/win/windows_version.h" 9 #include "base/win/windows_version.h"
10 #include "content/common/gamepad_hardware_buffer.h" 10 #include "content/common/gamepad_hardware_buffer.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 pad_state_[i].raw_input_handle == handle) 90 pad_state_[i].raw_input_handle == handle)
91 return true; 91 return true;
92 } 92 }
93 return false; 93 return false;
94 } 94 }
95 95
96 void GamepadPlatformDataFetcherWin::EnumerateDevices( 96 void GamepadPlatformDataFetcherWin::EnumerateDevices(
97 WebGamepads* pads) { 97 WebGamepads* pads) {
98 TRACE_EVENT0("GAMEPAD", "EnumerateDevices"); 98 TRACE_EVENT0("GAMEPAD", "EnumerateDevices");
99 99
100 pads->length = 0;
100 // Mark all disconnected pads DISCONNECTED. 101 // Mark all disconnected pads DISCONNECTED.
101 for (size_t i = 0; i < WebGamepads::itemsLengthCap; ++i) { 102 for (size_t i = 0; i < WebGamepads::itemsLengthCap; ++i) {
102 if (!pads->items[i].connected) 103 if (!pads->items[i].connected)
103 pad_state_[i].status = DISCONNECTED; 104 pad_state_[i].status = DISCONNECTED;
104 } 105 }
105 106
106 for (size_t i = 0; i < XUSER_MAX_COUNT; ++i) { 107 for (size_t i = 0; i < XUSER_MAX_COUNT; ++i) {
107 if (HasXInputGamepad(i)) 108 if (HasXInputGamepad(i))
108 continue; 109 continue;
109 int pad_index = FirstAvailableGamepadId(); 110 int pad_index = FirstAvailableGamepadId();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 return false; 314 return false;
314 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>( 315 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>(
315 xinput_dll_.GetFunctionPointer("XInputGetState")); 316 xinput_dll_.GetFunctionPointer("XInputGetState"));
316 if (!xinput_get_state_) 317 if (!xinput_get_state_)
317 return false; 318 return false;
318 xinput_enable_(true); 319 xinput_enable_(true);
319 return true; 320 return true;
320 } 321 }
321 322
322 } // namespace content 323 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | ppapi/examples/gamepad/gamepad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698