chromium/third_party/blink/renderer/core/clipboard/data_transfer.cc

/*
 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "third_party/blink/renderer/core/clipboard/data_transfer.h"

#include <memory>
#include <optional>

#include "build/build_config.h"
#include "third_party/blink/renderer/core/clipboard/clipboard_mime_types.h"
#include "third_party/blink/renderer/core/clipboard/clipboard_utilities.h"
#include "third_party/blink/renderer/core/clipboard/data_object.h"
#include "third_party/blink/renderer/core/clipboard/data_transfer_access_policy.h"
#include "third_party/blink/renderer/core/clipboard/data_transfer_item.h"
#include "third_party/blink/renderer/core/clipboard/data_transfer_item_list.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/serializers/serialization.h"
#include "third_party/blink/renderer/core/editing/visible_selection.h"
#include "third_party/blink/renderer/core/fileapi/file_list.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/html/forms/text_control_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/layout/layout_image.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/loader/resource/image_resource_content.h"
#include "third_party/blink/renderer/core/page/drag_image.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/cull_rect_updater.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_painter.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h"
#include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
#include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h"
#include "third_party/blink/renderer/platform/graphics/unaccelerated_static_bitmap_image.h"
#include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-blink.h"
#include "ui/gfx/geometry/rect_conversions.h"

namespace blink {

namespace {

class DraggedNodeImageBuilder {};

std::optional<DragOperationsMask> ConvertEffectAllowedToDragOperationsMask(
    const AtomicString& op) {}

AtomicString ConvertDragOperationsMaskToEffectAllowed(DragOperationsMask op) {}

// We provide the IE clipboard types (URL and Text), and the clipboard types
// specified in the HTML spec. See
// https://html.spec.whatwg.org/multipage/dnd.html#the-datatransfer-interface
String NormalizeType(const String& type, bool* convert_to_url = nullptr) {}

}  // namespace

// static
DataTransfer* DataTransfer::Create() {}

// static
DataTransfer* DataTransfer::Create(DataTransferType type,
                                   DataTransferAccessPolicy policy,
                                   DataObject* data_object) {}

DataTransfer::~DataTransfer() = default;

void DataTransfer::setDropEffect(const AtomicString& effect) {}

void DataTransfer::setEffectAllowed(const AtomicString& effect) {}

void DataTransfer::clearData(const String& type) {}

String DataTransfer::getData(const String& type) const {}

void DataTransfer::setData(const String& type, const String& data) {}

bool DataTransfer::hasDataStoreItemListChanged() const {}

void DataTransfer::OnItemListChanged() {}

Vector<String> DataTransfer::types() {}

FileList* DataTransfer::files() const {}

void DataTransfer::setDragImage(Element* image, int x, int y) {}

void DataTransfer::ClearDragImage() {}

void DataTransfer::SetDragImageResource(ImageResourceContent* img,
                                        const gfx::Point& loc) {}

void DataTransfer::SetDragImageElement(Node* node, const gfx::Point& loc) {}

// static
gfx::RectF DataTransfer::ClipByVisualViewport(const gfx::RectF& absolute_rect,
                                              const LocalFrame& frame) {}

// Returns a DragImage whose bitmap contains |contents|, positioned and scaled
// in device space.
//
// static
std::unique_ptr<DragImage> DataTransfer::CreateDragImageForFrame(
    LocalFrame& frame,
    float opacity,
    const gfx::SizeF& layout_size,
    const gfx::Vector2dF& paint_offset,
    PaintRecordBuilder& builder,
    const PropertyTreeState& property_tree_state) {}

// static
std::unique_ptr<DragImage> DataTransfer::NodeImage(LocalFrame& frame,
                                                   Node& node) {}

std::unique_ptr<DragImage> DataTransfer::CreateDragImage(
    gfx::Point& loc,
    float device_scale_factor,
    LocalFrame* frame) const {}

static ImageResourceContent* GetImageResourceContent(Element* element) {}

static void WriteImageToDataObject(DataObject* data_object,
                                   Element* element,
                                   const KURL& image_url) {}

void DataTransfer::DeclareAndWriteDragImage(Element* element,
                                            const KURL& link_url,
                                            const KURL& image_url,
                                            const String& title) {}

void DataTransfer::WriteURL(Node* node, const KURL& url, const String& title) {}

void DataTransfer::WriteSelection(const FrameSelection& selection) {}

void DataTransfer::SetAccessPolicy(DataTransferAccessPolicy policy) {}

bool DataTransfer::CanReadTypes() const {}

bool DataTransfer::CanReadData() const {}

bool DataTransfer::CanWriteData() const {}

bool DataTransfer::CanSetDragImage() const {}

DragOperationsMask DataTransfer::SourceOperation() const {}

ui::mojom::blink::DragOperation DataTransfer::DestinationOperation() const {}

void DataTransfer::SetSourceOperation(DragOperationsMask op) {}

void DataTransfer::SetDestinationOperation(ui::mojom::blink::DragOperation op) {}

DataTransferItemList* DataTransfer::items() {}

DataObject* DataTransfer::GetDataObject() const {}

DataTransfer::DataTransfer(DataTransferType type,
                           DataTransferAccessPolicy policy,
                           DataObject* data_object)
    :{}

void DataTransfer::setDragImage(ImageResourceContent* image,
                                Node* node,
                                const gfx::Point& loc) {}

bool DataTransfer::HasFileOfType(const String& type) const {}

bool DataTransfer::HasStringOfType(const String& type) const {}

void DataTransfer::Trace(Visitor* visitor) const {}

}  // namespace blink