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

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

Issue 580963002: Add a service to track devices selected by the user. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2014 The Chromium Authors. All rights reserved. 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 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_impl.h" 5 #include "device/usb/usb_device_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 case LIBUSB_ISO_USAGE_TYPE_IMPLICIT: 91 case LIBUSB_ISO_USAGE_TYPE_IMPLICIT:
92 return USB_USAGE_EXPLICIT_FEEDBACK; 92 return USB_USAGE_EXPLICIT_FEEDBACK;
93 default: 93 default:
94 NOTREACHED(); 94 NOTREACHED();
95 return USB_USAGE_DATA; 95 return USB_USAGE_DATA;
96 } 96 }
97 } 97 }
98 98
99 } // namespace 99 } // namespace
100 100
101 UsbDevice::UsbDevice(uint16 vendor_id, uint16 product_id, uint32 unique_id)
102 : vendor_id_(vendor_id), product_id_(product_id), unique_id_(unique_id) {
103 }
104
105 UsbDevice::~UsbDevice() {
106 }
107
108 void UsbDevice::NotifyDisconnect() {
109 FOR_EACH_OBSERVER(Observer, observer_list_, OnDisconnect(this));
110 }
111
101 UsbDeviceImpl::UsbDeviceImpl( 112 UsbDeviceImpl::UsbDeviceImpl(
102 scoped_refptr<UsbContext> context, 113 scoped_refptr<UsbContext> context,
103 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 114 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
104 PlatformUsbDevice platform_device, 115 PlatformUsbDevice platform_device,
105 uint16 vendor_id, 116 uint16 vendor_id,
106 uint16 product_id, 117 uint16 product_id,
107 uint32 unique_id) 118 uint32 unique_id)
108 : UsbDevice(vendor_id, product_id, unique_id), 119 : UsbDevice(vendor_id, product_id, unique_id),
109 platform_device_(platform_device), 120 platform_device_(platform_device),
110 current_configuration_cached_(false), 121 current_configuration_cached_(false),
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 277
267 void UsbDeviceImpl::OnDisconnect() { 278 void UsbDeviceImpl::OnDisconnect() {
268 DCHECK(thread_checker_.CalledOnValidThread()); 279 DCHECK(thread_checker_.CalledOnValidThread());
269 HandlesVector handles; 280 HandlesVector handles;
270 swap(handles, handles_); 281 swap(handles, handles_);
271 for (HandlesVector::iterator it = handles.begin(); it != handles.end(); ++it) 282 for (HandlesVector::iterator it = handles.begin(); it != handles.end(); ++it)
272 (*it)->InternalClose(); 283 (*it)->InternalClose();
273 } 284 }
274 285
275 } // namespace device 286 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698