#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/base/x/selection_owner.h"
#include <algorithm>
#include "base/logging.h"
#include "base/memory/ref_counted_memory.h"
#include "ui/base/x/selection_utils.h"
#include "ui/base/x/x11_util.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/x/atom_cache.h"
#include "ui/gfx/x/window_event_manager.h"
#include "ui/gfx/x/xproto.h"
namespace ui {
const char kIncr[] = …;
const char kSaveTargets[] = …;
const char kTargets[] = …;
namespace {
const char kAtomPair[] = …;
const char kMultiple[] = …;
const char kTimestamp[] = …;
const int KSelectionOwnerTimerPeriodMs = …;
const int kIncrementalTransferTimeoutMs = …;
static_assert …;
size_t GetMaxIncrementalTransferSize() { … }
bool GetAtomPairArrayProperty(
x11::Connection& connection,
x11::Window window,
x11::Atom property,
std::vector<std::pair<x11::Atom, x11::Atom>>* value) { … }
x11::Window GetSelectionOwner(x11::Atom selection) { … }
void SetSelectionOwner(x11::Window window,
x11::Atom selection,
x11::Time time = x11::Time::CurrentTime) { … }
}
SelectionOwner::SelectionOwner(x11::Connection& connection,
x11::Window x_window,
x11::Atom selection_name)
: … { … }
SelectionOwner::~SelectionOwner() { … }
void SelectionOwner::RetrieveTargets(std::vector<x11::Atom>* targets) { … }
void SelectionOwner::TakeOwnershipOfSelection(const SelectionFormatMap& data) { … }
void SelectionOwner::ClearSelectionOwner() { … }
void SelectionOwner::OnSelectionRequest(
const x11::SelectionRequestEvent& request) { … }
void SelectionOwner::OnSelectionClear(const x11::SelectionClearEvent& event) { … }
bool SelectionOwner::CanDispatchPropertyEvent(
const x11::PropertyNotifyEvent& event) { … }
void SelectionOwner::OnPropertyEvent(const x11::PropertyNotifyEvent& event) { … }
bool SelectionOwner::ProcessTarget(x11::Atom target,
x11::Window requestor,
x11::Atom property) { … }
void SelectionOwner::ProcessIncrementalTransfer(IncrementalTransfer* transfer) { … }
void SelectionOwner::AbortStaleIncrementalTransfers() { … }
void SelectionOwner::CompleteIncrementalTransfer(
std::vector<IncrementalTransfer>::iterator it) { … }
std::vector<SelectionOwner::IncrementalTransfer>::iterator
SelectionOwner::FindIncrementalTransferForEvent(
const x11::PropertyNotifyEvent& prop) { … }
SelectionOwner::IncrementalTransfer::IncrementalTransfer(
x11::Window window,
x11::Atom target,
x11::Atom property,
x11::ScopedEventSelector event_selector,
const scoped_refptr<base::RefCountedMemory>& data,
int offset,
base::TimeTicks timeout)
: … { … }
SelectionOwner::IncrementalTransfer::IncrementalTransfer(
IncrementalTransfer&& other) = default;
SelectionOwner::IncrementalTransfer&
SelectionOwner::IncrementalTransfer::operator=(IncrementalTransfer&&) = default;
SelectionOwner::IncrementalTransfer::~IncrementalTransfer() = default;
}