mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-02-02 10:25:26 +02:00
Update to CEF 88.2.9
Added the SimpleBrowser demo for Linux. Added Linux support to TChromiumWindow. Removed unused code and added more code comments to the SimpleBrowser demos for Windows.
This commit is contained in:
parent
fcb2b586cf
commit
9d17a50210
14
README.md
14
README.md
@ -3,14 +3,14 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
|
|||||||
|
|
||||||
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 88.2.8 which includes Chromium 88.0.4324.150.
|
CEF4Delphi uses CEF 88.2.9 which includes Chromium 88.0.4324.182.
|
||||||
The CEF binaries used by CEF4Delphi are available for download at spotify :
|
The CEF binaries used by CEF4Delphi are available for download at spotify :
|
||||||
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.8%2Bge484012%2Bchromium-88.0.4324.150_windows32.tar.bz2)
|
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.9%2Bg5c8711a%2Bchromium-88.0.4324.182_windows32.tar.bz2)
|
||||||
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.8%2Bge484012%2Bchromium-88.0.4324.150_windows64.tar.bz2)
|
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.9%2Bg5c8711a%2Bchromium-88.0.4324.182_windows64.tar.bz2)
|
||||||
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.8%2Bge484012%2Bchromium-88.0.4324.150_linux32.tar.bz2)
|
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.9%2Bg5c8711a%2Bchromium-88.0.4324.182_linux32.tar.bz2)
|
||||||
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.8%2Bge484012%2Bchromium-88.0.4324.150_linux64.tar.bz2)
|
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.9%2Bg5c8711a%2Bchromium-88.0.4324.182_linux64.tar.bz2)
|
||||||
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.8%2Bge484012%2Bchromium-88.0.4324.150_linuxarm.tar.bz2)
|
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.9%2Bg5c8711a%2Bchromium-88.0.4324.182_linuxarm.tar.bz2)
|
||||||
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.8%2Bge484012%2Bchromium-88.0.4324.150_linuxarm64.tar.bz2)
|
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_88.2.9%2Bg5c8711a%2Bchromium-88.0.4324.182_linuxarm64.tar.bz2)
|
||||||
|
|
||||||
CEF4Delphi was developed and tested on Delphi 10.4.1 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
CEF4Delphi was developed and tested on Delphi 10.4.1 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
// For more information about CEF4Delphi visit :
|
// For more information about CEF4Delphi visit :
|
||||||
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
//
|
//
|
||||||
// Copyright © 2018 Salvador Díaz Fau. All rights reserved.
|
// Copyright © 2021 Salvador Díaz Fau. All rights reserved.
|
||||||
//
|
//
|
||||||
// ************************************************************************
|
// ************************************************************************
|
||||||
// ************ vvvv Original license and comments below vvvv *************
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
@ -50,9 +50,11 @@ uses
|
|||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
{$IFDEF WIN32}
|
||||||
// If you don't add this flag the rederer process will crash when you try to load large images.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
// If you don't add this flag the rederer process will crash when you try to load large images.
|
||||||
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
@ -26,7 +26,6 @@ object Form1: TForm1
|
|||||||
TabStop = True
|
TabStop = True
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnClose = ChromiumWindow1Close
|
OnClose = ChromiumWindow1Close
|
||||||
OnBeforeClose = ChromiumWindow1BeforeClose
|
|
||||||
OnAfterCreated = ChromiumWindow1AfterCreated
|
OnAfterCreated = ChromiumWindow1AfterCreated
|
||||||
end
|
end
|
||||||
object AddressPnl: TPanel
|
object AddressPnl: TPanel
|
||||||
|
@ -69,7 +69,6 @@ type
|
|||||||
|
|
||||||
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
||||||
procedure ChromiumWindow1Close(Sender: TObject);
|
procedure ChromiumWindow1Close(Sender: TObject);
|
||||||
procedure ChromiumWindow1BeforeClose(Sender: TObject);
|
|
||||||
|
|
||||||
private
|
private
|
||||||
// You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned.
|
// You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned.
|
||||||
@ -81,7 +80,7 @@ type
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
// Variables to control when can we destroy the form safely
|
// Variables to control when can we destroy the form safely
|
||||||
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
FCanClose : boolean; // Set to True in TChromium.OnClose
|
||||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||||
|
|
||||||
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||||
@ -108,15 +107,19 @@ uses
|
|||||||
|
|
||||||
// Depending on your internet connection it may take longer than expected.
|
// Depending on your internet connection it may take longer than expected.
|
||||||
|
|
||||||
|
// This demo uses a TChromiumWindow component which should *ONLY* be used for extremely
|
||||||
|
// simple applications with a simple browser. For any other configuration it's
|
||||||
|
// recommended using a TChromium with a TCEFWindowParent as shown in the SimpleBrowser2 demo.
|
||||||
|
|
||||||
// Please check that your firewall or antivirus are not blocking this application
|
// Please check that your firewall or antivirus are not blocking this application
|
||||||
// or the domain "google.com". If you don't live in the US, you'll be redirected to
|
// or the domain "google.com". If you don't live in the US, you'll be redirected to
|
||||||
// another domain which will take a little time too.
|
// another domain which will take a little time too.
|
||||||
|
|
||||||
// Destruction steps
|
// Destruction steps
|
||||||
// =================
|
// =================
|
||||||
// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event.
|
// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser,
|
||||||
// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event.
|
// which triggers the TChromiumWindow.OnClose event.
|
||||||
// 3. TChromiumWindow.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
// 2. The TChromiumWindow.OnClose sets FCanClose to true and sends WM_CLOSE to the form.
|
||||||
|
|
||||||
|
|
||||||
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
@ -135,6 +138,9 @@ procedure TForm1.FormCreate(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
FCanClose := False;
|
FCanClose := False;
|
||||||
FClosing := False;
|
FClosing := False;
|
||||||
|
|
||||||
|
// The browser will load the URL in AddressEdt initially.
|
||||||
|
ChromiumWindow1.ChromiumBrowser.DefaultURL := AddressEdt.Text;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormShow(Sender: TObject);
|
procedure TForm1.FormShow(Sender: TObject);
|
||||||
@ -151,22 +157,12 @@ begin
|
|||||||
if not(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True;
|
if not(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.ChromiumWindow1BeforeClose(Sender: TObject);
|
procedure TForm1.ChromiumWindow1Close(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FCanClose := True;
|
FCanClose := True;
|
||||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.ChromiumWindow1Close(Sender: TObject);
|
|
||||||
begin
|
|
||||||
// DestroyChildWindow will destroy the child window created by CEF at the top of the Z order.
|
|
||||||
if not(ChromiumWindow1.DestroyChildWindow) then
|
|
||||||
begin
|
|
||||||
FCanClose := True;
|
|
||||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm1.Chromium_OnBeforePopup( Sender : TObject;
|
procedure TForm1.Chromium_OnBeforePopup( Sender : TObject;
|
||||||
const browser : ICefBrowser;
|
const browser : ICefBrowser;
|
||||||
const frame : ICefFrame;
|
const frame : ICefFrame;
|
||||||
@ -188,10 +184,8 @@ end;
|
|||||||
|
|
||||||
procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject);
|
procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
// Now the browser is fully initialized we can load the initial web page.
|
|
||||||
Caption := 'Simple Browser';
|
Caption := 'Simple Browser';
|
||||||
AddressPnl.Enabled := True;
|
AddressPnl.Enabled := True;
|
||||||
GoBtn.Click;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||||
|
2
demos/Lazarus_Linux/SimpleBrowser/00-Delete.bat
Normal file
2
demos/Lazarus_Linux/SimpleBrowser/00-Delete.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
rmdir /S /Q lib
|
||||||
|
rmdir /S /Q backup
|
BIN
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.ico
Normal file
BIN
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
88
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.lpi
Normal file
88
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.lpi
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<General>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="SimpleBrowser"/>
|
||||||
|
<Scaled Value="True"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
<UseXPManifest Value="True"/>
|
||||||
|
<XPManifest>
|
||||||
|
<DpiAware Value="True"/>
|
||||||
|
</XPManifest>
|
||||||
|
<Icon Value="0"/>
|
||||||
|
</General>
|
||||||
|
<BuildModes Count="1">
|
||||||
|
<Item1 Name="Default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
<Modes Count="0"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="2">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="CEF4Delphi_Lazarus"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item2>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="3">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="SimpleBrowser.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="usimplebrowser.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="uSimpleBrowser"/>
|
||||||
|
</Unit1>
|
||||||
|
<Unit2>
|
||||||
|
<Filename Value="interfaces.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit2>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../../../bin/SimpleBrowser"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CustomOptions Value="-dUseCthreads"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item3>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
90
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.lpr
Normal file
90
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.lpr
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Salvador Díaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
program SimpleBrowser;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
// "Interfaces" is a custom unit used to initialize the LCL WidgetSet
|
||||||
|
// We keep the same name to avoid a Lazarus warning.
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms, uSimpleBrowser,
|
||||||
|
{ you can add units after this }
|
||||||
|
uCEFApplication;
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
begin
|
||||||
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
|
||||||
|
// In case you want to use custom directories for the CEF3 binaries, cache and user data.
|
||||||
|
// If you don't set a cache directory the browser will use in-memory cache.
|
||||||
|
{
|
||||||
|
GlobalCEFApp.FrameworkDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.ResourcesDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.LocalesDirPath := 'c:\cef\locales';
|
||||||
|
GlobalCEFApp.EnableGPU := True; // Enable hardware acceleration
|
||||||
|
GlobalCEFApp.cache := 'c:\cef\cache';
|
||||||
|
GlobalCEFApp.UserDataPath := 'c:\cef\User Data';
|
||||||
|
}
|
||||||
|
|
||||||
|
// You *MUST* call GlobalCEFApp.StartMainProcess in a if..then clause
|
||||||
|
// with the Application initialization inside the begin..end.
|
||||||
|
// Read this https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
if GlobalCEFApp.StartMainProcess then
|
||||||
|
begin
|
||||||
|
// The LCL Widgetset must be initialized after the CEF initialization and
|
||||||
|
// only in the browser process.
|
||||||
|
CustomWidgetSetInitialization;
|
||||||
|
RequireDerivedFormResource:=True;
|
||||||
|
Application.Scaled:=True;
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
CustomWidgetSetFinalization;
|
||||||
|
end;
|
||||||
|
|
||||||
|
GlobalCEFApp.Free;
|
||||||
|
GlobalCEFApp := nil;
|
||||||
|
end.
|
||||||
|
|
BIN
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.res
Normal file
BIN
demos/Lazarus_Linux/SimpleBrowser/SimpleBrowser.res
Normal file
Binary file not shown.
468
demos/Lazarus_Linux/SimpleBrowser/cef.inc
Normal file
468
demos/Lazarus_Linux/SimpleBrowser/cef.inc
Normal file
@ -0,0 +1,468 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2017 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
// The complete list of compiler versions is here :
|
||||||
|
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
|
||||||
|
|
||||||
|
{$DEFINE DELPHI_VERSION_UNKNOW}
|
||||||
|
|
||||||
|
// Delphi 5
|
||||||
|
{$IFDEF VER130}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 6
|
||||||
|
{$IFDEF VER140}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 7
|
||||||
|
{$IFDEF VER150}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 8
|
||||||
|
{$IFDEF VER160}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2005
|
||||||
|
{$IFDEF VER170}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF VER180}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
// Delphi 2007
|
||||||
|
{$IFDEF VER185}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
// Delphi 2006
|
||||||
|
{$ELSE}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2009
|
||||||
|
{$IFDEF VER200}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
//Delphi 2010
|
||||||
|
{$IFDEF VER210}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE
|
||||||
|
{$IFDEF VER220}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE2 (First FireMonkey and 64bit compiler)
|
||||||
|
{$IFDEF VER230}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE3
|
||||||
|
{$IFDEF VER240}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE4
|
||||||
|
{$IFDEF VER250}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE5
|
||||||
|
{$IFDEF VER260}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE6
|
||||||
|
{$IFDEF VER270}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE7
|
||||||
|
{$IFDEF VER280}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE8
|
||||||
|
{$IFDEF VER290}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$ENDIF VER290}
|
||||||
|
|
||||||
|
// Rad Studio 10 - Delphi Seattle
|
||||||
|
{$IFDEF VER300}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.1 - Delphi Berlin
|
||||||
|
{$IFDEF VER310}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.2 - Delphi Tokyo
|
||||||
|
{$IFDEF VER320}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.3 - Delphi Rio
|
||||||
|
{$IFDEF VER330}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.4 - Delphi Sydney
|
||||||
|
{$IFDEF VER340}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$DEFINE DELPHI27_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)}
|
||||||
|
{$DEFINE FPC_VER_320}
|
||||||
|
{$IFEND}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$DEFINE DELPHI27_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF DELPHI9_UP}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IF DEFINED(CPUX32) OR
|
||||||
|
DEFINED(CPU386) OR
|
||||||
|
DEFINED(CPUi386) OR
|
||||||
|
DEFINED(CPUPOWERPC32) OR
|
||||||
|
DEFINED(CPUSPARC32) OR
|
||||||
|
DEFINED(CPU32BITS) OR
|
||||||
|
DEFINED(CPUARM32) OR
|
||||||
|
DEFINED(WIN32) OR
|
||||||
|
DEFINED(IOS32) OR
|
||||||
|
DEFINED(MACOS32) OR
|
||||||
|
DEFINED(LINUX32) OR
|
||||||
|
DEFINED(POSIX32) OR
|
||||||
|
DEFINED(ANDROID32)}
|
||||||
|
{$DEFINE TARGET_32BITS}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// Delphi uses MACOS for the new MacOSX and DARWIN is not defined
|
||||||
|
// FPC uses DARWIN for the new MacOSX and MACOS is defined for the classic Macintosh OS (System 7)
|
||||||
|
// We define MACOSX to avoid conflicts in both situations
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF MACOS}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
48
demos/Lazarus_Linux/SimpleBrowser/interfaces.pas
Normal file
48
demos/Lazarus_Linux/SimpleBrowser/interfaces.pas
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
unit Interfaces;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
{$IFDEF UNIX}{$IFNDEF DisableCWString}uses cwstring;{$ENDIF}{$ENDIF}
|
||||||
|
|
||||||
|
procedure CustomWidgetSetInitialization;
|
||||||
|
procedure CustomWidgetSetFinalization;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFNDEF EnableLibOverlay}
|
||||||
|
gtk2DisableLibOverlay,
|
||||||
|
{$ENDIF}
|
||||||
|
Gtk2Int, Forms, xlib;
|
||||||
|
|
||||||
|
function CustomX11ErrorHandler(Display:PDisplay; ErrorEv:PXErrorEvent):longint;cdecl;
|
||||||
|
begin
|
||||||
|
{$IFDEF DEBUG}
|
||||||
|
XError := ErrorEv^.error_code;
|
||||||
|
WriteLn('Error: ' + IntToStr(XError));
|
||||||
|
{$ENDIF}
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CustomXIOErrorHandler(Display:PDisplay):longint;cdecl;
|
||||||
|
begin
|
||||||
|
Result := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CustomWidgetSetInitialization;
|
||||||
|
begin
|
||||||
|
CreateWidgetset(TGtk2WidgetSet);
|
||||||
|
// Install xlib error handlers so that the application won't be terminated
|
||||||
|
// on non-fatal errors. Must be done after initializing GTK.
|
||||||
|
XSetErrorHandler(@CustomX11ErrorHandler);
|
||||||
|
XSetIOErrorHandler(@CustomXIOErrorHandler);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CustomWidgetSetFinalization;
|
||||||
|
begin
|
||||||
|
FreeWidgetSet;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
62
demos/Lazarus_Linux/SimpleBrowser/usimplebrowser.lfm
Normal file
62
demos/Lazarus_Linux/SimpleBrowser/usimplebrowser.lfm
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 335
|
||||||
|
Height = 705
|
||||||
|
Top = 119
|
||||||
|
Width = 1013
|
||||||
|
Caption = 'Initializing browser. Please wait...'
|
||||||
|
ClientHeight = 705
|
||||||
|
ClientWidth = 1013
|
||||||
|
OnActivate = FormActivate
|
||||||
|
OnCloseQuery = FormCloseQuery
|
||||||
|
OnCreate = FormCreate
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '2.0.10.0'
|
||||||
|
object AddressPnl: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 21
|
||||||
|
Top = 0
|
||||||
|
Width = 1013
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 21
|
||||||
|
ClientWidth = 1013
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 0
|
||||||
|
object AddressEdt: TEdit
|
||||||
|
Left = 0
|
||||||
|
Height = 21
|
||||||
|
Top = 0
|
||||||
|
Width = 982
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'http://www.google.com'
|
||||||
|
end
|
||||||
|
object GoBtn: TButton
|
||||||
|
Left = 982
|
||||||
|
Height = 21
|
||||||
|
Top = 0
|
||||||
|
Width = 31
|
||||||
|
Align = alRight
|
||||||
|
Caption = 'Go'
|
||||||
|
OnClick = GoBtnClick
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object ChromiumWindow1: TChromiumWindow
|
||||||
|
Left = 0
|
||||||
|
Height = 684
|
||||||
|
Top = 21
|
||||||
|
Width = 1013
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 1
|
||||||
|
OnBeforeClose = ChromiumWindow1BeforeClose
|
||||||
|
OnAfterCreated = ChromiumWindow1AfterCreated
|
||||||
|
end
|
||||||
|
object Timer1: TTimer
|
||||||
|
Enabled = False
|
||||||
|
Interval = 300
|
||||||
|
OnTimer = Timer1Timer
|
||||||
|
Left = 80
|
||||||
|
Top = 120
|
||||||
|
end
|
||||||
|
end
|
225
demos/Lazarus_Linux/SimpleBrowser/usimplebrowser.pas
Normal file
225
demos/Lazarus_Linux/SimpleBrowser/usimplebrowser.pas
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uSimpleBrowser;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls, LMessages,
|
||||||
|
uCEFConstants, uCEFTypes, uCEFInterfaces, uCEFChromiumEvents, uCEFChromiumWindow;
|
||||||
|
|
||||||
|
type
|
||||||
|
{ TForm1 }
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
AddressEdt: TEdit;
|
||||||
|
AddressPnl: TPanel;
|
||||||
|
ChromiumWindow1: TChromiumWindow;
|
||||||
|
GoBtn: TButton;
|
||||||
|
Timer1: TTimer;
|
||||||
|
|
||||||
|
procedure GoBtnClick(Sender: TObject);
|
||||||
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
|
||||||
|
procedure FormActivate(Sender: TObject);
|
||||||
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
|
||||||
|
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
||||||
|
procedure ChromiumWindow1BeforeClose(Sender: TObject);
|
||||||
|
private
|
||||||
|
|
||||||
|
protected
|
||||||
|
// Variables to control when can we destroy the form safely
|
||||||
|
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||||
|
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||||
|
|
||||||
|
// CEF needs to handle these messages to call TChromium.NotifyMoveOrResizeStarted
|
||||||
|
procedure WMMove(var Message: TLMMove); message LM_MOVE;
|
||||||
|
procedure WMSize(var Message: TLMSize); message LM_SIZE;
|
||||||
|
procedure WMWindowPosChanged(var Message: TLMWindowPosChanged); message LM_WINDOWPOSCHANGED;
|
||||||
|
|
||||||
|
procedure BrowserCloseMainForm(Data: PtrInt);
|
||||||
|
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||||
|
public
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFApplication;
|
||||||
|
|
||||||
|
// This is a demo with the simplest web browser you can build using CEF4Delphi and
|
||||||
|
// it doesn't show any sign of progress like other web browsers do.
|
||||||
|
|
||||||
|
// Remember that it may take a few seconds to load if Windows update, your antivirus or
|
||||||
|
// any other windows service is using your hard drive.
|
||||||
|
|
||||||
|
// Depending on your internet connection it may take longer than expected.
|
||||||
|
|
||||||
|
// This demo uses a TChromiumWindow component which should *ONLY* be used for extremely
|
||||||
|
// simple applications with a simple browser. For any other configuration it's
|
||||||
|
// recommended using a TChromium with a TCEFWindowParent as shown in the SimpleBrowser2 demo.
|
||||||
|
|
||||||
|
// Please check that your firewall or antivirus are not blocking this application
|
||||||
|
// or the domain "google.com". If you don't live in the US, you'll be redirected to
|
||||||
|
// another domain which will take a little time too.
|
||||||
|
|
||||||
|
// Destruction steps
|
||||||
|
// =================
|
||||||
|
// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser,
|
||||||
|
// which triggers the TChromiumWindow.OnBeforeClose event.
|
||||||
|
// 2. The TChromiumWindow.OnBeforeClose sets FCanClose to true and closes the
|
||||||
|
// the form in the main application thread.
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
|
begin
|
||||||
|
CanClose := FCanClose;
|
||||||
|
|
||||||
|
if not(FClosing) then
|
||||||
|
begin
|
||||||
|
FClosing := True;
|
||||||
|
Visible := False;
|
||||||
|
ChromiumWindow1.CloseBrowser(True);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FCanClose := False;
|
||||||
|
FClosing := False;
|
||||||
|
|
||||||
|
// The browser will load the URL in AddressEdt initially.
|
||||||
|
ChromiumWindow1.ChromiumBrowser.DefaultURL := AddressEdt.Text;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.Chromium_OnBeforePopup(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||||
|
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||||
|
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
||||||
|
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
||||||
|
var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue;
|
||||||
|
var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||||
|
begin
|
||||||
|
// For simplicity, this demo blocks all popup windows and new tabs
|
||||||
|
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Caption := 'Simple Browser';
|
||||||
|
AddressPnl.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// This will load the URL in the edit box
|
||||||
|
ChromiumWindow1.LoadURL(AddressEdt.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.FormActivate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if ChromiumWindow1.Initialized then exit;
|
||||||
|
|
||||||
|
// For simplicity, this demo blocks all popup windows and new tabs
|
||||||
|
ChromiumWindow1.ChromiumBrowser.OnBeforePopup := @Chromium_OnBeforePopup;
|
||||||
|
|
||||||
|
// You *MUST* call CreateBrowser to create and initialize the browser.
|
||||||
|
// This will trigger the AfterCreated event when the browser is fully
|
||||||
|
// initialized and ready to receive commands.
|
||||||
|
|
||||||
|
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
|
||||||
|
// If it's not initialized yet, we use a simple timer to create the browser later.
|
||||||
|
|
||||||
|
// Linux needs a visible form to create a browser so we need to use the
|
||||||
|
// TForm.OnActivate event instead of the TForm.OnShow event
|
||||||
|
|
||||||
|
if not(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.ChromiumWindow1BeforeClose(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// We must wait until all browsers trigger the TChromium.OnBeforeClose event
|
||||||
|
// in order to close the application safely or we will have shutdown issues.
|
||||||
|
FCanClose := True;
|
||||||
|
Application.QueueAsyncCall(@BrowserCloseMainForm, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Timer1.Enabled := False;
|
||||||
|
if not(ChromiumWindow1.CreateBrowser) and not(ChromiumWindow1.Initialized) then
|
||||||
|
Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.WMMove(var Message: TLMMove);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
ChromiumWindow1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.WMSize(var Message: TLMSize);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
ChromiumWindow1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.WMWindowPosChanged(var Message: TLMWindowPosChanged);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
ChromiumWindow1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.BrowserCloseMainForm(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
Close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -10,7 +10,7 @@
|
|||||||
// For more information about CEF4Delphi visit :
|
// For more information about CEF4Delphi visit :
|
||||||
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
//
|
//
|
||||||
// Copyright © 2018 Salvador Díaz Fau. All rights reserved.
|
// Copyright © 2021 Salvador Díaz Fau. All rights reserved.
|
||||||
//
|
//
|
||||||
// ************************************************************************
|
// ************************************************************************
|
||||||
// ************ vvvv Original license and comments below vvvv *************
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
@ -44,21 +44,36 @@ uses
|
|||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uSimpleBrowser in 'uSimpleBrowser.pas' {Form1};
|
uSimpleBrowser in 'uSimpleBrowser.pas' {Form1};
|
||||||
|
|
||||||
|
{$IFDEF WIN32}
|
||||||
//{$R *.res}
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
|
// If you don't add this flag the rederer process will crash when you try to load large images.
|
||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
{$SetPEFlags $20}
|
||||||
{$SetPEFlags $20}
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
CreateGlobalCEFApp;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
|
||||||
|
// In case you want to use custom directories for the CEF3 binaries, cache and user data.
|
||||||
|
// If you don't set a cache directory the browser will use in-memory cache.
|
||||||
|
{
|
||||||
|
GlobalCEFApp.FrameworkDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.ResourcesDirPath := 'c:\cef';
|
||||||
|
GlobalCEFApp.LocalesDirPath := 'c:\cef\locales';
|
||||||
|
GlobalCEFApp.EnableGPU := True; // Enable hardware acceleration
|
||||||
|
GlobalCEFApp.cache := 'c:\cef\cache';
|
||||||
|
GlobalCEFApp.UserDataPath := 'c:\cef\User Data';
|
||||||
|
}
|
||||||
|
|
||||||
|
// You *MUST* call GlobalCEFApp.StartMainProcess in a if..then clause
|
||||||
|
// with the Application initialization inside the begin..end.
|
||||||
|
// Read this https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
if GlobalCEFApp.StartMainProcess then
|
if GlobalCEFApp.StartMainProcess then
|
||||||
begin
|
begin
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
Application.CreateForm(TForm1, Form1);
|
Application.CreateForm(TForm1, Form1);
|
||||||
Application.Run;
|
Application.Run;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DestroyGlobalCEFApp;
|
GlobalCEFApp.Free;
|
||||||
|
GlobalCEFApp := nil;
|
||||||
end.
|
end.
|
||||||
|
@ -14,7 +14,7 @@ object Form1: TForm1
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '2.0.6.0'
|
LCLVersion = '2.0.10.0'
|
||||||
object ChromiumWindow1: TChromiumWindow
|
object ChromiumWindow1: TChromiumWindow
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 603
|
Height = 603
|
||||||
@ -24,7 +24,6 @@ object Form1: TForm1
|
|||||||
TabStop = True
|
TabStop = True
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnClose = ChromiumWindow1Close
|
OnClose = ChromiumWindow1Close
|
||||||
OnBeforeClose = ChromiumWindow1BeforeClose
|
|
||||||
OnAfterCreated = ChromiumWindow1AfterCreated
|
OnAfterCreated = ChromiumWindow1AfterCreated
|
||||||
end
|
end
|
||||||
object AddressPnl: TPanel
|
object AddressPnl: TPanel
|
||||||
@ -62,7 +61,7 @@ object Form1: TForm1
|
|||||||
Enabled = False
|
Enabled = False
|
||||||
Interval = 300
|
Interval = 300
|
||||||
OnTimer = Timer1Timer
|
OnTimer = Timer1Timer
|
||||||
left = 56
|
Left = 56
|
||||||
top = 88
|
Top = 88
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -50,7 +50,7 @@ uses
|
|||||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces,
|
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces,
|
||||||
uCEFWinControl, uCEFSentinel;
|
uCEFWinControl;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -62,15 +62,16 @@ type
|
|||||||
AddressEdt: TEdit;
|
AddressEdt: TEdit;
|
||||||
GoBtn: TButton;
|
GoBtn: TButton;
|
||||||
Timer1: TTimer;
|
Timer1: TTimer;
|
||||||
procedure CEFSentinel1Close(Sender: TObject);
|
|
||||||
procedure GoBtnClick(Sender: TObject);
|
procedure GoBtnClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
|
||||||
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
|
||||||
procedure Timer1Timer(Sender: TObject);
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
|
|
||||||
|
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
||||||
procedure ChromiumWindow1Close(Sender: TObject);
|
procedure ChromiumWindow1Close(Sender: TObject);
|
||||||
procedure ChromiumWindow1BeforeClose(Sender: TObject);
|
|
||||||
private
|
private
|
||||||
// You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned.
|
// You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned.
|
||||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||||
@ -81,7 +82,7 @@ type
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
// Variables to control when can we destroy the form safely
|
// Variables to control when can we destroy the form safely
|
||||||
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
FCanClose : boolean; // Set to True in TChromium.OnClose
|
||||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||||
|
|
||||||
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||||
@ -93,7 +94,6 @@ type
|
|||||||
var
|
var
|
||||||
Form1: TForm1;
|
Form1: TForm1;
|
||||||
|
|
||||||
procedure CreateGlobalCEFApp;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -110,32 +110,20 @@ uses
|
|||||||
|
|
||||||
// Depending on your internet connection it may take longer than expected.
|
// Depending on your internet connection it may take longer than expected.
|
||||||
|
|
||||||
|
// This demo uses a TChromiumWindow component which should *ONLY* be used for extremely
|
||||||
|
// simple applications with a simple browser. For any other configuration it's
|
||||||
|
// recommended using a TChromium with a TCEFWindowParent as shown in the SimpleBrowser2 demo.
|
||||||
|
|
||||||
// Please check that your firewall or antivirus are not blocking this application
|
// Please check that your firewall or antivirus are not blocking this application
|
||||||
// or the domain "google.com". If you don't live in the US, you'll be redirected to
|
// or the domain "google.com". If you don't live in the US, you'll be redirected to
|
||||||
// another domain which will take a little time too.
|
// another domain which will take a little time too.
|
||||||
|
|
||||||
// Destruction steps
|
// Destruction steps
|
||||||
// =================
|
// =================
|
||||||
// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event.
|
// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser,
|
||||||
// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event.
|
// which triggers the TChromiumWindow.OnClose event.
|
||||||
// 3. TChromiumWindow.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
// 2. The TChromiumWindow.OnClose sets FCanClose to true and sends WM_CLOSE to the form.
|
||||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
|
||||||
|
|
||||||
|
|
||||||
procedure CreateGlobalCEFApp;
|
|
||||||
begin
|
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
|
||||||
|
|
||||||
// In case you want to use custom directories for the CEF binaries, cache and user data.
|
|
||||||
{
|
|
||||||
GlobalCEFApp.FrameworkDirPath := 'cef';
|
|
||||||
GlobalCEFApp.ResourcesDirPath := 'cef';
|
|
||||||
GlobalCEFApp.LocalesDirPath := 'cef\locales';
|
|
||||||
GlobalCEFApp.cache := 'cef\cache';
|
|
||||||
GlobalCEFApp.UserDataPath := 'cef\User Data';
|
|
||||||
}
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
begin
|
begin
|
||||||
CanClose := FCanClose;
|
CanClose := FCanClose;
|
||||||
@ -151,7 +139,10 @@ end;
|
|||||||
procedure TForm1.FormCreate(Sender: TObject);
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FCanClose := False;
|
FCanClose := False;
|
||||||
FClosing := False;
|
FClosing := False;
|
||||||
|
|
||||||
|
// The browser will load the URL in AddressEdt initially.
|
||||||
|
ChromiumWindow1.ChromiumBrowser.DefaultURL := AddressEdt.Text;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.FormShow(Sender: TObject);
|
procedure TForm1.FormShow(Sender: TObject);
|
||||||
@ -168,31 +159,26 @@ begin
|
|||||||
if not(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True;
|
if not(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.ChromiumWindow1BeforeClose(Sender: TObject);
|
procedure TForm1.ChromiumWindow1Close(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FCanClose := True;
|
FCanClose := True;
|
||||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.ChromiumWindow1Close(Sender: TObject);
|
procedure TForm1.Chromium_OnBeforePopup( Sender : TObject;
|
||||||
begin
|
const browser : ICefBrowser;
|
||||||
// DestroyChildWindow will destroy the child window created by CEF at the top of the Z order.
|
const frame : ICefFrame;
|
||||||
if not(ChromiumWindow1.DestroyChildWindow) then
|
const targetUrl : ustring;
|
||||||
begin
|
const targetFrameName : ustring;
|
||||||
FCanClose := True;
|
targetDisposition : TCefWindowOpenDisposition;
|
||||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
userGesture : Boolean;
|
||||||
end;
|
const popupFeatures : TCefPopupFeatures;
|
||||||
end;
|
var windowInfo : TCefWindowInfo;
|
||||||
|
var client : ICefClient;
|
||||||
procedure TForm1.Chromium_OnBeforePopup(Sender: TObject;
|
var settings : TCefBrowserSettings;
|
||||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
var extra_info : ICefDictionaryValue;
|
||||||
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
var noJavascriptAccess : Boolean;
|
||||||
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
var Result : Boolean);
|
||||||
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
|
||||||
var settings: TCefBrowserSettings;
|
|
||||||
var extra_info: ICefDictionaryValue;
|
|
||||||
var noJavascriptAccess: Boolean;
|
|
||||||
var Result: Boolean);
|
|
||||||
begin
|
begin
|
||||||
// For simplicity, this demo blocks all popup windows and new tabs
|
// For simplicity, this demo blocks all popup windows and new tabs
|
||||||
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||||
@ -200,10 +186,8 @@ end;
|
|||||||
|
|
||||||
procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject);
|
procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
// Now the browser is fully initialized we can load the initial web page.
|
|
||||||
Caption := 'Simple Browser';
|
Caption := 'Simple Browser';
|
||||||
AddressPnl.Enabled := True;
|
AddressPnl.Enabled := True;
|
||||||
GoBtn.Click;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||||
@ -212,12 +196,6 @@ begin
|
|||||||
ChromiumWindow1.LoadURL(AddressEdt.Text);
|
ChromiumWindow1.LoadURL(AddressEdt.Text);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.CEFSentinel1Close(Sender: TObject);
|
|
||||||
begin
|
|
||||||
FCanClose := True;
|
|
||||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Timer1.Enabled := False;
|
Timer1.Enabled := False;
|
||||||
|
@ -66,7 +66,7 @@ uses
|
|||||||
const
|
const
|
||||||
CEF_SUPPORTED_VERSION_MAJOR = 88;
|
CEF_SUPPORTED_VERSION_MAJOR = 88;
|
||||||
CEF_SUPPORTED_VERSION_MINOR = 2;
|
CEF_SUPPORTED_VERSION_MINOR = 2;
|
||||||
CEF_SUPPORTED_VERSION_RELEASE = 8;
|
CEF_SUPPORTED_VERSION_RELEASE = 9;
|
||||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||||
|
|
||||||
CEF_CHROMEELF_VERSION_MAJOR = 88;
|
CEF_CHROMEELF_VERSION_MAJOR = 88;
|
||||||
@ -191,7 +191,7 @@ type
|
|||||||
FDeviceScaleFactor : single;
|
FDeviceScaleFactor : single;
|
||||||
FForcedDeviceScaleFactor : single;
|
FForcedDeviceScaleFactor : single;
|
||||||
FDisableZygote : boolean;
|
FDisableZygote : boolean;
|
||||||
FUseMockKeyChain: boolean;
|
FUseMockKeyChain : boolean;
|
||||||
|
|
||||||
FPluginPolicy : TCefPluginPolicySwitch;
|
FPluginPolicy : TCefPluginPolicySwitch;
|
||||||
FDefaultEncoding : ustring;
|
FDefaultEncoding : ustring;
|
||||||
|
@ -71,6 +71,9 @@ type
|
|||||||
FOnAfterCreated : TNotifyEvent;
|
FOnAfterCreated : TNotifyEvent;
|
||||||
FUseSetFocus : boolean;
|
FUseSetFocus : boolean;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
procedure SetVisible(Value: Boolean); override;
|
||||||
|
{$ENDIF}
|
||||||
function GetBrowserInitialized : boolean;
|
function GetBrowserInitialized : boolean;
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
function GetChildWindowHandle : THandle; override;
|
function GetChildWindowHandle : THandle; override;
|
||||||
@ -84,6 +87,11 @@ type
|
|||||||
procedure WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
procedure WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
procedure WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
procedure WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
procedure BrowserAfterCreated(Data: PtrInt);
|
||||||
|
procedure BrowserOnCLose(Data: PtrInt);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure AfterConstruction; override;
|
procedure AfterConstruction; override;
|
||||||
@ -91,9 +99,10 @@ type
|
|||||||
procedure CloseBrowser(aForceClose : boolean);
|
procedure CloseBrowser(aForceClose : boolean);
|
||||||
procedure LoadURL(const aURL : ustring);
|
procedure LoadURL(const aURL : ustring);
|
||||||
procedure NotifyMoveOrResizeStarted;
|
procedure NotifyMoveOrResizeStarted;
|
||||||
|
procedure UpdateSize; override;
|
||||||
|
|
||||||
property ChromiumBrowser : TChromium read FChromium;
|
property ChromiumBrowser : TChromium read FChromium;
|
||||||
property Initialized : boolean read GetBrowserInitialized;
|
property Initialized : boolean read GetBrowserInitialized;
|
||||||
|
|
||||||
published
|
published
|
||||||
property UseSetFocus : boolean read FUseSetFocus write FUseSetFocus default True;
|
property UseSetFocus : boolean read FUseSetFocus write FUseSetFocus default True;
|
||||||
@ -133,6 +142,10 @@ procedure Register;
|
|||||||
// *********************************************************
|
// *********************************************************
|
||||||
// *********************************************************
|
// *********************************************************
|
||||||
|
|
||||||
|
// This component should *ONLY* be used in emtremely simple applications with simple browsers.
|
||||||
|
// In other cases it's recomended using a TChromium with a TCEFWindowParent as shown in the
|
||||||
|
// SimpleBrowser2 demo.
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -218,13 +231,17 @@ end;
|
|||||||
procedure TChromiumWindow.WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
procedure TChromiumWindow.WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
begin
|
begin
|
||||||
aAction := cbaClose;
|
aAction := cbaClose;
|
||||||
{$IFDEF MSWINDOWS}
|
|
||||||
if assigned(FOnClose) then
|
if assigned(FOnClose) then
|
||||||
begin
|
begin
|
||||||
PostMessage(Handle, CEF_DOONCLOSE, 0, 0);
|
{$IFDEF MSWINDOWS}
|
||||||
aAction := cbaDelay;
|
PostMessage(Handle, CEF_DOONCLOSE, 0, 0);
|
||||||
|
aAction := cbaDelay;
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF FPC}
|
||||||
|
Application.QueueAsyncCall(@BrowserOnClose, 0);
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromiumWindow.WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
procedure TChromiumWindow.WebBrowser_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
@ -235,7 +252,11 @@ end;
|
|||||||
procedure TChromiumWindow.WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
procedure TChromiumWindow.WebBrowser_OnAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
begin
|
begin
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF FPC}
|
||||||
|
Application.QueueAsyncCall(@BrowserAfterCreated, 0);
|
||||||
|
{$ENDIF}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -252,6 +273,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
procedure TChromiumWindow.BrowserAfterCreated(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
UpdateSize;
|
||||||
|
if assigned(FOnAfterCreated) then FOnAfterCreated(self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumWindow.BrowserOnCLose(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
if assigned(FOnClose) then FOnClose(self);
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function TChromiumWindow.CreateBrowser : boolean;
|
function TChromiumWindow.CreateBrowser : boolean;
|
||||||
begin
|
begin
|
||||||
Result := not(csDesigning in ComponentState) and
|
Result := not(csDesigning in ComponentState) and
|
||||||
@ -275,6 +309,41 @@ begin
|
|||||||
if (FChromium <> nil) then FChromium.NotifyMoveOrResizeStarted;
|
if (FChromium <> nil) then FChromium.NotifyMoveOrResizeStarted;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
procedure TChromiumWindow.SetVisible(Value: Boolean);
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
var
|
||||||
|
TempChanged : boolean;
|
||||||
|
{$ENDIF}
|
||||||
|
begin
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
TempChanged := (Visible <> Value);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
inherited SetVisible(Value);
|
||||||
|
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
if not(csDesigning in ComponentState) and
|
||||||
|
TempChanged and
|
||||||
|
(FChromium <> nil) and
|
||||||
|
FChromium.Initialized then
|
||||||
|
FChromium.UpdateXWindowVisibility(Visible);
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
procedure TChromiumWindow.UpdateSize;
|
||||||
|
begin
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
if not(csDesigning in ComponentState) and
|
||||||
|
(FChromium <> nil) and
|
||||||
|
FChromium.Initialized then
|
||||||
|
FChromium.UpdateBrowserSize(Left, Top, Width, Height);
|
||||||
|
{$ELSE}
|
||||||
|
inherited UpdateSize;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
|
@ -50,7 +50,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages,{$ENDIF} System.Classes, Vcl.Controls, Vcl.Graphics,
|
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages,{$ENDIF} System.Classes, Vcl.Controls,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Forms, Controls, Graphics,
|
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Forms, Controls, Graphics,
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
@ -67,10 +67,10 @@ type
|
|||||||
TCEFLinkedWindowParent = class(TCEFWinControl)
|
TCEFLinkedWindowParent = class(TCEFWinControl)
|
||||||
protected
|
protected
|
||||||
FChromium : TChromium;
|
FChromium : TChromium;
|
||||||
|
|
||||||
{$IFDEF FPC}{$IFDEF LINUX}
|
{$IFDEF FPC}
|
||||||
procedure SetVisible(Value: Boolean); override;
|
procedure SetVisible(Value: Boolean); override;
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}
|
||||||
procedure SetChromium(aValue : TChromium);
|
procedure SetChromium(aValue : TChromium);
|
||||||
|
|
||||||
function GetChildWindowHandle : THandle; override;
|
function GetChildWindowHandle : THandle; override;
|
||||||
@ -81,9 +81,7 @@ type
|
|||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner : TComponent); override;
|
constructor Create(AOwner : TComponent); override;
|
||||||
{$IFDEF FPC}{$IFDEF LINUX}
|
procedure UpdateSize; override;
|
||||||
procedure UpdateSize; override;
|
|
||||||
{$ENDIF}{$ENDIF}
|
|
||||||
|
|
||||||
published
|
published
|
||||||
property Chromium : TChromium read FChromium write SetChromium;
|
property Chromium : TChromium read FChromium write SetChromium;
|
||||||
@ -158,30 +156,40 @@ begin
|
|||||||
if (Operation = opRemove) and (AComponent = FChromium) then FChromium := nil;
|
if (Operation = opRemove) and (AComponent = FChromium) then FChromium := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF FPC}{$IFDEF LINUX}
|
{$IFDEF FPC}
|
||||||
procedure TCEFLinkedWindowParent.SetVisible(Value: Boolean);
|
procedure TCEFLinkedWindowParent.SetVisible(Value: Boolean);
|
||||||
|
{$IFDEF LINUX}
|
||||||
var
|
var
|
||||||
TempChanged : boolean;
|
TempChanged : boolean;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF LINUX}
|
||||||
TempChanged := (Visible <> Value);
|
TempChanged := (Visible <> Value);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
inherited SetVisible(Value);
|
inherited SetVisible(Value);
|
||||||
|
|
||||||
|
{$IFDEF LINUX}
|
||||||
if not(csDesigning in ComponentState) and
|
if not(csDesigning in ComponentState) and
|
||||||
TempChanged and
|
TempChanged and
|
||||||
(FChromium <> nil) and
|
(FChromium <> nil) and
|
||||||
FChromium.Initialized then
|
FChromium.Initialized then
|
||||||
FChromium.UpdateXWindowVisibility(Visible);
|
FChromium.UpdateXWindowVisibility(Visible);
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
procedure TCEFLinkedWindowParent.UpdateSize;
|
procedure TCEFLinkedWindowParent.UpdateSize;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF LINUX}
|
||||||
if not(csDesigning in ComponentState) and
|
if not(csDesigning in ComponentState) and
|
||||||
(FChromium <> nil) and
|
(FChromium <> nil) and
|
||||||
FChromium.Initialized then
|
FChromium.Initialized then
|
||||||
FChromium.UpdateBrowserSize(Left, Top, Width, Height);
|
FChromium.UpdateBrowserSize(Left, Top, Width, Height);
|
||||||
|
{$ELSE}
|
||||||
|
inherited UpdateSize;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
{$ENDIF}{$ENDIF}
|
|
||||||
|
|
||||||
procedure TCEFLinkedWindowParent.SetChromium(aValue : TChromium);
|
procedure TCEFLinkedWindowParent.SetChromium(aValue : TChromium);
|
||||||
begin
|
begin
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 259,
|
"InternalVersion" : 260,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "88.2.8.0"
|
"Version" : "88.2.9.0"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpdatePackageData" : {
|
"UpdatePackageData" : {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user