#include "chrome/browser/devtools/device/usb/usb_device_provider.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/devtools/device/usb/android_rsa.h"
#include "chrome/browser/devtools/device/usb/android_usb_device.h"
#include "crypto/rsa_private_key.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/socket/stream_socket.h"
namespace {
const char kLocalAbstractCommand[] = …;
const int kBufferSize = …;
void OnOpenSocket(UsbDeviceProvider::SocketCallback callback,
net::StreamSocket* socket_raw,
int result) { … }
void OnRead(net::StreamSocket* socket,
scoped_refptr<net::IOBuffer> buffer,
const std::string& data,
UsbDeviceProvider::CommandCallback callback,
int result) { … }
void OpenedForCommand(UsbDeviceProvider::CommandCallback callback,
net::StreamSocket* socket,
int result) { … }
void RunCommand(scoped_refptr<AndroidUsbDevice> device,
const std::string& command,
UsbDeviceProvider::CommandCallback callback) { … }
}
UsbDeviceProvider::UsbDeviceProvider(Profile* profile) { … }
void UsbDeviceProvider::QueryDevices(SerialsCallback callback) { … }
void UsbDeviceProvider::QueryDeviceInfo(const std::string& serial,
DeviceInfoCallback callback) { … }
void UsbDeviceProvider::OpenSocket(const std::string& serial,
const std::string& name,
SocketCallback callback) { … }
void UsbDeviceProvider::ReleaseDevice(const std::string& serial) { … }
UsbDeviceProvider::~UsbDeviceProvider() { … }
void UsbDeviceProvider::EnumeratedDevices(SerialsCallback callback,
const AndroidUsbDevices& devices) { … }