Adding ClearFilenames method to CefDragData (fixes issue #3266)

This commit is contained in:
Jelle Bleyaert 2022-03-02 19:44:16 +00:00 committed by Marshall Greenblatt
parent 0cb874c9e1
commit 3c2e97d82e
8 changed files with 54 additions and 9 deletions

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=221973f3d5728478eeb0f8f5f55ca5e68b3afd8a$ // $hash=c99e9efb74fea2a2a99b25a694c59256f59238ab$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
@ -199,6 +199,11 @@ typedef struct _cef_drag_data_t {
const cef_string_t* path, const cef_string_t* path,
const cef_string_t* display_name); const cef_string_t* display_name);
///
// Clear list of filenames.
///
void(CEF_CALLBACK* clear_filenames)(struct _cef_drag_data_t* self);
/// ///
// Get the image representation of drag data. May return NULL if no image // Get the image representation of drag data. May return NULL if no image
// representation is available. // representation is available.

View File

@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal // way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash // hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected. // values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "c32d3ae315c5991d1bd81c412635d95a3fd353f8" #define CEF_API_HASH_UNIVERSAL "2aa3d374f5c27a433acba25d772b3a67fb1c528a"
#if defined(OS_WIN) #if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "cb1d823e15caa7e7b6074e3e612d111145b374d1" #define CEF_API_HASH_PLATFORM "acdae91db336230e00c4e8863236fd479576249f"
#elif defined(OS_MAC) #elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "7e3a768a3b73a514763ce9902afb85775ca8c83d" #define CEF_API_HASH_PLATFORM "6cdb410709486a7e78bf5876e9ca4a79e4553a30"
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "bc9260335c9493beb100645dbccd587e62925b9e" #define CEF_API_HASH_PLATFORM "3b89d9dab5020373d90525066de3166d0b949f25"
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -196,6 +196,12 @@ class CefDragData : public virtual CefBaseRefCounted {
virtual void AddFile(const CefString& path, virtual void AddFile(const CefString& path,
const CefString& display_name) = 0; const CefString& display_name) = 0;
///
// Clear list of filenames.
///
/*--cef()--*/
virtual void ClearFilenames() = 0;
/// ///
// Get the image representation of drag data. May return NULL if no image // Get the image representation of drag data. May return NULL if no image
// representation is available. // representation is available.

View File

@ -183,6 +183,11 @@ void CefDragDataImpl::AddFile(const CefString& path,
ui::FileInfo(base::FilePath(path), base::FilePath(display_name))); ui::FileInfo(base::FilePath(path), base::FilePath(display_name)));
} }
void CefDragDataImpl::ClearFilenames() {
base::AutoLock lock_scope(lock_);
data_.filenames.clear();
}
void CefDragDataImpl::SetReadOnly(bool read_only) { void CefDragDataImpl::SetReadOnly(bool read_only) {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
if (read_only_ == read_only) if (read_only_ == read_only)
@ -204,4 +209,4 @@ CefPoint CefDragDataImpl::GetImageHotspot() {
bool CefDragDataImpl::HasImage() { bool CefDragDataImpl::HasImage() {
base::AutoLock lock_scope(lock_); base::AutoLock lock_scope(lock_);
return image_ ? true : false; return image_ ? true : false;
} }

View File

@ -45,6 +45,7 @@ class CefDragDataImpl : public CefDragData {
void SetFragmentBaseURL(const CefString& fragment) override; void SetFragmentBaseURL(const CefString& fragment) override;
void ResetFileContents() override; void ResetFileContents() override;
void AddFile(const CefString& path, const CefString& display_name) override; void AddFile(const CefString& path, const CefString& display_name) override;
void ClearFilenames() override;
CefRefPtr<CefImage> GetImage() override; CefRefPtr<CefImage> GetImage() override;
CefPoint GetImageHotspot() override; CefPoint GetImageHotspot() override;
bool HasImage() override; bool HasImage() override;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=2a39ab30ca26c5c63ce557b31f86a5557cd96ebc$ // $hash=284032a14fc598b45b138f1dd949d9004abc6930$
// //
#include "libcef_dll/cpptoc/drag_data_cpptoc.h" #include "libcef_dll/cpptoc/drag_data_cpptoc.h"
@ -410,6 +410,19 @@ void CEF_CALLBACK drag_data_add_file(struct _cef_drag_data_t* self,
CefString(display_name)); CefString(display_name));
} }
void CEF_CALLBACK drag_data_clear_filenames(struct _cef_drag_data_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefDragDataCppToC::Get(self)->ClearFilenames();
}
struct _cef_image_t* CEF_CALLBACK struct _cef_image_t* CEF_CALLBACK
drag_data_get_image(struct _cef_drag_data_t* self) { drag_data_get_image(struct _cef_drag_data_t* self) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
@ -487,6 +500,7 @@ CefDragDataCppToC::CefDragDataCppToC() {
GetStruct()->set_fragment_base_url = drag_data_set_fragment_base_url; GetStruct()->set_fragment_base_url = drag_data_set_fragment_base_url;
GetStruct()->reset_file_contents = drag_data_reset_file_contents; GetStruct()->reset_file_contents = drag_data_reset_file_contents;
GetStruct()->add_file = drag_data_add_file; GetStruct()->add_file = drag_data_add_file;
GetStruct()->clear_filenames = drag_data_clear_filenames;
GetStruct()->get_image = drag_data_get_image; GetStruct()->get_image = drag_data_get_image;
GetStruct()->get_image_hotspot = drag_data_get_image_hotspot; GetStruct()->get_image_hotspot = drag_data_get_image_hotspot;
GetStruct()->has_image = drag_data_has_image; GetStruct()->has_image = drag_data_has_image;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=57352ff85ca98fc34a0f2c58afbb1224ce1a1f09$ // $hash=7d9a55e1e8779d677d34e2b6c9277db7e6b75d3d$
// //
#include "libcef_dll/ctocpp/drag_data_ctocpp.h" #include "libcef_dll/ctocpp/drag_data_ctocpp.h"
@ -420,6 +420,19 @@ void CefDragDataCToCpp::AddFile(const CefString& path,
_struct->add_file(_struct, path.GetStruct(), display_name.GetStruct()); _struct->add_file(_struct, path.GetStruct(), display_name.GetStruct());
} }
NO_SANITIZE("cfi-icall") void CefDragDataCToCpp::ClearFilenames() {
shutdown_checker::AssertNotShutdown();
cef_drag_data_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, clear_filenames))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->clear_filenames(_struct);
}
NO_SANITIZE("cfi-icall") CefRefPtr<CefImage> CefDragDataCToCpp::GetImage() { NO_SANITIZE("cfi-icall") CefRefPtr<CefImage> CefDragDataCToCpp::GetImage() {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=0814e8ced30cbbd7c5867464550da973395b385b$ // $hash=1a5339fa563b702a47be56dda2e0ac53617a6e27$
// //
#ifndef CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_ #ifndef CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_
@ -57,6 +57,7 @@ class CefDragDataCToCpp : public CefCToCppRefCounted<CefDragDataCToCpp,
void SetFragmentBaseURL(const CefString& base_url) override; void SetFragmentBaseURL(const CefString& base_url) override;
void ResetFileContents() override; void ResetFileContents() override;
void AddFile(const CefString& path, const CefString& display_name) override; void AddFile(const CefString& path, const CefString& display_name) override;
void ClearFilenames() override;
CefRefPtr<CefImage> GetImage() override; CefRefPtr<CefImage> GetImage() override;
CefPoint GetImageHotspot() override; CefPoint GetImageHotspot() override;
bool HasImage() override; bool HasImage() override;