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

Side by Side Diff: device/usb/usb_device.cc

Issue 1857033002: Include USB device version in chrome.usb.Device fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 4 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
« no previous file with comments | « device/usb/usb_device.h ('k') | device/usb/usb_device_android.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/usb/usb_device.h" 5 #include "device/usb/usb_device.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "device/usb/webusb_descriptors.h" 8 #include "device/usb/webusb_descriptors.h"
9 9
10 namespace device { 10 namespace device {
11 11
12 UsbDevice::Observer::~Observer() {} 12 UsbDevice::Observer::~Observer() {}
13 13
14 void UsbDevice::Observer::OnDeviceRemoved(scoped_refptr<UsbDevice> device) {} 14 void UsbDevice::Observer::OnDeviceRemoved(scoped_refptr<UsbDevice> device) {}
15 15
16 UsbDevice::UsbDevice(uint16_t vendor_id, 16 UsbDevice::UsbDevice(uint16_t usb_version,
17 uint8_t device_class,
18 uint8_t device_subclass,
19 uint8_t device_protocol,
20 uint16_t vendor_id,
17 uint16_t product_id, 21 uint16_t product_id,
22 uint16_t device_version,
18 const base::string16& manufacturer_string, 23 const base::string16& manufacturer_string,
19 const base::string16& product_string, 24 const base::string16& product_string,
20 const base::string16& serial_number) 25 const base::string16& serial_number)
21 : manufacturer_string_(manufacturer_string), 26 : manufacturer_string_(manufacturer_string),
22 product_string_(product_string), 27 product_string_(product_string),
23 serial_number_(serial_number), 28 serial_number_(serial_number),
24 guid_(base::GenerateGUID()), 29 guid_(base::GenerateGUID()),
30 usb_version_(usb_version),
31 device_class_(device_class),
32 device_subclass_(device_subclass),
33 device_protocol_(device_protocol),
25 vendor_id_(vendor_id), 34 vendor_id_(vendor_id),
26 product_id_(product_id) {} 35 product_id_(product_id),
36 device_version_(device_version) {}
27 37
28 UsbDevice::~UsbDevice() { 38 UsbDevice::~UsbDevice() {
29 } 39 }
30 40
31 void UsbDevice::CheckUsbAccess(const ResultCallback& callback) { 41 void UsbDevice::CheckUsbAccess(const ResultCallback& callback) {
32 // By default assume that access to the device is allowed. This is implemented 42 // By default assume that access to the device is allowed. This is implemented
33 // on Chrome OS by checking with permission_broker. 43 // on Chrome OS by checking with permission_broker.
34 callback.Run(true); 44 callback.Run(true);
35 } 45 }
36 46
37 void UsbDevice::AddObserver(Observer* observer) { 47 void UsbDevice::AddObserver(Observer* observer) {
38 observer_list_.AddObserver(observer); 48 observer_list_.AddObserver(observer);
39 } 49 }
40 50
41 void UsbDevice::RemoveObserver(Observer* observer) { 51 void UsbDevice::RemoveObserver(Observer* observer) {
42 observer_list_.RemoveObserver(observer); 52 observer_list_.RemoveObserver(observer);
43 } 53 }
44 54
45 void UsbDevice::NotifyDeviceRemoved() { 55 void UsbDevice::NotifyDeviceRemoved() {
46 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(this)); 56 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(this));
47 } 57 }
48 58
49 } // namespace device 59 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_device.h ('k') | device/usb/usb_device_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698