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

Side by Side Diff: device/hid/hid_service_mac.cc

Issue 2230083003: device: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "device/hid/hid_service_mac.h" 5 #include "device/hid/hid_service_mac.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <IOKit/hid/IOHIDDevice.h> 8 #include <IOKit/hid/IOHIDDevice.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 68
69 bool TryGetHidDataProperty(IOHIDDeviceRef device, 69 bool TryGetHidDataProperty(IOHIDDeviceRef device,
70 CFStringRef key, 70 CFStringRef key,
71 std::vector<uint8_t>* result) { 71 std::vector<uint8_t>* result) {
72 CFDataRef ref = 72 CFDataRef ref =
73 base::mac::CFCast<CFDataRef>(IOHIDDeviceGetProperty(device, key)); 73 base::mac::CFCast<CFDataRef>(IOHIDDeviceGetProperty(device, key));
74 if (!ref) { 74 if (!ref) {
75 return false; 75 return false;
76 } 76 }
77 STLClearObject(result); 77 base::STLClearObject(result);
78 const uint8_t* bytes = CFDataGetBytePtr(ref); 78 const uint8_t* bytes = CFDataGetBytePtr(ref);
79 result->insert(result->begin(), bytes, bytes + CFDataGetLength(ref)); 79 result->insert(result->begin(), bytes, bytes + CFDataGetLength(ref));
80 return true; 80 return true;
81 } 81 }
82 82
83 } // namespace 83 } // namespace
84 84
85 HidServiceMac::HidServiceMac( 85 HidServiceMac::HidServiceMac(
86 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) 86 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
87 : file_task_runner_(file_task_runner) { 87 : file_task_runner_(file_task_runner) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 return new HidDeviceInfo( 261 return new HidDeviceInfo(
262 entry_id, GetHidIntProperty(hid_device, CFSTR(kIOHIDVendorIDKey)), 262 entry_id, GetHidIntProperty(hid_device, CFSTR(kIOHIDVendorIDKey)),
263 GetHidIntProperty(hid_device, CFSTR(kIOHIDProductIDKey)), 263 GetHidIntProperty(hid_device, CFSTR(kIOHIDProductIDKey)),
264 GetHidStringProperty(hid_device, CFSTR(kIOHIDProductKey)), 264 GetHidStringProperty(hid_device, CFSTR(kIOHIDProductKey)),
265 GetHidStringProperty(hid_device, CFSTR(kIOHIDSerialNumberKey)), 265 GetHidStringProperty(hid_device, CFSTR(kIOHIDSerialNumberKey)),
266 kHIDBusTypeUSB, // TODO(reillyg): Detect Bluetooth. crbug.com/443335 266 kHIDBusTypeUSB, // TODO(reillyg): Detect Bluetooth. crbug.com/443335
267 report_descriptor); 267 report_descriptor);
268 } 268 }
269 269
270 } // namespace device 270 } // namespace device
OLDNEW
« no previous file with comments | « device/hid/hid_service.cc ('k') | device/media_transfer_protocol/media_transfer_protocol_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698