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

Unified Diff: device/usb/mojo/device_manager_impl.cc

Issue 2234443002: Mojo C++ binding: make device/usb mojom targets use STD string/vector types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move the vector converter into a private header. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: device/usb/mojo/device_manager_impl.cc
diff --git a/device/usb/mojo/device_manager_impl.cc b/device/usb/mojo/device_manager_impl.cc
index 89f642fc8327cf6577e8ae7761869de63a04c9dc..0b71c390922cb9791e367c8d1cdcf05488313c60 100644
--- a/device/usb/mojo/device_manager_impl.cc
+++ b/device/usb/mojo/device_manager_impl.cc
@@ -18,6 +18,7 @@
#include "device/usb/usb_device.h"
#include "device/usb/usb_device_filter.h"
#include "device/usb/usb_service.h"
+#include "mojo/common/common_type_converters.h"
#include "mojo/public/cpp/bindings/array.h"
#include "mojo/public/cpp/bindings/interface_request.h"
@@ -63,7 +64,7 @@ void DeviceManagerImpl::GetDevices(EnumerationOptionsPtr options,
}
void DeviceManagerImpl::GetDevice(
- const mojo::String& guid,
+ const std::string& guid,
mojo::InterfaceRequest<Device> device_request) {
scoped_refptr<UsbDevice> device = usb_service_->GetDevice(guid);
if (!device)
@@ -85,10 +86,10 @@ void DeviceManagerImpl::OnGetDevices(
const GetDevicesCallback& callback,
const std::vector<scoped_refptr<UsbDevice>>& devices) {
std::vector<UsbDeviceFilter> filters;
- if (options)
- filters = options->filters.To<std::vector<UsbDeviceFilter>>();
+ if (options && options->filters)
+ filters = mojo::ConvertTo<std::vector<UsbDeviceFilter>>(*options->filters);
- mojo::Array<DeviceInfoPtr> device_infos;
+ std::vector<DeviceInfoPtr> device_infos;
for (const auto& device : devices) {
if (filters.empty() || UsbDeviceFilter::MatchesAny(device, filters)) {
if (permission_provider_ &&

Powered by Google App Engine
This is Rietveld 408576698