diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-11-11 09:23:24 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-11-11 18:02:04 +0000 |
commit | d2c1957d8f79c9a60ba067b8bef780d7abf64bba (patch) | |
tree | 91270e1b9bb5d9fe5ad94c1ae4a1520a9afe0446 /Userland/Libraries/LibWebView | |
parent | 2d33b2996f5737f82c07c73fba675a29d5521f4f (diff) | |
download | serenity-d2c1957d8f79c9a60ba067b8bef780d7abf64bba.zip |
LibWebView+WebContent: Add IPC to get all cookies for a document's URL
Diffstat (limited to 'Userland/Libraries/LibWebView')
5 files changed, 16 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp index 337a20270d..cffee72b65 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp @@ -382,6 +382,13 @@ void OutOfProcessWebView::notify_server_did_change_favicon(Gfx::Bitmap const& fa on_favicon_change(favicon); } +Vector<Web::Cookie::Cookie> OutOfProcessWebView::notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url) +{ + if (on_get_all_cookies) + return on_get_all_cookies(url); + return {}; +} + String OutOfProcessWebView::notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) { if (on_get_cookie) diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h index a8e68db925..36ec0dab56 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h @@ -92,6 +92,7 @@ public: Function<void(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing)> on_get_dom_node_properties; Function<void(i32 message_id)> on_js_console_new_message; Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages; + Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies; Function<String(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie; Function<void(const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie; Function<void(i32 count_waiting)> on_resource_status_change; @@ -154,6 +155,7 @@ private: virtual void notify_server_did_output_js_console_message(i32 message_index) override; virtual void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages) override; virtual void notify_server_did_change_favicon(Gfx::Bitmap const& favicon) override; + virtual Vector<Web::Cookie::Cookie> notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url) override; virtual String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) override; virtual void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) override; virtual void notify_server_did_update_resource_count(i32 count_waiting) override; diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h index 6294114da7..bdd787a8b3 100644 --- a/Userland/Libraries/LibWebView/ViewImplementation.h +++ b/Userland/Libraries/LibWebView/ViewImplementation.h @@ -47,6 +47,7 @@ public: virtual void notify_server_did_output_js_console_message(i32 message_index) = 0; virtual void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages) = 0; virtual void notify_server_did_change_favicon(Gfx::Bitmap const& favicon) = 0; + virtual Vector<Web::Cookie::Cookie> notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url) = 0; virtual String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) = 0; virtual void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) = 0; virtual void notify_server_did_update_resource_count(i32 count_waiting) = 0; diff --git a/Userland/Libraries/LibWebView/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp index c5bb0a8afd..46d9e83722 100644 --- a/Userland/Libraries/LibWebView/WebContentClient.cpp +++ b/Userland/Libraries/LibWebView/WebContentClient.cpp @@ -185,6 +185,11 @@ void WebContentClient::did_change_favicon(Gfx::ShareableBitmap const& favicon) m_view.notify_server_did_change_favicon(*favicon.bitmap()); } +Messages::WebContentClient::DidRequestAllCookiesResponse WebContentClient::did_request_all_cookies(AK::URL const& url) +{ + return m_view.notify_server_did_request_all_cookies({}, url); +} + Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(AK::URL const& url, u8 source) { return m_view.notify_server_did_request_cookie({}, url, static_cast<Web::Cookie::Source>(source)); diff --git a/Userland/Libraries/LibWebView/WebContentClient.h b/Userland/Libraries/LibWebView/WebContentClient.h index b8ee9f4ab5..7e784b5adf 100644 --- a/Userland/Libraries/LibWebView/WebContentClient.h +++ b/Userland/Libraries/LibWebView/WebContentClient.h @@ -58,6 +58,7 @@ private: virtual void did_request_alert(String const&) override; virtual Messages::WebContentClient::DidRequestConfirmResponse did_request_confirm(String const&) override; virtual Messages::WebContentClient::DidRequestPromptResponse did_request_prompt(String const&, String const&) override; + virtual Messages::WebContentClient::DidRequestAllCookiesResponse did_request_all_cookies(AK::URL const&) override; virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(AK::URL const&, u8) override; virtual void did_set_cookie(AK::URL const&, Web::Cookie::ParsedCookie const&, u8) override; virtual void did_update_resource_count(i32 count_waiting) override; |