chromium/ui/base/x/x11_os_exchange_data_provider.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.

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

#include "ui/base/x/x11_os_exchange_data_provider.h"

#include <optional>
#include <utility>

#include "base/containers/contains.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "net/base/filename_util.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/clipboard/file_info.h"
#include "ui/base/data_transfer_policy/data_transfer_endpoint.h"
#include "ui/base/dragdrop/os_exchange_data_provider.h"
#include "ui/base/x/selection_utils.h"
#include "ui/base/x/x11_drag_drop_client.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/atom_cache.h"
#include "ui/gfx/x/connection.h"

// Note: the GetBlah() methods are used immediately by the
// web_contents_view_aura.cc:PrepareDropData(), while the omnibox is a
// little more discriminating and calls HasBlah() before trying to get the
// information.

namespace ui {

namespace {

const char kDndSelection[] =;
const char kRendererTaint[] =;
const char kFromPrivileged[] =;

const char kNetscapeURL[] =;

}  // namespace

XOSExchangeDataProvider::XOSExchangeDataProvider(
    x11::Window x_window,
    x11::Window source_window,
    const SelectionFormatMap& selection)
    :{}

XOSExchangeDataProvider::XOSExchangeDataProvider()
    :{}

XOSExchangeDataProvider::~XOSExchangeDataProvider() {}

void XOSExchangeDataProvider::TakeOwnershipOfSelection() const {}

void XOSExchangeDataProvider::RetrieveTargets(
    std::vector<x11::Atom>* targets) const {}

SelectionFormatMap XOSExchangeDataProvider::GetFormatMap() const {}

std::unique_ptr<OSExchangeDataProvider> XOSExchangeDataProvider::Clone() const {}

void XOSExchangeDataProvider::MarkRendererTaintedFromOrigin(
    const url::Origin& origin) {}

bool XOSExchangeDataProvider::IsRendererTainted() const {}

std::optional<url::Origin> XOSExchangeDataProvider::GetRendererTaintedOrigin()
    const {}

void XOSExchangeDataProvider::MarkAsFromPrivileged() {}

bool XOSExchangeDataProvider::IsFromPrivileged() const {}

void XOSExchangeDataProvider::SetString(const std::u16string& text_data) {}

void XOSExchangeDataProvider::SetURL(const GURL& url,
                                     const std::u16string& title) {}

void XOSExchangeDataProvider::SetFilename(const base::FilePath& path) {}

void XOSExchangeDataProvider::SetFilenames(
    const std::vector<FileInfo>& filenames) {}

void XOSExchangeDataProvider::SetPickledData(const ClipboardFormatType& format,
                                             const base::Pickle& pickle) {}

std::optional<std::u16string> XOSExchangeDataProvider::GetString() const {}

std::optional<OSExchangeDataProvider::UrlInfo>
XOSExchangeDataProvider::GetURLAndTitle(FilenameToURLPolicy policy) const {}

std::optional<std::vector<GURL>> XOSExchangeDataProvider::GetURLs(
    FilenameToURLPolicy policy) const {}

std::optional<std::vector<FileInfo>> XOSExchangeDataProvider::GetFilenames()
    const {}

std::optional<base::Pickle> XOSExchangeDataProvider::GetPickledData(
    const ClipboardFormatType& format) const {}

bool XOSExchangeDataProvider::HasString() const {}

bool XOSExchangeDataProvider::HasURL(FilenameToURLPolicy policy) const {}

bool XOSExchangeDataProvider::HasFile() const {}

bool XOSExchangeDataProvider::HasCustomFormat(
    const ClipboardFormatType& format) const {}

void XOSExchangeDataProvider::SetFileContents(
    const base::FilePath& filename,
    const std::string& file_contents) {}

std::optional<OSExchangeDataProvider::FileContentsInfo>
XOSExchangeDataProvider::GetFileContents() const {}

bool XOSExchangeDataProvider::HasFileContents() const {}

void XOSExchangeDataProvider::SetHtml(const std::u16string& html,
                                      const GURL& base_url) {}

std::optional<OSExchangeDataProvider::HtmlInfo>
XOSExchangeDataProvider::GetHtml() const {}

bool XOSExchangeDataProvider::HasHtml() const {}

void XOSExchangeDataProvider::SetDragImage(const gfx::ImageSkia& image,
                                           const gfx::Vector2d& cursor_offset) {}

gfx::ImageSkia XOSExchangeDataProvider::GetDragImage() const {}

gfx::Vector2d XOSExchangeDataProvider::GetDragImageOffset() const {}

std::vector<x11::Atom> XOSExchangeDataProvider::GetTargets() const {}

void XOSExchangeDataProvider::InsertData(
    x11::Atom format,
    const scoped_refptr<base::RefCountedMemory>& data) {}

void XOSExchangeDataProvider::SetSource(
    std::unique_ptr<DataTransferEndpoint> data_source) {}

DataTransferEndpoint* XOSExchangeDataProvider::GetSource() const {}

}  // namespace ui