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

Unified Diff: device/hid/hid_service.cc

Issue 947663002: Log device/hid messages to chrome://device-log. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: device/hid/hid_service.cc
diff --git a/device/hid/hid_service.cc b/device/hid/hid_service.cc
index 8f502dfc7e69b97645edb2171152275bccaec2ee..4b824ff991fab927ad10a2f35738fb255e4ab187 100644
--- a/device/hid/hid_service.cc
+++ b/device/hid/hid_service.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "base/stl_util.h"
+#include "components/device_event_log/device_event_log.h"
#if defined(OS_LINUX) && defined(USE_UDEV)
#include "device/hid/hid_service_linux.h"
@@ -103,6 +104,12 @@ void HidService::AddDevice(scoped_refptr<HidDeviceInfo> device_info) {
if (!ContainsKey(devices_, device_info->device_id())) {
devices_[device_info->device_id()] = device_info;
+ HID_LOG(USER) << "HID device "
+ << (enumeration_ready_ ? "added" : "detected")
+ << ": vendorId = " << device_info->vendor_id()
+ << ", productId = " << device_info->product_id()
+ << ", deviceId = '" << device_info->device_id() << "'";
+
if (enumeration_ready_) {
FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceAdded(device_info));
}
@@ -113,6 +120,8 @@ void HidService::RemoveDevice(const HidDeviceId& device_id) {
DCHECK(thread_checker_.CalledOnValidThread());
DeviceMap::iterator it = devices_.find(device_id);
if (it != devices_.end()) {
+ HID_LOG(USER) << "HID device removed: deviceId = '" << device_id << "'";
+
if (enumeration_ready_) {
FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(it->second));
}

Powered by Google App Engine
This is Rietveld 408576698