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

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

Issue 16917011: mac: Replace base::mac::ScopedCFTypeRef with base::ScopedCFTypeRef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with fixed off-by-1 in git-clang-format Created 7 years, 6 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 | Annotate | Revision Log
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/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 associated_[slot].hid.mapper ? "STANDARD GAMEPAD " : "", 262 associated_[slot].hid.mapper ? "STANDARD GAMEPAD " : "",
263 vendor_int, 263 vendor_int,
264 product_int]; 264 product_int];
265 NSData* as16 = [ident dataUsingEncoding:NSUTF16LittleEndianStringEncoding]; 265 NSData* as16 = [ident dataUsingEncoding:NSUTF16LittleEndianStringEncoding];
266 266
267 const size_t kOutputLengthBytes = sizeof(data_.items[slot].id); 267 const size_t kOutputLengthBytes = sizeof(data_.items[slot].id);
268 memset(&data_.items[slot].id, 0, kOutputLengthBytes); 268 memset(&data_.items[slot].id, 0, kOutputLengthBytes);
269 [as16 getBytes:data_.items[slot].id 269 [as16 getBytes:data_.items[slot].id
270 length:kOutputLengthBytes - sizeof(WebKit::WebUChar)]; 270 length:kOutputLengthBytes - sizeof(WebKit::WebUChar)];
271 271
272 base::mac::ScopedCFTypeRef<CFArrayRef> elements( 272 base::ScopedCFTypeRef<CFArrayRef> elements(
273 IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone)); 273 IOHIDDeviceCopyMatchingElements(device, NULL, kIOHIDOptionsTypeNone));
274 AddButtonsAndAxes(CFToNSCast(elements), slot); 274 AddButtonsAndAxes(CFToNSCast(elements), slot);
275 275
276 associated_[slot].hid.device_ref = device; 276 associated_[slot].hid.device_ref = device;
277 data_.items[slot].connected = true; 277 data_.items[slot].connected = true;
278 if (slot >= data_.length) 278 if (slot >= data_.length)
279 data_.length = slot + 1; 279 data_.length = slot + 1;
280 } 280 }
281 281
282 void GamepadPlatformDataFetcherMac::DeviceRemove(IOHIDDeviceRef device) { 282 void GamepadPlatformDataFetcherMac::DeviceRemove(IOHIDDeviceRef device) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 pads->length = WebGamepads::itemsLengthCap; 432 pads->length = WebGamepads::itemsLengthCap;
433 for (size_t i = 0; i < WebGamepads::itemsLengthCap; ++i) { 433 for (size_t i = 0; i < WebGamepads::itemsLengthCap; ++i) {
434 if (!associated_[i].is_xbox && associated_[i].hid.mapper) 434 if (!associated_[i].is_xbox && associated_[i].hid.mapper)
435 associated_[i].hid.mapper(data_.items[i], &pads->items[i]); 435 associated_[i].hid.mapper(data_.items[i], &pads->items[i]);
436 else 436 else
437 pads->items[i] = data_.items[i]; 437 pads->items[i] = data_.items[i];
438 } 438 }
439 } 439 }
440 440
441 } // namespace content 441 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gamepad/gamepad_platform_data_fetcher_mac.h ('k') | content/browser/gamepad/xbox_data_fetcher_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698