| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/devtools/adb/android_usb_device.h" | 5 #include "chrome/browser/devtools/adb/android_usb_device.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/devtools/adb/android_rsa.h" | 10 #include "chrome/browser/devtools/adb/android_rsa.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 AdbMessage::~AdbMessage() { | 197 AdbMessage::~AdbMessage() { |
| 198 } | 198 } |
| 199 | 199 |
| 200 // static | 200 // static |
| 201 void AndroidUsbDevice::Enumerate(Profile* profile, Devices* devices) { | 201 void AndroidUsbDevice::Enumerate(Profile* profile, Devices* devices) { |
| 202 UsbService* service = | 202 UsbService* service = |
| 203 UsbServiceFactory::GetInstance()->GetForProfile(profile); | 203 UsbServiceFactory::GetInstance()->GetForProfile(profile); |
| 204 | 204 |
| 205 // Enumerate usb devices. | 205 // Enumerate usb devices. |
| 206 std::vector<scoped_refptr<UsbDevice> > usb_devices; | 206 std::vector<int> usb_devices; |
| 207 service->EnumerateDevices(&usb_devices); | 207 service->GetDevices(&usb_devices); |
| 208 for (size_t i = 0; i < usb_devices.size(); ++i) { | 208 for (size_t i = 0; i < usb_devices.size(); ++i) { |
| 209 scoped_refptr<UsbDevice> usb_device = usb_devices[i]; | 209 int usb_device_id = usb_devices[i]; |
| 210 | 210 scoped_refptr<UsbDevice> usb_device = service->OpenDevice(usb_device_id); |
| 211 // Enumerate device interfaces. | 211 // Enumerate device interfaces. |
| 212 scoped_refptr<UsbConfigDescriptor> config = new UsbConfigDescriptor(); | 212 scoped_refptr<UsbConfigDescriptor> config = new UsbConfigDescriptor(); |
| 213 usb_device->ListInterfaces(config.get(), base::Bind(&BoolNoop)); | 213 usb_device->ListInterfaces(config.get(), base::Bind(&BoolNoop)); |
| 214 for (size_t i = 0; i < config->GetNumInterfaces(); ++i) | 214 for (size_t i = 0; i < config->GetNumInterfaces(); ++i) |
| 215 ClaimInterface(profile, usb_device, config->GetInterface(i), devices); | 215 ClaimInterface(profile, usb_device, config->GetInterface(i), devices); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 AndroidUsbDevice::AndroidUsbDevice(Profile* profile, | 219 AndroidUsbDevice::AndroidUsbDevice(Profile* profile, |
| 220 scoped_refptr<UsbDevice> usb_device, | 220 scoped_refptr<UsbDevice> usb_device, |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 it != sockets_.end(); ++it) { | 468 it != sockets_.end(); ++it) { |
| 469 it->second->Terminated(); | 469 it->second->Terminated(); |
| 470 } | 470 } |
| 471 usb_device_->ReleaseInterface(1, base::Bind(&BoolNoop)); | 471 usb_device_->ReleaseInterface(1, base::Bind(&BoolNoop)); |
| 472 usb_device_->Close(base::Bind(&Noop)); | 472 usb_device_->Close(base::Bind(&Noop)); |
| 473 } | 473 } |
| 474 | 474 |
| 475 void AndroidUsbDevice::SocketDeleted(uint32 socket_id) { | 475 void AndroidUsbDevice::SocketDeleted(uint32 socket_id) { |
| 476 sockets_.erase(socket_id); | 476 sockets_.erase(socket_id); |
| 477 } | 477 } |
| OLD | NEW |