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

Unified Diff: device/hid/hid_service_linux.cc

Issue 161823002: Clean up HID backend and API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: linux headers 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 side-by-side diff with in-line comments
Download patch
Index: device/hid/hid_service_linux.cc
diff --git a/device/hid/hid_service_linux.cc b/device/hid/hid_service_linux.cc
index f02a550e5a9d3822f9c7e8035fcd379499d3807e..f5981ec1b79a8ceca5ba216f83620b4f43c1b055 100644
--- a/device/hid/hid_service_linux.cc
+++ b/device/hid/hid_service_linux.cc
@@ -1,22 +1,18 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <libudev.h>
+#include <stdint.h>
#include <string>
#include <vector>
-#include "base/basictypes.h"
-#include "base/bind.h"
-#include "base/callback.h"
#include "base/logging.h"
-#include "base/memory/scoped_vector.h"
#include "base/platform_file.h"
+#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/strings/string_split.h"
-#include "base/threading/thread_restrictions.h"
-#include "device/hid/hid_connection.h"
#include "device/hid/hid_connection_linux.h"
#include "device/hid/hid_device_info.h"
#include "device/hid/hid_service_linux.h"
@@ -110,14 +106,12 @@ void HidServiceLinux::Enumerate() {
ScopedUdevDevicePtr hid_dev(
udev_device_new_from_syspath(udev_.get(), udev_list_entry_get_name(i)));
if (hid_dev) {
- PlatformDeviceAdd(hid_dev.get());
+ PlatformAddDevice(hid_dev.get());
}
}
-
- initialized_ = true;
}
-void HidServiceLinux::PlatformDeviceAdd(udev_device* device) {
+void HidServiceLinux::PlatformAddDevice(udev_device* device) {
if (!device)
return;
@@ -129,7 +123,7 @@ void HidServiceLinux::PlatformDeviceAdd(udev_device* device) {
HidDeviceInfo device_info;
device_info.device_id = device_id;
- uint32 int_property = 0;
+ uint32_t int_property = 0;
const char* str_property = NULL;
const char* hid_id = udev_device_get_property_value(device, kHIDID);
@@ -161,7 +155,7 @@ void HidServiceLinux::PlatformDeviceAdd(udev_device* device) {
AddDevice(device_info);
}
-void HidServiceLinux::PlatformDeviceRemove(udev_device* raw_dev) {
+void HidServiceLinux::PlatformRemoveDevice(udev_device* raw_dev) {
// The returned the device is not referenced.
udev_device* hid_dev =
udev_device_get_parent_with_subsystem_devtype(raw_dev, "hid", NULL);
@@ -177,7 +171,8 @@ void HidServiceLinux::PlatformDeviceRemove(udev_device* raw_dev) {
RemoveDevice(device_id);
}
-scoped_refptr<HidConnection> HidServiceLinux::Connect(std::string device_id) {
+scoped_refptr<HidConnection> HidServiceLinux::Connect(
+ const std::string& device_id) {
if (!ContainsKey(devices_, device_id))
return NULL;
ScopedUdevDevicePtr hid_device(
@@ -200,9 +195,9 @@ void HidServiceLinux::OnFileCanReadWithoutBlocking(int fd) {
std::string action(udev_device_get_action(dev.get()));
if (action == kUdevActionAdd) {
- PlatformDeviceAdd(dev.get());
+ PlatformAddDevice(dev.get());
} else if (action == kUdevActionRemove) {
- PlatformDeviceRemove(dev.get());
+ PlatformRemoveDevice(dev.get());
}
}

Powered by Google App Engine
This is Rietveld 408576698