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

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

Issue 2492013005: Mojo C++ bindings: switch device/serial mojom target to use STL types. (Closed)
Patch Set: \ Created 4 years, 1 month 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
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_mac.h" 5 #include "device/serial/serial_device_enumerator_mac.h"
6 6
7 #include <IOKit/serial/IOSerialKeys.h> 7 #include <IOKit/serial/IOSerialKeys.h>
8 #include <IOKit/usb/IOUSBLib.h> 8 #include <IOKit/usb/IOUSBLib.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 uint16_t productId; 130 uint16_t productId;
131 if (GetUInt16Property(scoped_device.get(), CFSTR(kUSBProductID), 131 if (GetUInt16Property(scoped_device.get(), CFSTR(kUSBProductID),
132 &productId)) { 132 &productId)) {
133 callout_info->has_product_id = true; 133 callout_info->has_product_id = true;
134 callout_info->product_id = productId; 134 callout_info->product_id = productId;
135 } 135 }
136 136
137 mojo::String displayName; 137 mojo::String displayName;
138 if (GetStringProperty(scoped_device.get(), CFSTR(kUSBProductString), 138 if (GetStringProperty(scoped_device.get(), CFSTR(kUSBProductString),
139 &displayName)) { 139 &displayName)) {
140 callout_info->display_name = displayName; 140 callout_info->display_name = displayName.PassStorage();
141 } 141 }
142 142
143 // Each serial device has two "paths" in /dev/ associated with it: a 143 // Each serial device has two "paths" in /dev/ associated with it: a
144 // "dialin" path starting with "tty" and a "callout" path starting with 144 // "dialin" path starting with "tty" and a "callout" path starting with
145 // "cu". Each of these is considered a different device from Chrome's 145 // "cu". Each of these is considered a different device from Chrome's
146 // standpoint, but both should share the device's USB properties. 146 // standpoint, but both should share the device's USB properties.
147 mojo::String dialinDevice; 147 mojo::String dialinDevice;
148 if (GetStringProperty(scoped_device.get(), CFSTR(kIODialinDeviceKey), 148 if (GetStringProperty(scoped_device.get(), CFSTR(kIODialinDeviceKey),
149 &dialinDevice)) { 149 &dialinDevice)) {
150 serial::DeviceInfoPtr dialin_info = callout_info.Clone(); 150 serial::DeviceInfoPtr dialin_info = callout_info.Clone();
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 236
237 mojo::Array<mojo::String> paths; 237 mojo::Array<mojo::String> paths;
238 mojo::Array<serial::DeviceInfoPtr> devices; 238 mojo::Array<serial::DeviceInfoPtr> devices;
239 deviceMap.DecomposeMapTo(&paths, &devices); 239 deviceMap.DecomposeMapTo(&paths, &devices);
240 240
241 return devices; 241 return devices;
242 } 242 }
243 243
244 } // namespace device 244 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_device_enumerator_linux.cc ('k') | device/serial/serial_device_enumerator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698