LibWebView+WebContent: Add an IPC hook to insert data into the clipboard

This commit is contained in:
Timothy Flynn 2023-11-10 13:35:41 -05:00 committed by Andreas Kling
parent 4b94b0b561
commit 306850652f
Notes: sideshowbarker 2024-07-17 18:08:55 +09:00
6 changed files with 15 additions and 0 deletions

View File

@ -161,6 +161,7 @@ public:
Function<void(bool)> on_finish_handling_input_event;
Function<void()> on_text_test_finish;
Function<void(Gfx::Color)> on_theme_color_change;
Function<void(String const&, String const&, String const&)> on_insert_clipboard_entry;
virtual Gfx::IntRect viewport_rect() const = 0;
virtual Gfx::IntPoint to_content_position(Gfx::IntPoint widget_position) const = 0;

View File

@ -402,4 +402,10 @@ void WebContentClient::did_change_theme_color(Gfx::Color color)
m_view.on_theme_color_change(color);
}
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);
}
}

View File

@ -86,6 +86,7 @@ private:
virtual void did_finish_handling_input_event(bool event_was_accepted) override;
virtual void did_finish_text_test() override;
virtual void did_change_theme_color(Gfx::Color color) override;
virtual void did_insert_clipboard_entry(String const& data, String const& presentation_style, String const& mime_type) override;
ViewImplementation& m_view;
};

View File

@ -499,4 +499,9 @@ void PageHost::page_did_change_theme_color(Gfx::Color color)
m_client.async_did_change_theme_color(color);
}
void PageHost::page_did_insert_clipboard_entry(String data, String presentation_style, String mime_type)
{
m_client.async_did_insert_clipboard_entry(move(data), move(presentation_style), move(mime_type));
}
}

View File

@ -120,6 +120,7 @@ private:
virtual void page_did_request_color_picker(Color current_color) override;
virtual void page_did_finish_text_test() override;
virtual void page_did_change_theme_color(Gfx::Color color) override;
virtual void page_did_insert_clipboard_entry(String data, String presentation_style, String mime_type) override;
explicit PageHost(ConnectionFromClient&);

View File

@ -63,6 +63,7 @@ endpoint WebContentClient
did_request_color_picker(Color current_color) =|
did_finish_handling_input_event(bool event_was_accepted) =|
did_change_theme_color(Gfx::Color color) =|
did_insert_clipboard_entry(String data, String presentation_style, String mime_type) =|
did_output_js_console_message(i32 message_index) =|
did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> message_types, Vector<DeprecatedString> messages) =|