1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Added TCEFSentinel to more demos

- Check that all frames are valid before using them
- Added an error page to MiniBrowser.
This commit is contained in:
Salvador Díaz Fau
2019-10-13 18:50:23 +02:00
parent 9391d68ee0
commit 77121dc510
89 changed files with 1097 additions and 522 deletions

View File

@ -241,6 +241,9 @@ function DeleteDirContents(const aDirectory : string; const aExcludeFiles : TStr
function DeleteFileList(const aFileList : TStringList) : boolean;
function MoveFileList(const aFileList : TStringList; const aSrcDirectory, aDstDirectory : string) : boolean;
function CefGetDataURI(const aString, aMimeType : ustring) : ustring; overload;
function CefGetDataURI(aData : pointer; aSize : integer; const aMimeType : ustring; const aCharset : ustring = '') : ustring; overload;
implementation
uses
@ -2132,4 +2135,25 @@ begin
end;
end;
function CefGetDataURI(const aString, aMimeType : ustring) : ustring;
var
TempUTF : AnsiString;
begin
TempUTF := UTF8Encode(aString);
if (length(TempUTF) > 0) then
Result := CefGetDataURI(@TempUTF[1], length(TempUTF), aMimeType, 'utf-8')
else
Result := '';
end;
function CefGetDataURI(aData : pointer; aSize : integer; const aMimeType, aCharset : ustring) : ustring;
begin
Result := 'data:' + aMimeType;
if (length(aCharset) > 0) then Result := Result + ';charset=' + aCharset;
Result := Result + ';base64,' + CefURIEncode(CefBase64Encode(aData, aSize), false);
end;
end.