#include "third_party/blink/renderer/core/clipboard/system_clipboard.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "mojo/public/cpp/base/big_buffer.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "skia/ext/skia_utils_base.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_drag_data.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_local_frame_client.h"
#include "third_party/blink/renderer/core/clipboard/clipboard_mime_types.h"
#include "third_party/blink/renderer/core/clipboard/clipboard_utilities.h"
#include "third_party/blink/renderer/core/clipboard/data_object.h"
#include "third_party/blink/renderer/core/dom/document_fragment.h"
#include "third_party/blink/renderer/core/dom/element_traversal.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/platform/graphics/image.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/skia/include/core/SkBitmap.h"
namespace blink {
namespace {
String NonNullString(const String& string) { … }
std::pair<mojo::PendingRemote<mojom::blink::FileSystemAccessDataTransferToken>,
mojo::PendingRemote<mojom::blink::FileSystemAccessDataTransferToken>>
CloneFsaToken(
mojo::PendingRemote<mojom::blink::FileSystemAccessDataTransferToken> in) { … }
}
SystemClipboard::SystemClipboard(LocalFrame* frame)
: … { … }
bool SystemClipboard::IsSelectionMode() const { … }
void SystemClipboard::SetSelectionMode(bool selection_mode) { … }
bool SystemClipboard::IsFormatAvailable(blink::mojom::ClipboardFormat format) { … }
ClipboardSequenceNumberToken SystemClipboard::SequenceNumber() { … }
Vector<String> SystemClipboard::ReadAvailableTypes() { … }
String SystemClipboard::ReadPlainText() { … }
String SystemClipboard::ReadPlainText(mojom::blink::ClipboardBuffer buffer) { … }
void SystemClipboard::ReadPlainText(
mojom::blink::ClipboardBuffer buffer,
mojom::blink::ClipboardHost::ReadTextCallback callback) { … }
void SystemClipboard::WritePlainText(const String& plain_text,
SmartReplaceOption) { … }
String SystemClipboard::ReadHTML(KURL& url,
unsigned& fragment_start,
unsigned& fragment_end) { … }
void SystemClipboard::ReadHTML(
mojom::blink::ClipboardHost::ReadHtmlCallback callback) { … }
void SystemClipboard::WriteHTML(const String& markup,
const KURL& document_url,
SmartReplaceOption smart_replace_option) { … }
void SystemClipboard::ReadSvg(
mojom::blink::ClipboardHost::ReadSvgCallback callback) { … }
void SystemClipboard::WriteSvg(const String& markup) { … }
String SystemClipboard::ReadRTF() { … }
mojo_base::BigBuffer SystemClipboard::ReadPng(
mojom::blink::ClipboardBuffer buffer) { … }
String SystemClipboard::ReadImageAsImageMarkup(
mojom::blink::ClipboardBuffer buffer) { … }
void SystemClipboard::WriteImageWithTag(Image* image,
const KURL& url,
const String& title) { … }
void SystemClipboard::WriteImage(const SkBitmap& bitmap) { … }
mojom::blink::ClipboardFilesPtr SystemClipboard::ReadFiles() { … }
String SystemClipboard::ReadDataTransferCustomData(const String& type) { … }
void SystemClipboard::WriteDataObject(DataObject* data_object) { … }
void SystemClipboard::CommitWrite() { … }
void SystemClipboard::CopyToFindPboard(const String& text) { … }
void SystemClipboard::ReadAvailableCustomAndStandardFormats(
mojom::blink::ClipboardHost::ReadAvailableCustomAndStandardFormatsCallback
callback) { … }
void SystemClipboard::ReadUnsanitizedCustomFormat(
const String& type,
mojom::blink::ClipboardHost::ReadUnsanitizedCustomFormatCallback callback) { … }
void SystemClipboard::WriteUnsanitizedCustomFormat(const String& type,
mojo_base::BigBuffer data) { … }
void SystemClipboard::Trace(Visitor* visitor) const { … }
bool SystemClipboard::IsValidBufferType(mojom::blink::ClipboardBuffer buffer) { … }
void SystemClipboard::TakeSnapshot() { … }
void SystemClipboard::DropSnapshot() { … }
SystemClipboard::Snapshot::Snapshot() = default;
SystemClipboard::Snapshot::~Snapshot() = default;
bool SystemClipboard::Snapshot::HasPlainText(
mojom::blink::ClipboardBuffer buffer) const { … }
const String& SystemClipboard::Snapshot::PlainText(
mojom::blink::ClipboardBuffer buffer) const { … }
void SystemClipboard::Snapshot::SetPlainText(
mojom::blink::ClipboardBuffer buffer,
const String& text) { … }
bool SystemClipboard::Snapshot::HasHtml(
mojom::blink::ClipboardBuffer buffer) const { … }
const KURL& SystemClipboard::Snapshot::Url(
mojom::blink::ClipboardBuffer buffer) const { … }
unsigned SystemClipboard::Snapshot::FragmentStart(
mojom::blink::ClipboardBuffer buffer) const { … }
unsigned SystemClipboard::Snapshot::FragmentEnd(
mojom::blink::ClipboardBuffer buffer) const { … }
const String& SystemClipboard::Snapshot::Html(
mojom::blink::ClipboardBuffer buffer) const { … }
void SystemClipboard::Snapshot::SetHtml(mojom::blink::ClipboardBuffer buffer,
const String& html,
const KURL& url,
unsigned fragment_start,
unsigned fragment_end) { … }
bool SystemClipboard::Snapshot::HasRtf(
mojom::blink::ClipboardBuffer buffer) const { … }
const String& SystemClipboard::Snapshot::Rtf(
mojom::blink::ClipboardBuffer buffer) const { … }
void SystemClipboard::Snapshot::SetRtf(mojom::blink::ClipboardBuffer buffer,
const String& rtf) { … }
bool SystemClipboard::Snapshot::HasPng(
mojom::blink::ClipboardBuffer buffer) const { … }
mojo_base::BigBuffer SystemClipboard::Snapshot::Png(
mojom::blink::ClipboardBuffer buffer) const { … }
void SystemClipboard::Snapshot::SetPng(mojom::blink::ClipboardBuffer buffer,
const mojo_base::BigBuffer& png) { … }
bool SystemClipboard::Snapshot::HasFiles(
mojom::blink::ClipboardBuffer buffer) const { … }
mojom::blink::ClipboardFilesPtr SystemClipboard::Snapshot::Files(
mojom::blink::ClipboardBuffer buffer) const { … }
void SystemClipboard::Snapshot::SetFiles(
mojom::blink::ClipboardBuffer buffer,
mojom::blink::ClipboardFilesPtr& files) { … }
bool SystemClipboard::Snapshot::HasCustomData(
mojom::blink::ClipboardBuffer buffer,
const String& type) const { … }
String SystemClipboard::Snapshot::CustomData(
mojom::blink::ClipboardBuffer buffer,
const String& type) const { … }
void SystemClipboard::Snapshot::SetCustomData(
mojom::blink::ClipboardBuffer buffer,
const String& type,
const String& data) { … }
mojom::blink::ClipboardFilesPtr SystemClipboard::Snapshot::CloneFiles(
mojom::blink::ClipboardFilesPtr& files) { … }
void SystemClipboard::Snapshot::BindToBuffer(
mojom::blink::ClipboardBuffer buffer) { … }
ScopedSystemClipboardSnapshot::ScopedSystemClipboardSnapshot(
SystemClipboard& clipboard)
: … { … }
ScopedSystemClipboardSnapshot::~ScopedSystemClipboardSnapshot() { … }
}