1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 17:07:47 +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

@ -590,6 +590,10 @@ Tab& BrowserWindow::create_new_tab(URL url, Web::HTML::ActivateTab activate)
create_new_tab(url, Web::HTML::ActivateTab::Yes);
};
new_tab.on_activate_tab_request = [this](auto& tab) {
m_tab_widget->set_active_widget(&tab);
};
new_tab.on_tab_close_request = [this](auto& tab) {
m_tab_widget->deferred_invoke([this, &tab] {
m_tab_widget->remove_tab(tab);

View file

@ -473,6 +473,10 @@ Tab::Tab(BrowserWindow& window)
return tab.view().handle();
};
view().on_activate_tab = [this]() {
on_activate_tab_request(*this);
};
view().on_close = [this] {
on_tab_close_request(*this);
};

View file

@ -62,6 +62,7 @@ public:
Function<void(DeprecatedString const&)> on_title_change;
Function<void(const URL&)> on_tab_open_request;
Function<void(Tab&)> on_activate_tab_request;
Function<void(Tab&)> on_tab_close_request;
Function<void(Tab&)> on_tab_close_other_request;
Function<void(const URL&)> on_window_open_request;