1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-02 21:57:37 +02:00

Update to CEF 78.3.1

- Added TChromium.LoadString using a DATA URL
- Added TChromium.LoadResource using a DATA URL
This commit is contained in:
Salvador Díaz Fau 2019-11-07 11:01:25 +01:00
parent f180972f22
commit 172e7ba9e4
9 changed files with 229 additions and 61 deletions

View File

@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador D
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file. CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 78.2.14 which includes Chromium 78.0.3904.87. CEF4Delphi uses CEF 78.3.1 which includes Chromium 78.0.3904.87.
The CEF binaries used by CEF4Delphi are available for download at spotify : The CEF binaries used by CEF4Delphi are available for download at spotify :
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_78.2.14%2Bg9633d3e%2Bchromium-78.0.3904.87_windows32.tar.bz2) * [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_78.3.1%2Bg8819d2e%2Bchromium-78.0.3904.87_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_78.2.14%2Bg9633d3e%2Bchromium-78.0.3904.87_windows64.tar.bz2) * [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_78.3.1%2Bg8819d2e%2Bchromium-78.0.3904.87_windows64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.3 Rio and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.6/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. CEF4Delphi was developed and tested on Delphi 10.3 Rio and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.6/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -764,7 +764,7 @@ begin
' with error ' + errorText + ' with error ' + errorText +
' (' + inttostr(errorCode) + ').</h2></body></html>'; ' (' + inttostr(errorCode) + ').</h2></body></html>';
frame.LoadURL(CefGetDataURI(TempString, 'text/html')); Chromium1.LoadString(TempString, frame);
end; end;
procedure TMiniBrowserFrm.Chromium1LoadingProgressChange(Sender: TObject; procedure TMiniBrowserFrm.Chromium1LoadingProgressChange(Sender: TObject;
@ -1107,7 +1107,6 @@ end;
procedure TMiniBrowserFrm.OpenfilewithaDAT1Click(Sender: TObject); procedure TMiniBrowserFrm.OpenfilewithaDAT1Click(Sender: TObject);
var var
TempDATA : string;
TempFile : TMemoryStream; TempFile : TMemoryStream;
begin begin
TempFile := nil; TempFile := nil;
@ -1123,11 +1122,9 @@ begin
TempFile.LoadFromFile(OpenDialog1.FileName); TempFile.LoadFromFile(OpenDialog1.FileName);
if (OpenDialog1.FilterIndex = 1) then if (OpenDialog1.FilterIndex = 1) then
TempDATA := CefGetDataURI(TempFile.Memory, TempFile.Size, 'text/html', 'utf-8') Chromium1.LoadResource(TempFile, 'text/html', 'utf-8')
else else
TempDATA := CefGetDataURI(TempFile.Memory, TempFile.Size, 'application/pdf', 'utf-8'); Chromium1.LoadResource(TempFile, 'application/pdf', 'utf-8');
Chromium1.LoadURL(TempDATA);
end; end;
except except
on e : exception do on e : exception do

View File

@ -20,14 +20,15 @@
<ComponentName Value="MiniBrowserFrm"/> <ComponentName Value="MiniBrowserFrm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<TopLine Value="1009"/> <TopLine Value="735"/>
<CursorPos X="74" Y="1029"/> <CursorPos X="43" Y="749"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Bookmarks Count="3"> <Bookmarks Count="3">
<Item0 Y="799" ID="1"/> <Item0 Y="806" ID="1"/>
<Item1 X="49" Y="61" ID="2"/> <Item1 X="49" Y="61" ID="2"/>
<Item2 X="65" Y="1024" ID="3"/> <Item2 X="65" Y="1031" ID="3"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
@ -39,10 +40,9 @@
<ComponentName Value="PreferencesFrm"/> <ComponentName Value="PreferencesFrm"/>
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<TopLine Value="69"/> <TopLine Value="69"/>
<CursorPos X="17" Y="92"/> <CursorPos X="86" Y="70"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
@ -90,123 +90,123 @@
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="342" Column="9" TopLine="314"/> <Caret Line="988" Column="62" TopLine="980"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="350" TopLine="345"/> <Caret Line="246" Column="77" TopLine="245"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="982" Column="56" TopLine="980"/> <Caret Line="388" Column="5" TopLine="364"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="1015" Column="66" TopLine="994"/> <Caret Line="988" Column="26" TopLine="969"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="258" Column="5" TopLine="251"/> <Caret Line="258" Column="93" TopLine="245"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="988" Column="62" TopLine="980"/> <Caret Line="288" Column="76" TopLine="276"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="246" Column="77" TopLine="245"/> <Caret Line="1221" Column="70" TopLine="1205"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="388" Column="5" TopLine="364"/> <Caret Line="1228" Column="70" TopLine="1212"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="988" Column="26" TopLine="969"/> <Caret Line="401" TopLine="396"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="258" Column="93" TopLine="245"/> <Caret Line="989" Column="44" TopLine="989"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="288" Column="76" TopLine="276"/> <Caret Line="406" Column="110" TopLine="387"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="1221" Column="70" TopLine="1205"/> <Caret Line="298" Column="62" TopLine="276"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="1228" Column="70" TopLine="1212"/> <Caret Line="794" Column="3" TopLine="780"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="401" TopLine="396"/> <Caret Line="61" Column="49" TopLine="45"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="989" Column="44" TopLine="989"/> <Caret Line="794" Column="3" TopLine="779"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="406" Column="110" TopLine="387"/> <Caret Line="62" Column="46" TopLine="46"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="298" Column="62" TopLine="276"/> <Caret Line="795" Column="3" TopLine="780"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="794" Column="3" TopLine="780"/> <Caret Line="266" Column="20" TopLine="255"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="61" Column="49" TopLine="45"/> <Caret Line="1032" Column="5" TopLine="1018"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="794" Column="3" TopLine="779"/> <Caret Line="798" TopLine="783"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="62" Column="46" TopLine="46"/> <Caret Line="1027" Column="28" TopLine="1012"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="795" Column="3" TopLine="780"/> <Caret Line="806" TopLine="783"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="266" Column="20" TopLine="255"/> <Caret Line="1035" Column="36" TopLine="1015"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="1032" Column="5" TopLine="1018"/> <Caret Line="62" TopLine="46"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="798" TopLine="783"/> <Caret Line="798" Column="52" TopLine="783"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="1027" Column="28" TopLine="1012"/> <Caret Line="836" Column="84" TopLine="818"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="806" TopLine="783"/> <Caret Line="1079" Column="54" TopLine="1055"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="1035" Column="36" TopLine="1015"/> <Caret Line="1157" Column="11" TopLine="1133"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="62" TopLine="46"/> <Caret Line="1172" Column="75" TopLine="1153"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="uMiniBrowser.pas"/> <Filename Value="uMiniBrowser.pas"/>
<Caret Line="798" Column="52" TopLine="783"/> <Caret Line="1077" Column="74" TopLine="1065"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
<RunParams> <RunParams>

View File

@ -736,10 +736,17 @@ end;
procedure TMiniBrowserFrm.Chromium1LoadError(Sender: TObject; procedure TMiniBrowserFrm.Chromium1LoadError(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer;
const errorText, failedUrl: ustring); const errorText, failedUrl: ustring);
var
TempString : string;
begin begin
CefDebugLog('Error code:' + inttostr(errorCode) + if (errorCode = ERR_ABORTED) then exit;
' - Error text :' + quotedstr(errorText) +
' - URL:' + failedUrl, CEF_LOG_SEVERITY_ERROR); TempString := '<html><body bgcolor="white">' +
'<h2>Failed to load URL ' + failedUrl +
' with error ' + errorText +
' (' + inttostr(errorCode) + ').</h2></body></html>';
Chromium1.LoadString(TempString, frame);
end; end;
procedure TMiniBrowserFrm.Chromium1LoadingProgressChange(Sender: TObject; procedure TMiniBrowserFrm.Chromium1LoadingProgressChange(Sender: TObject;
@ -1154,7 +1161,6 @@ end;
procedure TMiniBrowserFrm.OpenfilewithaDAT1Click(Sender: TObject); procedure TMiniBrowserFrm.OpenfilewithaDAT1Click(Sender: TObject);
var var
TempDATA : string;
TempFile : TMemoryStream; TempFile : TMemoryStream;
begin begin
TempFile := nil; TempFile := nil;
@ -1165,16 +1171,13 @@ begin
if OpenDialog1.Execute then if OpenDialog1.Execute then
begin begin
// Use TByteStream instead of TMemoryStream if your Delphi version supports it.
TempFile := TMemoryStream.Create; TempFile := TMemoryStream.Create;
TempFile.LoadFromFile(OpenDialog1.FileName); TempFile.LoadFromFile(OpenDialog1.FileName);
if (OpenDialog1.FilterIndex = 1) then if (OpenDialog1.FilterIndex = 1) then
TempDATA := 'data:text/html;charset=utf-8;base64,' + CefBase64Encode(TempFile.Memory, TempFile.Size) Chromium1.LoadResource(TempFile, 'text/html', 'utf-8')
else else
TempDATA := 'data:application/pdf;charset=utf-8;base64,' + CefBase64Encode(TempFile.Memory, TempFile.Size); Chromium1.LoadResource(TempFile, 'application/pdf', 'utf-8');
Chromium1.LoadURL(TempDATA);
end; end;
except except
on e : exception do on e : exception do

View File

@ -21,7 +21,7 @@
</CompilerOptions> </CompilerOptions>
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/> <Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
<License Value="MPL 1.1"/> <License Value="MPL 1.1"/>
<Version Major="78" Minor="2" Release="14"/> <Version Major="78" Minor="3" Release="1"/>
<Files Count="144"> <Files Count="144">
<Item1> <Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -61,8 +61,8 @@ uses
const const
CEF_SUPPORTED_VERSION_MAJOR = 78; CEF_SUPPORTED_VERSION_MAJOR = 78;
CEF_SUPPORTED_VERSION_MINOR = 2; CEF_SUPPORTED_VERSION_MINOR = 3;
CEF_SUPPORTED_VERSION_RELEASE = 14; CEF_SUPPORTED_VERSION_RELEASE = 1;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 78; CEF_CHROMEELF_VERSION_MAJOR = 78;

View File

@ -541,6 +541,12 @@ type
procedure LoadURL(const aURL : ustring; const aFrameName : ustring = ''); overload; procedure LoadURL(const aURL : ustring; const aFrameName : ustring = ''); overload;
procedure LoadURL(const aURL : ustring; const aFrame : ICefFrame); overload; procedure LoadURL(const aURL : ustring; const aFrame : ICefFrame); overload;
procedure LoadURL(const aURL : ustring; const aFrameIdentifier : int64); overload; procedure LoadURL(const aURL : ustring; const aFrameIdentifier : int64); overload;
procedure LoadString(const aHTML : ustring; const aFrameName : ustring = ''); overload;
procedure LoadString(const aHTML : ustring; const aFrame : ICefFrame); overload;
procedure LoadString(const aHTML : ustring; const aFrameIdentifier : int64); overload;
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameName : ustring = ''); overload;
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrame : ICefFrame); overload;
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameIdentifier : int64); overload;
procedure LoadRequest(const aRequest: ICefRequest); procedure LoadRequest(const aRequest: ICefRequest);
procedure GoBack; procedure GoBack;
@ -1767,7 +1773,7 @@ begin
end; end;
// Leave aFrameName empty to load the URL in the main frame // Leave aFrameName empty to load the URL in the main frame
procedure TChromium.LoadURL(const aURL : ustring; const aFrameName : ustring = ''); procedure TChromium.LoadURL(const aURL : ustring; const aFrameName : ustring);
var var
TempFrame : ICefFrame; TempFrame : ICefFrame;
begin begin
@ -1802,6 +1808,84 @@ begin
end; end;
end; end;
// Leave aFrameName empty to load the URL in the main frame
procedure TChromium.LoadString(const aHTML : ustring; const aFrameName : ustring);
var
TempFrame : ICefFrame;
begin
if Initialized and (length(aHTML) > 0) then
begin
if (length(aFrameName) > 0) then
TempFrame := FBrowser.GetFrame(aFrameName)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aHTML, 'text/html'));
end;
end;
procedure TChromium.LoadString(const aHTML : ustring; const aFrame : ICefFrame);
begin
if Initialized and (length(aHTML) > 0) and (aFrame <> nil) and aFrame.IsValid then
aFrame.LoadUrl(CefGetDataURI(aHTML, 'text/html'));
end;
procedure TChromium.LoadString(const aHTML : ustring; const aFrameIdentifier : int64);
var
TempFrame : ICefFrame;
begin
if Initialized and (length(aHTML) > 0) then
begin
if (aFrameIdentifier <> 0) then
TempFrame := FBrowser.GetFrameByident(aFrameIdentifier)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aHTML, 'text/html'));
end;
end;
// Leave aFrameName empty to load the URL in the main frame
procedure TChromium.LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameName : ustring);
var
TempFrame : ICefFrame;
begin
if Initialized and (aStream <> nil) and (aStream.Size > 0) then
begin
if (length(aFrameName) > 0) then
TempFrame := FBrowser.GetFrame(aFrameName)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aStream.Memory, aStream.Size, aMimeType, aCharset));
end;
end;
procedure TChromium.LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrame : ICefFrame);
begin
if Initialized and (aStream <> nil) and (aStream.Size > 0) and (aFrame <> nil) and aFrame.IsValid then
aFrame.LoadUrl(CefGetDataURI(aStream.Memory, aStream.Size, aMimeType, aCharset));
end;
procedure TChromium.LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameIdentifier : int64);
var
TempFrame : ICefFrame;
begin
if Initialized and (aStream <> nil) and (aStream.Size > 0) then
begin
if (aFrameIdentifier <> 0) then
TempFrame := FBrowser.GetFrameByident(aFrameIdentifier)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aStream.Memory, aStream.Size, aMimeType, aCharset));
end;
end;
// WARNING: This function will fail with "bad IPC message" reason // WARNING: This function will fail with "bad IPC message" reason
// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request // INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
// origin using some other mechanism (LoadURL, link click, etc). // origin using some other mechanism (LoadURL, link click, etc).

