2020-06-17 18:31:42 +03:00
|
|
|
/*
|
2021-02-10 10:48:28 +03:00
|
|
|
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
|
2020-06-17 18:31:42 +03:00
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-17 18:31:42 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "WebContentClient.h"
|
2023-05-20 17:52:02 +03:00
|
|
|
#include "ViewImplementation.h"
|
2021-01-17 18:57:17 +03:00
|
|
|
#include <AK/Debug.h>
|
2021-04-15 17:36:20 +03:00
|
|
|
#include <LibWeb/Cookie/ParsedCookie.h>
|
2020-06-17 18:31:42 +03:00
|
|
|
|
2022-04-30 11:46:33 +03:00
|
|
|
namespace WebView {
|
2020-08-24 14:03:18 +03:00
|
|
|
|
2023-02-09 01:05:44 +03:00
|
|
|
WebContentClient::WebContentClient(NonnullOwnPtr<Core::LocalSocket> socket, ViewImplementation& view)
|
2022-02-25 13:27:37 +03:00
|
|
|
: IPC::ConnectionToServer<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket))
|
2020-06-17 18:31:42 +03:00
|
|
|
, m_view(view)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-01-30 20:20:40 +03:00
|
|
|
void WebContentClient::die()
|
|
|
|
{
|
2021-02-23 22:42:32 +03:00
|
|
|
VERIFY(on_web_content_process_crash);
|
2021-01-30 20:20:40 +03:00
|
|
|
on_web_content_process_crash();
|
|
|
|
}
|
|
|
|
|
2023-05-14 19:53:29 +03:00
|
|
|
void WebContentClient::did_paint(Gfx::IntRect const& rect, i32 bitmap_id)
|
2020-06-17 18:31:42 +03:00
|
|
|
{
|
2023-05-20 17:50:05 +03:00
|
|
|
m_view.server_did_paint({}, bitmap_id, rect.size());
|
2020-06-17 18:31:42 +03:00
|
|
|
}
|
|
|
|
|
2023-05-17 19:37:31 +03:00
|
|
|
void WebContentClient::did_start_loading(AK::URL const& url, bool is_redirect)
|
|
|
|
{
|
|
|
|
m_view.set_url({}, url);
|
|
|
|
|
|
|
|
if (m_view.on_load_start)
|
|
|
|
m_view.on_load_start(url, is_redirect);
|
|
|
|
}
|
|
|
|
|
2021-09-13 00:33:23 +03:00
|
|
|
void WebContentClient::did_finish_loading(AK::URL const& url)
|
2020-06-17 18:31:42 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
m_view.set_url({}, url);
|
|
|
|
|
|
|
|
if (m_view.on_load_finish)
|
|
|
|
m_view.on_load_finish(url);
|
2020-06-17 18:31:42 +03:00
|
|
|
}
|
2020-06-17 19:00:18 +03:00
|
|
|
|
2023-09-14 20:17:32 +03:00
|
|
|
void WebContentClient::did_finish_text_test()
|
|
|
|
{
|
|
|
|
if (m_view.on_text_test_finish)
|
|
|
|
m_view.on_text_test_finish();
|
|
|
|
}
|
|
|
|
|
2022-11-11 21:33:11 +03:00
|
|
|
void WebContentClient::did_request_navigate_back()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_navigate_back)
|
|
|
|
m_view.on_navigate_back();
|
2022-11-11 21:33:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WebContentClient::did_request_navigate_forward()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_navigate_forward)
|
|
|
|
m_view.on_navigate_forward();
|
2022-11-11 21:33:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WebContentClient::did_request_refresh()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_refresh)
|
|
|
|
m_view.on_refresh();
|
2022-11-11 21:33:11 +03:00
|
|
|
}
|
|
|
|
|
2021-05-02 20:54:34 +03:00
|
|
|
void WebContentClient::did_invalidate_content_rect(Gfx::IntRect const& content_rect)
|
2020-06-17 19:00:18 +03:00
|
|
|
{
|
2021-05-02 20:54:34 +03:00
|
|
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidInvalidateContentRect! content_rect={}", content_rect);
|
2020-06-17 19:00:18 +03:00
|
|
|
|
|
|
|
// FIXME: Figure out a way to coalesce these messages to reduce unnecessary painting
|
2023-05-20 18:04:02 +03:00
|
|
|
m_view.server_did_invalidate_content_rect({}, content_rect);
|
2020-06-17 19:00:18 +03:00
|
|
|
}
|
2020-07-04 21:57:57 +03:00
|
|
|
|
2021-05-02 20:54:34 +03:00
|
|
|
void WebContentClient::did_change_selection()
|
2020-07-04 21:57:57 +03:00
|
|
|
{
|
2021-05-01 22:10:08 +03:00
|
|
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidChangeSelection!");
|
2023-05-20 18:04:02 +03:00
|
|
|
m_view.server_did_change_selection({});
|
2020-07-04 21:57:57 +03:00
|
|
|
}
|
2020-07-05 00:19:32 +03:00
|
|
|
|
2021-05-02 20:54:34 +03:00
|
|
|
void WebContentClient::did_request_cursor_change(i32 cursor_type)
|
2021-02-28 00:12:12 +03:00
|
|
|
{
|
2021-05-02 20:54:34 +03:00
|
|
|
if (cursor_type < 0 || cursor_type >= (i32)Gfx::StandardCursor::__Count) {
|
2021-02-28 00:12:12 +03:00
|
|
|
dbgln("DidRequestCursorChange: Bad cursor type");
|
|
|
|
return;
|
|
|
|
}
|
2023-08-23 17:43:27 +03:00
|
|
|
|
|
|
|
if (m_view.on_cursor_change)
|
|
|
|
m_view.on_cursor_change(static_cast<Gfx::StandardCursor>(cursor_type));
|
2021-02-28 00:12:12 +03:00
|
|
|
}
|
|
|
|
|
2022-12-07 00:35:32 +03:00
|
|
|
void WebContentClient::did_layout(Gfx::IntSize content_size)
|
2020-07-05 00:19:32 +03:00
|
|
|
{
|
2021-05-02 20:54:34 +03:00
|
|
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidLayout! content_size={}", content_size);
|
2023-08-23 17:33:26 +03:00
|
|
|
if (m_view.on_did_layout)
|
|
|
|
m_view.on_did_layout(content_size);
|
2020-07-05 00:19:32 +03:00
|
|
|
}
|
2020-07-05 00:40:17 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
void WebContentClient::did_change_title(DeprecatedString const& title)
|
2020-07-05 00:40:17 +03:00
|
|
|
{
|
2021-05-02 20:54:34 +03:00
|
|
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidChangeTitle! title={}", title);
|
2023-05-17 19:37:31 +03:00
|
|
|
|
2023-06-07 23:37:30 +03:00
|
|
|
if (!m_view.on_title_change)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (title.is_empty())
|
|
|
|
m_view.on_title_change(m_view.url().to_deprecated_string());
|
|
|
|
else
|
2023-05-17 19:37:31 +03:00
|
|
|
m_view.on_title_change(title);
|
2020-07-05 00:40:17 +03:00
|
|
|
}
|
2020-07-05 16:43:43 +03:00
|
|
|
|
2021-09-08 13:22:44 +03:00
|
|
|
void WebContentClient::did_request_scroll(i32 x_delta, i32 y_delta)
|
2021-03-02 00:39:07 +03:00
|
|
|
{
|
2023-08-23 17:57:09 +03:00
|
|
|
if (m_view.on_scroll_by_delta)
|
|
|
|
m_view.on_scroll_by_delta(x_delta, y_delta);
|
2021-03-02 00:39:07 +03:00
|
|
|
}
|
|
|
|
|
2022-12-06 23:27:44 +03:00
|
|
|
void WebContentClient::did_request_scroll_to(Gfx::IntPoint scroll_position)
|
2021-09-08 13:44:36 +03:00
|
|
|
{
|
2023-08-23 17:57:09 +03:00
|
|
|
if (m_view.on_scroll_to_point)
|
|
|
|
m_view.on_scroll_to_point(scroll_position);
|
2021-09-08 13:44:36 +03:00
|
|
|
}
|
|
|
|
|
2021-05-02 20:54:34 +03:00
|
|
|
void WebContentClient::did_request_scroll_into_view(Gfx::IntRect const& rect)
|
2020-07-05 16:43:43 +03:00
|
|
|
{
|
2021-05-02 20:54:34 +03:00
|
|
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidRequestScrollIntoView! rect={}", rect);
|
2023-08-23 17:57:09 +03:00
|
|
|
if (m_view.on_scroll_into_view)
|
|
|
|
m_view.on_scroll_into_view(rect);
|
2020-07-05 16:43:43 +03:00
|
|
|
}
|
2020-07-05 17:59:20 +03:00
|
|
|
|
2022-12-06 23:27:44 +03:00
|
|
|
void WebContentClient::did_enter_tooltip_area(Gfx::IntPoint content_position, DeprecatedString const& title)
|
2021-03-30 19:10:06 +03:00
|
|
|
{
|
2023-08-23 18:11:39 +03:00
|
|
|
if (m_view.on_enter_tooltip_area)
|
|
|
|
m_view.on_enter_tooltip_area(m_view.to_widget_position(content_position), title);
|
2021-03-30 19:10:06 +03:00
|
|
|
}
|
|
|
|
|
2021-05-02 20:54:34 +03:00
|
|
|
void WebContentClient::did_leave_tooltip_area()
|
2021-03-30 19:10:06 +03:00
|
|
|
{
|
2023-08-23 18:11:39 +03:00
|
|
|
if (m_view.on_leave_tooltip_area)
|
|
|
|
m_view.on_leave_tooltip_area();
|
2021-03-30 19:10:06 +03:00
|
|
|
}
|
|
|
|
|
2021-09-13 00:33:23 +03:00
|
|
|
void WebContentClient::did_hover_link(AK::URL const& url)
|
2020-07-05 17:59:20 +03:00
|
|
|
{
|
2021-05-02 20:54:34 +03:00
|
|
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidHoverLink! url={}", url);
|
2023-05-17 19:37:31 +03:00
|
|
|
|
|
|
|
if (m_view.on_link_hover)
|
|
|
|
m_view.on_link_hover(url);
|
2020-07-05 17:59:20 +03:00
|
|
|
}
|
|
|
|
|
2021-05-02 20:54:34 +03:00
|
|
|
void WebContentClient::did_unhover_link()
|
2020-07-05 17:59:20 +03:00
|
|
|
{
|
2021-05-01 22:10:08 +03:00
|
|
|
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidUnhoverLink!");
|
2023-05-17 19:37:31 +03:00
|
|
|
|
|
|
|
if (m_view.on_link_unhover)
|
|
|
|
m_view.on_link_unhover();
|
2020-07-05 17:59:20 +03:00
|
|
|
}
|
2020-07-06 21:01:46 +03:00
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
void WebContentClient::did_click_link(AK::URL const& url, DeprecatedString const& target, unsigned modifiers)
|
2020-07-06 21:01:46 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_link_click)
|
|
|
|
m_view.on_link_click(url, target, modifiers);
|
2020-07-06 21:01:46 +03:00
|
|
|
}
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
void WebContentClient::did_middle_click_link(AK::URL const& url, DeprecatedString const& target, unsigned modifiers)
|
2020-07-06 21:01:46 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_link_middle_click)
|
|
|
|
m_view.on_link_middle_click(url, target, modifiers);
|
2020-07-06 22:58:16 +03:00
|
|
|
}
|
2020-07-07 13:24:29 +03:00
|
|
|
|
2022-12-06 23:27:44 +03:00
|
|
|
void WebContentClient::did_request_context_menu(Gfx::IntPoint content_position)
|
2020-07-07 13:24:29 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_context_menu_request)
|
|
|
|
m_view.on_context_menu_request(m_view.to_widget_position(content_position));
|
2020-07-07 13:24:29 +03:00
|
|
|
}
|
|
|
|
|
2023-05-17 19:37:31 +03:00
|
|
|
void WebContentClient::did_request_link_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned)
|
2020-07-07 13:24:29 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_link_context_menu_request)
|
|
|
|
m_view.on_link_context_menu_request(url, m_view.to_widget_position(content_position));
|
2020-07-07 13:24:29 +03:00
|
|
|
}
|
2020-08-24 14:03:18 +03:00
|
|
|
|
2023-05-17 19:37:31 +03:00
|
|
|
void WebContentClient::did_request_image_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const& bitmap)
|
2021-04-11 17:49:25 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_image_context_menu_request)
|
|
|
|
m_view.on_image_context_menu_request(url, m_view.to_widget_position(content_position), bitmap);
|
2021-04-11 17:49:25 +03:00
|
|
|
}
|
|
|
|
|
2023-06-16 17:51:38 +03:00
|
|
|
void WebContentClient::did_request_media_context_menu(Gfx::IntPoint content_position, DeprecatedString const&, unsigned, Web::Page::MediaContextMenu const& menu)
|
2023-05-15 16:42:56 +03:00
|
|
|
{
|
2023-06-16 17:51:38 +03:00
|
|
|
if (m_view.on_media_context_menu_request)
|
|
|
|
m_view.on_media_context_menu_request(m_view.to_widget_position(content_position), menu);
|
2023-05-15 16:42:56 +03:00
|
|
|
}
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
void WebContentClient::did_get_source(AK::URL const& url, DeprecatedString const& source)
|
2021-02-23 15:17:23 +03:00
|
|
|
{
|
2023-08-23 18:25:24 +03:00
|
|
|
if (m_view.on_received_source)
|
|
|
|
m_view.on_received_source(url, source);
|
2021-02-23 15:17:23 +03:00
|
|
|
}
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
void WebContentClient::did_get_dom_tree(DeprecatedString const& dom_tree)
|
2021-06-07 18:35:10 +03:00
|
|
|
{
|
2023-08-23 18:25:24 +03:00
|
|
|
if (m_view.on_received_dom_tree)
|
|
|
|
m_view.on_received_dom_tree(dom_tree);
|
2021-06-07 18:35:10 +03:00
|
|
|
}
|
|
|
|
|
2023-05-17 19:37:31 +03:00
|
|
|
void WebContentClient::did_get_accessibility_tree(DeprecatedString const& accessibility_tree)
|
|
|
|
{
|
2023-08-23 18:25:24 +03:00
|
|
|
if (m_view.on_received_accessibility_tree)
|
|
|
|
m_view.on_received_accessibility_tree(accessibility_tree);
|
2021-08-27 14:47:30 +03:00
|
|
|
}
|
|
|
|
|
2021-09-04 13:14:25 +03:00
|
|
|
void WebContentClient::did_output_js_console_message(i32 message_index)
|
|
|
|
{
|
2023-08-23 18:25:24 +03:00
|
|
|
if (m_view.on_received_console_message)
|
|
|
|
m_view.on_received_console_message(message_index);
|
2021-09-04 13:14:25 +03:00
|
|
|
}
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
void WebContentClient::did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
|
2021-09-04 13:14:25 +03:00
|
|
|
{
|
2023-08-23 18:25:24 +03:00
|
|
|
if (m_view.on_received_console_messages)
|
|
|
|
m_view.on_received_console_messages(start_index, message_types, messages);
|
2021-09-04 13:14:25 +03:00
|
|
|
}
|
|
|
|
|
2023-03-14 00:30:51 +03:00
|
|
|
void WebContentClient::did_request_alert(String const& message)
|
2020-09-12 12:56:13 +03:00
|
|
|
{
|
2023-05-17 21:23:34 +03:00
|
|
|
if (m_view.on_request_alert)
|
|
|
|
m_view.on_request_alert(message);
|
2020-09-12 12:56:13 +03:00
|
|
|
}
|
|
|
|
|
2023-03-14 00:30:51 +03:00
|
|
|
void WebContentClient::did_request_confirm(String const& message)
|
2021-02-10 10:48:28 +03:00
|
|
|
{
|
2023-05-17 21:23:34 +03:00
|
|
|
if (m_view.on_request_confirm)
|
|
|
|
m_view.on_request_confirm(message);
|
2021-02-10 10:48:28 +03:00
|
|
|
}
|
|
|
|
|
2023-03-14 00:30:51 +03:00
|
|
|
void WebContentClient::did_request_prompt(String const& message, String const& default_)
|
2021-02-20 14:05:18 +03:00
|
|
|
{
|
2023-05-17 21:23:34 +03:00
|
|
|
if (m_view.on_request_prompt)
|
|
|
|
m_view.on_request_prompt(message, default_);
|
2021-02-20 14:05:18 +03:00
|
|
|
}
|
|
|
|
|
2023-03-14 00:30:51 +03:00
|
|
|
void WebContentClient::did_request_set_prompt_text(String const& message)
|
2022-11-16 16:57:05 +03:00
|
|
|
{
|
2023-05-17 21:23:34 +03:00
|
|
|
if (m_view.on_request_set_prompt_text)
|
|
|
|
m_view.on_request_set_prompt_text(message);
|
2022-11-16 16:57:05 +03:00
|
|
|
}
|
|
|
|
|
2022-11-16 14:58:14 +03:00
|
|
|
void WebContentClient::did_request_accept_dialog()
|
|
|
|
{
|
2023-05-17 21:23:34 +03:00
|
|
|
if (m_view.on_request_accept_dialog)
|
|
|
|
m_view.on_request_accept_dialog();
|
2022-11-16 14:58:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void WebContentClient::did_request_dismiss_dialog()
|
|
|
|
{
|
2023-05-17 21:23:34 +03:00
|
|
|
if (m_view.on_request_dismiss_dialog)
|
|
|
|
m_view.on_request_dismiss_dialog();
|
2022-11-16 14:58:14 +03:00
|
|
|
}
|
|
|
|
|
2021-05-02 20:54:34 +03:00
|
|
|
void WebContentClient::did_change_favicon(Gfx::ShareableBitmap const& favicon)
|
2021-03-26 17:41:25 +03:00
|
|
|
{
|
2021-05-02 20:54:34 +03:00
|
|
|
if (!favicon.is_valid()) {
|
2021-03-26 17:41:25 +03:00
|
|
|
dbgln("DidChangeFavicon: Received invalid favicon");
|
|
|
|
return;
|
|
|
|
}
|
2023-05-17 19:37:31 +03:00
|
|
|
|
|
|
|
if (m_view.on_favicon_change)
|
|
|
|
m_view.on_favicon_change(*favicon.bitmap());
|
2021-03-26 17:41:25 +03:00
|
|
|
}
|
|
|
|
|
2022-11-11 17:23:24 +03:00
|
|
|
Messages::WebContentClient::DidRequestAllCookiesResponse WebContentClient::did_request_all_cookies(AK::URL const& url)
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_get_all_cookies)
|
|
|
|
return m_view.on_get_all_cookies(url);
|
|
|
|
return Vector<Web::Cookie::Cookie> {};
|
2022-11-11 17:23:24 +03:00
|
|
|
}
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
Messages::WebContentClient::DidRequestNamedCookieResponse WebContentClient::did_request_named_cookie(AK::URL const& url, DeprecatedString const& name)
|
2022-11-11 17:46:56 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_get_named_cookie)
|
|
|
|
return m_view.on_get_named_cookie(url, name);
|
|
|
|
return OptionalNone {};
|
2022-11-11 17:46:56 +03:00
|
|
|
}
|
|
|
|
|
2021-09-13 00:33:23 +03:00
|
|
|
Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_request_cookie(AK::URL const& url, u8 source)
|
2021-04-11 17:54:11 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_get_cookie)
|
|
|
|
return m_view.on_get_cookie(url, static_cast<Web::Cookie::Source>(source));
|
|
|
|
return DeprecatedString {};
|
2021-04-11 17:54:11 +03:00
|
|
|
}
|
|
|
|
|
2021-09-13 00:33:23 +03:00
|
|
|
void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source)
|
2021-04-11 17:54:11 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_set_cookie)
|
|
|
|
m_view.on_set_cookie(url, cookie, static_cast<Web::Cookie::Source>(source));
|
2021-04-11 17:54:11 +03:00
|
|
|
}
|
|
|
|
|
2022-11-28 19:24:04 +03:00
|
|
|
void WebContentClient::did_update_cookie(Web::Cookie::Cookie const& cookie)
|
2022-11-11 19:18:40 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_update_cookie)
|
|
|
|
m_view.on_update_cookie(cookie);
|
2022-11-11 19:18:40 +03:00
|
|
|
}
|
|
|
|
|
2023-03-21 01:39:20 +03:00
|
|
|
Messages::WebContentClient::DidRequestNewTabResponse WebContentClient::did_request_new_tab(Web::HTML::ActivateTab const& activate_tab)
|
2023-03-14 17:12:09 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_new_tab)
|
|
|
|
return m_view.on_new_tab(activate_tab);
|
|
|
|
return String {};
|
2023-03-14 17:12:09 +03:00
|
|
|
}
|
|
|
|
|
2023-03-21 02:52:00 +03:00
|
|
|
void WebContentClient::did_request_activate_tab()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_activate_tab)
|
|
|
|
m_view.on_activate_tab();
|
2023-03-21 02:52:00 +03:00
|
|
|
}
|
|
|
|
|
2023-03-07 06:10:26 +03:00
|
|
|
void WebContentClient::did_close_browsing_context()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_close)
|
|
|
|
m_view.on_close();
|
2023-03-07 06:10:26 +03:00
|
|
|
}
|
|
|
|
|
2022-02-21 01:03:39 +03:00
|
|
|
void WebContentClient::did_update_resource_count(i32 count_waiting)
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_resource_status_change)
|
|
|
|
m_view.on_resource_status_change(count_waiting);
|
2022-02-21 01:03:39 +03:00
|
|
|
}
|
|
|
|
|
2022-11-09 17:51:39 +03:00
|
|
|
void WebContentClient::did_request_restore_window()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_restore_window)
|
|
|
|
m_view.on_restore_window();
|
2022-11-09 17:51:39 +03:00
|
|
|
}
|
|
|
|
|
2022-12-06 23:27:44 +03:00
|
|
|
Messages::WebContentClient::DidRequestRepositionWindowResponse WebContentClient::did_request_reposition_window(Gfx::IntPoint position)
|
2022-11-09 17:51:39 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_reposition_window)
|
|
|
|
return m_view.on_reposition_window(position);
|
|
|
|
return Gfx::IntPoint {};
|
2022-11-09 17:51:39 +03:00
|
|
|
}
|
|
|
|
|
2022-12-07 00:35:32 +03:00
|
|
|
Messages::WebContentClient::DidRequestResizeWindowResponse WebContentClient::did_request_resize_window(Gfx::IntSize size)
|
2022-11-09 17:51:39 +03:00
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_resize_window)
|
|
|
|
return m_view.on_resize_window(size);
|
|
|
|
return Gfx::IntSize {};
|
2022-11-09 17:51:39 +03:00
|
|
|
}
|
|
|
|
|
2022-11-09 18:04:09 +03:00
|
|
|
Messages::WebContentClient::DidRequestMaximizeWindowResponse WebContentClient::did_request_maximize_window()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_maximize_window)
|
|
|
|
return m_view.on_maximize_window();
|
|
|
|
return Gfx::IntRect {};
|
2022-11-09 18:04:09 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Messages::WebContentClient::DidRequestMinimizeWindowResponse WebContentClient::did_request_minimize_window()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_minimize_window)
|
|
|
|
return m_view.on_minimize_window();
|
|
|
|
return Gfx::IntRect {};
|
2022-11-09 18:04:09 +03:00
|
|
|
}
|
|
|
|
|
2022-11-09 21:09:17 +03:00
|
|
|
Messages::WebContentClient::DidRequestFullscreenWindowResponse WebContentClient::did_request_fullscreen_window()
|
|
|
|
{
|
2023-05-17 19:37:31 +03:00
|
|
|
if (m_view.on_fullscreen_window)
|
|
|
|
return m_view.on_fullscreen_window();
|
|
|
|
return Gfx::IntRect {};
|
2022-11-09 21:09:17 +03:00
|
|
|
}
|
|
|
|
|
2022-12-04 21:02:33 +03:00
|
|
|
void WebContentClient::did_request_file(DeprecatedString const& path, i32 request_id)
|
2022-02-26 19:50:31 +03:00
|
|
|
{
|
2023-08-23 13:54:22 +03:00
|
|
|
if (m_view.on_request_file)
|
|
|
|
m_view.on_request_file(path, request_id);
|
2022-02-26 19:50:31 +03:00
|
|
|
}
|
|
|
|
|
2023-09-04 12:32:40 +03:00
|
|
|
void WebContentClient::did_request_color_picker(Color const& current_color)
|
|
|
|
{
|
|
|
|
if (m_view.on_request_color_picker)
|
|
|
|
m_view.on_request_color_picker(current_color);
|
|
|
|
}
|
|
|
|
|
2022-11-21 19:07:47 +03:00
|
|
|
void WebContentClient::did_finish_handling_input_event(bool event_was_accepted)
|
|
|
|
{
|
2023-08-23 18:19:21 +03:00
|
|
|
if (m_view.on_finish_handling_input_event)
|
|
|
|
m_view.on_finish_handling_input_event(event_was_accepted);
|
2022-11-21 19:07:47 +03:00
|
|
|
}
|
|
|
|
|
2023-09-19 02:51:48 +03:00
|
|
|
void WebContentClient::did_change_theme_color(Gfx::Color color)
|
|
|
|
{
|
|
|
|
if (m_view.on_theme_color_change)
|
|
|
|
m_view.on_theme_color_change(color);
|
|
|
|
}
|
|
|
|
|
2023-11-10 21:35:41 +03:00
|
|
|
void WebContentClient::did_insert_clipboard_entry(String const& data, String const& presentation_style, String const& mime_type)
|
|
|
|
{
|
|
|
|
if (m_view.on_insert_clipboard_entry)
|
|
|
|
m_view.on_insert_clipboard_entry(data, presentation_style, mime_type);
|
|
|
|
}
|
|
|
|
|
2023-11-23 20:22:23 +03:00
|
|
|
void WebContentClient::inspector_did_load()
|
|
|
|
{
|
|
|
|
if (m_view.on_inspector_loaded)
|
|
|
|
m_view.on_inspector_loaded();
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebContentClient::inspector_did_select_dom_node(i32 node_id, Optional<Web::CSS::Selector::PseudoElement> const& pseudo_element)
|
|
|
|
{
|
|
|
|
if (m_view.on_inspector_selected_dom_node)
|
|
|
|
m_view.on_inspector_selected_dom_node(node_id, pseudo_element);
|
|
|
|
}
|
|
|
|
|
2023-12-03 19:49:08 +03:00
|
|
|
void WebContentClient::inspector_did_set_dom_node_text(i32 node_id, String const& text)
|
|
|
|
{
|
|
|
|
if (m_view.on_inspector_set_dom_node_text)
|
|
|
|
m_view.on_inspector_set_dom_node_text(node_id, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebContentClient::inspector_did_set_dom_node_tag(i32 node_id, String const& tag)
|
|
|
|
{
|
|
|
|
if (m_view.on_inspector_set_dom_node_tag)
|
|
|
|
m_view.on_inspector_set_dom_node_tag(node_id, tag);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WebContentClient::inspector_did_replace_dom_node_attribute(i32 node_id, String const& name, Vector<Attribute> const& replacement_attributes)
|
|
|
|
{
|
|
|
|
if (m_view.on_inspector_replaced_dom_node_attribute)
|
|
|
|
m_view.on_inspector_replaced_dom_node_attribute(node_id, name, replacement_attributes);
|
|
|
|
}
|
|
|
|
|
2023-12-05 22:47:56 +03:00
|
|
|
void WebContentClient::inspector_did_request_dom_tree_context_menu(i32 node_id, Gfx::IntPoint position, String const& type, Optional<String> const& tag_or_attribute_name)
|
|
|
|
{
|
|
|
|
if (m_view.on_inspector_requested_dom_tree_context_menu)
|
|
|
|
m_view.on_inspector_requested_dom_tree_context_menu(node_id, m_view.to_widget_position(position), type, tag_or_attribute_name);
|
|
|
|
}
|
|
|
|
|
2023-12-01 03:27:32 +03:00
|
|
|
void WebContentClient::inspector_did_execute_console_script(String const& script)
|
|
|
|
{
|
|
|
|
if (m_view.on_inspector_executed_console_script)
|
|
|
|
m_view.on_inspector_executed_console_script(script);
|
|
|
|
}
|
|
|
|
|
2020-08-24 14:03:18 +03:00
|
|
|
}
|