mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-08 05:27:14 +09:00

We currently have a single IPC to set clipboard data. We will also need an IPC to retrieve that data from the UI. This defines system clipboard data in LibWeb to handle this transfer, and adds the IPC to provide it.
43 lines
953 B
C++
43 lines
953 B
C++
/*
|
|
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/ByteString.h>
|
|
#include <AK/String.h>
|
|
#include <AK/Vector.h>
|
|
#include <LibIPC/Forward.h>
|
|
|
|
namespace Web::Clipboard {
|
|
|
|
// https://w3c.github.io/clipboard-apis/#system-clipboard-representation
|
|
struct SystemClipboardRepresentation {
|
|
ByteString data;
|
|
String mime_type;
|
|
};
|
|
|
|
// https://w3c.github.io/clipboard-apis/#system-clipboard-item
|
|
struct SystemClipboardItem {
|
|
Vector<SystemClipboardRepresentation> system_clipboard_representations;
|
|
};
|
|
|
|
}
|
|
|
|
namespace IPC {
|
|
|
|
template<>
|
|
ErrorOr<void> encode(Encoder&, Web::Clipboard::SystemClipboardRepresentation const&);
|
|
|
|
template<>
|
|
ErrorOr<Web::Clipboard::SystemClipboardRepresentation> decode(Decoder&);
|
|
|
|
template<>
|
|
ErrorOr<void> encode(Encoder&, Web::Clipboard::SystemClipboardItem const&);
|
|
|
|
template<>
|
|
ErrorOr<Web::Clipboard::SystemClipboardItem> decode(Decoder&);
|
|
|
|
}
|