mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWebView+LibProtocol: Allow app to pass custom WebSocketClients
This commit is contained in:
parent
a1e5a6ac40
commit
dd694215bc
Notes:
sideshowbarker
2024-07-17 01:13:25 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/dd694215bc Pull-request: https://github.com/SerenityOS/serenity/pull/20339
@ -21,6 +21,8 @@ class WebSocketClient final
|
||||
IPC_CLIENT_CONNECTION(WebSocketClient, "/tmp/session/%sid/portal/websocket"sv)
|
||||
|
||||
public:
|
||||
explicit WebSocketClient(NonnullOwnPtr<Core::LocalSocket>);
|
||||
|
||||
RefPtr<WebSocket> connect(const URL&, DeprecatedString const& origin = {}, Vector<DeprecatedString> const& protocols = {}, Vector<DeprecatedString> const& extensions = {}, HashMap<DeprecatedString, DeprecatedString> const& request_headers = {});
|
||||
|
||||
u32 ready_state(Badge<WebSocket>, WebSocket&);
|
||||
@ -30,8 +32,6 @@ public:
|
||||
bool set_certificate(Badge<WebSocket>, WebSocket&, DeprecatedString, DeprecatedString);
|
||||
|
||||
private:
|
||||
WebSocketClient(NonnullOwnPtr<Core::LocalSocket>);
|
||||
|
||||
virtual void connected(i32) override;
|
||||
virtual void received(i32, bool, ByteBuffer const&) override;
|
||||
virtual void errored(i32, i32) override;
|
||||
|
@ -107,6 +107,11 @@ void WebSocketClientSocketAdapter::close(u16 code, DeprecatedString reason)
|
||||
m_websocket->close(code, reason);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebSocketClientManagerAdapter>> WebSocketClientManagerAdapter::try_create(NonnullRefPtr<Protocol::WebSocketClient> websocket_client)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) WebSocketClientManagerAdapter(move(websocket_client)));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<WebSocketClientManagerAdapter>> WebSocketClientManagerAdapter::try_create()
|
||||
{
|
||||
auto websocket_client = TRY(Protocol::WebSocketClient::try_create());
|
||||
|
@ -40,6 +40,7 @@ private:
|
||||
|
||||
class WebSocketClientManagerAdapter : public Web::WebSockets::WebSocketClientManager {
|
||||
public:
|
||||
static ErrorOr<NonnullRefPtr<WebSocketClientManagerAdapter>> try_create(NonnullRefPtr<Protocol::WebSocketClient>);
|
||||
static ErrorOr<NonnullRefPtr<WebSocketClientManagerAdapter>> try_create();
|
||||
|
||||
virtual ~WebSocketClientManagerAdapter() override;
|
||||
|
Loading…
Reference in New Issue
Block a user