mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
Browser: Remove some needless indirection from Cookie-related IPCs
We don't need to forward Cookie-related IPCs from the WebView through the Tab to the BrowserWindow. We can skip the Tab like we do in other chromes. This is primarily to reduce overhead when changing Cookie IPCs in future patches.
This commit is contained in:
parent
8ea4e37c27
commit
dcd9962d7b
|
@ -361,9 +361,7 @@ void BrowserWindow::build_menus(StringView const man_file)
|
||||||
active_tab().m_history.dump();
|
active_tab().m_history.dump();
|
||||||
}));
|
}));
|
||||||
debug_menu->add_action(GUI::Action::create("Dump C&ookies", g_icon_bag.cookie, [this](auto&) {
|
debug_menu->add_action(GUI::Action::create("Dump C&ookies", g_icon_bag.cookie, [this](auto&) {
|
||||||
auto& tab = active_tab();
|
m_cookie_jar.dump_cookies();
|
||||||
if (tab.on_dump_cookies)
|
|
||||||
tab.on_dump_cookies();
|
|
||||||
}));
|
}));
|
||||||
debug_menu->add_action(GUI::Action::create("Dump Loc&al Storage", g_icon_bag.local_storage, [this](auto&) {
|
debug_menu->add_action(GUI::Action::create("Dump Loc&al Storage", g_icon_bag.local_storage, [this](auto&) {
|
||||||
active_tab().view().debug_request("dump-local-storage");
|
active_tab().view().debug_request("dump-local-storage");
|
||||||
|
@ -578,28 +576,24 @@ Tab& BrowserWindow::create_new_tab(URL const& url, Web::HTML::ActivateTab activa
|
||||||
create_new_window(url);
|
create_new_window(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
new_tab.on_get_all_cookies = [this](auto& url) {
|
new_tab.view().on_get_all_cookies = [this](auto& url) {
|
||||||
return m_cookie_jar.get_all_cookies(url);
|
return m_cookie_jar.get_all_cookies(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
new_tab.on_get_named_cookie = [this](auto& url, auto& name) {
|
new_tab.view().on_get_named_cookie = [this](auto& url, auto& name) {
|
||||||
return m_cookie_jar.get_named_cookie(url, name);
|
return m_cookie_jar.get_named_cookie(url, name);
|
||||||
};
|
};
|
||||||
|
|
||||||
new_tab.on_get_cookie = [this](auto& url, auto source) -> ByteString {
|
new_tab.view().on_get_cookie = [this](auto& url, auto source) {
|
||||||
return m_cookie_jar.get_cookie(url, source);
|
return m_cookie_jar.get_cookie(url, source);
|
||||||
};
|
};
|
||||||
|
|
||||||
new_tab.on_set_cookie = [this](auto& url, auto& cookie, auto source) {
|
new_tab.view().on_set_cookie = [this](auto& url, auto& cookie, auto source) {
|
||||||
m_cookie_jar.set_cookie(url, cookie, source);
|
m_cookie_jar.set_cookie(url, cookie, source);
|
||||||
};
|
};
|
||||||
|
|
||||||
new_tab.on_dump_cookies = [this]() {
|
new_tab.view().on_update_cookie = [this](auto const& cookie) {
|
||||||
m_cookie_jar.dump_cookies();
|
m_cookie_jar.update_cookie(cookie);
|
||||||
};
|
|
||||||
|
|
||||||
new_tab.on_update_cookie = [this](auto cookie) {
|
|
||||||
m_cookie_jar.update_cookie(move(cookie));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
new_tab.on_get_cookies_entries = [this]() {
|
new_tab.on_get_cookies_entries = [this]() {
|
||||||
|
|
|
@ -479,34 +479,6 @@ Tab::Tab(BrowserWindow& window)
|
||||||
on_favicon_change(icon);
|
on_favicon_change(icon);
|
||||||
};
|
};
|
||||||
|
|
||||||
view().on_get_all_cookies = [this](auto& url) -> Vector<Web::Cookie::Cookie> {
|
|
||||||
if (on_get_all_cookies)
|
|
||||||
return on_get_all_cookies(url);
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_get_named_cookie = [this](auto& url, auto& name) -> Optional<Web::Cookie::Cookie> {
|
|
||||||
if (on_get_named_cookie)
|
|
||||||
return on_get_named_cookie(url, name);
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_get_cookie = [this](auto& url, auto source) -> ByteString {
|
|
||||||
if (on_get_cookie)
|
|
||||||
return on_get_cookie(url, source);
|
|
||||||
return {};
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_set_cookie = [this](auto& url, auto& cookie, auto source) {
|
|
||||||
if (on_set_cookie)
|
|
||||||
on_set_cookie(url, cookie, source);
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_update_cookie = [this](auto& cookie) {
|
|
||||||
if (on_update_cookie)
|
|
||||||
on_update_cookie(cookie);
|
|
||||||
};
|
|
||||||
|
|
||||||
view().on_request_alert = [this](String const& message) {
|
view().on_request_alert = [this](String const& message) {
|
||||||
auto& window = this->window();
|
auto& window = this->window();
|
||||||
|
|
||||||
|
@ -975,8 +947,8 @@ void Tab::show_storage_inspector()
|
||||||
storage_window->set_icon(g_icon_bag.cookie);
|
storage_window->set_icon(g_icon_bag.cookie);
|
||||||
m_storage_widget = storage_window->set_main_widget<StorageWidget>();
|
m_storage_widget = storage_window->set_main_widget<StorageWidget>();
|
||||||
m_storage_widget->on_update_cookie = [this](Web::Cookie::Cookie cookie) {
|
m_storage_widget->on_update_cookie = [this](Web::Cookie::Cookie cookie) {
|
||||||
if (on_update_cookie)
|
if (view().on_update_cookie)
|
||||||
on_update_cookie(move(cookie));
|
view().on_update_cookie(move(cookie));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,12 +70,6 @@ public:
|
||||||
Function<void(Tab&)> on_tab_close_other_request;
|
Function<void(Tab&)> on_tab_close_other_request;
|
||||||
Function<void(const URL&)> on_window_open_request;
|
Function<void(const URL&)> on_window_open_request;
|
||||||
Function<void(Gfx::Bitmap const&)> on_favicon_change;
|
Function<void(Gfx::Bitmap const&)> on_favicon_change;
|
||||||
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
|
|
||||||
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, ByteString const& name)> on_get_named_cookie;
|
|
||||||
Function<ByteString(const URL&, Web::Cookie::Source source)> on_get_cookie;
|
|
||||||
Function<void(const URL&, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
|
|
||||||
Function<void()> on_dump_cookies;
|
|
||||||
Function<void(Web::Cookie::Cookie)> on_update_cookie;
|
|
||||||
Function<Vector<Web::Cookie::Cookie>()> on_get_cookies_entries;
|
Function<Vector<Web::Cookie::Cookie>()> on_get_cookies_entries;
|
||||||
Function<OrderedHashMap<String, String>()> on_get_local_storage_entries;
|
Function<OrderedHashMap<String, String>()> on_get_local_storage_entries;
|
||||||
Function<OrderedHashMap<String, String>()> on_get_session_storage_entries;
|
Function<OrderedHashMap<String, String>()> on_get_session_storage_entries;
|
||||||
|
|
Loading…
Reference in a new issue