#include "chrome/browser/devtools/device/usb/usb_device_manager_helper.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/device_service.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/device/public/mojom/usb_enumeration_options.mojom.h"
UsbTransferDirection;
UsbTransferType;
namespace {
const int kAdbClass = …;
const int kAdbSubclass = …;
const int kAdbProtocol = …;
std::unique_ptr<AndroidInterfaceInfo> FindAndroidInterface(
const device::mojom::UsbDeviceInfo& device_info) { … }
void GetAndroidDeviceInfoList(
AndroidDeviceInfoListCallback callback,
std::vector<device::mojom::UsbDeviceInfoPtr> usb_devices) { … }
void CountAndroidDevices(base::OnceCallback<void(int)> callback,
std::vector<AndroidDeviceInfo> info_list) { … }
}
AndroidInterfaceInfo::AndroidInterfaceInfo(
uint8_t interface_number,
const device::mojom::UsbAlternateInterfaceInfo* alternate)
: … { … }
AndroidDeviceInfo::AndroidDeviceInfo(const std::string& guid,
const std::string& serial,
int interface_id,
int inbound_address,
int outbound_address,
int zero_mask)
: … { … }
AndroidDeviceInfo::AndroidDeviceInfo(const AndroidDeviceInfo& other) = default;
UsbDeviceManagerHelper* UsbDeviceManagerHelper::GetInstance() { … }
void UsbDeviceManagerHelper::CountDevices(
base::OnceCallback<void(int)> callback) { … }
void UsbDeviceManagerHelper::SetUsbManagerForTesting(
mojo::PendingRemote<device::mojom::UsbDeviceManager> fake_usb_manager) { … }
UsbDeviceManagerHelper::UsbDeviceManagerHelper() { … }
UsbDeviceManagerHelper::~UsbDeviceManagerHelper() { … }
void UsbDeviceManagerHelper::GetAndroidDevices(
AndroidDeviceInfoListCallback callback) { … }
void UsbDeviceManagerHelper::GetDevice(
const std::string& guid,
mojo::PendingReceiver<device::mojom::UsbDevice> device_receiver) { … }
void UsbDeviceManagerHelper::EnsureUsbDeviceManagerConnection() { … }
void UsbDeviceManagerHelper::CountDevicesInternal(
base::OnceCallback<void(int)> callback) { … }
void UsbDeviceManagerHelper::SetUsbManagerForTestingInternal(
mojo::PendingRemote<device::mojom::UsbDeviceManager> fake_usb_manager) { … }
void UsbDeviceManagerHelper::OnDeviceManagerConnectionError() { … }