#include "content/browser/devtools/protocol/tethering_handler.h"
#include <map>
#include <memory>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/task/single_thread_task_runner.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/io_buffer.h"
#include "net/base/ip_address.h"
#include "net/base/net_errors.h"
#include "net/log/net_log_source.h"
#include "net/socket/server_socket.h"
#include "net/socket/stream_socket.h"
#include "net/socket/tcp_server_socket.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
namespace content {
namespace protocol {
BindCallback;
UnbindCallback;
namespace {
const int kListenBacklog = …;
const int kSocketPumpBufferSize = …;
const int kMinTetheringPort = …;
const int kMaxTetheringPort = …;
const net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
CreateServerSocketCallback;
class SocketPump { … };
class BoundSocket { … };
}
class TetheringHandler::TetheringImpl { … };
TetheringHandler::TetheringImpl::TetheringImpl(
base::WeakPtr<TetheringHandler> handler,
CreateServerSocketCallback socket_callback)
: … { … }
TetheringHandler::TetheringImpl::~TetheringImpl() = default;
void TetheringHandler::TetheringImpl::Bind(
uint16_t port, std::unique_ptr<BindCallback> callback) { … }
void TetheringHandler::TetheringImpl::Unbind(
uint16_t port, std::unique_ptr<UnbindCallback> callback) { … }
void TetheringHandler::TetheringImpl::Accepted(uint16_t port,
const std::string& name) { … }
TetheringHandler::TetheringImpl* TetheringHandler::impl_ = …;
TetheringHandler::TetheringHandler(
CreateServerSocketCallback socket_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
TetheringHandler::~TetheringHandler() { … }
void TetheringHandler::Wire(UberDispatcher* dispatcher) { … }
void TetheringHandler::Accepted(uint16_t port, const std::string& name) { … }
bool TetheringHandler::Activate() { … }
void TetheringHandler::Bind(
int port, std::unique_ptr<BindCallback> callback) { … }
void TetheringHandler::Unbind(
int port, std::unique_ptr<UnbindCallback> callback) { … }
}
}