| Index: device/hid/hid_service_win.cc
|
| diff --git a/device/hid/hid_service_win.cc b/device/hid/hid_service_win.cc
|
| index cf9db15bf30901d85adb4c5e76ca6cc111dd1a8e..4133f765eeea5558c8e055b1e6fc37c5d42a1805 100644
|
| --- a/device/hid/hid_service_win.cc
|
| +++ b/device/hid/hid_service_win.cc
|
| @@ -1,20 +1,15 @@
|
| -// 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 "device/hid/hid_service_win.h"
|
|
|
| #include <cstdlib>
|
| -#include <string>
|
|
|
| -#include "base/callback_helpers.h"
|
| -#include "base/lazy_instance.h"
|
| -#include "base/memory/scoped_ptr.h"
|
| #include "base/stl_util.h"
|
| #include "base/strings/sys_string_conversions.h"
|
| -#include "device/hid/hid_connection.h"
|
| #include "device/hid/hid_connection_win.h"
|
| -#include "device/hid/hid_service.h"
|
| +#include "device/hid/hid_device_info.h"
|
| #include "net/base/io_buffer.h"
|
|
|
| #if defined(OS_WIN)
|
| @@ -48,12 +43,11 @@ const char kHIDClass[] = "HIDClass";
|
|
|
| } // namespace
|
|
|
| -HidServiceWin::HidServiceWin() {
|
| - initialized_ = Enumerate();
|
| -}
|
| +HidServiceWin::HidServiceWin() { Enumerate(); }
|
| +
|
| HidServiceWin::~HidServiceWin() {}
|
|
|
| -bool HidServiceWin::Enumerate() {
|
| +void HidServiceWin::Enumerate() {
|
| BOOL res;
|
| HDEVINFO device_info_set;
|
| SP_DEVINFO_DATA devinfo_data;
|
| @@ -70,7 +64,7 @@ bool HidServiceWin::Enumerate() {
|
| DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
|
|
|
| if (device_info_set == INVALID_HANDLE_VALUE)
|
| - return false;
|
| + return;
|
|
|
| for (int device_index = 0;
|
| SetupDiEnumDeviceInterfaces(device_info_set,
|
| @@ -131,7 +125,7 @@ bool HidServiceWin::Enumerate() {
|
| sizeof(driver_name) - 1,
|
| NULL);
|
| if (res) {
|
| - // Found the drive.
|
| + // Found the driver.
|
| break;
|
| }
|
| }
|
| @@ -142,11 +136,9 @@ bool HidServiceWin::Enumerate() {
|
|
|
| PlatformAddDevice(device_interface_detail_data->DevicePath);
|
| }
|
| -
|
| - return true;
|
| }
|
|
|
| -void HidServiceWin::PlatformAddDevice(std::string device_path) {
|
| +void HidServiceWin::PlatformAddDevice(const std::string& device_path) {
|
| HidDeviceInfo device_info;
|
| device_info.device_id = device_path;
|
|
|
| @@ -217,7 +209,7 @@ void HidServiceWin::PlatformAddDevice(std::string device_path) {
|
| HidService::AddDevice(device_info);
|
| }
|
|
|
| -void HidServiceWin::PlatformRemoveDevice(std::string device_path) {
|
| +void HidServiceWin::PlatformRemoveDevice(const std::string& device_path) {
|
| HidService::RemoveDevice(device_path);
|
| }
|
|
|
| @@ -226,7 +218,8 @@ void HidServiceWin::GetDevices(std::vector<HidDeviceInfo>* devices) {
|
| HidService::GetDevices(devices);
|
| }
|
|
|
| -scoped_refptr<HidConnection> HidServiceWin::Connect(std::string device_id) {
|
| +scoped_refptr<HidConnection> HidServiceWin::Connect(
|
| + const std::string& device_id) {
|
| if (!ContainsKey(devices_, device_id)) return NULL;
|
| scoped_refptr<HidConnectionWin> connection(
|
| new HidConnectionWin(devices_[device_id]));
|
|
|