OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |