diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-06 21:58:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-06 21:58:16 +0200 |
commit | 9169c8ca94216e8267b7fc278d7fbb199675e92a (patch) | |
tree | 89d8de6e45e71f0c878b35a437b2ee1ca0000f10 | |
parent | a94ef9e0218f763ed6f8f93599c3d6da5dda46fa (diff) | |
download | serenity-9169c8ca94216e8267b7fc278d7fbb199675e92a.zip |
LibWeb: Make the WebContentView::on_load_start hook actually work :^)
-rw-r--r-- | Libraries/LibWeb/WebContentClient.cpp | 5 | ||||
-rw-r--r-- | Libraries/LibWeb/WebContentClient.h | 1 | ||||
-rw-r--r-- | Libraries/LibWeb/WebContentView.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibWeb/WebContentView.h | 1 | ||||
-rw-r--r-- | Services/WebContent/PageHost.cpp | 5 | ||||
-rw-r--r-- | Services/WebContent/PageHost.h | 1 | ||||
-rw-r--r-- | Services/WebContent/WebContentClient.ipc | 1 |
7 files changed, 20 insertions, 0 deletions
diff --git a/Libraries/LibWeb/WebContentClient.cpp b/Libraries/LibWeb/WebContentClient.cpp index 0042cc14db..8e5b892e84 100644 --- a/Libraries/LibWeb/WebContentClient.cpp +++ b/Libraries/LibWeb/WebContentClient.cpp @@ -124,3 +124,8 @@ void WebContentClient::handle(const Messages::WebContentClient::DidMiddleClickLi { m_view.notify_server_did_middle_click_link({}, message.url(), message.target(), message.modifiers()); } + +void WebContentClient::handle(const Messages::WebContentClient::DidStartLoading& message) +{ + m_view.notify_server_did_start_loading({}, message.url()); +} diff --git a/Libraries/LibWeb/WebContentClient.h b/Libraries/LibWeb/WebContentClient.h index 638cf22b40..72450ca421 100644 --- a/Libraries/LibWeb/WebContentClient.h +++ b/Libraries/LibWeb/WebContentClient.h @@ -55,6 +55,7 @@ private: virtual void handle(const Messages::WebContentClient::DidUnhoverLink&) override; virtual void handle(const Messages::WebContentClient::DidClickLink&) override; virtual void handle(const Messages::WebContentClient::DidMiddleClickLink&) override; + virtual void handle(const Messages::WebContentClient::DidStartLoading&) override; WebContentView& m_view; }; diff --git a/Libraries/LibWeb/WebContentView.cpp b/Libraries/LibWeb/WebContentView.cpp index f5851e50ac..739372f08a 100644 --- a/Libraries/LibWeb/WebContentView.cpp +++ b/Libraries/LibWeb/WebContentView.cpp @@ -150,6 +150,12 @@ void WebContentView::notify_server_did_middle_click_link(Badge<WebContentClient> on_link_middle_click(url, target, modifiers); } +void WebContentView::notify_server_did_start_loading(Badge<WebContentClient>, const URL& url) +{ + if (on_load_start) + on_load_start(url); +} + void WebContentView::did_scroll() { client().post_message(Messages::WebContentServer::SetViewportRect(visible_content_rect())); diff --git a/Libraries/LibWeb/WebContentView.h b/Libraries/LibWeb/WebContentView.h index a96d5316ce..30d69ccb4e 100644 --- a/Libraries/LibWeb/WebContentView.h +++ b/Libraries/LibWeb/WebContentView.h @@ -54,6 +54,7 @@ public: void notify_server_did_unhover_link(Badge<WebContentClient>); void notify_server_did_click_link(Badge<WebContentClient>, const URL&, const String& target, unsigned modifiers); void notify_server_did_middle_click_link(Badge<WebContentClient>, const URL&, const String& target, unsigned modifiers); + void notify_server_did_start_loading(Badge<WebContentClient>, const URL&); private: WebContentView(); diff --git a/Services/WebContent/PageHost.cpp b/Services/WebContent/PageHost.cpp index 29cc5cc2c1..21fe0abeab 100644 --- a/Services/WebContent/PageHost.cpp +++ b/Services/WebContent/PageHost.cpp @@ -154,4 +154,9 @@ void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] const m_client.post_message(Messages::WebContentClient::DidMiddleClickLink(url, target, modifiers)); } +void PageHost::page_did_start_loading(const URL& url) +{ + m_client.post_message(Messages::WebContentClient::DidStartLoading(url)); +} + } diff --git a/Services/WebContent/PageHost.h b/Services/WebContent/PageHost.h index 22be237acf..6ab5094247 100644 --- a/Services/WebContent/PageHost.h +++ b/Services/WebContent/PageHost.h @@ -60,6 +60,7 @@ private: virtual void page_did_unhover_link() override; virtual void page_did_click_link(const URL&, const String& target, unsigned modifiers) override; virtual void page_did_middle_click_link(const URL&, const String& target, unsigned modifiers) override; + virtual void page_did_start_loading(const URL&) override; explicit PageHost(ClientConnection&); diff --git a/Services/WebContent/WebContentClient.ipc b/Services/WebContent/WebContentClient.ipc index 70c6158827..ddaa8fb934 100644 --- a/Services/WebContent/WebContentClient.ipc +++ b/Services/WebContent/WebContentClient.ipc @@ -11,4 +11,5 @@ endpoint WebContentClient = 90 DidUnhoverLink() =| DidClickLink(URL url, String target, unsigned modifiers) =| DidMiddleClickLink(URL url, String target, unsigned modifiers) =| + DidStartLoading(URL url) =| } |