#include "chrome/browser/devtools/device/tcp_device_provider.h"
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/net_errors.h"
#include "net/base/network_isolation_key.h"
#include "net/dns/public/host_resolver_results.h"
#include "net/dns/public/resolve_error_info.h"
#include "net/log/net_log_source.h"
#include "net/log/net_log_with_source.h"
#include "net/socket/tcp_client_socket.h"
#include "services/network/public/cpp/resolve_host_client_base.h"
#include "services/network/public/mojom/network_context.mojom.h"
namespace {
const char kDeviceModel[] = …;
const char kBrowserName[] = …;
static void RunSocketCallback(AndroidDeviceManager::SocketCallback callback,
std::unique_ptr<net::StreamSocket> socket,
int result) { … }
class ResolveHostAndOpenSocket final : public network::ResolveHostClientBase { … };
}
scoped_refptr<TCPDeviceProvider> TCPDeviceProvider::CreateForLocalhost(
uint16_t port) { … }
TCPDeviceProvider::TCPDeviceProvider(const HostPortSet& targets)
: … { … }
void TCPDeviceProvider::QueryDevices(SerialsCallback callback) { … }
void TCPDeviceProvider::QueryDeviceInfo(const std::string& serial,
DeviceInfoCallback callback) { … }
void TCPDeviceProvider::OpenSocket(const std::string& serial,
const std::string& socket_name,
SocketCallback callback) { … }
void TCPDeviceProvider::ReleaseDevice(const std::string& serial) { … }
void TCPDeviceProvider::set_release_callback_for_test(
base::OnceClosure callback) { … }
TCPDeviceProvider::~TCPDeviceProvider() { … }