mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 91.0.4472.0 (#870763)
This commit is contained in:
@ -34,7 +34,6 @@
|
||||
#include <memory.h>
|
||||
#include <string>
|
||||
|
||||
#include "include/base/cef_string16.h"
|
||||
#include "include/internal/cef_string_types.h"
|
||||
|
||||
#if defined(USING_CHROMIUM_INCLUDES)
|
||||
@ -91,32 +90,34 @@ struct CefStringTraitsWide {
|
||||
: false;
|
||||
}
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
static inline base::string16 to_string16(const struct_type* s) {
|
||||
static inline std::u16string to_string16(const struct_type* s) {
|
||||
cef_string_utf16_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_wide_to_utf16(s->str, s->length, &cstr);
|
||||
base::string16 str;
|
||||
std::u16string str;
|
||||
if (cstr.length > 0) {
|
||||
str = base::string16(
|
||||
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
|
||||
str = std::u16string(
|
||||
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
|
||||
}
|
||||
cef_string_utf16_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||
static inline bool from_string16(const std::u16string& str, struct_type* s) {
|
||||
return cef_string_utf16_to_wide(
|
||||
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
||||
? true
|
||||
: false;
|
||||
}
|
||||
#else // WCHAR_T_IS_UTF32
|
||||
static inline base::string16 to_string16(const struct_type* s) {
|
||||
return base::string16(
|
||||
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
|
||||
static inline std::u16string to_string16(const struct_type* s) {
|
||||
return std::u16string(
|
||||
reinterpret_cast<const std::u16string::value_type*>(s->str), s->length);
|
||||
}
|
||||
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||
return cef_string_wide_set(str.c_str(), str.length(), s, true) ? true
|
||||
: false;
|
||||
static inline bool from_string16(const std::u16string& str, struct_type* s) {
|
||||
return cef_string_wide_set(reinterpret_cast<const wchar_t*>(str.c_str()),
|
||||
str.length(), s, true)
|
||||
? true
|
||||
: false;
|
||||
}
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
};
|
||||
@ -169,19 +170,19 @@ struct CefStringTraitsUTF8 {
|
||||
static inline bool from_wstring(const std::wstring& str, struct_type* s) {
|
||||
return cef_string_wide_to_utf8(str.c_str(), str.length(), s) ? true : false;
|
||||
}
|
||||
static inline base::string16 to_string16(const struct_type* s) {
|
||||
static inline std::u16string to_string16(const struct_type* s) {
|
||||
cef_string_utf16_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
|
||||
base::string16 str;
|
||||
std::u16string str;
|
||||
if (cstr.length > 0) {
|
||||
str = base::string16(
|
||||
reinterpret_cast<base::string16::value_type*>(cstr.str), cstr.length);
|
||||
str = std::u16string(
|
||||
reinterpret_cast<std::u16string::value_type*>(cstr.str), cstr.length);
|
||||
}
|
||||
cef_string_utf16_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||
static inline bool from_string16(const std::u16string& str, struct_type* s) {
|
||||
return cef_string_utf16_to_utf8(
|
||||
reinterpret_cast<const char16*>(str.c_str()), str.length(), s)
|
||||
? true
|
||||
@ -256,11 +257,11 @@ struct CefStringTraitsUTF16 {
|
||||
: false;
|
||||
}
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
static inline base::string16 to_string16(const struct_type* s) {
|
||||
return base::string16(
|
||||
reinterpret_cast<const base::string16::value_type*>(s->str), s->length);
|
||||
static inline std::u16string to_string16(const struct_type* s) {
|
||||
return std::u16string(
|
||||
reinterpret_cast<const std::u16string::value_type*>(s->str), s->length);
|
||||
}
|
||||
static inline bool from_string16(const base::string16& str, struct_type* s) {
|
||||
static inline bool from_string16(const std::u16string& str, struct_type* s) {
|
||||
return cef_string_utf16_set(reinterpret_cast<const char16*>(str.c_str()),
|
||||
str.length(), s, true)
|
||||
? true
|
||||
@ -341,19 +342,25 @@ class CefStringBase {
|
||||
FromWString(std::wstring(src));
|
||||
}
|
||||
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
///
|
||||
// Create a new string from an existing string16. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
///
|
||||
CefStringBase(const base::string16& src) : string_(NULL), owner_(false) {
|
||||
CefStringBase(const std::u16string& src) : string_(NULL), owner_(false) {
|
||||
FromString16(src);
|
||||
}
|
||||
CefStringBase(const char16* src) : string_(NULL), owner_(false) {
|
||||
CefStringBase(const std::u16string::value_type* src)
|
||||
: string_(NULL), owner_(false) {
|
||||
if (src)
|
||||
FromString16(base::string16(
|
||||
reinterpret_cast<const base::string16::value_type*>(src)));
|
||||
FromString16(std::u16string(src));
|
||||
}
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
CefStringBase(const char16* src) : string_(NULL), owner_(false) {
|
||||
if (src) {
|
||||
FromString16(std::u16string(
|
||||
reinterpret_cast<const std::u16string::value_type*>(src)));
|
||||
}
|
||||
}
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
|
||||
@ -620,9 +627,9 @@ class CefStringBase {
|
||||
// Return this string's data as a string16. Translation will occur if
|
||||
// necessary based on the underlying string type.
|
||||
///
|
||||
base::string16 ToString16() const {
|
||||
std::u16string ToString16() const {
|
||||
if (empty())
|
||||
return base::string16();
|
||||
return std::u16string();
|
||||
return traits::to_string16(string_);
|
||||
}
|
||||
|
||||
@ -631,7 +638,7 @@ class CefStringBase {
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
///
|
||||
bool FromString16(const base::string16& str) {
|
||||
bool FromString16(const std::u16string& str) {
|
||||
if (str.empty()) {
|
||||
clear();
|
||||
return true;
|
||||
@ -683,15 +690,19 @@ class CefStringBase {
|
||||
FromWString(std::wstring(str));
|
||||
return *this;
|
||||
}
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
operator base::string16() const { return ToString16(); }
|
||||
CefStringBase& operator=(const base::string16& str) {
|
||||
operator std::u16string() const { return ToString16(); }
|
||||
CefStringBase& operator=(const std::u16string& str) {
|
||||
FromString16(str);
|
||||
return *this;
|
||||
}
|
||||
CefStringBase& operator=(const std::u16string::value_type* str) {
|
||||
FromString16(std::u16string(str));
|
||||
return *this;
|
||||
}
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
CefStringBase& operator=(const char16* str) {
|
||||
FromString16(base::string16(
|
||||
reinterpret_cast<const base::string16::value_type*>(str)));
|
||||
FromString16(std::u16string(
|
||||
reinterpret_cast<const std::u16string::value_type*>(str)));
|
||||
return *this;
|
||||
}
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
|
Reference in New Issue
Block a user