1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 12:00:49 +00:00

Ladybird: Handle close event in WebContentView

This commit is contained in:
Aliaksandr Kalenik 2023-03-07 06:13:08 +03:00 committed by Linus Groh
parent cc41233be4
commit 59752807c4
3 changed files with 7 additions and 0 deletions

View File

@ -64,6 +64,10 @@ Tab::Tab(BrowserWindow* window, StringView webdriver_content_ipc_path)
m_toolbar->addAction(m_home_action);
m_toolbar->addWidget(m_location_edit);
QObject::connect(m_view, &WebContentView::close, [this] {
m_window->close_tab(tab_index());
});
QObject::connect(m_view, &WebContentView::link_hovered, [this](QString const& title) {
m_hover_label->setText(title);
update_hover_label();

View File

@ -966,6 +966,7 @@ void WebContentView::notify_server_did_set_cookie(Badge<WebContentClient>, AK::U
void WebContentView::notify_server_did_close_browsing_context(Badge<WebContentClient>)
{
emit close();
}
void WebContentView::notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie)

View File

@ -49,6 +49,7 @@ public:
explicit WebContentView(StringView webdriver_content_ipc_path);
virtual ~WebContentView() override;
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;
Function<void(const AK::URL&, Gfx::IntPoint screen_position)> on_link_context_menu_request;
@ -154,6 +155,7 @@ public:
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
signals:
void close();
void link_hovered(QString, int timeout = 0);
void link_unhovered();
void back_mouse_button();