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

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

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

#include <viewporter-client-protocol.h>

#include <bitset>
#include <cstdint>
#include <memory>

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/task_runner.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/dragdrop/os_exchange_data_provider_non_backed.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event_constants.h"
#include "ui/events/platform/platform_event_dispatcher.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/scoped_event_dispatcher.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/ozone/platform/wayland/common/wayland_util.h"
#include "ui/ozone/platform/wayland/host/dump_util.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
#include "ui/ozone/platform/wayland/host/wayland_cursor_position.h"
#include "ui/ozone/platform/wayland/host/wayland_data_device_manager.h"
#include "ui/ozone/platform/wayland/host/wayland_data_offer.h"
#include "ui/ozone/platform/wayland/host/wayland_data_source.h"
#include "ui/ozone/platform/wayland/host/wayland_event_source.h"
#include "ui/ozone/platform/wayland/host/wayland_exchange_data_provider.h"
#include "ui/ozone/platform/wayland/host/wayland_serial_tracker.h"
#include "ui/ozone/platform/wayland/host/wayland_shm_buffer.h"
#include "ui/ozone/platform/wayland/host/wayland_surface.h"
#include "ui/ozone/platform/wayland/host/wayland_toplevel_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window.h"
#include "ui/ozone/platform/wayland/host/wayland_window_manager.h"

namespace ui {
namespace {

DragEventSource;
DragOperation;

DragOperation DndActionToDragOperation(uint32_t action) {}

int DndActionsToDragOperations(uint32_t actions) {}

uint32_t DragOperationsToDndActions(int operations) {}

}  // namespace

WaylandDataDragController::WaylandDataDragController(
    WaylandConnection* connection,
    WaylandDataDeviceManager* data_device_manager,
    WaylandPointer::Delegate* pointer_delegate,
    WaylandTouch::Delegate* touch_delegate)
    :{}

WaylandDataDragController::~WaylandDataDragController() {}

bool WaylandDataDragController::StartSession(const OSExchangeData& data,
                                             int operations,
                                             DragEventSource source) {}

void WaylandDataDragController::CancelSession() {}

bool WaylandDataDragController::IsDragInProgress() const {}

void WaylandDataDragController::UpdateDragImage(const gfx::ImageSkia& image,
                                                const gfx::Vector2d& offset) {}

bool WaylandDataDragController::ShouldReleaseCaptureForDrag(
    ui::OSExchangeData* data) const {}

bool WaylandDataDragController::IsWindowDragSessionRunning() const {}

void WaylandDataDragController::DumpState(std::ostream& out) const {}

// Sessions initiated from Chromium, will have |data_source_| set. In which
// case, |offered_exchange_data_provider_| is expected to be non-null as well.
bool WaylandDataDragController::IsDragSource() const {}

void WaylandDataDragController::DrawIcon() {}

void WaylandDataDragController::OnDragSurfaceFrame(void* data,
                                                   struct wl_callback* callback,
                                                   uint32_t time) {}

SkBitmap WaylandDataDragController::GetIconBitmap() {}

void WaylandDataDragController::DrawIconInternal() {}

void WaylandDataDragController::OnDragOffer(
    std::unique_ptr<WaylandDataOffer> offer) {}

void WaylandDataDragController::OnDragEnter(WaylandWindow* window,
                                            const gfx::PointF& location,
                                            base::TimeTicks timestamp,
                                            uint32_t serial) {}

void WaylandDataDragController::OnDragMotion(const gfx::PointF& location,
                                             base::TimeTicks timestamp) {}

void WaylandDataDragController::OnDragLeave(base::TimeTicks timestamp) {}

void WaylandDataDragController::OnDragDrop(base::TimeTicks timestamp) {}

void WaylandDataDragController::OnDataSourceFinish(WaylandDataSource* source,
                                                   base::TimeTicks timestamp,
                                                   bool completed) {}

void WaylandDataDragController::OnDataSourceDropPerformed(
    WaylandDataSource* source,
    base::TimeTicks timestamp) {}

const WaylandWindow* WaylandDataDragController::GetDragTarget() const {}

void WaylandDataDragController::OnDataSourceSend(WaylandDataSource* source,
                                                 const std::string& mime_type,
                                                 std::string* buffer) {}

void WaylandDataDragController::OnWindowRemoved(WaylandWindow* window) {}

void WaylandDataDragController::PostDataFetchingTask(
    const gfx::PointF& location,
    base::TimeTicks start_time,
    const scoped_refptr<CancelFlag>& cancel_flag) {}

void WaylandDataDragController::OnDataFetchingFinished(
    base::TimeTicks timestamp,
    std::unique_ptr<OSExchangeData> received_data) {}

void WaylandDataDragController::CancelDataFetchingIfNeeded() {}

void WaylandDataDragController::Reset() {}

// TODO(crbug.com/329479345): Drop DragResult in favor of intermediary states
// `kDropping` and `kCancelling`, move `Reset` back into this function, called
// conditionally depending on the state it would be transitioning to.
void WaylandDataDragController::HandleDragEnd(DragResult result,
                                              base::TimeTicks timestamp) {}

std::optional<wl::Serial>
WaylandDataDragController::GetAndValidateSerialForDrag(DragEventSource source) {}

void WaylandDataDragController::SetOfferedExchangeDataProvider(
    const OSExchangeData& data) {}

const WaylandExchangeDataProvider*
WaylandDataDragController::GetOfferedExchangeDataProvider() const {}

bool WaylandDataDragController::IsWindowDraggingSession(
    const ui::OSExchangeData& data) const {}

void WaylandDataDragController::SetUpWindowDraggingSessionIfNeeded(
    const ui::OSExchangeData& data) {}

void WaylandDataDragController::DispatchPointerRelease(
    base::TimeTicks timestamp) {}

bool WaylandDataDragController::CanDispatchEvent(const PlatformEvent& event) {}

uint32_t WaylandDataDragController::DispatchEvent(const PlatformEvent& event) {}

//  Data fetch task runner is lazily initialized so unrelated test suites
//  (without ThreadPool available) do not fail.
//
//  TODO(b/328574254): Move to constructor once the offending test suites
//  provide a suitable task environment.
base::TaskRunner& WaylandDataDragController::GetDataFetchTaskRunner() {}

}  // namespace ui