#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/base/x/selection_requestor.h"
#include "base/memory/ref_counted_memory.h"
#include "base/ranges/algorithm.h"
#include "ui/base/x/selection_owner.h"
#include "ui/base/x/selection_utils.h"
#include "ui/base/x/x11_clipboard_helper.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/atom_cache.h"
#include "ui/gfx/x/xproto.h"
namespace ui {
namespace {
const char kChromeSelection[] = …;
const int kRequestTimeoutMs = …;
std::vector<uint8_t> CombineData(
const std::vector<scoped_refptr<base::RefCountedMemory>>& data) { … }
}
SelectionRequestor::SelectionRequestor(x11::Window x_window,
XClipboardHelper* helper)
: … { … }
SelectionRequestor::~SelectionRequestor() = default;
bool SelectionRequestor::PerformBlockingConvertSelection(
x11::Atom selection,
x11::Atom target,
std::vector<uint8_t>* out_data,
x11::Atom* out_type) { … }
void SelectionRequestor::PerformBlockingConvertSelectionWithParameter(
x11::Atom selection,
x11::Atom target,
const std::vector<x11::Atom>& parameter) { … }
SelectionData SelectionRequestor::RequestAndWaitForTypes(
x11::Atom selection,
const std::vector<x11::Atom>& types) { … }
void SelectionRequestor::OnSelectionNotify(
const x11::SelectionNotifyEvent& selection) { … }
bool SelectionRequestor::CanDispatchPropertyEvent(
const x11::PropertyNotifyEvent& prop) { … }
void SelectionRequestor::OnPropertyEvent(
const x11::PropertyNotifyEvent& event) { … }
void SelectionRequestor::AbortStaleRequests() { … }
void SelectionRequestor::CompleteRequest(size_t index, bool success) { … }
void SelectionRequestor::ConvertSelectionForCurrentRequest() { … }
void SelectionRequestor::BlockTillSelectionNotifyForRequest(Request* request) { … }
SelectionRequestor::Request* SelectionRequestor::GetCurrentRequest() { … }
SelectionRequestor::Request::Request(x11::Atom selection,
x11::Atom target,
base::TimeTicks timeout)
: … { … }
SelectionRequestor::Request::~Request() = default;
}