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

Side by Side Diff: device/usb/public/interfaces/device_manager_struct_traits.h

Issue 2821723002: Move classes in the device.usb Mojo namespace to device.mojom (Closed)
Patch Set: fix usb_descriptors_fuzzer Created 3 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef DEVICE_USB_PUBLIC_INTERFACES_DEVICE_MANAGER_STRUCT_TRAITS_H_ 5 #ifndef DEVICE_USB_PUBLIC_INTERFACES_DEVICE_MANAGER_STRUCT_TRAITS_H_
6 #define DEVICE_USB_PUBLIC_INTERFACES_DEVICE_MANAGER_STRUCT_TRAITS_H_ 6 #define DEVICE_USB_PUBLIC_INTERFACES_DEVICE_MANAGER_STRUCT_TRAITS_H_
7 7
8 #include "device/usb/public/interfaces/device_manager.mojom.h" 8 #include "device/usb/public/interfaces/device_manager.mojom.h"
9 #include "device/usb/usb_device_filter.h" 9 #include "device/usb/usb_device_filter.h"
10 10
11 namespace mojo { 11 namespace mojo {
12 12
13 template <> 13 template <>
14 struct StructTraits<device::usb::DeviceFilterDataView, 14 struct StructTraits<device::mojom::UsbDeviceFilterDataView,
15 device::UsbDeviceFilter> { 15 device::UsbDeviceFilter> {
16 static bool has_vendor_id(const device::UsbDeviceFilter& filter) { 16 static bool has_vendor_id(const device::UsbDeviceFilter& filter) {
17 return filter.vendor_id.has_value(); 17 return filter.vendor_id.has_value();
18 } 18 }
19 19
20 static uint16_t vendor_id(const device::UsbDeviceFilter& filter) { 20 static uint16_t vendor_id(const device::UsbDeviceFilter& filter) {
21 return filter.vendor_id.value_or(0); 21 return filter.vendor_id.value_or(0);
22 } 22 }
23 23
24 static bool has_product_id(const device::UsbDeviceFilter& filter) { 24 static bool has_product_id(const device::UsbDeviceFilter& filter) {
(...skipping 26 matching lines...) Expand all
51 51
52 static uint8_t protocol_code(const device::UsbDeviceFilter& filter) { 52 static uint8_t protocol_code(const device::UsbDeviceFilter& filter) {
53 return filter.interface_protocol.value_or(0); 53 return filter.interface_protocol.value_or(0);
54 } 54 }
55 55
56 static const base::Optional<std::string>& serial_number( 56 static const base::Optional<std::string>& serial_number(
57 const device::UsbDeviceFilter& filter) { 57 const device::UsbDeviceFilter& filter) {
58 return filter.serial_number; 58 return filter.serial_number;
59 } 59 }
60 60
61 static bool Read(device::usb::DeviceFilterDataView input, 61 static bool Read(device::mojom::UsbDeviceFilterDataView input,
62 device::UsbDeviceFilter* output); 62 device::UsbDeviceFilter* output);
63 }; 63 };
64 64
65 } // namespace mojo 65 } // namespace mojo
66 66
67 #endif // DEVICE_USB_PUBLIC_INTERFACES_DEVICE_MANAGER_STRUCT_TRAITS_H_ 67 #endif // DEVICE_USB_PUBLIC_INTERFACES_DEVICE_MANAGER_STRUCT_TRAITS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698