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

Side by Side Diff: trunk/src/device/hid/hid_utils_mac.cc

Issue 148183015: Revert 247926 "HID backend" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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
« no previous file with comments | « trunk/src/device/hid/hid_utils_mac.h ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/hid/hid_utils_mac.h"
6
7 #include "base/basictypes.h"
8 #include "base/logging.h"
9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h"
11
12 #if defined(OS_MACOSX)
13 #include <CoreFoundation/CoreFoundation.h>
14 #include <IOKit/hid/IOHIDManager.h>
15 #endif
16
17 namespace device {
18
19 bool GetHidIntProperty(IOHIDDeviceRef device,
20 CFStringRef key,
21 int32_t* result) {
22 CFNumberRef ref = base::mac::CFCast<CFNumberRef>(
23 IOHIDDeviceGetProperty(device, key));
24 return ref && CFNumberGetValue(ref, kCFNumberSInt32Type, result);
25 }
26
27 bool GetHidStringProperty(IOHIDDeviceRef device,
28 CFStringRef key,
29 std::string* result) {
30 CFStringRef ref = base::mac::CFCast<CFStringRef>(
31 IOHIDDeviceGetProperty(device, key));
32 if (!ref) {
33 return false;
34 }
35 *result = base::SysCFStringRefToUTF8(ref);
36 return true;
37 }
38
39 } // namespace device
OLDNEW
« no previous file with comments | « trunk/src/device/hid/hid_utils_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698