GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / device / serial / serial_device_enumerator_win.cc
blob124c6b720466909d811e86384d65f2c616de8596
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
3 // found in the LICENSE file.
5 #include "device/serial/serial_device_enumerator_win.h"
7 #include <windows.h>
9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h"
13 #include "base/win/registry.h"
15 namespace device {
17 // static
18 scoped_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create() {
19 return scoped_ptr<SerialDeviceEnumerator>(new SerialDeviceEnumeratorWin());
22 SerialDeviceEnumeratorWin::SerialDeviceEnumeratorWin() {}
24 SerialDeviceEnumeratorWin::~SerialDeviceEnumeratorWin() {}
26 // TODO(rockot): Query the system for more information than just device paths.
27 // This may or may not require using a different strategy than scanning the
28 // registry location below.
29 mojo::Array<serial::DeviceInfoPtr> SerialDeviceEnumeratorWin::GetDevices() {
30 base::win::RegistryValueIterator iter_key(
31 HKEY_LOCAL_MACHINE, L"HARDWARE\\DEVICEMAP\\SERIALCOMM\\");
32 mojo::Array<serial::DeviceInfoPtr> devices(0);
33 for (; iter_key.Valid(); ++iter_key) {
34 serial::DeviceInfoPtr info(serial::DeviceInfo::New());
35 info->path = base::UTF16ToASCII(iter_key.Value());
36 devices.push_back(info.Pass());
38 return devices.Pass();
41 } // namespace device