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

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

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | gin/modules/file_module_provider.cc » ('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 <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 udev_device* parent = udev_device_get_parent(device); 105 udev_device* parent = udev_device_get_parent(device);
106 if (!parent) { 106 if (!parent) {
107 return; 107 return;
108 } 108 }
109 109
110 const char* hid_id = udev_device_get_property_value(parent, kHIDID); 110 const char* hid_id = udev_device_get_property_value(parent, kHIDID);
111 if (!hid_id) { 111 if (!hid_id) {
112 return; 112 return;
113 } 113 }
114 114
115 std::vector<std::string> parts; 115 std::vector<std::string> parts = base::SplitString(
116 base::SplitString(hid_id, ':', &parts); 116 hid_id, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
117 if (parts.size() != 3) { 117 if (parts.size() != 3) {
118 return; 118 return;
119 } 119 }
120 120
121 uint32_t int_property = 0; 121 uint32_t int_property = 0;
122 if (!HexStringToUInt(base::StringPiece(parts[1]), &int_property) || 122 if (!HexStringToUInt(base::StringPiece(parts[1]), &int_property) ||
123 int_property > std::numeric_limits<uint16_t>::max()) { 123 int_property > std::numeric_limits<uint16_t>::max()) {
124 return; 124 return;
125 } 125 }
126 uint16_t vendor_id = int_property; 126 uint16_t vendor_id = int_property;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 // static 330 // static
331 void HidServiceLinux::CreateConnection(scoped_ptr<ConnectParams> params) { 331 void HidServiceLinux::CreateConnection(scoped_ptr<ConnectParams> params) {
332 DCHECK(params->device_file.IsValid()); 332 DCHECK(params->device_file.IsValid());
333 params->callback.Run(make_scoped_refptr( 333 params->callback.Run(make_scoped_refptr(
334 new HidConnectionLinux(params->device_info, params->device_file.Pass(), 334 new HidConnectionLinux(params->device_info, params->device_file.Pass(),
335 params->file_task_runner))); 335 params->file_task_runner)));
336 } 336 }
337 337
338 } // namespace device 338 } // namespace device
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | gin/modules/file_module_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698