LibWebView+UI: Move clipboard handling from the WebView to the App

Clipboard handling largely has nothing to do with the individual web
views. Rather, we interact with the system clipboard at the application
level. So let's move these implementations to the Application.
This commit is contained in:
Timothy Flynn 2025-09-18 08:16:36 -04:00 committed by Tim Flynn
commit ca082d6d73
Notes: github-actions[bot] 2025-09-19 10:39:59 +00:00
15 changed files with 131 additions and 145 deletions

View file

@ -663,19 +663,19 @@ void WebContentClient::did_change_theme_color(u64 page_id, Gfx::Color color)
}
}
void WebContentClient::did_insert_clipboard_entry(u64 page_id, Web::Clipboard::SystemClipboardRepresentation entry, String presentation_style)
void WebContentClient::did_insert_clipboard_entry(u64, Web::Clipboard::SystemClipboardRepresentation entry, String)
{
if (auto view = view_for_page_id(page_id); view.has_value()) {
if (view->on_insert_clipboard_entry)
view->on_insert_clipboard_entry(move(entry), presentation_style);
}
Application::the().insert_clipboard_entry(move(entry));
}
void WebContentClient::did_request_clipboard_entries(u64 page_id, u64 request_id)
{
if (auto view = view_for_page_id(page_id); view.has_value()) {
if (view->on_request_clipboard_entries)
view->on_request_clipboard_entries(request_id);
Vector<Web::Clipboard::SystemClipboardItem> items;
if (auto entries = Application::the().clipboard_entries(); !entries.is_empty())
items.empend(move(entries));
view->retrieved_clipboard_entries(request_id, items);
}
}