chromium/ui/ozone/platform/wayland/host/wayland_data_source.cc

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "ui/ozone/platform/wayland/host/wayland_data_source.h"

#include <gtk-primary-selection-client-protocol.h>
#include <primary-selection-unstable-v1-client-protocol.h>

#include <cstdint>
#include <vector>

#include "base/files/file_util.h"
#include "base/logging.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/events/base_event_utils.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"

namespace wl {

template <typename T>
DataSource<T>::DataSource(T* data_source,
                          ui::WaylandConnection* connection,
                          Delegate* delegate)
    :{}

template <typename T>
DataSource<T>::~DataSource() {}

template <typename T>
void DataSource<T>::HandleDropEvent() {}

template <typename T>
void DataSource<T>::HandleFinishEvent(bool completed) {}

// Writes |data_str| to file descriptor |fd| assuming it is flagged as
// O_NONBLOCK, which implies in handling EAGAIN, besides EINTR. Returns true
// iff data is fully written to the given file descriptor. See the link below
// for more details about non-blocking behavior for 'write' syscall.
// https://pubs.opengroup.org/onlinepubs/007904975/functions/write.html
bool WriteDataNonBlocking(int fd, const std::string& data_str) {}

template <typename T>
void DataSource<T>::HandleSendEvent(const std::string& mime_type, int32_t fd) {}

// static
template <typename T>
void DataSource<T>::OnSend(void* data,
                           T* source,
                           const char* mime_type,
                           int32_t fd) {}

template <typename T>
void DataSource<T>::OnCancelled(void* data, T* source) {}

template <typename T>
void DataSource<T>::OnDndFinished(void* data, T* source) {}

template <typename T>
void DataSource<T>::OnAction(void* data, T* source, uint32_t dnd_action) {}

template <typename T>
void DataSource<T>::OnTarget(void* data, T* source, const char* mime_type) {}

template <typename T>
void DataSource<T>::OnDndDropPerformed(void* data, T* source) {}

//////////////////////////////////////////////////////////////////////////////
// wl_data_source specializations and instantiation
//////////////////////////////////////////////////////////////////////////////

template <>
void DataSource<wl_data_source>::Initialize() {}

template <>
void DataSource<wl_data_source>::Offer(
    const std::vector<std::string>& mime_types) {}

template <typename T>
void DataSource<T>::SetDndActions(uint32_t dnd_actions) {}

template <>
void DataSource<wl_data_source>::SetDndActions(uint32_t dnd_actions) {}

template class DataSource<wl_data_source>;

//////////////////////////////////////////////////////////////////////////////
// gtk_primary_selection_source specializations and instantiation
//////////////////////////////////////////////////////////////////////////////

template <>
void DataSource<gtk_primary_selection_source>::Initialize() {}

template <>
void DataSource<gtk_primary_selection_source>::Offer(
    const std::vector<std::string>& mime_types) {}

template <>
void DataSource<zwp_primary_selection_source_v1>::Initialize() {}

template <>
void DataSource<zwp_primary_selection_source_v1>::Offer(
    const std::vector<std::string>& mime_types) {}

template class DataSource<gtk_primary_selection_source>;
template class DataSource<zwp_primary_selection_source_v1>;

}  // namespace wl