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

Side by Side Diff: device/serial/serial_device_enumerator_linux.cc

Issue 1874313002: Convert device to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 | « device/serial/serial_device_enumerator.h ('k') | device/serial/serial_device_enumerator_mac.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/serial/serial_device_enumerator_linux.h" 5 #include "device/serial/serial_device_enumerator_linux.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8
9 #include <memory>
8 #include <utility> 10 #include <utility>
9 11
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
12 14
13 namespace device { 15 namespace device {
14 16
15 namespace { 17 namespace {
16 18
17 const char kSerialSubsystem[] = "tty"; 19 const char kSerialSubsystem[] = "tty";
18 20
19 const char kHostPathKey[] = "DEVNAME"; 21 const char kHostPathKey[] = "DEVNAME";
20 const char kHostBusKey[] = "ID_BUS"; 22 const char kHostBusKey[] = "ID_BUS";
21 const char kVendorIDKey[] = "ID_VENDOR_ID"; 23 const char kVendorIDKey[] = "ID_VENDOR_ID";
22 const char kProductIDKey[] = "ID_MODEL_ID"; 24 const char kProductIDKey[] = "ID_MODEL_ID";
23 const char kProductNameKey[] = "ID_MODEL"; 25 const char kProductNameKey[] = "ID_MODEL";
24 26
25 } // namespace 27 } // namespace
26 28
27 // static 29 // static
28 scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() { 30 std::unique_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() {
29 return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorLinux()); 31 return std::unique_ptr<SerialDeviceEnumerator>(
32 new SerialDeviceEnumeratorLinux());
30 } 33 }
31 34
32 SerialDeviceEnumeratorLinux::SerialDeviceEnumeratorLinux() { 35 SerialDeviceEnumeratorLinux::SerialDeviceEnumeratorLinux() {
33 udev_.reset(udev_new()); 36 udev_.reset(udev_new());
34 } 37 }
35 38
36 SerialDeviceEnumeratorLinux::~SerialDeviceEnumeratorLinux() {} 39 SerialDeviceEnumeratorLinux::~SerialDeviceEnumeratorLinux() {}
37 40
38 mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorLinux::GetDevices() { 41 mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorLinux::GetDevices() {
39 mojo::Array<serial::DeviceInfoPtr> devices; 42 mojo::Array<serial::DeviceInfoPtr> devices;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 88 }
86 if (product_name) 89 if (product_name)
87 info->display_name = product_name; 90 info->display_name = product_name;
88 devices.push_back(std::move(info)); 91 devices.push_back(std::move(info));
89 } 92 }
90 } 93 }
91 return devices; 94 return devices;
92 } 95 }
93 96
94 } // namespace device 97 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_device_enumerator.h ('k') | device/serial/serial_device_enumerator_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698