#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/ozone/platform/wayland/test/test_selection_device_manager.h"
#include <wayland-server-core.h>
#include <cstdint>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/notreached.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "ui/ozone/platform/wayland/test/server_object.h"
namespace wl {
namespace {
std::vector<uint8_t> ReadDataOnWorkerThread(base::ScopedFD fd) { … }
void WriteDataOnWorkerThread(base::ScopedFD fd,
ui::PlatformClipboard::Data data) { … }
}
TestSelectionOffer::TestSelectionOffer(wl_resource* resource,
std::unique_ptr<Delegate> delegate)
: … { … }
TestSelectionOffer::~TestSelectionOffer() = default;
void TestSelectionOffer::OnOffer(const std::string& mime_type,
ui::PlatformClipboard::Data data) { … }
void TestSelectionOffer::Receive(wl_client* client,
wl_resource* resource,
const char* mime_type,
int fd) { … }
TestSelectionSource::TestSelectionSource(wl_resource* resource,
std::unique_ptr<Delegate> delegate)
: … { … }
TestSelectionSource::~TestSelectionSource() = default;
void TestSelectionSource::ReadData(const std::string& mime_type,
ReadDataCallback callback) { … }
void TestSelectionSource::OnFinished() { … }
void TestSelectionSource::OnCancelled() { … }
void TestSelectionSource::OnDndAction(uint32_t action) { … }
void TestSelectionSource::OnDndDropPerformed() { … }
void TestSelectionSource::Offer(struct wl_client* client,
struct wl_resource* resource,
const char* mime_type) { … }
TestSelectionDevice::TestSelectionDevice(wl_resource* resource,
std::unique_ptr<Delegate> delegate)
: … { … }
TestSelectionDevice::~TestSelectionDevice() = default;
TestSelectionOffer* TestSelectionDevice::OnDataOffer() { … }
void TestSelectionDevice::OnSelection(TestSelectionOffer* offer) { … }
void TestSelectionDevice::SetSelection(struct wl_client* client,
struct wl_resource* resource,
struct wl_resource* source,
uint32_t serial) { … }
TestSelectionDeviceManager::TestSelectionDeviceManager(
const InterfaceInfo& info,
std::unique_ptr<Delegate> delegate)
: … { … }
TestSelectionDeviceManager::~TestSelectionDeviceManager() = default;
void TestSelectionDeviceManager::CreateSource(wl_client* client,
wl_resource* manager_resource,
uint32_t id) { … }
void TestSelectionDeviceManager::GetDevice(wl_client* client,
wl_resource* manager_resource,
uint32_t id,
wl_resource* seat_resource) { … }
}