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

Side by Side Diff: components/usb_service/usb_device_impl.cc

Issue 462753002: Add usb_service::UsbDeviceFilter class for device matching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add UsbDevice::RequestUsbAccess to the mock (and fix spelling). Created 6 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 unified diff | Download patch
« no previous file with comments | « components/usb_service/usb_device_impl.h ('k') | extensions/browser/api/usb/usb_api.cc » ('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 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 "components/usb_service/usb_device_impl.h" 5 #include "components/usb_service/usb_device_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "components/usb_service/usb_context.h" 10 #include "components/usb_service/usb_context.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 for (HandlesVector::iterator it = handles_.begin(); it != handles_.end(); 54 for (HandlesVector::iterator it = handles_.begin(); it != handles_.end();
55 ++it) { 55 ++it) {
56 (*it)->InternalClose(); 56 (*it)->InternalClose();
57 } 57 }
58 STLClearObject(&handles_); 58 STLClearObject(&handles_);
59 libusb_unref_device(platform_device_); 59 libusb_unref_device(platform_device_);
60 } 60 }
61 61
62 #if defined(OS_CHROMEOS) 62 #if defined(OS_CHROMEOS)
63 63
64 void UsbDeviceImpl::RequestUsbAcess( 64 void UsbDeviceImpl::RequestUsbAccess(
65 int interface_id, 65 int interface_id,
66 const base::Callback<void(bool success)>& callback) { 66 const base::Callback<void(bool success)>& callback) {
67 DCHECK(thread_checker_.CalledOnValidThread()); 67 DCHECK(thread_checker_.CalledOnValidThread());
68 68
69 // ChromeOS builds on non-ChromeOS machines (dev) should not attempt to 69 // ChromeOS builds on non-ChromeOS machines (dev) should not attempt to
70 // use permission broker. 70 // use permission broker.
71 if (base::SysInfo::IsRunningOnChromeOS()) { 71 if (base::SysInfo::IsRunningOnChromeOS()) {
72 chromeos::PermissionBrokerClient* client = 72 chromeos::PermissionBrokerClient* client =
73 chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient(); 73 chromeos::DBusThreadManager::Get()->GetPermissionBrokerClient();
74 DCHECK(client) << "Could not get permission broker client."; 74 DCHECK(client) << "Could not get permission broker client.";
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 139
140 void UsbDeviceImpl::OnDisconnect() { 140 void UsbDeviceImpl::OnDisconnect() {
141 DCHECK(thread_checker_.CalledOnValidThread()); 141 DCHECK(thread_checker_.CalledOnValidThread());
142 HandlesVector handles; 142 HandlesVector handles;
143 swap(handles, handles_); 143 swap(handles, handles_);
144 for (HandlesVector::iterator it = handles.begin(); it != handles.end(); ++it) 144 for (HandlesVector::iterator it = handles.begin(); it != handles.end(); ++it)
145 (*it)->InternalClose(); 145 (*it)->InternalClose();
146 } 146 }
147 147
148 } // namespace usb_service 148 } // namespace usb_service
OLDNEW
« no previous file with comments | « components/usb_service/usb_device_impl.h ('k') | extensions/browser/api/usb/usb_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698