#include "components/devtools/simple_devtools_protocol_client/simple_devtools_protocol_client.h"
#include <algorithm>
#include <optional>
#include <string_view>
#include <vector>
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_split.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
DevToolsAgentHost;
namespace simple_devtools_protocol_client {
namespace {
constexpr int kVLogLevel = …;
const char kId[] = …;
const char kSessionId[] = …;
const char kMethod[] = …;
const char kParams[] = …;
int g_next_message_id = …;
}
SimpleDevToolsProtocolClient::SimpleDevToolsProtocolClient() = default;
SimpleDevToolsProtocolClient::SimpleDevToolsProtocolClient(
const std::string& session_id)
: … { … }
SimpleDevToolsProtocolClient::~SimpleDevToolsProtocolClient() { … }
void SimpleDevToolsProtocolClient::AttachClient(
scoped_refptr<content::DevToolsAgentHost> agent_host) { … }
void SimpleDevToolsProtocolClient::DetachClient() { … }
void SimpleDevToolsProtocolClient::AttachToBrowser() { … }
void SimpleDevToolsProtocolClient::AttachToWebContents(
content::WebContents* web_contents) { … }
std::string SimpleDevToolsProtocolClient::GetTargetId() { … }
std::unique_ptr<SimpleDevToolsProtocolClient>
SimpleDevToolsProtocolClient::CreateSession(const std::string& session_id) { … }
void SimpleDevToolsProtocolClient::DispatchProtocolMessage(
content::DevToolsAgentHost* agent_host,
base::span<const uint8_t> json_message) { … }
void SimpleDevToolsProtocolClient::AgentHostClosed(
content::DevToolsAgentHost* agent_host) { … }
void SimpleDevToolsProtocolClient::DispatchProtocolMessageTask(
base::Value::Dict message) { … }
void SimpleDevToolsProtocolClient::SendProtocolMessage(
base::Value::Dict message) { … }
void SimpleDevToolsProtocolClient::SendCommand(
const std::string& method,
base::Value::Dict params,
ResponseCallback response_callback) { … }
void SimpleDevToolsProtocolClient::SendCommand(
const std::string& method,
ResponseCallback response_callback) { … }
void SimpleDevToolsProtocolClient::SendCommand(const std::string& method,
base::Value::Dict params) { … }
void SimpleDevToolsProtocolClient::SendCommand(const std::string& method) { … }
void SimpleDevToolsProtocolClient::AddEventHandler(
const std::string& event_name,
EventCallback event_callback) { … }
void SimpleDevToolsProtocolClient::RemoveEventHandler(
const std::string& event_name,
const EventCallback& event_callback) { … }
bool SimpleDevToolsProtocolClient::HasEventHandler(
const std::string& event_name,
const EventCallback& event_callback) { … }
base::WeakPtr<SimpleDevToolsProtocolClient>
SimpleDevToolsProtocolClient::GetWeakPtr() { … }
}