From 3c2e97d82e9adad0cee00021a9e9fe387f73009c Mon Sep 17 00:00:00 2001 From: Jelle Bleyaert Date: Wed, 2 Mar 2022 19:44:16 +0000 Subject: [PATCH] Adding ClearFilenames method to CefDragData (fixes issue #3266) --- include/capi/cef_drag_data_capi.h | 7 ++++++- include/cef_api_hash.h | 8 ++++---- include/cef_drag_data.h | 6 ++++++ libcef/common/drag_data_impl.cc | 7 ++++++- libcef/common/drag_data_impl.h | 1 + libcef_dll/cpptoc/drag_data_cpptoc.cc | 16 +++++++++++++++- libcef_dll/ctocpp/drag_data_ctocpp.cc | 15 ++++++++++++++- libcef_dll/ctocpp/drag_data_ctocpp.h | 3 ++- 8 files changed, 54 insertions(+), 9 deletions(-) diff --git a/include/capi/cef_drag_data_capi.h b/include/capi/cef_drag_data_capi.h index 97a7f0b35..656603afc 100644 --- a/include/capi/cef_drag_data_capi.h +++ b/include/capi/cef_drag_data_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=221973f3d5728478eeb0f8f5f55ca5e68b3afd8a$ +// $hash=c99e9efb74fea2a2a99b25a694c59256f59238ab$ // #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* 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 // representation is available. diff --git a/include/cef_api_hash.h b/include/cef_api_hash.h index bc4579bb1..b418ac8a0 100644 --- a/include/cef_api_hash.h +++ b/include/cef_api_hash.h @@ -42,13 +42,13 @@ // way that may cause binary incompatibility with other builds. The universal // hash value will change if any platform is affected whereas the platform hash // 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) -#define CEF_API_HASH_PLATFORM "cb1d823e15caa7e7b6074e3e612d111145b374d1" +#define CEF_API_HASH_PLATFORM "acdae91db336230e00c4e8863236fd479576249f" #elif defined(OS_MAC) -#define CEF_API_HASH_PLATFORM "7e3a768a3b73a514763ce9902afb85775ca8c83d" +#define CEF_API_HASH_PLATFORM "6cdb410709486a7e78bf5876e9ca4a79e4553a30" #elif defined(OS_LINUX) -#define CEF_API_HASH_PLATFORM "bc9260335c9493beb100645dbccd587e62925b9e" +#define CEF_API_HASH_PLATFORM "3b89d9dab5020373d90525066de3166d0b949f25" #endif #ifdef __cplusplus diff --git a/include/cef_drag_data.h b/include/cef_drag_data.h index 35661f870..33904c079 100644 --- a/include/cef_drag_data.h +++ b/include/cef_drag_data.h @@ -196,6 +196,12 @@ class CefDragData : public virtual CefBaseRefCounted { virtual void AddFile(const CefString& path, 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 // representation is available. diff --git a/libcef/common/drag_data_impl.cc b/libcef/common/drag_data_impl.cc index 79d9a1293..a645ed526 100644 --- a/libcef/common/drag_data_impl.cc +++ b/libcef/common/drag_data_impl.cc @@ -183,6 +183,11 @@ void CefDragDataImpl::AddFile(const CefString& path, 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) { base::AutoLock lock_scope(lock_); if (read_only_ == read_only) @@ -204,4 +209,4 @@ CefPoint CefDragDataImpl::GetImageHotspot() { bool CefDragDataImpl::HasImage() { base::AutoLock lock_scope(lock_); return image_ ? true : false; -} +} \ No newline at end of file diff --git a/libcef/common/drag_data_impl.h b/libcef/common/drag_data_impl.h index c44f83c55..8acef05e7 100644 --- a/libcef/common/drag_data_impl.h +++ b/libcef/common/drag_data_impl.h @@ -45,6 +45,7 @@ class CefDragDataImpl : public CefDragData { void SetFragmentBaseURL(const CefString& fragment) override; void ResetFileContents() override; void AddFile(const CefString& path, const CefString& display_name) override; + void ClearFilenames() override; CefRefPtr GetImage() override; CefPoint GetImageHotspot() override; bool HasImage() override; diff --git a/libcef_dll/cpptoc/drag_data_cpptoc.cc b/libcef_dll/cpptoc/drag_data_cpptoc.cc index 6e682e5d8..fd081c83b 100644 --- a/libcef_dll/cpptoc/drag_data_cpptoc.cc +++ b/libcef_dll/cpptoc/drag_data_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=2a39ab30ca26c5c63ce557b31f86a5557cd96ebc$ +// $hash=284032a14fc598b45b138f1dd949d9004abc6930$ // #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)); } +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 drag_data_get_image(struct _cef_drag_data_t* self) { shutdown_checker::AssertNotShutdown(); @@ -487,6 +500,7 @@ CefDragDataCppToC::CefDragDataCppToC() { GetStruct()->set_fragment_base_url = drag_data_set_fragment_base_url; GetStruct()->reset_file_contents = drag_data_reset_file_contents; GetStruct()->add_file = drag_data_add_file; + GetStruct()->clear_filenames = drag_data_clear_filenames; GetStruct()->get_image = drag_data_get_image; GetStruct()->get_image_hotspot = drag_data_get_image_hotspot; GetStruct()->has_image = drag_data_has_image; diff --git a/libcef_dll/ctocpp/drag_data_ctocpp.cc b/libcef_dll/ctocpp/drag_data_ctocpp.cc index fc33a78e5..2b92dd49a 100644 --- a/libcef_dll/ctocpp/drag_data_ctocpp.cc +++ b/libcef_dll/ctocpp/drag_data_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=57352ff85ca98fc34a0f2c58afbb1224ce1a1f09$ +// $hash=7d9a55e1e8779d677d34e2b6c9277db7e6b75d3d$ // #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()); } +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 CefDragDataCToCpp::GetImage() { shutdown_checker::AssertNotShutdown(); diff --git a/libcef_dll/ctocpp/drag_data_ctocpp.h b/libcef_dll/ctocpp/drag_data_ctocpp.h index 9b903e3b5..4779c78e5 100644 --- a/libcef_dll/ctocpp/drag_data_ctocpp.h +++ b/libcef_dll/ctocpp/drag_data_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=0814e8ced30cbbd7c5867464550da973395b385b$ +// $hash=1a5339fa563b702a47be56dda2e0ac53617a6e27$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_ @@ -57,6 +57,7 @@ class CefDragDataCToCpp : public CefCToCppRefCounted GetImage() override; CefPoint GetImageHotspot() override; bool HasImage() override;