2013-10-18 18:33:56 +02:00
|
|
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_COMMON_DRAG_DATA_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_COMMON_DRAG_DATA_IMPL_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2014-07-15 00:18:51 +02:00
|
|
|
#include "base/synchronization/lock.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/include/cef_drag_data.h"
|
|
|
|
#include "cef/include/cef_image.h"
|
2013-10-18 18:33:56 +02:00
|
|
|
#include "content/public/common/drop_data.h"
|
|
|
|
|
|
|
|
// Implementation of CefDragData.
|
|
|
|
class CefDragDataImpl : public CefDragData {
|
|
|
|
public:
|
2014-07-01 00:30:29 +02:00
|
|
|
CefDragDataImpl();
|
2013-10-18 18:33:56 +02:00
|
|
|
explicit CefDragDataImpl(const content::DropData& data);
|
2017-05-11 20:22:21 +02:00
|
|
|
CefDragDataImpl(const content::DropData& data,
|
|
|
|
CefRefPtr<CefImage> image,
|
|
|
|
const CefPoint& image_hotspot);
|
2013-10-18 18:33:56 +02:00
|
|
|
|
2014-11-12 20:25:15 +01:00
|
|
|
CefRefPtr<CefDragData> Clone() override;
|
|
|
|
bool IsReadOnly() override;
|
|
|
|
bool IsLink() override;
|
|
|
|
bool IsFragment() override;
|
|
|
|
bool IsFile() override;
|
|
|
|
CefString GetLinkURL() override;
|
|
|
|
CefString GetLinkTitle() override;
|
|
|
|
CefString GetLinkMetadata() override;
|
|
|
|
CefString GetFragmentText() override;
|
|
|
|
CefString GetFragmentHtml() override;
|
|
|
|
CefString GetFragmentBaseURL() override;
|
|
|
|
CefString GetFileName() override;
|
|
|
|
size_t GetFileContents(CefRefPtr<CefStreamWriter> writer) override;
|
|
|
|
bool GetFileNames(std::vector<CefString>& names) override;
|
2023-09-22 13:04:16 +02:00
|
|
|
bool GetFilePaths(std::vector<CefString>& paths) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void SetLinkURL(const CefString& url) override;
|
|
|
|
void SetLinkTitle(const CefString& title) override;
|
|
|
|
void SetLinkMetadata(const CefString& data) override;
|
|
|
|
void SetFragmentText(const CefString& text) override;
|
|
|
|
void SetFragmentHtml(const CefString& fragment) override;
|
|
|
|
void SetFragmentBaseURL(const CefString& fragment) override;
|
|
|
|
void ResetFileContents() override;
|
|
|
|
void AddFile(const CefString& path, const CefString& display_name) override;
|
2022-03-02 20:44:16 +01:00
|
|
|
void ClearFilenames() override;
|
2017-05-11 20:22:21 +02:00
|
|
|
CefRefPtr<CefImage> GetImage() override;
|
|
|
|
CefPoint GetImageHotspot() override;
|
|
|
|
bool HasImage() override;
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
// This method is not safe. Use Lock/Unlock to get mutually exclusive access.
|
2017-05-17 11:29:28 +02:00
|
|
|
content::DropData* drop_data() { return &data_; }
|
2014-07-01 00:30:29 +02:00
|
|
|
|
|
|
|
void SetReadOnly(bool read_only);
|
|
|
|
|
2014-07-15 00:18:51 +02:00
|
|
|
base::Lock& lock() { return lock_; }
|
|
|
|
|
|
|
|
private:
|
2013-10-18 18:33:56 +02:00
|
|
|
content::DropData data_;
|
2017-05-11 20:22:21 +02:00
|
|
|
CefRefPtr<CefImage> image_;
|
|
|
|
CefPoint image_hotspot_;
|
2013-10-18 18:33:56 +02:00
|
|
|
|
2014-07-01 00:30:29 +02:00
|
|
|
// True if this object is read-only.
|
|
|
|
bool read_only_;
|
|
|
|
|
2014-07-15 00:18:51 +02:00
|
|
|
base::Lock lock_;
|
|
|
|
|
2013-10-18 18:33:56 +02:00
|
|
|
IMPLEMENT_REFCOUNTING(CefDragDataImpl);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_COMMON_DRAG_DATA_IMPL_H_
|