#include "ui/base/clipboard/clipboard.h"
#include <iterator>
#include <limits>
#include <memory>
#include <string_view>
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/functional/overloaded.h"
#include "base/json/json_reader.h"
#include "base/memory/ptr_util.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/utf_string_conversions.h"
#include "base/types/optional_util.h"
#include "build/build_config.h"
#include "net/base/mime_util.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
namespace ui {
Clipboard::HtmlData::HtmlData() noexcept = default;
Clipboard::HtmlData::~HtmlData() = default;
Clipboard::HtmlData::HtmlData(const HtmlData&) = default;
Clipboard::HtmlData& Clipboard::HtmlData::operator=(const HtmlData&) = default;
Clipboard::HtmlData::HtmlData(HtmlData&&) = default;
Clipboard::HtmlData& Clipboard::HtmlData::operator=(HtmlData&&) = default;
Clipboard::RawData::RawData() noexcept = default;
Clipboard::RawData::~RawData() = default;
Clipboard::RawData::RawData(const RawData&) = default;
Clipboard::RawData& Clipboard::RawData::operator=(const RawData&) = default;
Clipboard::RawData::RawData(RawData&&) = default;
Clipboard::RawData& Clipboard::RawData::operator=(RawData&&) = default;
bool Clipboard::IsSupportedClipboardBuffer(ClipboardBuffer buffer) { … }
void Clipboard::SetAllowedThreads(
const std::vector<base::PlatformThreadId>& allowed_threads) { … }
void Clipboard::SetClipboardForCurrentThread(
std::unique_ptr<Clipboard> platform_clipboard) { … }
Clipboard* Clipboard::GetForCurrentThread() { … }
std::unique_ptr<Clipboard> Clipboard::TakeForCurrentThread() { … }
void Clipboard::OnPreShutdownForCurrentThread() { … }
void Clipboard::DestroyClipboardForCurrentThread() { … }
base::Time Clipboard::GetLastModifiedTime() const { … }
void Clipboard::ClearLastModifiedTime() { … }
std::map<std::string, std::string> Clipboard::ExtractCustomPlatformNames(
ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst) const { … }
std::vector<std::u16string>
Clipboard::ReadAvailableStandardAndCustomFormatNames(
ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst) const { … }
Clipboard::Clipboard() = default;
Clipboard::~Clipboard() = default;
void Clipboard::DispatchPortableRepresentation(const ObjectMapParams& params) { … }
Clipboard::ObjectMapParams::ObjectMapParams() = default;
Clipboard::ObjectMapParams::ObjectMapParams(Data data)
: … { … }
Clipboard::ObjectMapParams::ObjectMapParams(const ObjectMapParams& other) =
default;
Clipboard::ObjectMapParams& Clipboard::ObjectMapParams::operator=(
const ObjectMapParams& other) = default;
Clipboard::ObjectMapParams::ObjectMapParams(ObjectMapParams&& other) = default;
Clipboard::ObjectMapParams& Clipboard::ObjectMapParams::operator=(
ObjectMapParams&& other) = default;
Clipboard::ObjectMapParams::~ObjectMapParams() = default;
void Clipboard::DispatchPlatformRepresentations(
std::vector<Clipboard::PlatformRepresentation> platform_representations) { … }
base::PlatformThreadId Clipboard::GetAndValidateThreadID() { … }
void Clipboard::AddObserver(ClipboardWriteObserver* observer) { … }
void Clipboard::RemoveObserver(ClipboardWriteObserver* observer) { … }
void Clipboard::NotifyCopyWithUrl(const std::string_view text,
const GURL& frame,
const GURL& main_frame) { … }
std::vector<base::PlatformThreadId>& Clipboard::AllowedThreads() { … }
Clipboard::ClipboardMap* Clipboard::ClipboardMapPtr() { … }
base::Lock& Clipboard::ClipboardMapLock() { … }
bool Clipboard::IsMarkedByOriginatorAsConfidential() const { … }
void Clipboard::ReadAvailableTypes(ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst,
ReadAvailableTypesCallback callback) const { … }
void Clipboard::ReadText(ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst,
ReadTextCallback callback) const { … }
void Clipboard::ReadAsciiText(ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst,
ReadAsciiTextCallback callback) const { … }
void Clipboard::ReadHTML(ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst,
ReadHtmlCallback callback) const { … }
void Clipboard::ReadSvg(ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst,
ReadSvgCallback callback) const { … }
void Clipboard::ReadRTF(ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst,
ReadRTFCallback callback) const { … }
void Clipboard::ReadDataTransferCustomData(
ClipboardBuffer buffer,
const std::u16string& type,
const DataTransferEndpoint* data_dst,
ReadDataTransferCustomDataCallback callback) const { … }
void Clipboard::ReadFilenames(ClipboardBuffer buffer,
const DataTransferEndpoint* data_dst,
ReadFilenamesCallback callback) const { … }
void Clipboard::ReadBookmark(const DataTransferEndpoint* data_dst,
ReadBookmarkCallback callback) const { … }
void Clipboard::ReadData(const ClipboardFormatType& format,
const DataTransferEndpoint* data_dst,
ReadDataCallback callback) const { … }
}