#include "headless/lib/browser/headless_devtools.h"
#include <memory>
#include <string>
#include <utility>
#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_socket_factory.h"
#include "content/public/browser/navigation_entry.h"
#include "headless/public/headless_browser.h"
#include "net/base/net_errors.h"
#include "net/log/net_log_source.h"
#include "net/socket/tcp_server_socket.h"
#include "ui/base/resource/resource_bundle.h"
namespace headless {
namespace {
const int kBackLog = …;
class TCPServerSocketFactory : public content::DevToolsSocketFactory { … };
#if BUILDFLAG(IS_POSIX)
class TCPAdoptServerSocketFactory : public content::DevToolsSocketFactory { … };
#else
class DummyTCPServerSocketFactory : public content::DevToolsSocketFactory {
public:
explicit DummyTCPServerSocketFactory() {}
DummyTCPServerSocketFactory(const DummyTCPServerSocketFactory&) = delete;
DummyTCPServerSocketFactory& operator=(const DummyTCPServerSocketFactory&) =
delete;
private:
std::unique_ptr<net::ServerSocket> CreateForHttpServer() override {
return nullptr;
}
std::unique_ptr<net::ServerSocket> CreateForTethering(
std::string* out_name) override {
return nullptr;
}
};
#endif
void PostTaskToCloseBrowser(base::WeakPtr<HeadlessBrowserImpl> browser) { … }
}
void StartLocalDevToolsHttpHandler(HeadlessBrowserImpl* browser) { … }
void StopLocalDevToolsHttpHandler() { … }
}