#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include <memory>
#include <utility>
#include "base/json/json_writer.h"
#include "base/pickle.h"
#include "base/strings/escape.h"
#include "base/strings/utf_string_conversions.h"
#include "base/types/variant_util.h"
#include "base/values.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/clipboard/clipboard_metrics.h"
#include "ui/gfx/geometry/size.h"
namespace ui {
ScopedClipboardWriter::ScopedClipboardWriter(
ClipboardBuffer buffer,
std::unique_ptr<DataTransferEndpoint> data_src)
: … { … }
ScopedClipboardWriter::~ScopedClipboardWriter() { … }
void ScopedClipboardWriter::SetDataSource(
std::unique_ptr<DataTransferEndpoint> data_src) { … }
void ScopedClipboardWriter::SetDataSourceURL(const GURL& main_frame,
const GURL& frame_url) { … }
void ScopedClipboardWriter::WriteText(const std::u16string& text) { … }
void ScopedClipboardWriter::WriteHTML(const std::u16string& markup,
const std::string& source_url) { … }
void ScopedClipboardWriter::WriteSvg(const std::u16string& markup) { … }
void ScopedClipboardWriter::WriteRTF(const std::string& rtf_data) { … }
void ScopedClipboardWriter::WriteFilenames(const std::string& uri_list) { … }
void ScopedClipboardWriter::WriteBookmark(const std::u16string& bookmark_title,
const std::string& url) { … }
void ScopedClipboardWriter::WriteHyperlink(const std::u16string& anchor_text,
const std::string& url) { … }
void ScopedClipboardWriter::WriteWebSmartPaste() { … }
void ScopedClipboardWriter::WriteImage(const SkBitmap& bitmap) { … }
void ScopedClipboardWriter::MarkAsConfidential() { … }
void ScopedClipboardWriter::MarkAsOffTheRecord() { … }
void ScopedClipboardWriter::WritePickledData(
const base::Pickle& pickle,
const ClipboardFormatType& format) { … }
void ScopedClipboardWriter::WriteData(const std::u16string& format,
mojo_base::BigBuffer data) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS)
void ScopedClipboardWriter::WriteEncodedDataTransferEndpointForTesting(
const std::string& json) {
Clipboard::Data data =
Clipboard::EncodedDataTransferEndpointData{.data = json};
const size_t index = data.index();
objects_[index] = Clipboard::ObjectMapParams(std::move(data));
}
#endif
void ScopedClipboardWriter::Reset() { … }
}