summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWebView
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-03-20 19:52:00 -0400
committerLinus Groh <mail@linusgroh.de>2023-03-21 09:39:49 +0000
commitf8b6369c238a57abb2fb3f5b093c5b629070e1f4 (patch)
tree7faaf422c0727e429f19c02fed969e928e39446a /Userland/Libraries/LibWebView
parenta77daf77bdc44d8150f3da698dcf3aa1f4917347 (diff)
downloadserenity-f8b6369c238a57abb2fb3f5b093c5b629070e1f4.zip
WebContent+Everywhere: Add a WebContent IPC to activate a tab
Diffstat (limited to 'Userland/Libraries/LibWebView')
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.cpp6
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.h2
-rw-r--r--Userland/Libraries/LibWebView/ViewImplementation.h1
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.cpp5
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.h1
5 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
index 8470c1296c..fe767b09b7 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
@@ -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)
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
index 66a8e364f7..e521b29751 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
@@ -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;
diff --git a/Userland/Libraries/LibWebView/ViewImplementation.h b/Userland/Libraries/LibWebView/ViewImplementation.h
index a88b3bd125..613cad0410 100644
--- a/Userland/Libraries/LibWebView/ViewImplementation.h
+++ b/Userland/Libraries/LibWebView/ViewImplementation.h
@@ -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;
diff --git a/Userland/Libraries/LibWebView/WebContentClient.cpp b/Userland/Libraries/LibWebView/WebContentClient.cpp
index d9b85d350c..5e53927197 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.cpp
+++ b/Userland/Libraries/LibWebView/WebContentClient.cpp
@@ -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({});
diff --git a/Userland/Libraries/LibWebView/WebContentClient.h b/Userland/Libraries/LibWebView/WebContentClient.h
index a7d32ec695..295affda79 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.h
+++ b/Userland/Libraries/LibWebView/WebContentClient.h
@@ -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;