diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp index b247777741..6484b9828f 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.cpp @@ -335,6 +335,12 @@ void OutOfProcessWebView::notify_server_did_js_console_output(const String& meth on_js_console_output(method, line); } +void OutOfProcessWebView::notify_server_did_change_favicon(const Gfx::Bitmap& favicon) +{ + if (on_favicon_change) + on_favicon_change(favicon); +} + void OutOfProcessWebView::did_scroll() { client().post_message(Messages::WebContentServer::SetViewportRect(visible_content_rect())); diff --git a/Userland/Libraries/LibWeb/OutOfProcessWebView.h b/Userland/Libraries/LibWeb/OutOfProcessWebView.h index c4f353e3c5..11405a98a2 100644 --- a/Userland/Libraries/LibWeb/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWeb/OutOfProcessWebView.h @@ -75,6 +75,7 @@ public: String notify_server_did_request_prompt(Badge, const String& message, const String& default_); void notify_server_did_get_source(const URL& url, const String& source); void notify_server_did_js_console_output(const String& method, const String& line); + void notify_server_did_change_favicon(const Gfx::Bitmap& favicon); private: OutOfProcessWebView(); diff --git a/Userland/Libraries/LibWeb/WebContentClient.cpp b/Userland/Libraries/LibWeb/WebContentClient.cpp index 9dfbfc9702..f049f21cb2 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.cpp +++ b/Userland/Libraries/LibWeb/WebContentClient.cpp @@ -173,4 +173,13 @@ OwnPtr WebContentClient::h return make(result); } +void WebContentClient::handle(const Messages::WebContentClient::DidChangeFavicon& message) +{ + if (!message.favicon().is_valid()) { + dbgln("DidChangeFavicon: Received invalid favicon"); + return; + } + m_view.notify_server_did_change_favicon(*message.favicon().bitmap()); +} + } diff --git a/Userland/Libraries/LibWeb/WebContentClient.h b/Userland/Libraries/LibWeb/WebContentClient.h index 5f83d1eb4a..9357930f2a 100644 --- a/Userland/Libraries/LibWeb/WebContentClient.h +++ b/Userland/Libraries/LibWeb/WebContentClient.h @@ -68,6 +68,7 @@ private: virtual void handle(const Messages::WebContentClient::DidRequestLinkContextMenu&) override; virtual void handle(const Messages::WebContentClient::DidGetSource&) override; virtual void handle(const Messages::WebContentClient::DidJSConsoleOutput&) override; + virtual void handle(const Messages::WebContentClient::DidChangeFavicon&) override; virtual OwnPtr handle(const Messages::WebContentClient::DidRequestAlert&) override; virtual OwnPtr handle(const Messages::WebContentClient::DidRequestConfirm&) override; virtual OwnPtr handle(const Messages::WebContentClient::DidRequestPrompt&) override; diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index 46a9c0c09e..97aa69ff03 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -188,4 +188,9 @@ String PageHost::page_did_request_prompt(const String& message, const String& de return m_client.send_sync(message, default_)->response(); } +void PageHost::page_did_change_favicon(const Gfx::Bitmap& favicon) +{ + m_client.post_message(Messages::WebContentClient::DidChangeFavicon(favicon.to_shareable_bitmap())); +} + } diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index 066dd69481..0bbb20fe3e 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -72,6 +72,7 @@ private: virtual void page_did_request_alert(const String&) override; virtual bool page_did_request_confirm(const String&) override; virtual String page_did_request_prompt(const String&, const String&) override; + virtual void page_did_change_favicon(const Gfx::Bitmap&) override; explicit PageHost(ClientConnection&); diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc index 6d1b7ebd3a..6e96fa94ba 100644 --- a/Userland/Services/WebContent/WebContentClient.ipc +++ b/Userland/Services/WebContent/WebContentClient.ipc @@ -21,4 +21,5 @@ endpoint WebContentClient = 90 DidRequestPrompt(String message, String default_) => (String response) DidGetSource(URL url, String source) =| DidJSConsoleOutput(String method, String line) =| + DidChangeFavicon(Gfx::ShareableBitmap favicon) =| }