View File

@ -508,6 +508,12 @@ type
procedure LoadURL(const aURL : ustring; const aFrameName : ustring = ''); overload; procedure LoadURL(const aURL : ustring; const aFrameName : ustring = ''); overload;
procedure LoadURL(const aURL : ustring; const aFrame : ICefFrame); overload; procedure LoadURL(const aURL : ustring; const aFrame : ICefFrame); overload;
procedure LoadURL(const aURL : ustring; const aFrameIdentifier : int64); overload; procedure LoadURL(const aURL : ustring; const aFrameIdentifier : int64); overload;
procedure LoadString(const aHTML : ustring; const aFrameName : ustring = ''); overload;
procedure LoadString(const aHTML : ustring; const aFrame : ICefFrame); overload;
procedure LoadString(const aHTML : ustring; const aFrameIdentifier : int64); overload;
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameName : ustring = ''); overload;
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrame : ICefFrame); overload;
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameIdentifier : int64); overload;
procedure LoadRequest(const aRequest: ICefRequest); procedure LoadRequest(const aRequest: ICefRequest);
procedure GoBack; procedure GoBack;
@ -1566,7 +1572,7 @@ begin
end; end;
// Leave aFrameName empty to load the URL in the main frame // Leave aFrameName empty to load the URL in the main frame
procedure TFMXChromium.LoadURL(const aURL : ustring; const aFrameName : ustring = ''); procedure TFMXChromium.LoadURL(const aURL : ustring; const aFrameName : ustring);
var var
TempFrame : ICefFrame; TempFrame : ICefFrame;
begin begin
@ -1601,6 +1607,84 @@ begin
end; end;
end; end;
// Leave aFrameName empty to load the URL in the main frame
procedure TFMXChromium.LoadString(const aHTML : ustring; const aFrameName : ustring);
var
TempFrame : ICefFrame;
begin
if Initialized and (length(aHTML) > 0) then
begin
if (length(aFrameName) > 0) then
TempFrame := FBrowser.GetFrame(aFrameName)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aHTML, 'text/html'));
end;
end;
procedure TFMXChromium.LoadString(const aHTML : ustring; const aFrame : ICefFrame);
begin
if Initialized and (length(aHTML) > 0) and (aFrame <> nil) and aFrame.IsValid then
aFrame.LoadUrl(CefGetDataURI(aHTML, 'text/html'));
end;
procedure TFMXChromium.LoadString(const aHTML : ustring; const aFrameIdentifier : int64);
var
TempFrame : ICefFrame;
begin
if Initialized and (length(aHTML) > 0) then
begin
if (aFrameIdentifier <> 0) then
TempFrame := FBrowser.GetFrameByident(aFrameIdentifier)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aHTML, 'text/html'));
end;
end;
// Leave aFrameName empty to load the URL in the main frame
procedure TFMXChromium.LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameName : ustring);
var
TempFrame : ICefFrame;
begin
if Initialized and (aStream <> nil) and (aStream.Size > 0) then
begin
if (length(aFrameName) > 0) then
TempFrame := FBrowser.GetFrame(aFrameName)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aStream.Memory, aStream.Size, aMimeType, aCharset));
end;
end;
procedure TFMXChromium.LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrame : ICefFrame);
begin
if Initialized and (aStream <> nil) and (aStream.Size > 0) and (aFrame <> nil) and aFrame.IsValid then
aFrame.LoadUrl(CefGetDataURI(aStream.Memory, aStream.Size, aMimeType, aCharset));
end;
procedure TFMXChromium.LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameIdentifier : int64);
var
TempFrame : ICefFrame;
begin
if Initialized and (aStream <> nil) and (aStream.Size > 0) then
begin
if (aFrameIdentifier <> 0) then
TempFrame := FBrowser.GetFrameByident(aFrameIdentifier)
else
TempFrame := FBrowser.MainFrame;
if (TempFrame <> nil) and TempFrame.IsValid then
TempFrame.LoadUrl(CefGetDataURI(aStream.Memory, aStream.Size, aMimeType, aCharset));
end;
end;
// WARNING: This function will fail with "bad IPC message" reason // WARNING: This function will fail with "bad IPC message" reason
// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request // INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
// origin using some other mechanism (LoadURL, link click, etc). // origin using some other mechanism (LoadURL, link click, etc).

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 54, "InternalVersion" : 55,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "78.2.14.0" "Version" : "78.3.1.0"
} }
], ],
"UpdatePackageData" : { "UpdatePackageData" : {