mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-04-17 06:57:13 +02:00
Added the MiniBrowser demo for Linux
Fixed the Linux version of WindowInfoAsPopUp.
This commit is contained in:
parent
83cf65a8ec
commit
76d296871f
2
demos/Lazarus_Linux/MiniBrowser/00-Delete.bat
Normal file
2
demos/Lazarus_Linux/MiniBrowser/00-Delete.bat
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
rmdir /S /Q lib
|
||||||
|
rmdir /S /Q backup
|
BIN
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.ico
Normal file
BIN
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
91
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.lpi
Normal file
91
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.lpi
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<General>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<MainUnit Value="0"/>
|
||||||
|
<Title Value="MiniBrowser"/>
|
||||||
|
<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="MiniBrowser.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="uMiniBrowser.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="MiniBrowserFrm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
</Unit1>
|
||||||
|
<Unit2>
|
||||||
|
<Filename Value="interfaces.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="Interfaces"/>
|
||||||
|
</Unit2>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../../../bin/MiniBrowser"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CustomOptions Value="-dUseCThreads"/>
|
||||||
|
<OtherDefines Count="1">
|
||||||
|
<Define0 Value="UseCThreads"/>
|
||||||
|
</OtherDefines>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item3>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
71
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.lpr
Normal file
71
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.lpr
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 © 2018 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 MiniBrowser;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
Forms, uMiniBrowser
|
||||||
|
{ you can add units after this },
|
||||||
|
uCEFApplication;
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
begin
|
||||||
|
CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
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(TMiniBrowserFrm, MiniBrowserFrm);
|
||||||
|
Application.Run;
|
||||||
|
CustomWidgetSetFinalization;
|
||||||
|
end;
|
||||||
|
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
end.
|
||||||
|
|
254
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.lps
Normal file
254
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.lps
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectSession>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<BuildModes Active="Default"/>
|
||||||
|
<Units Count="13">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="MiniBrowser.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<EditorIndex Value="6"/>
|
||||||
|
<TopLine Value="26"/>
|
||||||
|
<CursorPos X="62" Y="52"/>
|
||||||
|
<UsageCount Value="22"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="uMiniBrowser.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="MiniBrowserFrm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<IsVisibleTab Value="True"/>
|
||||||
|
<TopLine Value="183"/>
|
||||||
|
<CursorPos Y="352"/>
|
||||||
|
<FoldState Value=" TJmA1{32 pjZlg1@4 pmOoL1{D1q"/>
|
||||||
|
<UsageCount Value="22"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
<LoadedDesigner Value="True"/>
|
||||||
|
</Unit1>
|
||||||
|
<Unit2>
|
||||||
|
<Filename Value="interfaces.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="Interfaces"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<CursorPos X="11" Y="9"/>
|
||||||
|
<UsageCount Value="22"/>
|
||||||
|
</Unit2>
|
||||||
|
<Unit3>
|
||||||
|
<Filename Value="uminibrowser.pas"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
<UnitName Value="uMiniBrowser"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<WindowIndex Value="-1"/>
|
||||||
|
<TopLine Value="29"/>
|
||||||
|
<CursorPos X="45" Y="36"/>
|
||||||
|
<UsageCount Value="20"/>
|
||||||
|
</Unit3>
|
||||||
|
<Unit4>
|
||||||
|
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/winapi.inc"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<TopLine Value="306"/>
|
||||||
|
<CursorPos Y="329"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit4>
|
||||||
|
<Unit5>
|
||||||
|
<Filename Value="/usr/share/lazarus/2.0.10/lcl/include/application.inc"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<TopLine Value="420"/>
|
||||||
|
<CursorPos Y="439"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit5>
|
||||||
|
<Unit6>
|
||||||
|
<Filename Value="/usr/share/lazarus/2.0.10/lcl/forms.pp"/>
|
||||||
|
<UnitName Value="Forms"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<TopLine Value="1462"/>
|
||||||
|
<CursorPos X="25" Y="1499"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit6>
|
||||||
|
<Unit7>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<EditorIndex Value="5"/>
|
||||||
|
<TopLine Value="130"/>
|
||||||
|
<CursorPos X="3" Y="146"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit7>
|
||||||
|
<Unit8>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<EditorIndex Value="1"/>
|
||||||
|
<TopLine Value="780"/>
|
||||||
|
<CursorPos X="70" Y="807"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Bookmarks Count="1">
|
||||||
|
<Item0 X="68" Y="793" ID="2"/>
|
||||||
|
</Bookmarks>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit8>
|
||||||
|
<Unit9>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<EditorIndex Value="3"/>
|
||||||
|
<TopLine Value="1950"/>
|
||||||
|
<CursorPos X="71" Y="1975"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Bookmarks Count="1">
|
||||||
|
<Item0 X="56" Y="1966" ID="1"/>
|
||||||
|
</Bookmarks>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit9>
|
||||||
|
<Unit10>
|
||||||
|
<Filename Value="/usr/share/fpcsrc/3.2.0/packages/gtk2/src/gtk+/gtk/gtkwidget.inc"/>
|
||||||
|
<EditorIndex Value="-1"/>
|
||||||
|
<TopLine Value="82"/>
|
||||||
|
<CursorPos X="9" Y="105"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
</Unit10>
|
||||||
|
<Unit11>
|
||||||
|
<Filename Value="../../../source/uCEFTypes.pas"/>
|
||||||
|
<EditorIndex Value="2"/>
|
||||||
|
<TopLine Value="1228"/>
|
||||||
|
<CursorPos X="53" Y="1251"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit11>
|
||||||
|
<Unit12>
|
||||||
|
<Filename Value="../../../source/uCEFApplicationCore.pas"/>
|
||||||
|
<EditorIndex Value="4"/>
|
||||||
|
<TopLine Value="220"/>
|
||||||
|
<UsageCount Value="10"/>
|
||||||
|
<Loaded Value="True"/>
|
||||||
|
</Unit12>
|
||||||
|
</Units>
|
||||||
|
<OtherDefines Count="1">
|
||||||
|
<Define0 Value="UseCThreads"/>
|
||||||
|
</OtherDefines>
|
||||||
|
<JumpHistory Count="30" HistoryIndex="29">
|
||||||
|
<Position1>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="173" Column="11" TopLine="150"/>
|
||||||
|
</Position1>
|
||||||
|
<Position2>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="786" TopLine="767"/>
|
||||||
|
</Position2>
|
||||||
|
<Position3>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="142" Column="49" TopLine="121"/>
|
||||||
|
</Position3>
|
||||||
|
<Position4>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="148" Column="45" TopLine="121"/>
|
||||||
|
</Position4>
|
||||||
|
<Position5>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<Caret Line="447" Column="17" TopLine="426"/>
|
||||||
|
</Position5>
|
||||||
|
<Position6>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<Caret Line="1956" Column="3" TopLine="1950"/>
|
||||||
|
</Position6>
|
||||||
|
<Position7>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="173" Column="11" TopLine="150"/>
|
||||||
|
</Position7>
|
||||||
|
<Position8>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="790" Column="3" TopLine="786"/>
|
||||||
|
</Position8>
|
||||||
|
<Position9>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="772" Column="17" TopLine="749"/>
|
||||||
|
</Position9>
|
||||||
|
<Position10>
|
||||||
|
<Filename Value="uMiniBrowser.pas"/>
|
||||||
|
<Caret Line="865" TopLine="829"/>
|
||||||
|
</Position10>
|
||||||
|
<Position11>
|
||||||
|
<Filename Value="uMiniBrowser.pas"/>
|
||||||
|
<Caret Line="158" Column="15" TopLine="137"/>
|
||||||
|
</Position11>
|
||||||
|
<Position12>
|
||||||
|
<Filename Value="uMiniBrowser.pas"/>
|
||||||
|
<Caret Line="863" Column="3" TopLine="829"/>
|
||||||
|
</Position12>
|
||||||
|
<Position13>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="76" Column="17" TopLine="53"/>
|
||||||
|
</Position13>
|
||||||
|
<Position14>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="157" Column="3" TopLine="146"/>
|
||||||
|
</Position14>
|
||||||
|
<Position15>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="70" Column="17" TopLine="47"/>
|
||||||
|
</Position15>
|
||||||
|
<Position16>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="146" Column="3" TopLine="133"/>
|
||||||
|
</Position16>
|
||||||
|
<Position17>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<Caret Line="447" Column="17" TopLine="426"/>
|
||||||
|
</Position17>
|
||||||
|
<Position18>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<Caret Line="1956" Column="3" TopLine="1950"/>
|
||||||
|
</Position18>
|
||||||
|
<Position19>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="173" Column="11" TopLine="150"/>
|
||||||
|
</Position19>
|
||||||
|
<Position20>
|
||||||
|
<Filename Value="uMiniBrowser.pas"/>
|
||||||
|
<Caret Line="849" Column="74" TopLine="829"/>
|
||||||
|
</Position20>
|
||||||
|
<Position21>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="76" Column="17" TopLine="53"/>
|
||||||
|
</Position21>
|
||||||
|
<Position22>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="157" Column="3" TopLine="140"/>
|
||||||
|
</Position22>
|
||||||
|
<Position23>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="70" Column="17" TopLine="48"/>
|
||||||
|
</Position23>
|
||||||
|
<Position24>
|
||||||
|
<Filename Value="../../../source/uCEFChromium.pas"/>
|
||||||
|
<Caret Line="146" Column="3" TopLine="130"/>
|
||||||
|
</Position24>
|
||||||
|
<Position25>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<Caret Line="447" Column="17" TopLine="426"/>
|
||||||
|
</Position25>
|
||||||
|
<Position26>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<Caret Line="1964" Column="66" TopLine="1950"/>
|
||||||
|
</Position26>
|
||||||
|
<Position27>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="173" Column="11" TopLine="150"/>
|
||||||
|
</Position27>
|
||||||
|
<Position28>
|
||||||
|
<Filename Value="../../../source/uCEFChromiumCore.pas"/>
|
||||||
|
<Caret Line="1964" Column="56" TopLine="1950"/>
|
||||||
|
</Position28>
|
||||||
|
<Position29>
|
||||||
|
<Filename Value="../../../source/uCEFMiscFunctions.pas"/>
|
||||||
|
<Caret Line="173" Column="11" TopLine="150"/>
|
||||||
|
</Position29>
|
||||||
|
<Position30>
|
||||||
|
<Filename Value="uMiniBrowser.pas"/>
|
||||||
|
<Caret Line="222" Column="47" TopLine="210"/>
|
||||||
|
</Position30>
|
||||||
|
</JumpHistory>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
<Modes Count="0" ActiveMode=""/>
|
||||||
|
</RunParams>
|
||||||
|
</ProjectSession>
|
||||||
|
</CONFIG>
|
BIN
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.res
Normal file
BIN
demos/Lazarus_Linux/MiniBrowser/MiniBrowser.res
Normal file
Binary file not shown.
456
demos/Lazarus_Linux/MiniBrowser/cef.inc
Normal file
456
demos/Lazarus_Linux/MiniBrowser/cef.inc
Normal file
@ -0,0 +1,456 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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}
|
||||||
|
|
30
demos/Lazarus_Linux/MiniBrowser/interfaces.pas
Normal file
30
demos/Lazarus_Linux/MiniBrowser/interfaces.pas
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
|
procedure CustomWidgetSetInitialization;
|
||||||
|
begin
|
||||||
|
CreateWidgetset(TGtk2WidgetSet);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CustomWidgetSetFinalization;
|
||||||
|
begin
|
||||||
|
FreeWidgetSet;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
316
demos/Lazarus_Linux/MiniBrowser/uMiniBrowser.lfm
Normal file
316
demos/Lazarus_Linux/MiniBrowser/uMiniBrowser.lfm
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
object MiniBrowserFrm: TMiniBrowserFrm
|
||||||
|
Left = 347
|
||||||
|
Height = 712
|
||||||
|
Top = 163
|
||||||
|
Width = 1184
|
||||||
|
Caption = 'Initializing browser. Please wait...'
|
||||||
|
ClientHeight = 712
|
||||||
|
ClientWidth = 1184
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
OnActivate = FormActivate
|
||||||
|
OnCloseQuery = FormCloseQuery
|
||||||
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '2.0.10.0'
|
||||||
|
object NavControlPnl: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 1184
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 25
|
||||||
|
ClientWidth = 1184
|
||||||
|
Enabled = False
|
||||||
|
TabOrder = 0
|
||||||
|
object NavButtonPnl: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 133
|
||||||
|
Align = alLeft
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 25
|
||||||
|
ClientWidth = 133
|
||||||
|
TabOrder = 0
|
||||||
|
object BackBtn: TButton
|
||||||
|
Left = 8
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 25
|
||||||
|
Caption = '3'
|
||||||
|
Font.CharSet = SYMBOL_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -19
|
||||||
|
Font.Name = 'Webdings'
|
||||||
|
OnClick = BackBtnClick
|
||||||
|
ParentFont = False
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object ForwardBtn: TButton
|
||||||
|
Left = 39
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 25
|
||||||
|
Caption = '4'
|
||||||
|
Font.CharSet = SYMBOL_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -19
|
||||||
|
Font.Name = 'Webdings'
|
||||||
|
OnClick = ForwardBtnClick
|
||||||
|
ParentFont = False
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object ReloadBtn: TButton
|
||||||
|
Left = 70
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 25
|
||||||
|
Caption = 'q'
|
||||||
|
Font.CharSet = SYMBOL_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -19
|
||||||
|
Font.Name = 'Webdings'
|
||||||
|
OnClick = ReloadBtnClick
|
||||||
|
ParentFont = False
|
||||||
|
TabOrder = 2
|
||||||
|
end
|
||||||
|
object StopBtn: TButton
|
||||||
|
Left = 101
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 25
|
||||||
|
Caption = '='
|
||||||
|
Font.CharSet = SYMBOL_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -19
|
||||||
|
Font.Name = 'Webdings'
|
||||||
|
OnClick = StopBtnClick
|
||||||
|
ParentFont = False
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object URLEditPnl: TPanel
|
||||||
|
Left = 133
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 978
|
||||||
|
Align = alClient
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 25
|
||||||
|
ClientWidth = 978
|
||||||
|
TabOrder = 1
|
||||||
|
object URLCbx: TComboBox
|
||||||
|
Left = 0
|
||||||
|
Height = 21
|
||||||
|
Top = 3
|
||||||
|
Width = 978
|
||||||
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
ItemHeight = 0
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'https://www.google.com'
|
||||||
|
'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending'
|
||||||
|
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close'
|
||||||
|
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_alert'
|
||||||
|
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_loc_assign'
|
||||||
|
'https://www.w3schools.com/html/html5_video.asp'
|
||||||
|
'http://www.adobe.com/software/flash/about/'
|
||||||
|
'http://isflashinstalled.com/'
|
||||||
|
'http://html5test.com/'
|
||||||
|
'https://webrtc.github.io/samples/src/content/devices/input-output/'
|
||||||
|
'https://test.webrtc.org/'
|
||||||
|
'https://www.w3schools.com/'
|
||||||
|
'http://webglsamples.org/'
|
||||||
|
'https://get.webgl.org/'
|
||||||
|
'https://www.briskbard.com'
|
||||||
|
'https://www.youtube.com'
|
||||||
|
'https://html5demos.com/drag/'
|
||||||
|
'https://developers.google.com/maps/documentation/javascript/examples/streetview-embed?hl=fr'
|
||||||
|
'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe_name'
|
||||||
|
'http://www-db.deis.unibo.it/courses/TW/DOCS/w3schools/html/tryit.asp-filename=tryhtml5_html_manifest.html'
|
||||||
|
'https://www.browserleaks.com/webrtc'
|
||||||
|
'https://frames-per-second.appspot.com/'
|
||||||
|
'chrome://version/'
|
||||||
|
'chrome://net-internals/'
|
||||||
|
'chrome://tracing/'
|
||||||
|
'chrome://appcache-internals/'
|
||||||
|
'chrome://blob-internals/'
|
||||||
|
'chrome://view-http-cache/'
|
||||||
|
'chrome://credits/'
|
||||||
|
'chrome://histograms/'
|
||||||
|
'chrome://media-internals/'
|
||||||
|
'chrome://kill'
|
||||||
|
'chrome://crash'
|
||||||
|
'chrome://hang'
|
||||||
|
'chrome://shorthang'
|
||||||
|
'chrome://gpuclean'
|
||||||
|
'chrome://gpucrash'
|
||||||
|
'chrome://gpuhang'
|
||||||
|
'chrome://extensions-support'
|
||||||
|
'chrome://process-internals'
|
||||||
|
)
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'https://www.google.com'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object ConfigPnl: TPanel
|
||||||
|
Left = 1111
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 73
|
||||||
|
Align = alRight
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 25
|
||||||
|
ClientWidth = 73
|
||||||
|
TabOrder = 2
|
||||||
|
object ConfigBtn: TButton
|
||||||
|
Left = 40
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 25
|
||||||
|
Caption = '≡'
|
||||||
|
Font.CharSet = ANSI_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -17
|
||||||
|
Font.Name = 'Arial'
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
OnClick = ConfigBtnClick
|
||||||
|
ParentFont = False
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object GoBtn: TButton
|
||||||
|
Left = 8
|
||||||
|
Height = 25
|
||||||
|
Top = 0
|
||||||
|
Width = 25
|
||||||
|
Caption = '►'
|
||||||
|
Default = True
|
||||||
|
Font.CharSet = ANSI_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -17
|
||||||
|
Font.Name = 'Arial'
|
||||||
|
Font.Style = [fsBold]
|
||||||
|
OnClick = GoBtnClick
|
||||||
|
ParentFont = False
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object StatusBar1: TStatusBar
|
||||||
|
Left = 0
|
||||||
|
Height = 17
|
||||||
|
Top = 695
|
||||||
|
Width = 1184
|
||||||
|
Panels = <
|
||||||
|
item
|
||||||
|
Width = 500
|
||||||
|
end>
|
||||||
|
SimplePanel = False
|
||||||
|
end
|
||||||
|
object CEFLinkedWindowParent1: TCEFLinkedWindowParent
|
||||||
|
Left = 0
|
||||||
|
Height = 670
|
||||||
|
Top = 25
|
||||||
|
Width = 1184
|
||||||
|
Align = alClient
|
||||||
|
TabStop = True
|
||||||
|
TabOrder = 2
|
||||||
|
OnEnter = CEFLinkedWindowParent1Enter
|
||||||
|
OnExit = CEFLinkedWindowParent1Exit
|
||||||
|
Chromium = Chromium1
|
||||||
|
end
|
||||||
|
object Chromium1: TChromium
|
||||||
|
OnPdfPrintFinished = Chromium1PdfPrintFinished
|
||||||
|
OnLoadError = Chromium1LoadError
|
||||||
|
OnLoadingStateChange = Chromium1LoadingStateChange
|
||||||
|
OnGotFocus = Chromium1GotFocus
|
||||||
|
OnBeforeContextMenu = Chromium1BeforeContextMenu
|
||||||
|
OnContextMenuCommand = Chromium1ContextMenuCommand
|
||||||
|
OnPreKeyEvent = Chromium1PreKeyEvent
|
||||||
|
OnKeyEvent = Chromium1KeyEvent
|
||||||
|
OnAddressChange = Chromium1AddressChange
|
||||||
|
OnTitleChange = Chromium1TitleChange
|
||||||
|
OnStatusMessage = Chromium1StatusMessage
|
||||||
|
OnAfterCreated = Chromium1AfterCreated
|
||||||
|
OnBeforeClose = Chromium1BeforeClose
|
||||||
|
OnClose = Chromium1Close
|
||||||
|
OnBeforePluginLoad = Chromium1BeforePluginLoad
|
||||||
|
Left = 32
|
||||||
|
Top = 224
|
||||||
|
end
|
||||||
|
object PopupMenu1: TPopupMenu
|
||||||
|
Left = 32
|
||||||
|
Top = 168
|
||||||
|
object ShowDevTools1: TMenuItem
|
||||||
|
Caption = 'Show DevTools'
|
||||||
|
OnClick = ShowDevTools1Click
|
||||||
|
end
|
||||||
|
object HideDevTools1: TMenuItem
|
||||||
|
Caption = 'Hide DevTools'
|
||||||
|
OnClick = HideDevTools1Click
|
||||||
|
end
|
||||||
|
object N4: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object Openfile1: TMenuItem
|
||||||
|
Caption = 'Open file with a FILE URL...'
|
||||||
|
OnClick = Openfile1Click
|
||||||
|
end
|
||||||
|
object OpenfilewithaDAT1: TMenuItem
|
||||||
|
Caption = 'Open file with a DATA URL...'
|
||||||
|
OnClick = OpenfilewithaDAT1Click
|
||||||
|
end
|
||||||
|
object N2: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object Print1: TMenuItem
|
||||||
|
Caption = 'Print'
|
||||||
|
Enabled = False
|
||||||
|
OnClick = Print1Click
|
||||||
|
end
|
||||||
|
object PrintinPDF1: TMenuItem
|
||||||
|
Caption = 'Print to PDF'
|
||||||
|
Enabled = False
|
||||||
|
OnClick = PrintinPDF1Click
|
||||||
|
end
|
||||||
|
object N3: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
|
object Zoom1: TMenuItem
|
||||||
|
Caption = 'Zoom'
|
||||||
|
object Inczoom1: TMenuItem
|
||||||
|
Caption = 'Inc zoom'
|
||||||
|
OnClick = Inczoom1Click
|
||||||
|
end
|
||||||
|
object Deczoom1: TMenuItem
|
||||||
|
Caption = 'Dec zoom'
|
||||||
|
OnClick = Deczoom1Click
|
||||||
|
end
|
||||||
|
object Resetzoom1: TMenuItem
|
||||||
|
Caption = 'Reset zoom'
|
||||||
|
OnClick = Resetzoom1Click
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object SaveDialog1: TSaveDialog
|
||||||
|
Left = 32
|
||||||
|
Top = 112
|
||||||
|
end
|
||||||
|
object OpenDialog1: TOpenDialog
|
||||||
|
Filter = 'HTML files|*.htm;*.html|Text files|*.txt|PDF files|*.pdf|Image files|*.jpg;*.jpeg;*.png;*.bmp;*.gif'
|
||||||
|
Left = 32
|
||||||
|
Top = 280
|
||||||
|
end
|
||||||
|
object Timer1: TTimer
|
||||||
|
Enabled = False
|
||||||
|
Interval = 300
|
||||||
|
OnTimer = Timer1Timer
|
||||||
|
Left = 32
|
||||||
|
Top = 344
|
||||||
|
end
|
||||||
|
end
|
880
demos/Lazarus_Linux/MiniBrowser/uMiniBrowser.pas
Normal file
880
demos/Lazarus_Linux/MiniBrowser/uMiniBrowser.pas
Normal file
@ -0,0 +1,880 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 uMiniBrowser;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||||
|
Menus, ComCtrls, SyncObjs, LMessages,
|
||||||
|
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||||
|
uCEFConstants, uCEFWinControl, uCEFChromiumEvents, uCEFLinkedWindowParent;
|
||||||
|
|
||||||
|
type
|
||||||
|
{ TMiniBrowserFrm }
|
||||||
|
TMiniBrowserFrm = class(TForm)
|
||||||
|
CEFLinkedWindowParent1: TCEFLinkedWindowParent;
|
||||||
|
HideDevTools1: TMenuItem;
|
||||||
|
NavControlPnl: TPanel;
|
||||||
|
NavButtonPnl: TPanel;
|
||||||
|
StatusBar1: TStatusBar;
|
||||||
|
URLEditPnl: TPanel;
|
||||||
|
BackBtn: TButton;
|
||||||
|
ForwardBtn: TButton;
|
||||||
|
ReloadBtn: TButton;
|
||||||
|
Chromium1: TChromium;
|
||||||
|
StopBtn: TButton;
|
||||||
|
URLCbx: TComboBox;
|
||||||
|
ConfigPnl: TPanel;
|
||||||
|
ConfigBtn: TButton;
|
||||||
|
PopupMenu1: TPopupMenu;
|
||||||
|
ShowDevTools1: TMenuItem;
|
||||||
|
GoBtn: TButton;
|
||||||
|
N2: TMenuItem;
|
||||||
|
PrintinPDF1: TMenuItem;
|
||||||
|
Print1: TMenuItem;
|
||||||
|
N3: TMenuItem;
|
||||||
|
Zoom1: TMenuItem;
|
||||||
|
Inczoom1: TMenuItem;
|
||||||
|
Deczoom1: TMenuItem;
|
||||||
|
Resetzoom1: TMenuItem;
|
||||||
|
SaveDialog1: TSaveDialog;
|
||||||
|
OpenDialog1: TOpenDialog;
|
||||||
|
N4: TMenuItem;
|
||||||
|
Openfile1: TMenuItem;
|
||||||
|
Timer1: TTimer;
|
||||||
|
OpenfilewithaDAT1: TMenuItem;
|
||||||
|
|
||||||
|
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
procedure Chromium1BeforePluginLoad(Sender: TObject; const mimeType, pluginUrl: ustring; isMainFrame: boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; var pluginPolicy: TCefPluginPolicy; var aResult: boolean);
|
||||||
|
procedure Chromium1GotFocus(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
procedure Chromium1LoadingStateChange(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
||||||
|
procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
|
||||||
|
procedure Chromium1AddressChange(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const url: ustring);
|
||||||
|
procedure Chromium1BeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel);
|
||||||
|
procedure Chromium1StatusMessage(Sender: TObject; const browser: ICefBrowser; const value: ustring);
|
||||||
|
procedure Chromium1PreKeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut, Result: Boolean);
|
||||||
|
procedure Chromium1KeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out Result: Boolean);
|
||||||
|
procedure Chromium1ContextMenuCommand(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: Cardinal; out Result: Boolean);
|
||||||
|
procedure Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean);
|
||||||
|
procedure Chromium1LoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring);
|
||||||
|
|
||||||
|
procedure FormActivate(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
|
||||||
|
procedure CEFLinkedWindowParent1Enter(Sender: TObject);
|
||||||
|
procedure CEFLinkedWindowParent1Exit(Sender: TObject);
|
||||||
|
procedure HideDevTools1Click(Sender: TObject);
|
||||||
|
|
||||||
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
|
||||||
|
procedure BackBtnClick(Sender: TObject);
|
||||||
|
procedure ForwardBtnClick(Sender: TObject);
|
||||||
|
procedure ReloadBtnClick(Sender: TObject);
|
||||||
|
procedure StopBtnClick(Sender: TObject);
|
||||||
|
procedure GoBtnClick(Sender: TObject);
|
||||||
|
procedure ConfigBtnClick(Sender: TObject);
|
||||||
|
|
||||||
|
procedure ShowDevTools1Click(Sender: TObject);
|
||||||
|
procedure PrintinPDF1Click(Sender: TObject);
|
||||||
|
procedure Print1Click(Sender: TObject);
|
||||||
|
procedure Inczoom1Click(Sender: TObject);
|
||||||
|
procedure Deczoom1Click(Sender: TObject);
|
||||||
|
procedure Resetzoom1Click(Sender: TObject);
|
||||||
|
procedure Openfile1Click(Sender: TObject);
|
||||||
|
procedure OpenfilewithaDAT1Click(Sender: TObject);
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
FBrowserCS : TCriticalSection;
|
||||||
|
FBrowserAddress : string;
|
||||||
|
FBrowserIsLoading : boolean;
|
||||||
|
FBrowserCanGoBack : boolean;
|
||||||
|
FBrowserCanGoForward : boolean;
|
||||||
|
FBrowserStatusText : string;
|
||||||
|
FBrowserTitle : string;
|
||||||
|
|
||||||
|
procedure SetBrowserAddress(const aValue : string);
|
||||||
|
procedure SetBrowserIsLoading(aValue : boolean);
|
||||||
|
procedure SetBrowserCanGoBack(aValue : boolean);
|
||||||
|
procedure SetBrowserCanGoForward(aValue : boolean);
|
||||||
|
procedure SetBrowserStatusText(const aValue : string);
|
||||||
|
procedure SetBrowserTitle(const aValue : string);
|
||||||
|
|
||||||
|
function GetBrowserAddress : string;
|
||||||
|
function GetBrowserIsLoading : boolean;
|
||||||
|
function GetBrowserCanGoBack : boolean;
|
||||||
|
function GetBrowserCanGoForward : boolean;
|
||||||
|
function GetBrowserStatusText : string;
|
||||||
|
function GetBrowserTitle : string;
|
||||||
|
|
||||||
|
procedure ShowDevTools(aPoint : TPoint); overload;
|
||||||
|
procedure ShowDevTools; overload;
|
||||||
|
procedure HideDevTools;
|
||||||
|
|
||||||
|
// 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 SendCompMessage(aMsg : cardinal; Data: PtrInt = 0);
|
||||||
|
|
||||||
|
procedure BrowserCreatedMsg(Data: PtrInt);
|
||||||
|
procedure BrowserCloseFormMsg(Data: PtrInt);
|
||||||
|
procedure BrowserUpdateAddressMsg(Data: PtrInt);
|
||||||
|
procedure BrowserUpdateLoadingStateMsg(Data: PtrInt);
|
||||||
|
procedure BrowserUpdateStatusTextMsg(Data: PtrInt);
|
||||||
|
procedure BrowserUpdateTitleMsg(Data: PtrInt);
|
||||||
|
procedure BrowserShowDevToolsMsg(Data: PtrInt);
|
||||||
|
procedure BrowserHideDevToolsMsg(Data: PtrInt);
|
||||||
|
procedure BrowserPrintPDFEndMsg(Data: PtrInt);
|
||||||
|
|
||||||
|
property BrowserAddress : string read GetBrowserAddress write SetBrowserAddress;
|
||||||
|
property BrowserIsLoading : boolean read GetBrowserIsLoading write SetBrowserIsLoading;
|
||||||
|
property BrowserCanGoBack : boolean read GetBrowserCanGoBack write SetBrowserCanGoBack;
|
||||||
|
property BrowserCanGoForward : boolean read GetBrowserCanGoForward write SetBrowserCanGoForward;
|
||||||
|
property BrowserStatusText : string read GetBrowserStatusText write SetBrowserStatusText;
|
||||||
|
property BrowserTitle : string read GetBrowserTitle write SetBrowserTitle;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
MiniBrowserFrm : TMiniBrowserFrm;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uCefClient;
|
||||||
|
|
||||||
|
const
|
||||||
|
CEF_UPDATEADDRESS = 1;
|
||||||
|
CEF_UPDATELOADINGSTATE = 2;
|
||||||
|
CEF_UPDATESTATUSTEXT = 3;
|
||||||
|
CEF_UPDATETITLE = 4;
|
||||||
|
CEF_SHOWDEVTOOLS = 5;
|
||||||
|
CEF_HIDEDEVTOOLS = 6;
|
||||||
|
CEF_PDFPRINTEND = 7;
|
||||||
|
|
||||||
|
MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS = MENU_ID_USER_FIRST + 1;
|
||||||
|
MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS = MENU_ID_USER_FIRST + 2;
|
||||||
|
|
||||||
|
// Destruction steps
|
||||||
|
// =================
|
||||||
|
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||||
|
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||||
|
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
begin
|
||||||
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
GlobalCEFApp.cache := 'cache';
|
||||||
|
//GlobalCEFApp.LogFile := 'debug.log';
|
||||||
|
//GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||||
|
//GlobalCEFApp.EnablePrintPreview := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{Property setters and getters}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.SetBrowserAddress(const aValue : string);
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
FBrowserAddress := aValue;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.SetBrowserIsLoading(aValue : boolean);
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
FBrowserIsLoading := aValue;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.SetBrowserCanGoBack(aValue : boolean);
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
FBrowserCanGoBack := aValue;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.SetBrowserCanGoForward(aValue : boolean);
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
FBrowserCanGoForward := aValue;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.SetBrowserStatusText(const aValue : string);
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
FBrowserStatusText := aValue;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.SetBrowserTitle(const aValue : string);
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
FBrowserTitle := aValue;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMiniBrowserFrm.GetBrowserAddress : string;
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
Result := FBrowserAddress;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMiniBrowserFrm.GetBrowserIsLoading : boolean;
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
Result := FBrowserIsLoading;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMiniBrowserFrm.GetBrowserCanGoBack : boolean;
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
Result := FBrowserCanGoBack;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMiniBrowserFrm.GetBrowserCanGoForward : boolean;
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
Result := FBrowserCanGoForward;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMiniBrowserFrm.GetBrowserStatusText : string;
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
Result := FBrowserStatusText;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMiniBrowserFrm.GetBrowserTitle : string;
|
||||||
|
begin
|
||||||
|
FBrowserCS.Acquire;
|
||||||
|
Result := FBrowserTitle;
|
||||||
|
FBrowserCS.Release;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{Button events}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.BackBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.GoBack;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.ForwardBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.GoForward;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.ReloadBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.Reload;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.StopBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.StopLoad;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.GoBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.LoadURL(UTF8Decode(URLCbx.Text));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.ConfigBtnClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
TempPoint : TPoint;
|
||||||
|
begin
|
||||||
|
TempPoint.x := ConfigBtn.left;
|
||||||
|
TempPoint.y := ConfigBtn.top + ConfigBtn.Height;
|
||||||
|
TempPoint := ConfigPnl.ClientToScreen(TempPoint);
|
||||||
|
|
||||||
|
PopupMenu1.Popup(TempPoint.x, TempPoint.y);
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{Config menu events}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.Inczoom1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.IncZoomStep;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Deczoom1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.DecZoomStep;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Resetzoom1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.ResetZoomLevel;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Print1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// TODO: Linux applications need to use the Printer Handler events in
|
||||||
|
// GlobalCEFApp before printing.
|
||||||
|
//Chromium1.Print;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.PrintinPDF1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// TODO: Linux applications need to use the Printer Handler events in
|
||||||
|
// GlobalCEFApp before printing.
|
||||||
|
{
|
||||||
|
SaveDialog1.DefaultExt := 'pdf';
|
||||||
|
SaveDialog1.Filter := 'PDF files (*.pdf)|*.PDF';
|
||||||
|
|
||||||
|
if SaveDialog1.Execute and (length(SaveDialog1.FileName) > 0) then
|
||||||
|
Chromium1.PrintToPDF(SaveDialog1.FileName, Chromium1.DocumentURL, Chromium1.DocumentURL);
|
||||||
|
}
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.ShowDevTools1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ShowDevTools;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Openfile1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
OpenDialog1.Filter := 'Any file (*.*)|*.*';
|
||||||
|
|
||||||
|
if OpenDialog1.Execute then
|
||||||
|
begin
|
||||||
|
// This is a quick solution to load files. The file URL should be properly encoded.
|
||||||
|
Chromium1.LoadURL('file:///' + OpenDialog1.FileName);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.OpenfilewithaDAT1Click(Sender: TObject);
|
||||||
|
var
|
||||||
|
TempFile : TMemoryStream;
|
||||||
|
begin
|
||||||
|
TempFile := nil;
|
||||||
|
|
||||||
|
try
|
||||||
|
try
|
||||||
|
OpenDialog1.Filter := 'HTML files (*.html)|*.HTML;*.HTM|PDF files (*.pdf)|*.PDF';
|
||||||
|
|
||||||
|
if OpenDialog1.Execute then
|
||||||
|
begin
|
||||||
|
TempFile := TMemoryStream.Create;
|
||||||
|
TempFile.LoadFromFile(OpenDialog1.FileName);
|
||||||
|
|
||||||
|
if (OpenDialog1.FilterIndex = 1) then
|
||||||
|
Chromium1.LoadResource(TempFile, 'text/html', 'utf-8')
|
||||||
|
else
|
||||||
|
Chromium1.LoadResource(TempFile, 'application/pdf', 'utf-8');
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TMiniBrowserFrm.OpenfilewithaDAT1Click', e) then raise;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
if (TempFile <> nil) then FreeAndNil(TempFile);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.HideDevTools1Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
HideDevTools;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{Form events}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.FormActivate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
// 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(Chromium1.Initialized) and
|
||||||
|
not(Chromium1.CreateBrowser(CEFLinkedWindowParent1.Handle, CEFLinkedWindowParent1.BoundsRect)) then
|
||||||
|
Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
begin
|
||||||
|
CanClose := FCanClose;
|
||||||
|
|
||||||
|
if not(FClosing) then
|
||||||
|
begin
|
||||||
|
FClosing := True;
|
||||||
|
Visible := False;
|
||||||
|
|
||||||
|
// if TChromium.MultiBrowserMode is enabled then we have to close all
|
||||||
|
// stored browsers and not only the main browser.
|
||||||
|
Chromium1.CloseAllBrowsers;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FCanClose := False;
|
||||||
|
FClosing := False;
|
||||||
|
|
||||||
|
FBrowserAddress := '';
|
||||||
|
FBrowserIsLoading := False;
|
||||||
|
FBrowserCanGoBack := False;
|
||||||
|
FBrowserCanGoForward := False;
|
||||||
|
FBrowserStatusText := '';
|
||||||
|
FBrowserTitle := '';
|
||||||
|
|
||||||
|
FBrowserCS := TCriticalSection.Create;
|
||||||
|
|
||||||
|
// The MultiBrowserMode store all the browser references in TChromium.
|
||||||
|
// The first browser reference is the browser in the main form.
|
||||||
|
// When MiniBrowser allows CEF to create child popup browsers it will also
|
||||||
|
// store their reference inside TChromium and you can use all the TChromium's
|
||||||
|
// methods and properties to manipulate those browsers.
|
||||||
|
// To do that call TChromium.SelectBrowser with the browser ID that will be
|
||||||
|
// used when you call any method or property in TChromium.
|
||||||
|
Chromium1.MultiBrowserMode := True;
|
||||||
|
Chromium1.DefaultURL := UTF8Decode(URLCbx.Text);
|
||||||
|
|
||||||
|
// WebRTC's IP leaking can lowered/avoided by setting these preferences
|
||||||
|
// To test this go to https://www.browserleaks.com/webrtc
|
||||||
|
Chromium1.WebRTCIPHandlingPolicy := hpDisableNonProxiedUDP;
|
||||||
|
Chromium1.WebRTCMultipleRoutes := STATE_DISABLED;
|
||||||
|
Chromium1.WebRTCNonproxiedUDP := STATE_DISABLED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FBrowserCS.Free;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{Lazarus form messages}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.WMMove(var Message: TLMMove);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.WMSize(var Message: TLMSize);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.WMWindowPosChanged(var Message: TLMWindowPosChanged);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{TCEFLinkedWindowParent events}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.CEFLinkedWindowParent1Exit(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if not(csDesigning in ComponentState) then
|
||||||
|
Chromium1.SendCaptureLostEvent;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.CEFLinkedWindowParent1Enter(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if not(csDesigning in ComponentState) and
|
||||||
|
Chromium1.Initialized and
|
||||||
|
not(Chromium1.FrameIsFocused) then
|
||||||
|
Chromium1.SendFocusEvent(True);
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{Timer events}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.Timer1Timer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Timer1.Enabled := False;
|
||||||
|
if not(Chromium1.CreateBrowser(CEFLinkedWindowParent1.Handle, CEFLinkedWindowParent1.BoundsRect)) and
|
||||||
|
not(Chromium1.Initialized) then
|
||||||
|
Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{Chromium events}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.Chromium1AddressChange(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; const url: ustring);
|
||||||
|
begin
|
||||||
|
if Chromium1.IsSameBrowser(browser) then
|
||||||
|
begin
|
||||||
|
BrowserAddress := url;
|
||||||
|
SendCompMessage(CEF_UPDATEADDRESS);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
if Chromium1.IsSameBrowser(browser) then
|
||||||
|
SendCompMessage(CEF_AFTERCREATED);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
// The main browser is being destroyed
|
||||||
|
if (Chromium1.BrowserId = 0) then
|
||||||
|
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;
|
||||||
|
SendCompMessage(CEF_BEFORECLOSE);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1BeforeContextMenu(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
const params: ICefContextMenuParams; const model: ICefMenuModel);
|
||||||
|
begin
|
||||||
|
if Chromium1.IsSameBrowser(browser) then
|
||||||
|
begin
|
||||||
|
model.AddSeparator;
|
||||||
|
model.AddItem(MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS, 'Hide DevTools');
|
||||||
|
model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools');
|
||||||
|
end
|
||||||
|
else
|
||||||
|
model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
begin
|
||||||
|
if (browser <> nil) and
|
||||||
|
(Chromium1.BrowserId = browser.Identifier) then
|
||||||
|
begin
|
||||||
|
// continue closing the browser
|
||||||
|
aAction := cbaClose;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1ContextMenuCommand(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
const params: ICefContextMenuParams; commandId: Integer;
|
||||||
|
eventFlags: Cardinal; out Result: Boolean);
|
||||||
|
var
|
||||||
|
TempParam : cardinal;
|
||||||
|
TempInfo : TCefWindowInfo;
|
||||||
|
TempClient : ICefClient;
|
||||||
|
TempSettings : TCefBrowserSettings;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if Chromium1.IsSameBrowser(browser) then
|
||||||
|
case commandId of
|
||||||
|
MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS :
|
||||||
|
SendCompMessage(CEF_HIDEDEVTOOLS);
|
||||||
|
|
||||||
|
MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS :
|
||||||
|
begin
|
||||||
|
TempParam := ((params.XCoord and $FFFF) shl 16) or (params.YCoord and $FFFF);
|
||||||
|
SendCompMessage(CEF_SHOWDEVTOOLS, PtrInt(TempParam));
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
case commandId of
|
||||||
|
MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS :
|
||||||
|
try
|
||||||
|
WindowInfoAsPopUp(TempInfo, browser.Host.WindowHandle, 'DevTools');
|
||||||
|
TempClient := TCustomClientHandler.Create(Chromium1, True);
|
||||||
|
FillChar(TempSettings, SizeOf(TCefBrowserSettings), 0);
|
||||||
|
browser.Host.ShowDevTools(@TempInfo, TempClient, @TempSettings, nil);
|
||||||
|
finally
|
||||||
|
TempClient := nil
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||||
|
out isKeyboardShortcut, Result: Boolean);
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if (event <> nil) and
|
||||||
|
(event^.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) and
|
||||||
|
(event^.windows_key_code = VKEY_F12) then
|
||||||
|
isKeyboardShortcut := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1KeyEvent(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||||
|
out Result: Boolean);
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if (event <> nil) and (event^.windows_key_code = VKEY_F12) then
|
||||||
|
case event^.kind of
|
||||||
|
KEYEVENT_KEYDOWN :
|
||||||
|
Result := True;
|
||||||
|
|
||||||
|
KEYEVENT_KEYUP :
|
||||||
|
begin
|
||||||
|
// SendCompMessage(CEF_HIDEDEVTOOLS)
|
||||||
|
SendCompMessage(CEF_SHOWDEVTOOLS);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1LoadError(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer;
|
||||||
|
const errorText, failedUrl: ustring);
|
||||||
|
var
|
||||||
|
TempString : ustring;
|
||||||
|
begin
|
||||||
|
if (errorCode = ERR_ABORTED) then exit;
|
||||||
|
|
||||||
|
TempString := '<html><body bgcolor="white">' +
|
||||||
|
'<h2>Failed to load URL ' + failedUrl +
|
||||||
|
' with error ' + errorText +
|
||||||
|
' (' + inttostr(errorCode) + ').</h2></body></html>';
|
||||||
|
|
||||||
|
Chromium1.LoadString(TempString, frame);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1LoadingStateChange(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
||||||
|
begin
|
||||||
|
if not(Chromium1.IsSameBrowser(browser)) or FClosing then exit;
|
||||||
|
|
||||||
|
BrowserIsLoading := isLoading;
|
||||||
|
BrowserCanGoBack := canGoBack;
|
||||||
|
BrowserCanGoForward := canGoForward;
|
||||||
|
|
||||||
|
SendCompMessage(CEF_UPDATELOADINGSTATE);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean);
|
||||||
|
begin
|
||||||
|
SendCompMessage(CEF_PDFPRINTEND, PtrInt(ord(aResultOK)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1StatusMessage(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const value: ustring);
|
||||||
|
begin
|
||||||
|
if Chromium1.IsSameBrowser(browser) then
|
||||||
|
begin
|
||||||
|
BrowserStatusText := value;
|
||||||
|
SendCompMessage(CEF_UPDATESTATUSTEXT);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1TitleChange(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const title: ustring);
|
||||||
|
begin
|
||||||
|
if not(Chromium1.IsSameBrowser(browser)) then exit;
|
||||||
|
|
||||||
|
if (length(title) > 0) then
|
||||||
|
BrowserTitle := 'MiniBrowser - ' + title
|
||||||
|
else
|
||||||
|
BrowserTitle := 'MiniBrowser - ' + Chromium1.DocumentURL;
|
||||||
|
|
||||||
|
SendCompMessage(CEF_UPDATETITLE);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1BeforePluginLoad(Sender: TObject;
|
||||||
|
const mimeType, pluginUrl: ustring; isMainFrame: boolean;
|
||||||
|
const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo;
|
||||||
|
var pluginPolicy: TCefPluginPolicy; var aResult: boolean);
|
||||||
|
begin
|
||||||
|
// Always allow the PDF plugin to load.
|
||||||
|
if (pluginPolicy <> PLUGIN_POLICY_ALLOW) and
|
||||||
|
(CompareText(mimeType, 'application/pdf') = 0) then
|
||||||
|
begin
|
||||||
|
pluginPolicy := PLUGIN_POLICY_ALLOW;
|
||||||
|
aResult := True;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
aResult := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1GotFocus(Sender: TObject;
|
||||||
|
const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
CEFLinkedWindowParent1.SetFocus;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{Custom form messages}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.BrowserCreatedMsg(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
Caption := 'MiniBrowser';
|
||||||
|
NavControlPnl.Enabled := True;
|
||||||
|
CEFLinkedWindowParent1.UpdateSize;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserCloseFormMsg(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
Close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserShowDevToolsMsg(Data: PtrInt);
|
||||||
|
var
|
||||||
|
TempPoint : TPoint;
|
||||||
|
begin
|
||||||
|
if (Data <> 0) then
|
||||||
|
begin
|
||||||
|
TempPoint.x := (Data shr 16) and $FFFF;
|
||||||
|
TempPoint.y := Data and $FFFF;
|
||||||
|
ShowDevTools(TempPoint);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
ShowDevTools;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserHideDevToolsMsg(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
HideDevTools;
|
||||||
|
Chromium1.SetFocus(True);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserPrintPDFEndMsg(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
if (Data <> 0) then
|
||||||
|
showmessage('The PDF file was generated successfully')
|
||||||
|
else
|
||||||
|
showmessage('There was a problem generating the PDF file.');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserUpdateAddressMsg(Data: PtrInt);
|
||||||
|
var
|
||||||
|
TempURL : string;
|
||||||
|
begin
|
||||||
|
TempURL := BrowserAddress;
|
||||||
|
|
||||||
|
if (URLCbx.Items.IndexOf(TempURL) < 0) then
|
||||||
|
URLCbx.Items.Add(TempURL);
|
||||||
|
|
||||||
|
URLCbx.Text := TempURL;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserUpdateLoadingStateMsg(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
BackBtn.Enabled := BrowserCanGoBack;
|
||||||
|
ForwardBtn.Enabled := BrowserCanGoForward;
|
||||||
|
|
||||||
|
if BrowserIsLoading then
|
||||||
|
begin
|
||||||
|
ReloadBtn.Enabled := False;
|
||||||
|
StopBtn.Enabled := True;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
ReloadBtn.Enabled := True;
|
||||||
|
StopBtn.Enabled := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserUpdateStatusTextMsg(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
StatusBar1.Panels[0].Text := BrowserStatusText;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.BrowserUpdateTitleMsg(Data: PtrInt);
|
||||||
|
begin
|
||||||
|
Caption := BrowserTitle;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.SendCompMessage(aMsg : cardinal; Data: PtrInt);
|
||||||
|
begin
|
||||||
|
case aMsg of
|
||||||
|
CEF_AFTERCREATED : Application.QueueAsyncCall(@BrowserCreatedMsg, Data);
|
||||||
|
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseFormMsg, Data);
|
||||||
|
CEF_UPDATEADDRESS : Application.QueueAsyncCall(@BrowserUpdateAddressMsg, Data);
|
||||||
|
CEF_UPDATELOADINGSTATE : Application.QueueAsyncCall(@BrowserUpdateLoadingStateMsg, Data);
|
||||||
|
CEF_UPDATESTATUSTEXT : Application.QueueAsyncCall(@BrowserUpdateStatusTextMsg, Data);
|
||||||
|
CEF_UPDATETITLE : Application.QueueAsyncCall(@BrowserUpdateTitleMsg, Data);
|
||||||
|
CEF_SHOWDEVTOOLS : Application.QueueAsyncCall(@BrowserShowDevToolsMsg, Data);
|
||||||
|
CEF_HIDEDEVTOOLS : Application.QueueAsyncCall(@BrowserHideDevToolsMsg, Data);
|
||||||
|
CEF_PDFPRINTEND : Application.QueueAsyncCall(@BrowserPrintPDFEndMsg, Data);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
{DevTools procedures}
|
||||||
|
{%Region}
|
||||||
|
procedure TMiniBrowserFrm.ShowDevTools(aPoint : TPoint);
|
||||||
|
begin
|
||||||
|
Chromium1.ShowDevTools(aPoint);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.ShowDevTools;
|
||||||
|
var
|
||||||
|
TempPoint : TPoint;
|
||||||
|
begin
|
||||||
|
TempPoint.x := low(integer);
|
||||||
|
TempPoint.y := low(integer);
|
||||||
|
ShowDevTools(TempPoint);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.HideDevTools;
|
||||||
|
begin
|
||||||
|
Chromium1.CloseDevTools;
|
||||||
|
end;
|
||||||
|
{%Endregion}
|
||||||
|
|
||||||
|
end.
|
@ -134,17 +134,22 @@ uses
|
|||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl: TWinControl);
|
procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl: TWinControl);
|
||||||
begin
|
begin
|
||||||
if aDropTargetCtrl <> nil then
|
if (aDropTargetCtrl <> nil) then
|
||||||
inherited InitializeDragAndDrop(aDropTargetCtrl.Handle);
|
inherited InitializeDragAndDrop(aDropTargetCtrl.Handle);
|
||||||
end;
|
end;
|
||||||
{$ENDIF MSWINDOWS}
|
{$ENDIF MSWINDOWS}
|
||||||
|
|
||||||
procedure TChromium.InitializeDevToolsWindowInfo(aDevTools: TWinControl);
|
procedure TChromium.InitializeDevToolsWindowInfo(aDevTools: TWinControl);
|
||||||
|
var
|
||||||
|
TempHandle : TCefWindowHandle;
|
||||||
begin
|
begin
|
||||||
if aDevTools <> nil then
|
if (aDevTools <> nil) then
|
||||||
DefaultInitializeDevToolsWindowInfo(aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name)
|
DefaultInitializeDevToolsWindowInfo(aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name)
|
||||||
else
|
else
|
||||||
DefaultInitializeDevToolsWindowInfo(0, Rect(0, 0, 0, 0), '');
|
begin
|
||||||
|
InitializeWindowHandle(TempHandle);
|
||||||
|
DefaultInitializeDevToolsWindowInfo(TempHandle, Rect(0, 0, 0, 0), '');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TChromium.ShowDevTools(inspectElementAt: TPoint; const aDevTools : TWinControl);
|
procedure TChromium.ShowDevTools(inspectElementAt: TPoint; const aDevTools : TWinControl);
|
||||||
|
@ -1961,7 +1961,9 @@ begin
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
WindowInfoAsChild(FDevWindowInfo, aDevToolsWnd, aClientRect)
|
WindowInfoAsChild(FDevWindowInfo, aDevToolsWnd, aClientRect)
|
||||||
else
|
else
|
||||||
WindowInfoAsPopUp(FDevWindowInfo, WindowHandle);
|
// WindowInfoAsPopUp only exists for Windows. The Linux version of cefclient
|
||||||
|
// calls WindowInfoAsChild with aParent set to NULL to create a popup window.
|
||||||
|
WindowInfoAsPopUp(FDevWindowInfo, aDevToolsWnd);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -763,19 +763,28 @@ end;
|
|||||||
|
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; aRect : TRect; const aWindowName : ustring = '');
|
procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; aRect : TRect; const aWindowName : ustring = '');
|
||||||
|
var
|
||||||
|
TempParent : TCefWindowHandle;
|
||||||
begin
|
begin
|
||||||
|
if ValidCefWindowHandle(aParent) and (PGtkWidget(aParent)^.window <> nil) then
|
||||||
|
TempParent := gdk_window_xwindow(PGtkWidget(aParent)^.window)
|
||||||
|
else
|
||||||
|
TempParent := aParent;
|
||||||
|
|
||||||
aWindowInfo.window_name := CefString(aWindowName);
|
aWindowInfo.window_name := CefString(aWindowName);
|
||||||
aWindowInfo.x := aRect.left;
|
aWindowInfo.x := aRect.left;
|
||||||
aWindowInfo.y := aRect.top;
|
aWindowInfo.y := aRect.top;
|
||||||
aWindowInfo.width := aRect.right - aRect.left;
|
aWindowInfo.width := aRect.right - aRect.left;
|
||||||
aWindowInfo.height := aRect.bottom - aRect.top;
|
aWindowInfo.height := aRect.bottom - aRect.top;
|
||||||
aWindowInfo.parent_window := gdk_window_xwindow(PGtkWidget(aParent)^.window);
|
aWindowInfo.parent_window := TempParent;
|
||||||
aWindowInfo.windowless_rendering_enabled := ord(False);
|
aWindowInfo.windowless_rendering_enabled := ord(False);
|
||||||
aWindowInfo.shared_texture_enabled := ord(False);
|
aWindowInfo.shared_texture_enabled := ord(False);
|
||||||
aWindowInfo.external_begin_frame_enabled := ord(False);
|
aWindowInfo.external_begin_frame_enabled := ord(False);
|
||||||
aWindowInfo.window := 0;
|
aWindowInfo.window := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// WindowInfoAsPopUp only exists for Windows. The Linux version of cefclient
|
||||||
|
// calls WindowInfoAsChild with aParent set to NULL to create a popup window.
|
||||||
procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; const aWindowName : ustring = '');
|
procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; const aWindowName : ustring = '');
|
||||||
begin
|
begin
|
||||||
aWindowInfo.window_name := CefString(aWindowName);
|
aWindowInfo.window_name := CefString(aWindowName);
|
||||||
@ -783,7 +792,7 @@ begin
|
|||||||
aWindowInfo.y := 0;
|
aWindowInfo.y := 0;
|
||||||
aWindowInfo.width := 0;
|
aWindowInfo.width := 0;
|
||||||
aWindowInfo.height := 0;
|
aWindowInfo.height := 0;
|
||||||
aWindowInfo.parent_window := gdk_window_xwindow(PGtkWidget(aParent)^.window);
|
aWindowInfo.parent_window := aParent;
|
||||||
aWindowInfo.windowless_rendering_enabled := ord(False);
|
aWindowInfo.windowless_rendering_enabled := ord(False);
|
||||||
aWindowInfo.shared_texture_enabled := ord(False);
|
aWindowInfo.shared_texture_enabled := ord(False);
|
||||||
aWindowInfo.external_begin_frame_enabled := ord(False);
|
aWindowInfo.external_begin_frame_enabled := ord(False);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 223,
|
"InternalVersion" : 224,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "87.1.12.0"
|
"Version" : "87.1.12.0"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user