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

Unified Diff: device/serial/serial_device_enumerator_win.cc

Issue 311313002: Convert SerialDeviceInfo to a Mojo struct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: device/serial/serial_device_enumerator_win.cc
diff --git a/device/serial/serial_device_enumerator_win.cc b/device/serial/serial_device_enumerator_win.cc
index a45a609e7c6e02362c7eef8a3244cb7119408839..46fe6d6808c0761faa420e89e419a4086fd6fbe4 100644
--- a/device/serial/serial_device_enumerator_win.cc
+++ b/device/serial/serial_device_enumerator_win.cc
@@ -6,7 +6,6 @@
#include <windows.h>
-#include "base/memory/linked_ptr.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
@@ -27,17 +26,16 @@ SerialDeviceEnumeratorWin::~SerialDeviceEnumeratorWin() {}
// TODO(rockot): Query the system for more information than just device paths.
// This may or may not require using a different strategy than scanning the
// registry location below.
-void SerialDeviceEnumeratorWin::GetDevices(SerialDeviceInfoList* devices) {
- devices->clear();
-
+mojo::Array<SerialDeviceInfoPtr> SerialDeviceEnumeratorWin::GetDevices() {
base::win::RegistryValueIterator iter_key(
HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\SERIALCOMM\\");
+ mojo::Array<SerialDeviceInfoPtr> devices;
for (; iter_key.Valid(); ++iter_key) {
- base::string16 value(iter_key.Value());
- linked_ptr<SerialDeviceInfo> info(new SerialDeviceInfo);
- info->path = base::UTF16ToASCII(value);
- devices->push_back(info);
+ SerialDeviceInfoPtr info(SerialDeviceInfo::New());
+ info->path = mojo::String::From(base::UTF16ToASCII(iter_key.Value()));
darin (slow to review) 2014/06/16 16:59:19 nit: mojo::String::From(..) is unnecessary here
Sam McNally 2014/06/17 07:07:20 Done.
+ devices.push_back(info.Pass());
}
+ return devices.Pass();
}
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698