From 4474c6529a5095939ac4cf1f556dd870991cb241 Mon Sep 17 00:00:00 2001 From: yueyang Date: Wed, 25 Dec 2024 16:31:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E6=A0=B9=E6=8D=AEdefault=20charset?= =?UTF-8?q?=E8=A7=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yueyang --- include/capi/cef_download_item_capi.h | 2 +- include/cef_download_item.h | 3 ++- libcef/browser/download_item_impl.cc | 8 +++++--- libcef/browser/download_item_impl.h | 2 +- libcef_dll/cpptoc/download_item_cpptoc.cc | 12 +++++++----- libcef_dll/ctocpp/download_item_ctocpp.cc | 15 +++++++-------- libcef_dll/ctocpp/download_item_ctocpp.h | 5 +++-- 7 files changed, 26 insertions(+), 21 deletions(-) diff --git a/include/capi/cef_download_item_capi.h b/include/capi/cef_download_item_capi.h index 146697720..f83521a4b 100644 --- a/include/capi/cef_download_item_capi.h +++ b/include/capi/cef_download_item_capi.h @@ -145,7 +145,7 @@ typedef struct _cef_download_item_t { /// Returns the content disposition. /// // The resulting string must be freed by calling cef_string_userfree_free(). - cef_string_userfree_t(CEF_CALLBACK* get_content_disposition)( + struct _cef_value_t*(CEF_CALLBACK* get_content_disposition)( struct _cef_download_item_t* self); /// diff --git a/include/cef_download_item.h b/include/cef_download_item.h index 69cb0be32..9421f74c9 100644 --- a/include/cef_download_item.h +++ b/include/cef_download_item.h @@ -39,6 +39,7 @@ #pragma once #include "include/cef_base.h" +#include "include/cef_values.h" /// /// Class used to represent a download item. @@ -142,7 +143,7 @@ class CefDownloadItem : public virtual CefBaseRefCounted { /// Returns the content disposition. /// /*--cef()--*/ - virtual CefString GetContentDisposition() = 0; + virtual CefRefPtr GetContentDisposition() = 0; /// /// Returns the mime type. diff --git a/libcef/browser/download_item_impl.cc b/libcef/browser/download_item_impl.cc index 334865db3..8da6266de 100644 --- a/libcef/browser/download_item_impl.cc +++ b/libcef/browser/download_item_impl.cc @@ -117,9 +117,11 @@ CefString CefDownloadItemImpl::GetSuggestedFileName() { return const_value().GetSuggestedFilename(); } -CefString CefDownloadItemImpl::GetContentDisposition() { - CEF_VALUE_VERIFY_RETURN(false, CefString()); - return const_value().GetContentDisposition(); +CefRefPtr CefDownloadItemImpl::GetContentDisposition() { + CEF_VALUE_VERIFY_RETURN(false, nullptr); + CefRefPtr data = CefValue::Create(); + data->SetStdString(const_value().GetContentDisposition()); + return data; } CefString CefDownloadItemImpl::GetMimeType() { diff --git a/libcef/browser/download_item_impl.h b/libcef/browser/download_item_impl.h index 25eb44d88..8830621c0 100644 --- a/libcef/browser/download_item_impl.h +++ b/libcef/browser/download_item_impl.h @@ -38,7 +38,7 @@ class CefDownloadItemImpl CefString GetURL() override; CefString GetOriginalUrl() override; CefString GetSuggestedFileName() override; - CefString GetContentDisposition() override; + CefRefPtr GetContentDisposition() override; CefString GetMimeType() override; CefString GetOriginalMimeType() override; CefString GetGuid() override; diff --git a/libcef_dll/cpptoc/download_item_cpptoc.cc b/libcef_dll/cpptoc/download_item_cpptoc.cc index a40135837..496859b1c 100644 --- a/libcef_dll/cpptoc/download_item_cpptoc.cc +++ b/libcef_dll/cpptoc/download_item_cpptoc.cc @@ -9,10 +9,11 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=8ee1cd1c85cd52069e8344d6f2d28ef4eb0b745c$ +// $hash=5998532dc9d84ad0802b86aaf4d986b77ec124d0$ // #include "libcef_dll/cpptoc/download_item_cpptoc.h" +#include "libcef_dll/cpptoc/value_cpptoc.h" #include "libcef_dll/shutdown_checker.h" namespace { @@ -285,7 +286,7 @@ download_item_get_suggested_file_name(struct _cef_download_item_t* self) { return _retval.DetachToUserFree(); } -cef_string_userfree_t CEF_CALLBACK +struct _cef_value_t* CEF_CALLBACK download_item_get_content_disposition(struct _cef_download_item_t* self) { shutdown_checker::AssertNotShutdown(); @@ -297,10 +298,11 @@ download_item_get_content_disposition(struct _cef_download_item_t* self) { } // Execute - CefString _retval = CefDownloadItemCppToC::Get(self)->GetContentDisposition(); + CefRefPtr _retval = + CefDownloadItemCppToC::Get(self)->GetContentDisposition(); - // Return type: string - return _retval.DetachToUserFree(); + // Return type: refptr_same + return CefValueCppToC::Wrap(_retval); } cef_string_userfree_t CEF_CALLBACK diff --git a/libcef_dll/ctocpp/download_item_ctocpp.cc b/libcef_dll/ctocpp/download_item_ctocpp.cc index bd4b604c9..0e8bcc748 100644 --- a/libcef_dll/ctocpp/download_item_ctocpp.cc +++ b/libcef_dll/ctocpp/download_item_ctocpp.cc @@ -9,10 +9,11 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=4e1a4826a5fc77e2d81cbd8f4d1d721fe416d3d6$ +// $hash=0a0c193ae6e77b98ea8f5945c323819ee91be4ee$ // #include "libcef_dll/ctocpp/download_item_ctocpp.h" +#include "libcef_dll/ctocpp/value_ctocpp.h" #include "libcef_dll/shutdown_checker.h" // VIRTUAL METHODS - Body may be edited by hand. @@ -282,23 +283,21 @@ CefString CefDownloadItemCToCpp::GetSuggestedFileName() { } NO_SANITIZE("cfi-icall") -CefString CefDownloadItemCToCpp::GetContentDisposition() { +CefRefPtr CefDownloadItemCToCpp::GetContentDisposition() { shutdown_checker::AssertNotShutdown(); cef_download_item_t* _struct = GetStruct(); if (CEF_MEMBER_MISSING(_struct, get_content_disposition)) { - return CefString(); + return nullptr; } // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // Execute - cef_string_userfree_t _retval = _struct->get_content_disposition(_struct); + cef_value_t* _retval = _struct->get_content_disposition(_struct); - // Return type: string - CefString _retvalStr; - _retvalStr.AttachToUserFree(_retval); - return _retvalStr; + // Return type: refptr_same + return CefValueCToCpp::Wrap(_retval); } NO_SANITIZE("cfi-icall") CefString CefDownloadItemCToCpp::GetMimeType() { diff --git a/libcef_dll/ctocpp/download_item_ctocpp.h b/libcef_dll/ctocpp/download_item_ctocpp.h index 68ef45f32..664faf27e 100644 --- a/libcef_dll/ctocpp/download_item_ctocpp.h +++ b/libcef_dll/ctocpp/download_item_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=1fe7226c96b62b2e91dda051fe89ab47077c80e4$ +// $hash=801678582c97c2385f28f59c4967206b527e5539$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_DOWNLOAD_ITEM_CTOCPP_H_ @@ -23,6 +23,7 @@ #include "include/capi/cef_download_item_capi.h" #include "include/cef_download_item.h" #include "libcef_dll/ctocpp/ctocpp_ref_counted.h" +#include "libcef_dll/ctocpp/value_ctocpp.h" // Wrap a C structure with a C++ class. // This class may be instantiated and accessed wrapper-side only. @@ -49,7 +50,7 @@ class CefDownloadItemCToCpp : public CefCToCppRefCounted GetContentDisposition() override; CefString GetMimeType() override; CefString GetOriginalMimeType() override; CefString GetGuid() override; -- Gitee