| 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.h" | 5 #include "device/hid/hid_service.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 HidService::HidService() : enumeration_ready_(false) { | 85 HidService::HidService() : enumeration_ready_(false) { |
| 86 } | 86 } |
| 87 | 87 |
| 88 HidService::~HidService() { | 88 HidService::~HidService() { |
| 89 DCHECK(thread_checker_.CalledOnValidThread()); | 89 DCHECK(thread_checker_.CalledOnValidThread()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void HidService::AddDevice(scoped_refptr<HidDeviceInfo> device_info) { | 92 void HidService::AddDevice(scoped_refptr<HidDeviceInfo> device_info) { |
| 93 DCHECK(thread_checker_.CalledOnValidThread()); | 93 DCHECK(thread_checker_.CalledOnValidThread()); |
| 94 if (!ContainsKey(devices_, device_info->device_id())) { | 94 if (!base::ContainsKey(devices_, device_info->device_id())) { |
| 95 devices_[device_info->device_id()] = device_info; | 95 devices_[device_info->device_id()] = device_info; |
| 96 | 96 |
| 97 HID_LOG(USER) << "HID device " | 97 HID_LOG(USER) << "HID device " |
| 98 << (enumeration_ready_ ? "added" : "detected") | 98 << (enumeration_ready_ ? "added" : "detected") |
| 99 << ": vendorId=" << device_info->vendor_id() | 99 << ": vendorId=" << device_info->vendor_id() |
| 100 << ", productId=" << device_info->product_id() << ", name='" | 100 << ", productId=" << device_info->product_id() << ", name='" |
| 101 << device_info->product_name() << "', serial='" | 101 << device_info->product_name() << "', serial='" |
| 102 << device_info->serial_number() << "', deviceId='" | 102 << device_info->serial_number() << "', deviceId='" |
| 103 << device_info->device_id() << "'"; | 103 << device_info->device_id() << "'"; |
| 104 | 104 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 for (const GetDevicesCallback& callback : pending_enumerations_) { | 138 for (const GetDevicesCallback& callback : pending_enumerations_) { |
| 139 callback.Run(devices); | 139 callback.Run(devices); |
| 140 } | 140 } |
| 141 pending_enumerations_.clear(); | 141 pending_enumerations_.clear(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace device | 145 } // namespace device |
| OLD | NEW |