OLD | NEW |
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/IOHIDManager.h> | 8 #include <IOKit/hid/IOHIDManager.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 top_level_collections->push_back(collection_info); | 140 top_level_collections->push_back(collection_info); |
141 } | 141 } |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 } // namespace | 145 } // namespace |
146 | 146 |
147 HidServiceMac::HidServiceMac() { | 147 HidServiceMac::HidServiceMac() { |
148 DCHECK(thread_checker_.CalledOnValidThread()); | 148 DCHECK(thread_checker_.CalledOnValidThread()); |
149 message_loop_ = base::MessageLoopProxy::current(); | 149 message_loop_ = base::MessageLoopProxy::current(); |
150 DCHECK(message_loop_); | 150 DCHECK(message_loop_.get()); |
151 hid_manager_.reset(IOHIDManagerCreate(NULL, 0)); | 151 hid_manager_.reset(IOHIDManagerCreate(NULL, 0)); |
152 if (!hid_manager_) { | 152 if (!hid_manager_) { |
153 LOG(ERROR) << "Failed to initialize HidManager"; | 153 LOG(ERROR) << "Failed to initialize HidManager"; |
154 return; | 154 return; |
155 } | 155 } |
156 DCHECK(CFGetTypeID(hid_manager_) == IOHIDManagerGetTypeID()); | 156 DCHECK(CFGetTypeID(hid_manager_) == IOHIDManagerGetTypeID()); |
157 IOHIDManagerOpen(hid_manager_, kIOHIDOptionsTypeNone); | 157 IOHIDManagerOpen(hid_manager_, kIOHIDOptionsTypeNone); |
158 IOHIDManagerSetDeviceMatching(hid_manager_, NULL); | 158 IOHIDManagerSetDeviceMatching(hid_manager_, NULL); |
159 | 159 |
160 // Enumerate all the currently known devices. | 160 // Enumerate all the currently known devices. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 scoped_refptr<HidConnection> HidServiceMac::Connect( | 270 scoped_refptr<HidConnection> HidServiceMac::Connect( |
271 const HidDeviceId& device_id) { | 271 const HidDeviceId& device_id) { |
272 DCHECK(thread_checker_.CalledOnValidThread()); | 272 DCHECK(thread_checker_.CalledOnValidThread()); |
273 HidDeviceInfo device_info; | 273 HidDeviceInfo device_info; |
274 if (!GetDeviceInfo(device_id, &device_info)) | 274 if (!GetDeviceInfo(device_id, &device_info)) |
275 return NULL; | 275 return NULL; |
276 return scoped_refptr<HidConnection>(new HidConnectionMac(device_info)); | 276 return scoped_refptr<HidConnection>(new HidConnectionMac(device_info)); |
277 } | 277 } |
278 | 278 |
279 } // namespace device | 279 } // namespace device |
OLD | NEW |