OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/usb/usb_device.h" | 5 #include "chrome/browser/usb/usb_device.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 "chrome/browser/usb/usb_context.h" | 10 #include "chrome/browser/usb/usb_context.h" |
11 #include "chrome/browser/usb/usb_device_handle.h" | 11 #include "chrome/browser/usb/usb_device_handle.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "third_party/libusb/src/libusb/libusb.h" | 13 #include "third_party/libusb/src/libusb/libusb.h" |
14 | 14 |
15 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
16 #include "base/sys_info.h" | 16 #include "base/sys_info.h" |
17 #include "chromeos/dbus/dbus_thread_manager.h" | 17 #include "chromeos/dbus/dbus_thread_manager.h" |
18 #include "chromeos/dbus/permission_broker_client.h" | 18 #include "chromeos/dbus/permission_broker_client.h" |
19 #endif // defined(OS_CHROMEOS) | 19 #endif // defined(OS_CHROMEOS) |
20 | 20 |
21 using content::BrowserThread; | 21 using content::BrowserThread; |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
| 25 #if defined(OS_CHROMEOS) |
25 void OnRequestUsbAccessReplied( | 26 void OnRequestUsbAccessReplied( |
26 const base::Callback<void(bool success)>& callback, | 27 const base::Callback<void(bool success)>& callback, |
27 bool success) { | 28 bool success) { |
28 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, | 29 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
29 base::Bind(callback, success)); | 30 base::Bind(callback, success)); |
30 } | 31 } |
| 32 #endif // defined(OS_CHROMEOS) |
31 | 33 |
32 } // namespace | 34 } // namespace |
33 | 35 |
34 UsbDevice::UsbDevice( | 36 UsbDevice::UsbDevice( |
35 scoped_refptr<UsbContext> context, | 37 scoped_refptr<UsbContext> context, |
36 PlatformUsbDevice platform_device, | 38 PlatformUsbDevice platform_device, |
37 uint16 vendor_id, | 39 uint16 vendor_id, |
38 uint16 product_id, | 40 uint16 product_id, |
39 uint32 unique_id) | 41 uint32 unique_id) |
40 : platform_device_(platform_device), | 42 : platform_device_(platform_device), |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 DCHECK(thread_checker_.CalledOnValidThread()); | 145 DCHECK(thread_checker_.CalledOnValidThread()); |
144 HandlesVector handles; | 146 HandlesVector handles; |
145 swap(handles, handles_); | 147 swap(handles, handles_); |
146 for (std::vector<scoped_refptr<UsbDeviceHandle> >::iterator it = | 148 for (std::vector<scoped_refptr<UsbDeviceHandle> >::iterator it = |
147 handles.begin(); | 149 handles.begin(); |
148 it != handles.end(); | 150 it != handles.end(); |
149 ++it) { | 151 ++it) { |
150 (*it)->InternalClose(); | 152 (*it)->InternalClose(); |
151 } | 153 } |
152 } | 154 } |
OLD | NEW |