mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-09 18:16:09 +03:00
LibWeb+LibWebView+WebContent+Ladybird: Add IPC call that opens new tab
This commit is contained in:
parent
4717d645d3
commit
a9f8d4eada
Notes:
sideshowbarker
2024-07-17 07:25:39 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/a9f8d4eada Pull-request: https://github.com/SerenityOS/serenity/pull/17855 Reviewed-by: https://github.com/linusg Reviewed-by: https://github.com/trflynn89 ✅
@ -975,6 +975,11 @@ void WebContentView::notify_server_did_close_browsing_context(Badge<WebContentCl
|
||||
emit close();
|
||||
}
|
||||
|
||||
String WebContentView::notify_request_open_new_tab(Badge<WebContentClient>)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void WebContentView::notify_server_did_update_cookie(Badge<WebContentClient>, Web::Cookie::Cookie const& cookie)
|
||||
{
|
||||
if (on_update_cookie)
|
||||
|
@ -145,6 +145,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 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;
|
||||
|
@ -201,6 +201,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 void page_did_close_browsing_context(HTML::BrowsingContext const&) { }
|
||||
|
||||
virtual void request_file(FileRequest) = 0;
|
||||
|
@ -59,6 +59,14 @@ 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 = {};
|
||||
|
@ -57,6 +57,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<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;
|
||||
@ -161,6 +162,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 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;
|
||||
|
@ -98,6 +98,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 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;
|
||||
|
@ -240,6 +240,11 @@ 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()
|
||||
{
|
||||
return m_view.notify_request_open_new_tab({});
|
||||
}
|
||||
|
||||
void WebContentClient::did_close_browsing_context()
|
||||
{
|
||||
m_view.notify_server_did_close_browsing_context({});
|
||||
|
@ -79,6 +79,7 @@ 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;
|
||||
};
|
||||
|
@ -377,6 +377,11 @@ 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()
|
||||
{
|
||||
return m_client.did_request_new_tab();
|
||||
}
|
||||
|
||||
void PageHost::page_did_close_browsing_context(Web::HTML::BrowsingContext const&)
|
||||
{
|
||||
m_client.async_did_close_browsing_context();
|
||||
|
@ -98,6 +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 void page_did_close_browsing_context(Web::HTML::BrowsingContext const&) override;
|
||||
virtual void request_file(Web::FileRequest) override;
|
||||
|
||||
|
@ -55,6 +55,7 @@ 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) =|
|
||||
|
@ -132,6 +132,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 {}; }
|
||||
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 { }
|
||||
|
Loading…
Reference in New Issue
Block a user