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

Side by Side Diff: device/hid/hid_service_linux.cc

Issue 1542163002: Switch to standard integer types in device/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 5 years 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 unified diff | Download patch
« no previous file with comments | « device/hid/hid_service_linux.h ('k') | device/hid/hid_service_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_linux.h" 5 #include "device/hid/hid_service_linux.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stdint.h>
8 #include <limits> 9 #include <limits>
9 #include <string> 10 #include <string>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/files/file.h" 13 #include "base/files/file.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
15 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/macros.h"
16 #include "base/scoped_observer.h" 18 #include "base/scoped_observer.h"
17 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
19 #include "base/thread_task_runner_handle.h" 21 #include "base/thread_task_runner_handle.h"
20 #include "base/threading/thread_restrictions.h" 22 #include "base/threading/thread_restrictions.h"
23 #include "build/build_config.h"
21 #include "components/device_event_log/device_event_log.h" 24 #include "components/device_event_log/device_event_log.h"
22 #include "device/hid/device_monitor_linux.h" 25 #include "device/hid/device_monitor_linux.h"
23 #include "device/hid/hid_connection_linux.h" 26 #include "device/hid/hid_connection_linux.h"
24 #include "device/hid/hid_device_info_linux.h" 27 #include "device/hid/hid_device_info_linux.h"
25 #include "device/udev_linux/scoped_udev.h" 28 #include "device/udev_linux/scoped_udev.h"
26 29
27 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
28 #include "base/sys_info.h" 31 #include "base/sys_info.h"
29 #include "chromeos/dbus/dbus_thread_manager.h" 32 #include "chromeos/dbus/dbus_thread_manager.h"
30 #include "chromeos/dbus/permission_broker_client.h" 33 #include "chromeos/dbus/permission_broker_client.h"
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 std::string report_descriptor_str; 166 std::string report_descriptor_str;
164 if (!base::ReadFileToString(report_descriptor_path, 167 if (!base::ReadFileToString(report_descriptor_path,
165 &report_descriptor_str)) { 168 &report_descriptor_str)) {
166 return; 169 return;
167 } 170 }
168 171
169 scoped_refptr<HidDeviceInfo> device_info(new HidDeviceInfoLinux( 172 scoped_refptr<HidDeviceInfo> device_info(new HidDeviceInfoLinux(
170 device_id, device_node, vendor_id, product_id, product_name, 173 device_id, device_node, vendor_id, product_id, product_name,
171 serial_number, 174 serial_number,
172 kHIDBusTypeUSB, // TODO(reillyg): Detect Bluetooth. crbug.com/443335 175 kHIDBusTypeUSB, // TODO(reillyg): Detect Bluetooth. crbug.com/443335
173 std::vector<uint8>(report_descriptor_str.begin(), 176 std::vector<uint8_t>(report_descriptor_str.begin(),
174 report_descriptor_str.end()))); 177 report_descriptor_str.end())));
175 178
176 task_runner_->PostTask(FROM_HERE, base::Bind(&HidServiceLinux::AddDevice, 179 task_runner_->PostTask(FROM_HERE, base::Bind(&HidServiceLinux::AddDevice,
177 service_, device_info)); 180 service_, device_info));
178 } 181 }
179 182
180 void OnDeviceRemoved(udev_device* device) override { 183 void OnDeviceRemoved(udev_device* device) override {
181 DCHECK(thread_checker_.CalledOnValidThread()); 184 DCHECK(thread_checker_.CalledOnValidThread());
182 const char* device_path = udev_device_get_syspath(device); 185 const char* device_path = udev_device_get_syspath(device);
183 if (device_path) { 186 if (device_path) {
184 task_runner_->PostTask( 187 task_runner_->PostTask(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 333
331 // static 334 // static
332 void HidServiceLinux::CreateConnection(scoped_ptr<ConnectParams> params) { 335 void HidServiceLinux::CreateConnection(scoped_ptr<ConnectParams> params) {
333 DCHECK(params->device_file.IsValid()); 336 DCHECK(params->device_file.IsValid());
334 params->callback.Run(make_scoped_refptr( 337 params->callback.Run(make_scoped_refptr(
335 new HidConnectionLinux(params->device_info, params->device_file.Pass(), 338 new HidConnectionLinux(params->device_info, params->device_file.Pass(),
336 params->file_task_runner))); 339 params->file_task_runner)));
337 } 340 }
338 341
339 } // namespace device 342 } // namespace device
OLDNEW
« no previous file with comments | « device/hid/hid_service_linux.h ('k') | device/hid/hid_service_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698