1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:17:36 +00:00

WebContent+Everywhere: Add a WebContent IPC to activate a tab

This commit is contained in:
Timothy Flynn 2023-03-20 19:52:00 -04:00 committed by Linus Groh
parent a77daf77bd
commit f8b6369c23
18 changed files with 50 additions and 0 deletions

View file

@ -480,6 +480,12 @@ String OutOfProcessWebView::notify_server_did_request_new_tab(Badge<WebContentCl
return {};
}
void OutOfProcessWebView::notify_server_did_request_activate_tab(Badge<WebContentClient>)
{
if (on_activate_tab)
on_activate_tab();
}
void OutOfProcessWebView::notify_server_did_close_browsing_context(Badge<WebContentClient>)
{
if (on_close)

View file

@ -59,6 +59,7 @@ public:
void set_content_scales_to_viewport(bool);
Function<String(Web::HTML::ActivateTab)> on_new_tab;
Function<void()> on_activate_tab;
Function<void()> on_close;
Function<void(Gfx::IntPoint screen_position)> on_context_menu_request;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_click;
@ -164,6 +165,7 @@ private:
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_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) override;
virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) override;
virtual void notify_server_did_request_activate_tab(Badge<WebContentClient>) override;
virtual void notify_server_did_close_browsing_context(Badge<WebContentClient>) override;
virtual void notify_server_did_update_resource_count(i32 count_waiting) override;
virtual void notify_server_did_request_restore_window() override;

View file

@ -100,6 +100,7 @@ public:
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_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) = 0;
virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) = 0;
virtual void notify_server_did_request_activate_tab(Badge<WebContentClient>) = 0;
virtual void notify_server_did_close_browsing_context(Badge<WebContentClient>) = 0;
virtual void notify_server_did_update_resource_count(i32 count_waiting) = 0;
virtual void notify_server_did_request_restore_window() = 0;

View file

@ -245,6 +245,11 @@ Messages::WebContentClient::DidRequestNewTabResponse WebContentClient::did_reque
return m_view.notify_server_did_request_new_tab({}, activate_tab);
}
void WebContentClient::did_request_activate_tab()
{
m_view.notify_server_did_request_activate_tab({});
}
void WebContentClient::did_close_browsing_context()
{
m_view.notify_server_did_close_browsing_context({});

View file

@ -71,6 +71,7 @@ private:
virtual void did_set_cookie(AK::URL const&, Web::Cookie::ParsedCookie const&, u8) override;
virtual void did_update_cookie(Web::Cookie::Cookie const&) override;
virtual Messages::WebContentClient::DidRequestNewTabResponse did_request_new_tab(Web::HTML::ActivateTab const& activate_tab) override;
virtual void did_request_activate_tab() override;
virtual void did_close_browsing_context() override;
virtual void did_update_resource_count(i32 count_waiting) override;
virtual void did_request_restore_window() override;