#include <utility>
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/weak_ptr.h"
#include "base/rand_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_checker.h"
#include "chrome/browser/devtools/device/android_device_manager.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/server/web_socket_encoder.h"
#include "net/server/web_socket_parse_result.h"
#include "net/socket/stream_socket.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
BrowserThread;
WebSocket;
namespace {
const int kBufferSize = …;
const char kCloseResponse[] = …;
net::NetworkTrafficAnnotationTag kAndroidWebSocketTrafficAnnotation = …;
}
class AndroidDeviceManager::AndroidWebSocket::WebSocketImpl { … };
AndroidDeviceManager::AndroidWebSocket::AndroidWebSocket(
scoped_refptr<Device> device,
const std::string& socket_name,
const std::string& path,
Delegate* delegate)
: … { … }
AndroidDeviceManager::AndroidWebSocket::~AndroidWebSocket() = default;
void AndroidDeviceManager::AndroidWebSocket::SendFrame(
const std::string& message) { … }
void AndroidDeviceManager::AndroidWebSocket::Connected(
int result,
const std::string& extensions,
const std::string& body_head,
std::unique_ptr<net::StreamSocket> socket) { … }
void AndroidDeviceManager::AndroidWebSocket::OnFrameRead(
const std::string& message) { … }
void AndroidDeviceManager::AndroidWebSocket::OnSocketClosed() { … }
AndroidDeviceManager::AndroidWebSocket*
AndroidDeviceManager::Device::CreateWebSocket(
const std::string& socket_name,
const std::string& path,
AndroidWebSocket::Delegate* delegate) { … }