summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Ladybird/BrowserWindow.cpp14
-rw-r--r--Ladybird/BrowserWindow.h8
-rw-r--r--Ladybird/WebContentView.cpp17
-rw-r--r--Ladybird/WebContentView.h5
-rw-r--r--Userland/Applications/Browser/BrowserWindow.cpp10
-rw-r--r--Userland/Applications/Browser/BrowserWindow.h3
-rw-r--r--Userland/Applications/Browser/Tab.cpp4
-rw-r--r--Userland/Applications/Browser/main.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/ActivateTab.h16
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp4
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.h3
-rw-r--r--Userland/Libraries/LibWeb/Page/Page.h3
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.cpp27
-rw-r--r--Userland/Libraries/LibWebView/OutOfProcessWebView.h5
-rw-r--r--Userland/Libraries/LibWebView/ViewImplementation.h3
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.cpp4
-rw-r--r--Userland/Libraries/LibWebView/WebContentClient.h3
-rw-r--r--Userland/Services/WebContent/PageHost.cpp4
-rw-r--r--Userland/Services/WebContent/PageHost.h2
-rw-r--r--Userland/Services/WebContent/WebContentClient.ipc3
-rw-r--r--Userland/Utilities/headless-browser.cpp3
21 files changed, 81 insertions, 62 deletions
diff --git a/Ladybird/BrowserWindow.cpp b/Ladybird/BrowserWindow.cpp
index e1b874bd23..5b4c61d7fc 100644
--- a/Ladybird/BrowserWindow.cpp
+++ b/Ladybird/BrowserWindow.cpp
@@ -313,7 +313,7 @@ BrowserWindow::BrowserWindow(Browser::CookieJar& cookie_jar, StringView webdrive
});
QObject::connect(new_tab_action, &QAction::triggered, this, [this] {
- new_tab(s_settings->new_tab_page(), Activate::Yes);
+ new_tab(s_settings->new_tab_page(), Web::HTML::ActivateTab::Yes);
});
QObject::connect(settings_action, &QAction::triggered, this, [this] {
new SettingsDialog(this);
@@ -327,7 +327,7 @@ BrowserWindow::BrowserWindow(Browser::CookieJar& cookie_jar, StringView webdrive
QObject::connect(m_tabs_container, &QTabWidget::tabCloseRequested, this, &BrowserWindow::close_tab);
QObject::connect(close_current_tab_action, &QAction::triggered, this, &BrowserWindow::close_current_tab);
- new_tab(s_settings->new_tab_page(), Activate::Yes);
+ new_tab(s_settings->new_tab_page(), Web::HTML::ActivateTab::Yes);
setCentralWidget(m_tabs_container);
}
@@ -339,7 +339,7 @@ void BrowserWindow::debug_request(DeprecatedString const& request, DeprecatedStr
m_current_tab->debug_request(request, argument);
}
-Tab& BrowserWindow::new_tab(QString const& url, Activate activate)
+Tab& BrowserWindow::new_tab(QString const& url, Web::HTML::ActivateTab activate_tab)
{
auto tab = make<Tab>(this, m_webdriver_content_ipc_path);
auto tab_ptr = tab.ptr();
@@ -350,7 +350,7 @@ Tab& BrowserWindow::new_tab(QString const& url, Activate activate)
}
m_tabs_container->addTab(tab_ptr, "New Tab");
- if (activate == Activate::Yes)
+ if (activate_tab == Web::HTML::ActivateTab::Yes)
m_tabs_container->setCurrentWidget(tab_ptr);
QObject::connect(tab_ptr, &Tab::title_changed, this, &BrowserWindow::tab_title_changed);
@@ -361,11 +361,11 @@ Tab& BrowserWindow::new_tab(QString const& url, Activate activate)
m_current_tab->navigate(urls[0].toString());
for (qsizetype i = 1; i < urls.size(); ++i)
- new_tab(urls[i].toString(), Activate::No);
+ new_tab(urls[i].toString(), Web::HTML::ActivateTab::No);
});
- tab_ptr->view().on_new_tab = [this]() {
- auto& tab = new_tab("about:blank", Activate::Yes);
+ tab_ptr->view().on_new_tab = [this](auto activate_tab) {
+ auto& tab = new_tab("about:blank", activate_tab);
return tab.view().handle();
};
diff --git a/Ladybird/BrowserWindow.h b/Ladybird/BrowserWindow.h
index dc8f9b80fb..1e6ed62ebf 100644
--- a/Ladybird/BrowserWindow.h
+++ b/Ladybird/BrowserWindow.h
@@ -9,6 +9,7 @@
#include "Tab.h"
#include <LibCore/Forward.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <QIcon>
#include <QLineEdit>
#include <QMainWindow>
@@ -31,15 +32,10 @@ public:
int tab_index(Tab*);
- enum class Activate {
- Yes,
- No,
- };
-
public slots:
void tab_title_changed(int index, QString const&);
void tab_favicon_changed(int index, QIcon icon);
- Tab& new_tab(QString const&, Activate);
+ Tab& new_tab(QString const&, Web::HTML::ActivateTab);
void close_tab(int index);
void close_current_tab();
void open_next_tab();
diff --git a/Ladybird/WebContentView.cpp b/Ladybird/WebContentView.cpp
index 7214476531..f4f4ed5c2e 100644
--- a/Ladybird/WebContentView.cpp
+++ b/Ladybird/WebContentView.cpp
@@ -970,25 +970,24 @@ void WebContentView::notify_server_did_set_cookie(Badge<WebContentClient>, AK::U
on_set_cookie(url, cookie, source);
}
+void WebContentView::notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie)
+{
+ if (on_update_cookie)
+ on_update_cookie(cookie);
+}
+
void WebContentView::notify_server_did_close_browsing_context(Badge<WebContentClient>)
{
emit close();
}
-String WebContentView::notify_request_open_new_tab(Badge<WebContentClient>)
+String WebContentView::notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab)
{
if (on_new_tab)
- return on_new_tab();
-
+ return on_new_tab(activate_tab);
return {};
}
-void WebContentView::notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie)
-{
- if (on_update_cookie)
- on_update_cookie(cookie);
-}
-
void WebContentView::notify_server_did_update_resource_count(i32 count_waiting)
{
// FIXME
diff --git a/Ladybird/WebContentView.h b/Ladybird/WebContentView.h
index 421db81a70..4aac35aa05 100644
--- a/Ladybird/WebContentView.h
+++ b/Ladybird/WebContentView.h
@@ -20,6 +20,7 @@
#include <LibWeb/CSS/PreferredColorScheme.h>
#include <LibWeb/CSS/Selector.h>
#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <LibWebView/ViewImplementation.h>
#include <QAbstractScrollArea>
#include <QPointer>
@@ -49,7 +50,7 @@ public:
explicit WebContentView(StringView webdriver_content_ipc_path);
virtual ~WebContentView() override;
- Function<String()> on_new_tab;
+ Function<String(Web::HTML::ActivateTab)> on_new_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;
@@ -146,7 +147,7 @@ public:
virtual DeprecatedString 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_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) override;
- virtual String notify_request_open_new_tab(Badge<WebContentClient>) override;
+ virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) 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/Applications/Browser/BrowserWindow.cpp b/Userland/Applications/Browser/BrowserWindow.cpp
index c8ca1c6b93..de2545656e 100644
--- a/Userland/Applications/Browser/BrowserWindow.cpp
+++ b/Userland/Applications/Browser/BrowserWindow.cpp
@@ -102,7 +102,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
};
m_window_actions.on_create_new_tab = [this] {
- create_new_tab(Browser::url_from_user_input(Browser::g_new_tab_url), true);
+ create_new_tab(Browser::url_from_user_input(Browser::g_new_tab_url), Web::HTML::ActivateTab::Yes);
};
m_window_actions.on_create_new_window = [this] {
@@ -148,7 +148,7 @@ BrowserWindow::BrowserWindow(CookieJar& cookie_jar, URL url)
build_menus();
- create_new_tab(move(url), true);
+ create_new_tab(move(url), Web::HTML::ActivateTab::Yes);
}
void BrowserWindow::build_menus()
@@ -570,7 +570,7 @@ void BrowserWindow::set_window_title_for_tab(Tab const& tab)
set_title(DeprecatedString::formatted("{} - Browser", title.is_empty() ? url.to_deprecated_string() : title));
}
-Tab& BrowserWindow::create_new_tab(URL url, bool activate)
+Tab& BrowserWindow::create_new_tab(URL url, Web::HTML::ActivateTab activate)
{
auto& new_tab = m_tab_widget->add_tab<Browser::Tab>("New tab"_short_string, *this);
@@ -587,7 +587,7 @@ Tab& BrowserWindow::create_new_tab(URL url, bool activate)
};
new_tab.on_tab_open_request = [this](auto& url) {
- create_new_tab(url, true);
+ create_new_tab(url, Web::HTML::ActivateTab::Yes);
};
new_tab.on_tab_close_request = [this](auto& tab) {
@@ -655,7 +655,7 @@ Tab& BrowserWindow::create_new_tab(URL url, bool activate)
dbgln_if(SPAM_DEBUG, "Added new tab {:p}, loading {}", &new_tab, url);
- if (activate)
+ if (activate == Web::HTML::ActivateTab::Yes)
m_tab_widget->set_active_widget(&new_tab);
return new_tab;
diff --git a/Userland/Applications/Browser/BrowserWindow.h b/Userland/Applications/Browser/BrowserWindow.h
index d5f18cc8c5..5034725dfa 100644
--- a/Userland/Applications/Browser/BrowserWindow.h
+++ b/Userland/Applications/Browser/BrowserWindow.h
@@ -13,6 +13,7 @@
#include <LibConfig/Listener.h>
#include <LibGUI/ActionGroup.h>
#include <LibGUI/Window.h>
+#include <LibWeb/HTML/ActivateTab.h>
namespace Browser {
@@ -28,7 +29,7 @@ public:
GUI::TabWidget& tab_widget();
Tab& active_tab();
- Tab& create_new_tab(URL, bool activate);
+ Tab& create_new_tab(URL, Web::HTML::ActivateTab activate);
void create_new_window(URL);
GUI::Action& go_back_action() { return *m_go_back_action; }
diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp
index 83e724166e..02e1a5a8ea 100644
--- a/Userland/Applications/Browser/Tab.cpp
+++ b/Userland/Applications/Browser/Tab.cpp
@@ -468,8 +468,8 @@ Tab::Tab(BrowserWindow& window)
go_forward();
};
- view().on_new_tab = [this] {
- auto& tab = this->window().create_new_tab(URL("about:blank"), true);
+ view().on_new_tab = [this](auto activate_tab) {
+ auto& tab = this->window().create_new_tab(URL("about:blank"), activate_tab);
return tab.view().handle();
};
diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp
index 049be3a54b..1d9738ab2b 100644
--- a/Userland/Applications/Browser/main.cpp
+++ b/Userland/Applications/Browser/main.cpp
@@ -175,7 +175,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
};
for (size_t i = 1; i < specified_urls.size(); ++i)
- window->create_new_tab(url_from_argument_string(specified_urls[i]), false);
+ window->create_new_tab(url_from_argument_string(specified_urls[i]), Web::HTML::ActivateTab::No);
window->show();
diff --git a/Userland/Libraries/LibWeb/HTML/ActivateTab.h b/Userland/Libraries/LibWeb/HTML/ActivateTab.h
new file mode 100644
index 0000000000..5d6840f4ca
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/ActivateTab.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+namespace Web::HTML {
+
+enum class ActivateTab {
+ Yes,
+ No,
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index affa174a7c..7a530bb46f 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -615,7 +615,7 @@ JS::GCPtr<DOM::Node> BrowsingContext::currently_focused_area()
}
// https://html.spec.whatwg.org/#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name
-BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_context(StringView name, bool no_opener)
+BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_context(StringView name, bool no_opener, ActivateTab activate_tab)
{
// The rules for choosing a browsing context, given a browsing context name name, a browsing context current, and
// a boolean noopener are as follows:
@@ -699,7 +699,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex
// 3. If noopener is true, then set chosen to the result of creating a new top-level browsing context.
if (no_opener) {
- auto handle = m_page->client().page_did_request_new_tab();
+ auto handle = m_page->client().page_did_request_new_tab(activate_tab);
chosen = RemoteBrowsingContext::create_a_new_remote_browsing_context(handle);
}
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
index 3a8c46b768..dd58643135 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
@@ -17,6 +17,7 @@
#include <LibJS/Heap/Cell.h>
#include <LibWeb/DOM/Position.h>
#include <LibWeb/HTML/AbstractBrowsingContext.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <LibWeb/HTML/BrowsingContextContainer.h>
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
#include <LibWeb/HTML/Origin.h>
@@ -171,7 +172,7 @@ public:
WindowType window_type;
};
- ChosenBrowsingContext choose_a_browsing_context(StringView name, bool no_opener);
+ ChosenBrowsingContext choose_a_browsing_context(StringView name, bool no_opener, ActivateTab = ActivateTab::Yes);
size_t document_tree_child_browsing_context_count() const;
diff --git a/Userland/Libraries/LibWeb/Page/Page.h b/Userland/Libraries/LibWeb/Page/Page.h
index 05c15a18b4..f3b54501aa 100644
--- a/Userland/Libraries/LibWeb/Page/Page.h
+++ b/Userland/Libraries/LibWeb/Page/Page.h
@@ -25,6 +25,7 @@
#include <LibWeb/CSS/PreferredColorScheme.h>
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <LibWeb/Loader/FileRequest.h>
#include <LibWeb/PixelUnits.h>
@@ -201,7 +202,7 @@ public:
virtual void page_did_set_cookie(const AK::URL&, Cookie::ParsedCookie const&, Cookie::Source) { }
virtual void page_did_update_cookie(Web::Cookie::Cookie) { }
virtual void page_did_update_resource_count(i32) { }
- virtual String page_did_request_new_tab() { return {}; }
+ virtual String page_did_request_new_tab(HTML::ActivateTab) { return {}; }
virtual void page_did_close_browsing_context(HTML::BrowsingContext const&) { }
virtual void request_file(FileRequest) = 0;
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
index e230d6b632..8470c1296c 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp
@@ -59,14 +59,6 @@ void OutOfProcessWebView::handle_web_content_process_crash()
load_html(builder.to_deprecated_string(), m_url);
}
-String OutOfProcessWebView::notify_request_open_new_tab(Badge<WebContentClient>)
-{
- if (on_new_tab)
- return on_new_tab();
-
- return {};
-}
-
void OutOfProcessWebView::create_client()
{
m_client_state = {};
@@ -475,18 +467,25 @@ void OutOfProcessWebView::notify_server_did_set_cookie(Badge<WebContentClient>,
on_set_cookie(url, cookie, source);
}
-void OutOfProcessWebView::notify_server_did_close_browsing_context(Badge<WebContentClient>)
-{
- if (on_close)
- on_close();
-}
-
void OutOfProcessWebView::notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie)
{
if (on_update_cookie)
on_update_cookie(cookie);
}
+String OutOfProcessWebView::notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab)
+{
+ if (on_new_tab)
+ return on_new_tab(activate_tab);
+ return {};
+}
+
+void OutOfProcessWebView::notify_server_did_close_browsing_context(Badge<WebContentClient>)
+{
+ if (on_close)
+ on_close();
+}
+
void OutOfProcessWebView::notify_server_did_update_resource_count(i32 count_waiting)
{
if (on_resource_status_change)
diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
index f1465e9ecc..66a8e364f7 100644
--- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h
+++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h
@@ -12,6 +12,7 @@
#include <LibGUI/AbstractScrollableWidget.h>
#include <LibGUI/Widget.h>
#include <LibWeb/CSS/Selector.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <LibWeb/Page/Page.h>
#include <LibWebView/ViewImplementation.h>
@@ -57,7 +58,7 @@ public:
// In practice, this means that OOPWV may render scaled stale versions of the content while resizing.
void set_content_scales_to_viewport(bool);
- Function<String()> on_new_tab;
+ Function<String(Web::HTML::ActivateTab)> on_new_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;
@@ -162,7 +163,7 @@ private:
virtual DeprecatedString 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_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) override;
- virtual String notify_request_open_new_tab(Badge<WebContentClient>) override;
+ virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) 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 4bde4ed607..a88b3bd125 100644
--- a/Userland/Libraries/LibWebView/ViewImplementation.h
+++ b/Userland/Libraries/LibWebView/ViewImplementation.h
@@ -12,6 +12,7 @@
#include <LibGfx/Forward.h>
#include <LibGfx/StandardCursor.h>
#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <LibWebView/Forward.h>
#include <LibWebView/WebContentClient.h>
@@ -98,7 +99,7 @@ public:
virtual DeprecatedString 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_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie) = 0;
- virtual String notify_request_open_new_tab(Badge<WebContentClient>) = 0;
+ virtual String notify_server_did_request_new_tab(Badge<WebContentClient>, Web::HTML::ActivateTab activate_tab) = 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 25301251d2..d9b85d350c 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.cpp
+++ b/Userland/Libraries/LibWebView/WebContentClient.cpp
@@ -240,9 +240,9 @@ void WebContentClient::did_update_cookie(Web::Cookie::Cookie const& cookie)
m_view.notify_server_did_update_cookie({}, cookie);
}
-Messages::WebContentClient::DidRequestNewTabResponse WebContentClient::did_request_new_tab()
+Messages::WebContentClient::DidRequestNewTabResponse WebContentClient::did_request_new_tab(Web::HTML::ActivateTab const& activate_tab)
{
- return m_view.notify_request_open_new_tab({});
+ return m_view.notify_server_did_request_new_tab({}, activate_tab);
}
void WebContentClient::did_close_browsing_context()
diff --git a/Userland/Libraries/LibWebView/WebContentClient.h b/Userland/Libraries/LibWebView/WebContentClient.h
index 5cfdcefc19..a7d32ec695 100644
--- a/Userland/Libraries/LibWebView/WebContentClient.h
+++ b/Userland/Libraries/LibWebView/WebContentClient.h
@@ -8,6 +8,7 @@
#include <AK/HashMap.h>
#include <LibIPC/ConnectionToServer.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <WebContent/WebContentClientEndpoint.h>
#include <WebContent/WebContentServerEndpoint.h>
@@ -69,6 +70,7 @@ private:
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_cookie(Web::Cookie::Cookie const&) override;
+ virtual Messages::WebContentClient::DidRequestNewTabResponse did_request_new_tab(Web::HTML::ActivateTab const& 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;
@@ -79,7 +81,6 @@ private:
virtual Messages::WebContentClient::DidRequestFullscreenWindowResponse did_request_fullscreen_window() override;
virtual void did_request_file(DeprecatedString const& path, i32) override;
virtual void did_finish_handling_input_event(bool event_was_accepted) override;
- virtual Messages::WebContentClient::DidRequestNewTabResponse did_request_new_tab() override;
ViewImplementation& m_view;
};
diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp
index 069124ffdd..0ddc552154 100644
--- a/Userland/Services/WebContent/PageHost.cpp
+++ b/Userland/Services/WebContent/PageHost.cpp
@@ -377,9 +377,9 @@ void PageHost::page_did_update_resource_count(i32 count_waiting)
m_client.async_did_update_resource_count(count_waiting);
}
-String PageHost::page_did_request_new_tab()
+String PageHost::page_did_request_new_tab(Web::HTML::ActivateTab activate_tab)
{
- return m_client.did_request_new_tab();
+ return m_client.did_request_new_tab(activate_tab);
}
void PageHost::page_did_close_browsing_context(Web::HTML::BrowsingContext const&)
diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h
index 447774796f..faf8e2250b 100644
--- a/Userland/Services/WebContent/PageHost.h
+++ b/Userland/Services/WebContent/PageHost.h
@@ -98,7 +98,7 @@ private:
virtual void page_did_set_cookie(const URL&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override;
virtual void page_did_update_cookie(Web::Cookie::Cookie) override;
virtual void page_did_update_resource_count(i32) override;
- virtual String page_did_request_new_tab() override;
+ virtual String page_did_request_new_tab(Web::HTML::ActivateTab activate_tab) override;
virtual void page_did_close_browsing_context(Web::HTML::BrowsingContext const&) override;
virtual void request_file(Web::FileRequest) override;
diff --git a/Userland/Services/WebContent/WebContentClient.ipc b/Userland/Services/WebContent/WebContentClient.ipc
index cc7c201291..4d7df2ef50 100644
--- a/Userland/Services/WebContent/WebContentClient.ipc
+++ b/Userland/Services/WebContent/WebContentClient.ipc
@@ -3,6 +3,7 @@
#include <LibGfx/ShareableBitmap.h>
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/Cookie/ParsedCookie.h>
+#include <LibWeb/HTML/ActivateTab.h>
endpoint WebContentClient
{
@@ -46,6 +47,7 @@ endpoint WebContentClient
did_set_cookie(URL url, Web::Cookie::ParsedCookie cookie, u8 source) =|
did_update_cookie(Web::Cookie::Cookie cookie) =|
did_update_resource_count(i32 count_waiting) =|
+ did_request_new_tab(Web::HTML::ActivateTab activate_tab) => (String handle)
did_close_browsing_context() =|
did_request_restore_window() =|
did_request_reposition_window(Gfx::IntPoint position) => (Gfx::IntPoint window_position)
@@ -55,7 +57,6 @@ endpoint WebContentClient
did_request_fullscreen_window() => (Gfx::IntRect window_rect)
did_request_file(DeprecatedString path, i32 request_id) =|
did_finish_handling_input_event(bool event_was_accepted) =|
- did_request_new_tab() => (String handle)
did_output_js_console_message(i32 message_index) =|
did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> message_types, Vector<DeprecatedString> messages) =|
diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp
index 6cbe8fee1e..a3e4599f57 100644
--- a/Userland/Utilities/headless-browser.cpp
+++ b/Userland/Utilities/headless-browser.cpp
@@ -36,6 +36,7 @@
#include <LibIPC/File.h>
#include <LibWeb/Cookie/Cookie.h>
#include <LibWeb/Cookie/ParsedCookie.h>
+#include <LibWeb/HTML/ActivateTab.h>
#include <LibWeb/Loader/FrameLoader.h>
#include <LibWebView/ViewImplementation.h>
#include <LibWebView/WebContentClient.h>
@@ -132,7 +133,7 @@ private:
DeprecatedString notify_server_did_request_cookie(Badge<WebView::WebContentClient>, const URL&, Web::Cookie::Source) override { return {}; }
void notify_server_did_set_cookie(Badge<WebView::WebContentClient>, const URL&, Web::Cookie::ParsedCookie const&, Web::Cookie::Source) override { }
void notify_server_did_update_cookie(Badge<WebView::WebContentClient>, Web::Cookie::Cookie const&) override { }
- String notify_request_open_new_tab(Badge<WebView::WebContentClient>) override { return {}; }
+ String notify_server_did_request_new_tab(Badge<WebView::WebContentClient>, Web::HTML::ActivateTab) override { return {}; }
void notify_server_did_close_browsing_context(Badge<WebView::WebContentClient>) override { }
void notify_server_did_update_resource_count(i32) override { }
void notify_server_did_request_restore_window() override { }