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

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

Issue 80813002: Cleanup: Remove many unused wstring string_utils. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « base/strings/string_util_unittest.cc ('k') | 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_win.h" 5 #include "content/browser/gamepad/gamepad_platform_data_fetcher_win.h"
6 6
7 #include <dinput.h> 7 #include <dinput.h>
8 #include <dinputd.h> 8 #include <dinputd.h>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 gamepad->Release(); 189 gamepad->Release();
190 return DIENUM_CONTINUE; 190 return DIENUM_CONTINUE;
191 } 191 }
192 192
193 // Set the dead zone to 10% of the axis length for all axes. This 193 // Set the dead zone to 10% of the axis length for all axes. This
194 // gives us a larger space for what's "neutral" so the controls don't 194 // gives us a larger space for what's "neutral" so the controls don't
195 // slowly drift. 195 // slowly drift.
196 SetDirectInputDeadZone(gamepad, 1000); 196 SetDirectInputDeadZone(gamepad, 1000);
197 device.mapper = GetGamepadStandardMappingFunction(vendor, product); 197 device.mapper = GetGamepadStandardMappingFunction(vendor, product);
198 if (device.mapper) { 198 if (device.mapper) {
199 base::swprintf(device.id, 199 swprintf(device.id,
200 WebGamepad::idLengthCap, 200 WebGamepad::idLengthCap,
201 L"STANDARD GAMEPAD (%ls)", 201 L"STANDARD GAMEPAD (%ls)",
202 instance->tszProductName); 202 instance->tszProductName);
203 ctxt->directinput_devices->push_back(device); 203 ctxt->directinput_devices->push_back(device);
204 } else { 204 } else {
205 gamepad->Release(); 205 gamepad->Release();
206 } 206 }
207 return DIENUM_CONTINUE; 207 return DIENUM_CONTINUE;
208 } 208 }
209 209
210 } // namespace 210 } // namespace
211 211
212 GamepadPlatformDataFetcherWin::GamepadPlatformDataFetcherWin() 212 GamepadPlatformDataFetcherWin::GamepadPlatformDataFetcherWin()
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 WebGamepad* pad) const { 342 WebGamepad* pad) const {
343 DCHECK(pad); 343 DCHECK(pad);
344 TRACE_EVENT1("GAMEPAD", "GetXInputPadConnectivity", "id", i); 344 TRACE_EVENT1("GAMEPAD", "GetXInputPadConnectivity", "id", i);
345 XINPUT_CAPABILITIES caps; 345 XINPUT_CAPABILITIES caps;
346 DWORD res = xinput_get_capabilities_(i, XINPUT_FLAG_GAMEPAD, &caps); 346 DWORD res = xinput_get_capabilities_(i, XINPUT_FLAG_GAMEPAD, &caps);
347 if (res == ERROR_DEVICE_NOT_CONNECTED) { 347 if (res == ERROR_DEVICE_NOT_CONNECTED) {
348 pad->connected = false; 348 pad->connected = false;
349 return false; 349 return false;
350 } else { 350 } else {
351 pad->connected = true; 351 pad->connected = true;
352 base::swprintf(pad->id, 352 swprintf(pad->id,
353 WebGamepad::idLengthCap, 353 WebGamepad::idLengthCap,
354 L"Xbox 360 Controller (XInput STANDARD %ls)", 354 L"Xbox 360 Controller (XInput STANDARD %ls)",
355 GamepadSubTypeName(caps.SubType)); 355 GamepadSubTypeName(caps.SubType));
356 return true; 356 return true;
357 } 357 }
358 } 358 }
359 359
360 void GamepadPlatformDataFetcherWin::GetXInputPadData( 360 void GamepadPlatformDataFetcherWin::GetXInputPadData(
361 int i, 361 int i,
362 WebGamepad* pad) { 362 WebGamepad* pad) {
363 // We rely on device_changed and GetCapabilities to tell us that 363 // We rely on device_changed and GetCapabilities to tell us that
364 // something's been connected, but we will mark as disconnected if 364 // something's been connected, but we will mark as disconnected if
365 // GetState returns that we've lost the pad. 365 // GetState returns that we've lost the pad.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 return false; 481 return false;
482 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>( 482 xinput_get_state_ = reinterpret_cast<XInputGetStateFunc>(
483 xinput_dll_.GetFunctionPointer("XInputGetState")); 483 xinput_dll_.GetFunctionPointer("XInputGetState"));
484 if (!xinput_get_state_) 484 if (!xinput_get_state_)
485 return false; 485 return false;
486 xinput_enable_(true); 486 xinput_enable_(true);
487 return true; 487 return true;
488 } 488 }
489 489
490 } // namespace content 490 } // namespace content
OLDNEW
« no previous file with comments | « base/strings/string_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698