2022-11-08 12:18:11 -03:00
|
|
|
/*
|
2024-09-29 10:40:17 -03:00
|
|
|
* Copyright (c) 2022-2024, Tim Flynn <trflynn89@ladybird.org>
|
2022-11-08 12:18:11 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibIPC/ConnectionFromClient.h>
|
2024-10-22 18:47:33 -03:00
|
|
|
#include <LibIPC/Transport.h>
|
2022-11-14 13:00:31 -03:00
|
|
|
#include <WebContent/WebDriverClientEndpoint.h>
|
|
|
|
|
#include <WebContent/WebDriverServerEndpoint.h>
|
2022-11-08 12:18:11 -03:00
|
|
|
|
|
|
|
|
namespace WebDriver {
|
|
|
|
|
|
|
|
|
|
class Client;
|
|
|
|
|
|
|
|
|
|
class WebContentConnection
|
|
|
|
|
: public IPC::ConnectionFromClient<WebDriverClientEndpoint, WebDriverServerEndpoint> {
|
|
|
|
|
C_OBJECT_ABSTRACT(WebContentConnection)
|
|
|
|
|
public:
|
2025-04-08 17:01:46 -03:00
|
|
|
explicit WebContentConnection(NonnullOwnPtr<IPC::Transport> transport);
|
2022-11-08 12:18:11 -03:00
|
|
|
|
2026-06-13 11:06:49 -03:00
|
|
|
Web::WebDriver::Response wait_for_navigation_completion()
|
|
|
|
|
{
|
|
|
|
|
auto response = send_sync_but_allow_failure<Messages::WebDriverClient::WaitForNavigationCompletion>();
|
|
|
|
|
VERIFY(response);
|
|
|
|
|
return response->response();
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-19 08:08:52 -03:00
|
|
|
Function<void()> on_close;
|
2024-11-01 08:42:21 -03:00
|
|
|
Function<void(Web::WebDriver::Response)> on_driver_execution_complete;
|
2026-02-11 10:46:07 -03:00
|
|
|
Function<void(String)> on_did_set_window_handle;
|
2026-06-13 11:06:49 -03:00
|
|
|
Function<void(String)> on_did_start_window_replacement;
|
|
|
|
|
Function<void(String)> on_did_close_window;
|
2022-11-08 12:18:11 -03:00
|
|
|
|
2024-09-13 08:42:24 -03:00
|
|
|
private:
|
2023-03-19 08:08:52 -03:00
|
|
|
virtual void die() override;
|
2024-09-13 08:42:24 -03:00
|
|
|
|
2025-03-08 14:22:39 -03:00
|
|
|
virtual void driver_execution_complete(Web::WebDriver::Response) override;
|
2026-02-11 10:46:07 -03:00
|
|
|
virtual void did_set_window_handle(String) override;
|
2026-06-13 11:06:49 -03:00
|
|
|
virtual void did_start_window_replacement(String) override;
|
|
|
|
|
virtual void did_close_window(String) override;
|
2022-11-08 12:18:11 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|