You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-08-24 21:49:02 +02:00
Added ConsoleBrowser2 and WebpageSnapshot demos
- Split the Lazarus demos directory into "Lazarus_Windows" and "Lazarus_Linux". - Added OSRExternalPumpBrowser and TinyBrowser2 demos to "Lazarus_Linux". - Set TBufferPanel.GetScreenScale as virtual. - Added DevTools to the SchemeRegistrationBrowser demo. - Modified the SchemeRegistrationBrowser demo to receive XMLHttpRequest requests from JavaScript.
This commit is contained in:
2
demos/Lazarus_Linux/OSRExternalPumpBrowser/00-Delete.bat
Normal file
2
demos/Lazarus_Linux/OSRExternalPumpBrowser/00-Delete.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
rmdir /S /Q lib
|
||||
rmdir /S /Q backup
|
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="OSRExternalPumpBrowser"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</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="2">
|
||||
<Unit0>
|
||||
<Filename Value="OSRExternalPumpBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="OSRExternalPumpBrowserFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="..\..\..\bin\OSRExternalPumpBrowser"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL -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>
|
@@ -0,0 +1,78 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 OSRExternalPumpBrowser;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
cmem,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, Forms,
|
||||
uCEFApplication,
|
||||
uCEFWorkScheduler,
|
||||
uOSRExternalPumpBrowser in 'uOSRExternalPumpBrowser.pas' {OSRExternalPumpBrowserFrm};
|
||||
|
||||
{.$R *.res}
|
||||
|
||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||
{$SetPEFlags $20}
|
||||
|
||||
begin
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TOSRExternalPumpBrowserFrm, OSRExternalPumpBrowserFrm);
|
||||
Application.Run;
|
||||
|
||||
// The form needs to be destroyed *BEFORE* stopping the scheduler.
|
||||
OSRExternalPumpBrowserFrm.Free;
|
||||
|
||||
GlobalCEFWorkScheduler.StopScheduler;
|
||||
end;
|
||||
|
||||
DestroyGlobalCEFApp;
|
||||
DestroyGlobalCEFWorkScheduler;
|
||||
end.
|
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="12">
|
||||
<Unit0>
|
||||
<Filename Value="OSRExternalPumpBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="39"/>
|
||||
<CursorPos X="30" Y="66"/>
|
||||
<UsageCount Value="28"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="OSRExternalPumpBrowserFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="67"/>
|
||||
<CursorPos X="63" Y="108"/>
|
||||
<UsageCount Value="28"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="72" Y="518" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\..\source\uCEFApplication.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="412"/>
|
||||
<CursorPos X="39" Y="425"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\..\source\uCEFInterfaces.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="157"/>
|
||||
<CursorPos X="100" Y="168"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="C:\lazarus\lcl\lcltype.pp"/>
|
||||
<UnitName Value="LCLType"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="59"/>
|
||||
<CursorPos X="32" Y="68"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="C:\lazarus\lcl\include\wincontrol.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="5667"/>
|
||||
<CursorPos Y="5683"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\..\source\uCEFMediaObserver.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="266"/>
|
||||
<CursorPos X="13" Y="86"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="..\..\..\source\uCEFLinkedWindowParent.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="61"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="..\..\..\source\uCEFChromiumCore.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="904"/>
|
||||
<CursorPos Y="925"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="..\..\..\source\uCEFMediaObserverComponent.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="115"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="..\..\..\..\..\..\..\usr\share\fpcsrc\3.2.0\rtl\wince\windows.pp"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="25"/>
|
||||
<CursorPos X="5" Y="44"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="..\SimpleOSRBrowser\usimpleosrbrowser.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleOSRBrowser"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="150"/>
|
||||
<CursorPos X="80" Y="175"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit11>
|
||||
</Units>
|
||||
<JumpHistory Count="21" HistoryIndex="20">
|
||||
<Position1>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="762" Column="73" TopLine="739"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="123" Column="30" TopLine="104"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="203" Column="18" TopLine="171"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="209" Column="18" TopLine="177"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="415" Column="24" TopLine="383"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="420" Column="30" TopLine="388"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="468" Column="74" TopLine="447"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="50" Column="20" TopLine="27"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="162" Column="52" TopLine="125"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="170" Column="65" TopLine="133"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="162" Column="37" TopLine="130"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="616" Column="82" TopLine="596"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="77" TopLine="58"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="668" Column="56" TopLine="651"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="127" Column="34" TopLine="109"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="595" Column="42" TopLine="573"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="115" Column="41" TopLine="100"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="641" Column="54" TopLine="614"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="121" TopLine="102"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="537" TopLine="506"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="639" Column="84" TopLine="632"/>
|
||||
</Position21>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0" ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
456
demos/Lazarus_Linux/OSRExternalPumpBrowser/cef.inc
Normal file
456
demos/Lazarus_Linux/OSRExternalPumpBrowser/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}
|
||||
|
@@ -0,0 +1,143 @@
|
||||
object OSRExternalPumpBrowserFrm: TOSRExternalPumpBrowserFrm
|
||||
Left = 293
|
||||
Height = 584
|
||||
Top = 210
|
||||
Width = 913
|
||||
Caption = 'Initializing browser. Please wait...'
|
||||
ClientHeight = 584
|
||||
ClientWidth = 913
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnHide = FormHide
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.0.10.0'
|
||||
object NavControlPnl: TPanel
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 913
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 21
|
||||
ClientWidth = 913
|
||||
Enabled = False
|
||||
TabOrder = 0
|
||||
object ComboBox1: TComboBox
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 844
|
||||
Align = alClient
|
||||
ItemHeight = 0
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'https://www.google.com'
|
||||
'https://html5demos.com/drag'
|
||||
'https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_select_form'
|
||||
'https://www.briskbard.com'
|
||||
'https://frames-per-second.appspot.com/'
|
||||
'https://www.youtube.com'
|
||||
)
|
||||
OnEnter = ComboBox1Enter
|
||||
TabOrder = 0
|
||||
Text = 'https://www.google.com'
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 844
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 69
|
||||
Align = alRight
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 21
|
||||
ClientWidth = 69
|
||||
TabOrder = 1
|
||||
object GoBtn: TButton
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 31
|
||||
Align = alLeft
|
||||
Caption = 'Go'
|
||||
OnClick = GoBtnClick
|
||||
OnEnter = GoBtnEnter
|
||||
TabOrder = 0
|
||||
end
|
||||
object SnapshotBtn: TButton
|
||||
Left = 38
|
||||
Height = 21
|
||||
Hint = 'Take snapshot'
|
||||
Top = 0
|
||||
Width = 31
|
||||
Align = alRight
|
||||
Caption = 'µ'
|
||||
Font.CharSet = SYMBOL_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -24
|
||||
Font.Name = 'Webdings'
|
||||
OnClick = SnapshotBtnClick
|
||||
OnEnter = SnapshotBtnEnter
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
object Panel1: TBufferPanel
|
||||
Left = 0
|
||||
Height = 563
|
||||
Top = 21
|
||||
Width = 913
|
||||
Align = alClient
|
||||
OnUTF8KeyPress = Panel1UTF8KeyPress
|
||||
Caption = 'Panel1'
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
OnClick = Panel1Click
|
||||
OnEnter = Panel1Enter
|
||||
OnExit = Panel1Exit
|
||||
OnMouseDown = Panel1MouseDown
|
||||
OnMouseMove = Panel1MouseMove
|
||||
OnMouseUp = Panel1MouseUp
|
||||
OnMouseWheel = Panel1MouseWheel
|
||||
OnKeyDown = Panel1KeyDown
|
||||
OnKeyUp = Panel1KeyUp
|
||||
OnResize = Panel1Resize
|
||||
end
|
||||
object chrmosr: TChromium
|
||||
OnTooltip = chrmosrTooltip
|
||||
OnCursorChange = chrmosrCursorChange
|
||||
OnBeforePopup = chrmosrBeforePopup
|
||||
OnAfterCreated = chrmosrAfterCreated
|
||||
OnBeforeClose = chrmosrBeforeClose
|
||||
OnGetViewRect = chrmosrGetViewRect
|
||||
OnGetScreenPoint = chrmosrGetScreenPoint
|
||||
OnGetScreenInfo = chrmosrGetScreenInfo
|
||||
OnPopupShow = chrmosrPopupShow
|
||||
OnPopupSize = chrmosrPopupSize
|
||||
OnPaint = chrmosrPaint
|
||||
Left = 24
|
||||
Top = 56
|
||||
end
|
||||
object SaveDialog1: TSaveDialog
|
||||
Title = 'Save snapshot'
|
||||
DefaultExt = '.bmp'
|
||||
Filter = 'Bitmap files (*.bmp)|*.BMP'
|
||||
Left = 24
|
||||
Top = 278
|
||||
end
|
||||
object Timer1: TTimer
|
||||
Enabled = False
|
||||
Interval = 300
|
||||
OnTimer = Timer1Timer
|
||||
Left = 24
|
||||
Top = 206
|
||||
end
|
||||
end
|
@@ -0,0 +1,732 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 � 2020 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 uOSRExternalPumpBrowser;
|
||||
|
||||
{$MODE OBJFPC}{$H+}
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLType, Variants, SyncObjs, Graphics, Controls,
|
||||
Forms, Dialogs, StdCtrls, ExtCtrls, Types,
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||
uCEFWorkScheduler;
|
||||
|
||||
type
|
||||
|
||||
{ TOSRExternalPumpBrowserFrm }
|
||||
|
||||
TOSRExternalPumpBrowserFrm = class(TForm)
|
||||
NavControlPnl: TPanel;
|
||||
chrmosr: TChromium;
|
||||
ComboBox1: TComboBox;
|
||||
Panel2: TPanel;
|
||||
GoBtn: TButton;
|
||||
SnapshotBtn: TButton;
|
||||
SaveDialog1: TSaveDialog;
|
||||
Timer1: TTimer;
|
||||
Panel1: TBufferPanel;
|
||||
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure GoBtnEnter(Sender: TObject);
|
||||
|
||||
procedure Panel1Enter(Sender: TObject);
|
||||
procedure Panel1Exit(Sender: TObject);
|
||||
procedure Panel1Resize(Sender: TObject);
|
||||
procedure Panel1Click(Sender: TObject);
|
||||
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
procedure Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormHide(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure chrmosrPaint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer);
|
||||
procedure chrmosrCursorChange(Sender: TObject; const browser: ICefBrowser; aCursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean);
|
||||
procedure chrmosrGetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect);
|
||||
procedure chrmosrGetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
|
||||
procedure chrmosrGetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
|
||||
procedure chrmosrPopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean);
|
||||
procedure chrmosrPopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
|
||||
procedure chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
|
||||
procedure chrmosrBeforePopup(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 chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
procedure SnapshotBtnClick(Sender: TObject);
|
||||
procedure SnapshotBtnEnter(Sender: TObject);
|
||||
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure ComboBox1Enter(Sender: TObject);
|
||||
|
||||
protected
|
||||
FbFirst : boolean;
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
|
||||
function SendCompMessage(aMsg : cardinal) : boolean;
|
||||
function getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
function GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
procedure DoResize;
|
||||
|
||||
procedure BrowserCreated(Data: PtrInt);
|
||||
procedure BrowserCloseForm(Data: PtrInt);
|
||||
procedure PendingResize(Data: PtrInt);
|
||||
procedure PendingInvalidate(Data: PtrInt);
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
OSRExternalPumpBrowserFrm : TOSRExternalPumpBrowserFrm;
|
||||
|
||||
// This is a simple browser in OSR mode (off-screen rendering).
|
||||
// It was necessary to destroy the browser following the destruction sequence described in
|
||||
// the MDIBrowser demo but in OSR mode there are some modifications.
|
||||
|
||||
// This is the destruction sequence in OSR mode :
|
||||
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True).
|
||||
// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
|
||||
// set "Result" to false and CEF will destroy the internal browser immediately.
|
||||
// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed.
|
||||
// FCanClose is set to True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math,
|
||||
uCEFMiscFunctions, uCEFApplication;
|
||||
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
begin
|
||||
if (GlobalCEFWorkScheduler <> nil) then
|
||||
GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
var
|
||||
TempHome, TempBinDir : ustring;
|
||||
begin
|
||||
TempHome := IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME'));
|
||||
TempBinDir := TempHome + 'Lazarus/CEF4Delphi/bin';
|
||||
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := @GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
|
||||
if DirectoryExists(TempBinDir) then
|
||||
begin
|
||||
GlobalCEFApp.FrameworkDirPath := TempBinDir;
|
||||
GlobalCEFApp.ResourcesDirPath := TempBinDir;
|
||||
GlobalCEFApp.LocalesDirPath := TempBinDir + '/locales';
|
||||
end;
|
||||
|
||||
// Add a debug log in the BIN directory
|
||||
GlobalCEFApp.LogFile := 'cef.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
FResizeCS.Acquire;
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
FResizeCS.Release;
|
||||
|
||||
chrmosr.LoadURL(ComboBox1.Text);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.GoBtnEnter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
SendCompMessage(CEF_AFTERCREATED);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
SendCompMessage(CEF_BEFORECLOSE);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
TempString : UnicodeString;
|
||||
begin
|
||||
if Panel1.Focused then
|
||||
begin
|
||||
TempString := UTF8Decode(UTF8Key);
|
||||
|
||||
if (length(TempString) > 0) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_CHAR;
|
||||
TempKeyEvent.modifiers := EVENTFLAG_NONE;
|
||||
TempKeyEvent.windows_key_code := ord(TempString[1]);
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrBeforePopup(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 TOSRExternalPumpBrowserFrm.chrmosrCursorChange(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
aCursor : HICON;
|
||||
cursorType : TCefCursorType;
|
||||
const customCursorInfo : PCefCursorInfo;
|
||||
var aResult : boolean);
|
||||
begin
|
||||
Panel1.Cursor := CefCursorToWindowsCursor(cursorType);
|
||||
aResult := True;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrGetScreenInfo(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var screenInfo : TCefScreenInfo;
|
||||
out Result : Boolean);
|
||||
var
|
||||
TempRect : TCEFRect;
|
||||
TempScale : single;
|
||||
begin
|
||||
TempScale := Panel1.ScreenScale;
|
||||
TempRect.x := 0;
|
||||
TempRect.y := 0;
|
||||
TempRect.width := DeviceToLogical(Panel1.Width, TempScale);
|
||||
TempRect.height := DeviceToLogical(Panel1.Height, TempScale);
|
||||
|
||||
screenInfo.device_scale_factor := TempScale;
|
||||
screenInfo.depth := 0;
|
||||
screenInfo.depth_per_component := 0;
|
||||
screenInfo.is_monochrome := Ord(False);
|
||||
screenInfo.rect := TempRect;
|
||||
screenInfo.available_rect := TempRect;
|
||||
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrGetScreenPoint(Sender: TObject;
|
||||
const browser: ICefBrowser; viewX, viewY: Integer; var screenX,
|
||||
screenY: Integer; out Result: Boolean);
|
||||
var
|
||||
TempScreenPt, TempViewPt : TPoint;
|
||||
TempScale : single;
|
||||
begin
|
||||
TempScale := Panel1.ScreenScale;
|
||||
TempViewPt.x := LogicalToDevice(viewX, TempScale);
|
||||
TempViewPt.y := LogicalToDevice(viewY, TempScale);
|
||||
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
|
||||
screenX := TempScreenPt.x;
|
||||
screenY := TempScreenPt.y;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrGetViewRect(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var rect : TCefRect);
|
||||
var
|
||||
TempScale : single;
|
||||
begin
|
||||
TempScale := Panel1.ScreenScale;
|
||||
rect.x := 0;
|
||||
rect.y := 0;
|
||||
rect.width := DeviceToLogical(Panel1.Width, TempScale);
|
||||
rect.height := DeviceToLogical(Panel1.Height, TempScale);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrPaint(Sender: TObject; const browser: ICefBrowser;
|
||||
kind: TCefPaintElementType; dirtyRectsCount: NativeUInt;
|
||||
const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth,
|
||||
aHeight: Integer);
|
||||
var
|
||||
src, dst: PByte;
|
||||
i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride : Integer;
|
||||
n : NativeUInt;
|
||||
TempWidth, TempHeight : integer;
|
||||
TempBufferBits : Pointer;
|
||||
TempForcedResize : boolean;
|
||||
TempBitmap : TBitmap;
|
||||
TempSrcRect : TRect;
|
||||
begin
|
||||
try
|
||||
FResizeCS.Acquire;
|
||||
TempForcedResize := False;
|
||||
|
||||
if Panel1.BeginBufferDraw then
|
||||
begin
|
||||
if (kind = PET_POPUP) then
|
||||
begin
|
||||
if (FPopUpBitmap = nil) or
|
||||
(aWidth <> FPopUpBitmap.Width) or
|
||||
(aHeight <> FPopUpBitmap.Height) then
|
||||
begin
|
||||
if (FPopUpBitmap <> nil) then FPopUpBitmap.Free;
|
||||
|
||||
FPopUpBitmap := TBitmap.Create;
|
||||
FPopUpBitmap.PixelFormat := pf32bit;
|
||||
FPopUpBitmap.HandleType := bmDIB;
|
||||
FPopUpBitmap.Width := aWidth;
|
||||
FPopUpBitmap.Height := aHeight;
|
||||
end;
|
||||
|
||||
TempBitmap := FPopUpBitmap;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := FPopUpBitmap.Width;
|
||||
TempHeight := FPopUpBitmap.Height;
|
||||
end
|
||||
else
|
||||
begin
|
||||
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False));
|
||||
|
||||
TempBitmap := Panel1.Buffer;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := Panel1.BufferWidth;
|
||||
TempHeight := Panel1.BufferHeight;
|
||||
end;
|
||||
|
||||
SrcStride := aWidth * SizeOf(TRGBQuad);
|
||||
n := 0;
|
||||
|
||||
while (n < dirtyRectsCount) do
|
||||
begin
|
||||
if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then
|
||||
begin
|
||||
TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
|
||||
if (TempLineSize > 0) then
|
||||
begin
|
||||
TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad));
|
||||
|
||||
src := @PByte(buffer)[TempSrcOffset];
|
||||
|
||||
i := 0;
|
||||
j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y);
|
||||
|
||||
while (i < j) do
|
||||
begin
|
||||
TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i];
|
||||
dst := @PByte(TempBufferBits)[TempDstOffset];
|
||||
|
||||
Move(src^, dst^, TempLineSize);
|
||||
|
||||
Inc(src, SrcStride);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
inc(n);
|
||||
end;
|
||||
|
||||
TempBitmap.EndUpdate;
|
||||
|
||||
if FShowPopup and (FPopUpBitmap <> nil) then
|
||||
begin
|
||||
TempSrcRect := Rect(0, 0,
|
||||
min(FPopUpRect.Right - FPopUpRect.Left, FPopUpBitmap.Width),
|
||||
min(FPopUpRect.Bottom - FPopUpRect.Top, FPopUpBitmap.Height));
|
||||
|
||||
Panel1.BufferDraw(FPopUpBitmap, TempSrcRect, FPopUpRect);
|
||||
end;
|
||||
|
||||
Panel1.EndBufferDraw;
|
||||
|
||||
SendCompMessage(CEF_PENDINGINVALIDATE);
|
||||
|
||||
if (kind = PET_VIEW) then
|
||||
begin
|
||||
if TempForcedResize or FPendingResize then
|
||||
SendCompMessage(CEF_PENDINGRESIZE);
|
||||
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
FResizeCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrPopupShow(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
aShow : Boolean);
|
||||
begin
|
||||
if aShow then
|
||||
FShowPopUp := True
|
||||
else
|
||||
begin
|
||||
FShowPopUp := False;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
|
||||
if (chrmosr <> nil) then chrmosr.Invalidate(PET_VIEW);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrPopupSize(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const rect : PCefRect);
|
||||
begin
|
||||
LogicalToDevice(rect^, Panel1.ScreenScale);
|
||||
|
||||
FPopUpRect.Left := rect^.x;
|
||||
FPopUpRect.Top := rect^.y;
|
||||
FPopUpRect.Right := rect^.x + rect^.width - 1;
|
||||
FPopUpRect.Bottom := rect^.y + rect^.height - 1;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
|
||||
begin
|
||||
Panel1.hint := aText;
|
||||
Panel1.ShowHint := (length(aText) > 0);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.ComboBox1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
function TOSRExternalPumpBrowserFrm.SendCompMessage(aMsg : cardinal) : boolean;
|
||||
begin
|
||||
case aMsg of
|
||||
CEF_AFTERCREATED : Application.QueueAsyncCall(@BrowserCreated, 0);
|
||||
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseForm, 0);
|
||||
CEF_PENDINGRESIZE : Application.QueueAsyncCall(@PendingResize, 0);
|
||||
CEF_PENDINGINVALIDATE : Application.QueueAsyncCall(@PendingInvalidate, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TOSRExternalPumpBrowserFrm.getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
begin
|
||||
Result := EVENTFLAG_NONE;
|
||||
|
||||
if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN;
|
||||
if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN;
|
||||
if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN;
|
||||
if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
|
||||
if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
||||
if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
||||
end;
|
||||
|
||||
function TOSRExternalPumpBrowserFrm.GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
begin
|
||||
case Button of
|
||||
TMouseButton.mbRight : Result := MBT_RIGHT;
|
||||
TMouseButton.mbMiddle : Result := MBT_MIDDLE;
|
||||
else Result := MBT_LEFT;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.BrowserCreated(Data: PtrInt);
|
||||
begin
|
||||
Caption := 'Simple Lazarus OSR Browser';
|
||||
NavControlPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.BrowserCloseForm(Data: PtrInt);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.PendingResize(Data: PtrInt);
|
||||
begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.PendingInvalidate(Data: PtrInt);
|
||||
begin
|
||||
Panel1.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
CanClose := FCanClose;
|
||||
|
||||
if not(FClosing) then
|
||||
begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
chrmosr.CloseBrowser(True);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FbFirst := False;
|
||||
FPopUpBitmap := nil;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
FShowPopUp := False;
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FResizeCS := TCriticalSection.Create;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
||||
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.FormHide(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
chrmosr.WasHidden(True);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.FormShow(Sender: TObject);
|
||||
begin
|
||||
if chrmosr.Initialized then
|
||||
begin
|
||||
chrmosr.WasHidden(False);
|
||||
chrmosr.SendFocusEvent(True);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// opaque white background color
|
||||
chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||
chrmosr.DefaultURL := ComboBox1.Text;
|
||||
|
||||
if not(chrmosr.CreateBrowser(nil, '')) then
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1Click(Sender: TObject);
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, Panel1.ScreenScale);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
TempEvent.x := x;
|
||||
TempEvent.y := y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, Panel1.ScreenScale);
|
||||
chrmosr.SendMouseMoveEvent(@TempEvent, False);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, Panel1.ScreenScale);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1Resize(Sender: TObject);
|
||||
begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.DoResize;
|
||||
begin
|
||||
try
|
||||
FResizeCS.Acquire;
|
||||
|
||||
if FResizing then
|
||||
FPendingResize := True
|
||||
else
|
||||
if Panel1.BufferIsResized then
|
||||
chrmosr.Invalidate(PET_VIEW)
|
||||
else
|
||||
begin
|
||||
FResizing := True;
|
||||
chrmosr.WasResized;
|
||||
end;
|
||||
finally
|
||||
FResizeCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(True);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1Exit(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
|
||||
if (Key in [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_TAB]) then Key := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_KEYUP;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1MouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
TempEvent.x := MousePos.x;
|
||||
TempEvent.y := MousePos.y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, Panel1.ScreenScale);
|
||||
chrmosr.SendMouseWheelEvent(@TempEvent, 0, WheelDelta);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.SnapshotBtnClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog1.Execute then Panel1.SaveToFile(SaveDialog1.FileName);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.SnapshotBtnEnter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
||||
if not(chrmosr.CreateBrowser(nil, '')) and
|
||||
not(chrmosr.Initialized) then
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
end.
|
2
demos/Lazarus_Linux/SimpleBrowser2/00-Delete.bat
Normal file
2
demos/Lazarus_Linux/SimpleBrowser2/00-Delete.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
rmdir /S /Q lib
|
||||
rmdir /S /Q backup
|
BIN
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.ico
Normal file
BIN
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
84
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpi
Normal file
84
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpi
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="SimpleBrowser2"/>
|
||||
<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="2">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleBrowser2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleBrowser2"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="../../../bin/SimpleBrowser2"/>
|
||||
</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>
|
68
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpr
Normal file
68
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lpr
Normal file
@@ -0,0 +1,68 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 SimpleBrowser2;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
cmem,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, uSimpleBrowser2,
|
||||
{ you can add units after this }
|
||||
uCEFApplication;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
172
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lps
Normal file
172
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.lps
Normal file
@@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="11">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleBrowser2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="27"/>
|
||||
<CursorPos X="49" Y="58"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleBrowser2"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="122"/>
|
||||
<CursorPos X="66" Y="149"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="../../../../source/uCEFConstants.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="571"/>
|
||||
<CursorPos X="66" Y="597"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../../../../source/uCEFApplicationCore.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="891"/>
|
||||
<CursorPos X="63" Y="1021"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="/usr/share/lazarus/2.0.6/lcl/lclrescache.pas"/>
|
||||
<UnitName Value="LCLResCache"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="379"/>
|
||||
<CursorPos Y="398"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="../../../../source/uCEFMiscFunctions.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1025"/>
|
||||
<CursorPos X="80" Y="1040"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="/usr/share/lazarus/2.0.6/lcl/include/application.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1019"/>
|
||||
<CursorPos X="127" Y="1047"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="../../../../source/uCEFChromium.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="284"/>
|
||||
<CursorPos Y="312"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="../../../../source/uCEFChromiumCore.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="4369"/>
|
||||
<CursorPos X="40" Y="4378"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/classes/classesh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1556"/>
|
||||
<CursorPos X="3" Y="1573"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="/usr/share/fpcsrc/3.0.4/rtl/objpas/sysutils/osutilsh.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="10" Y="26"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit10>
|
||||
</Units>
|
||||
<JumpHistory Count="15" HistoryIndex="14">
|
||||
<Position1>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="211" Column="39" TopLine="201"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="211" Column="7" TopLine="194"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="216" Column="44" TopLine="194"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="91" Column="15" TopLine="67"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="212" Column="32" TopLine="195"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="212" Column="22" TopLine="195"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="88" Column="15" TopLine="72"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="137" Column="3" TopLine="132"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="136" TopLine="117"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="137" TopLine="117"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="138" TopLine="117"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="140" TopLine="117"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="142" TopLine="117"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="143" TopLine="117"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="usimplebrowser2.pas"/>
|
||||
<Caret Line="144" TopLine="117"/>
|
||||
</Position15>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0" ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
<Debugging>
|
||||
<BreakPoints Count="1">
|
||||
<Item1>
|
||||
<Kind Value="bpkSource"/>
|
||||
<WatchScope Value="wpsLocal"/>
|
||||
<WatchKind Value="wpkWrite"/>
|
||||
<Source Value="../../../../source/uCEFChromiumCore.pas"/>
|
||||
<Line Value="4373"/>
|
||||
</Item1>
|
||||
</BreakPoints>
|
||||
</Debugging>
|
||||
</CONFIG>
|
BIN
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.res
Normal file
BIN
demos/Lazarus_Linux/SimpleBrowser2/SimpleBrowser2.res
Normal file
Binary file not shown.
456
demos/Lazarus_Linux/SimpleBrowser2/cef.inc
Normal file
456
demos/Lazarus_Linux/SimpleBrowser2/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}
|
||||
|
66
demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.lfm
Normal file
66
demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.lfm
Normal file
@@ -0,0 +1,66 @@
|
||||
object Form1: TForm1
|
||||
Left = 450
|
||||
Height = 589
|
||||
Top = 267
|
||||
Width = 967
|
||||
Caption = 'Initializing browser. Please wait...'
|
||||
ClientHeight = 589
|
||||
ClientWidth = 967
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
LCLVersion = '2.0.6.0'
|
||||
object CEFWindowParent1: TCEFWindowParent
|
||||
Left = 0
|
||||
Height = 566
|
||||
Top = 23
|
||||
Width = 967
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
end
|
||||
object AddressPnl: TPanel
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 967
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 23
|
||||
ClientWidth = 967
|
||||
TabOrder = 1
|
||||
object GoBtn: TButton
|
||||
Left = 932
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 35
|
||||
Align = alRight
|
||||
Caption = 'Go'
|
||||
OnClick = GoBtnClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object AddressEdt: TEdit
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 932
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
Text = 'https://www.google.com'
|
||||
end
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
|
||||
left = 56
|
||||
top = 80
|
||||
end
|
||||
object Timer1: TTimer
|
||||
Enabled = False
|
||||
OnTimer = Timer1Timer
|
||||
left = 56
|
||||
top = 160
|
||||
end
|
||||
end
|
265
demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.pas
Normal file
265
demos/Lazarus_Linux/SimpleBrowser2/usimplebrowser2.pas
Normal file
@@ -0,0 +1,265 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 © 2020 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 uSimpleBrowser2;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||
uCEFChromium, uCEFWindowParent, uCEFConstants, uCEFTypes, uCEFInterfaces,
|
||||
uCEFChromiumEvents;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
AddressEdt: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
AddressPnl: TPanel;
|
||||
Timer1: TTimer;
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser
|
||||
);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser;
|
||||
var aAction: TCefCloseBrowserAction);
|
||||
procedure Chromium1OpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
userGesture: Boolean; out Result: Boolean);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Timer1Timer(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.
|
||||
|
||||
function SendCompMessage(aMsg : cardinal) : boolean;
|
||||
|
||||
procedure BrowserCreated;
|
||||
procedure BrowserDestroyMsg(Data: PtrInt);
|
||||
procedure BrowserCloseFormMsg(Data: PtrInt);
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
// 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.
|
||||
|
||||
// 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.
|
||||
|
||||
// This demo uses a TChromium and a TCEFWindowParent
|
||||
|
||||
// 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 CEF_BEFORECLOSE to close the form.
|
||||
|
||||
uses
|
||||
uCEFApplication;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
var
|
||||
TempHome, TempBinDir : ustring;
|
||||
begin
|
||||
TempHome := IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME'));
|
||||
TempBinDir := TempHome + 'Lazarus/CEF4Delphi/bin';
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
|
||||
if DirectoryExists(TempBinDir) then
|
||||
begin
|
||||
GlobalCEFApp.FrameworkDirPath := TempBinDir;
|
||||
GlobalCEFApp.ResourcesDirPath := TempBinDir;
|
||||
GlobalCEFApp.LocalesDirPath := TempBinDir + '/locales';
|
||||
end;
|
||||
|
||||
// Add a debug log in the BIN directory
|
||||
GlobalCEFApp.LogFile := 'cef.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormShow(Sender: TObject);
|
||||
begin
|
||||
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
|
||||
|
||||
// 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.
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1)) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
// This will load the URL in the edit box
|
||||
Chromium1.LoadURL(UTF8Decode(AddressEdt.Text));
|
||||
end;
|
||||
|
||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1)) and not(Chromium1.Initialized) then
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
begin
|
||||
CanClose := FCanClose;
|
||||
|
||||
if not(FClosing) then
|
||||
begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1BeforePopup(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.Chromium1Close(Sender: TObject; const browser: ICefBrowser;
|
||||
var aAction: TCefCloseBrowserAction);
|
||||
begin
|
||||
SendCompMessage(CEF_DESTROY);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1AfterCreated(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
// Now the browser is fully initialized we can initialize the UI.
|
||||
TThread.Queue(nil, @BrowserCreated);
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserCreated;
|
||||
begin
|
||||
Caption := 'Simple Browser 2';
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
SendCompMessage(CEF_BEFORECLOSE);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring;
|
||||
targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out
|
||||
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.BrowserDestroyMsg(Data: PtrInt);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserCloseFormMsg(Data: PtrInt);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
function TForm1.SendCompMessage(aMsg : cardinal) : boolean;
|
||||
begin
|
||||
case aMsg of
|
||||
CEF_DESTROY : Application.QueueAsyncCall(@BrowserDestroyMsg, 0);
|
||||
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseFormMsg, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
2
demos/Lazarus_Linux/SimpleOSRBrowser/00-Delete.bat
Normal file
2
demos/Lazarus_Linux/SimpleOSRBrowser/00-Delete.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
rmdir /S /Q lib
|
||||
rmdir /S /Q backup
|
BIN
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.ico
Normal file
BIN
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
84
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lpi
Normal file
84
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lpi
Normal file
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="SimpleOSRBrowser"/>
|
||||
<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="2">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleOSRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleOSRBrowser"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<Target>
|
||||
<Filename Value="../../../bin/SimpleOSRBrowser"/>
|
||||
</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>
|
68
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lpr
Normal file
68
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lpr
Normal file
@@ -0,0 +1,68 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 SimpleOSRBrowser;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
cmem,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, uSimpleOSRBrowser,
|
||||
{ you can add units after this }
|
||||
uCEFApplication;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
86
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lps
Normal file
86
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.lps
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="6">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleOSRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="13"/>
|
||||
<CursorPos X="8" Y="45"/>
|
||||
<UsageCount Value="23"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleOSRBrowser"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="165"/>
|
||||
<CursorPos X="32" Y="726"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="/usr/share/lazarus/2.0.6/lcl/lcltype.pp"/>
|
||||
<UnitName Value="LCLType"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="52"/>
|
||||
<CursorPos X="3" Y="68"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="../../../../source/uCEFMiscFunctions.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1889"/>
|
||||
<CursorPos X="27" Y="1907"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="../../../../source/uCEFApplicationCore.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="432"/>
|
||||
<CursorPos X="29" Y="445"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="/usr/share/fpcsrc/3.2.0/rtl/objpas/sysutils/finah.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="10" Y="33"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit5>
|
||||
</Units>
|
||||
<JumpHistory Count="5" HistoryIndex="4">
|
||||
<Position1>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="137" Column="44" TopLine="124"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="138" Column="30" TopLine="124"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="389" Column="18" TopLine="360"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="575" Column="48" TopLine="555"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="usimpleosrbrowser.pas"/>
|
||||
<Caret Line="581" Column="30" TopLine="555"/>
|
||||
</Position5>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0" ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.res
Normal file
BIN
demos/Lazarus_Linux/SimpleOSRBrowser/SimpleOSRBrowser.res
Normal file
Binary file not shown.
456
demos/Lazarus_Linux/SimpleOSRBrowser/cef.inc
Normal file
456
demos/Lazarus_Linux/SimpleOSRBrowser/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}
|
||||
|
88
demos/Lazarus_Linux/SimpleOSRBrowser/usimpleosrbrowser.lfm
Normal file
88
demos/Lazarus_Linux/SimpleOSRBrowser/usimpleosrbrowser.lfm
Normal file
@@ -0,0 +1,88 @@
|
||||
object Form1: TForm1
|
||||
Left = 393
|
||||
Height = 622
|
||||
Top = 250
|
||||
Width = 972
|
||||
Caption = ' Initializing browser. Please wait...'
|
||||
ClientHeight = 622
|
||||
ClientWidth = 972
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnHide = FormHide
|
||||
OnShow = FormShow
|
||||
LCLVersion = '2.0.6.0'
|
||||
object AddressPnl: TPanel
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 972
|
||||
Align = alTop
|
||||
ClientHeight = 21
|
||||
ClientWidth = 972
|
||||
TabOrder = 0
|
||||
object GoBtn: TButton
|
||||
Left = 940
|
||||
Height = 19
|
||||
Top = 1
|
||||
Width = 31
|
||||
Align = alRight
|
||||
Caption = 'Go'
|
||||
OnClick = GoBtnClick
|
||||
OnEnter = GoBtnEnter
|
||||
TabOrder = 0
|
||||
end
|
||||
object AddressEdt: TEdit
|
||||
Left = 1
|
||||
Height = 19
|
||||
Top = 1
|
||||
Width = 939
|
||||
Align = alClient
|
||||
OnEnter = AddressEdtEnter
|
||||
TabOrder = 1
|
||||
Text = 'AddressEdt'
|
||||
end
|
||||
end
|
||||
object Panel1: TBufferPanel
|
||||
Left = 0
|
||||
Height = 601
|
||||
Top = 21
|
||||
Width = 972
|
||||
Align = alClient
|
||||
OnUTF8KeyPress = Panel1UTF8KeyPress
|
||||
Caption = 'Panel1'
|
||||
TabOrder = 1
|
||||
OnClick = Panel1Click
|
||||
OnEnter = Panel1Enter
|
||||
OnExit = Panel1Exit
|
||||
OnMouseDown = Panel1MouseDown
|
||||
OnMouseMove = Panel1MouseMove
|
||||
OnMouseUp = Panel1MouseUp
|
||||
OnMouseWheel = Panel1MouseWheel
|
||||
OnKeyDown = Panel1KeyDown
|
||||
OnKeyUp = Panel1KeyUp
|
||||
OnResize = Panel1Resize
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnTooltip = Chromium1Tooltip
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
|
||||
OnGetViewRect = Chromium1GetViewRect
|
||||
OnGetScreenPoint = Chromium1GetScreenPoint
|
||||
OnGetScreenInfo = Chromium1GetScreenInfo
|
||||
OnPopupShow = Chromium1PopupShow
|
||||
OnPopupSize = Chromium1PopupSize
|
||||
OnPaint = Chromium1Paint
|
||||
OnCursorChange = Chromium1CursorChange
|
||||
left = 48
|
||||
top = 72
|
||||
end
|
||||
object Timer1: TTimer
|
||||
Enabled = False
|
||||
OnTimer = Timer1Timer
|
||||
left = 48
|
||||
top = 144
|
||||
end
|
||||
end
|
756
demos/Lazarus_Linux/SimpleOSRBrowser/usimpleosrbrowser.pas
Normal file
756
demos/Lazarus_Linux/SimpleOSRBrowser/usimpleosrbrowser.pas
Normal file
@@ -0,0 +1,756 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 © 2020 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 uSimpleOSRBrowser;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||
LCLType, Types, SyncObjs,
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||
uCEFChromiumEvents;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
AddressEdt: TEdit;
|
||||
Panel1: TBufferPanel;
|
||||
Chromium1: TChromium;
|
||||
GoBtn: TButton;
|
||||
AddressPnl: TPanel;
|
||||
Timer1: TTimer;
|
||||
procedure AddressEdtEnter(Sender: TObject);
|
||||
procedure Panel1Click(Sender: TObject);
|
||||
procedure Panel1Enter(Sender: TObject);
|
||||
procedure Panel1Exit(Sender: TObject);
|
||||
procedure Panel1KeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure Panel1KeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||
Y: Integer);
|
||||
procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
procedure Panel1Resize(Sender: TObject);
|
||||
procedure Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser
|
||||
);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1CursorChange(Sender: TObject;
|
||||
const browser: ICefBrowser; cursor_: TCefCursorHandle;
|
||||
cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo;
|
||||
var aResult : boolean);
|
||||
procedure Chromium1GetScreenInfo(Sender: TObject;
|
||||
const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out
|
||||
Result: Boolean);
|
||||
procedure Chromium1GetScreenPoint(Sender: TObject;
|
||||
const browser: ICefBrowser; viewX, viewY: Integer; var screenX,
|
||||
screenY: Integer; out Result: Boolean);
|
||||
procedure Chromium1GetViewRect(Sender: TObject; const browser: ICefBrowser;
|
||||
var rect: TCefRect);
|
||||
procedure Chromium1OpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
userGesture: Boolean; out Result: Boolean);
|
||||
procedure Chromium1Paint(Sender: TObject; const browser: ICefBrowser;
|
||||
type_: TCefPaintElementType; dirtyRectsCount: NativeUInt;
|
||||
const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth,
|
||||
aHeight: Integer);
|
||||
procedure Chromium1PopupShow(Sender: TObject; const browser: ICefBrowser;
|
||||
aShow: Boolean);
|
||||
procedure Chromium1PopupSize(Sender: TObject; const browser: ICefBrowser;
|
||||
const rect: PCefRect);
|
||||
procedure Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser;
|
||||
var aText: ustring; out Result: Boolean);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormHide(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure GoBtnEnter(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
private
|
||||
|
||||
protected
|
||||
FbFirst : boolean;
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
FDeviceBounds : TCefRectDynArray;
|
||||
FSelectedRange : TCefRange;
|
||||
|
||||
function SendCompMessage(aMsg : cardinal) : boolean;
|
||||
function getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
function GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
procedure DoResize;
|
||||
|
||||
procedure BrowserCreated;
|
||||
procedure BrowserCloseFormMsg(Data: PtrInt);
|
||||
procedure PendingResizeMsg(Data: PtrInt);
|
||||
procedure PendingInvalidateMsg(Data: PtrInt);
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math,
|
||||
uCEFMiscFunctions, uCEFApplication;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
var
|
||||
TempHome, TempBinDir : ustring;
|
||||
begin
|
||||
TempHome := IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME'));
|
||||
TempBinDir := TempHome + 'Lazarus/CEF4Delphi/bin';
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
|
||||
if DirectoryExists(TempBinDir) then
|
||||
begin
|
||||
GlobalCEFApp.FrameworkDirPath := TempBinDir;
|
||||
GlobalCEFApp.ResourcesDirPath := TempBinDir;
|
||||
GlobalCEFApp.LocalesDirPath := TempBinDir + '/locales';
|
||||
end;
|
||||
|
||||
// Add a debug log in the BIN directory
|
||||
GlobalCEFApp.LogFile := 'cef.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
end;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
FResizeCS.Acquire;
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
FResizeCS.Release;
|
||||
|
||||
Chromium1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1AfterCreated(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
// Now the browser is fully initialized we can initialize the UI.
|
||||
TThread.Queue(nil, @BrowserCreated);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1UTF8KeyPress(Sender: TObject;
|
||||
var UTF8Key: TUTF8Char);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
TempString : UnicodeString;
|
||||
begin
|
||||
if Panel1.Focused then
|
||||
begin
|
||||
TempString := UTF8Decode(UTF8Key);
|
||||
|
||||
if (length(TempString) > 0) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_CHAR;
|
||||
TempKeyEvent.modifiers := EVENTFLAG_NONE;
|
||||
TempKeyEvent.windows_key_code := ord(TempString[1]);
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
Chromium1.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.AddressEdtEnter(Sender: TObject);
|
||||
begin
|
||||
Chromium1.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Click(Sender: TObject);
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Enter(Sender: TObject);
|
||||
begin
|
||||
Chromium1.SendFocusEvent(True);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Exit(Sender: TObject);
|
||||
begin
|
||||
Chromium1.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1KeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
Chromium1.SendKeyEvent(@TempKeyEvent);
|
||||
|
||||
if (Key in [VK_LEFT, VK_RIGHT, VK_UP, VK_DOWN, VK_TAB]) then Key := 0;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1KeyUp(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_KEYUP;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
Chromium1.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseClickEvent(@TempEvent, GetButton(Button), False, 1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
|
||||
Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempEvent.x := x;
|
||||
TempEvent.y := y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseMoveEvent(@TempEvent, False);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseClickEvent(@TempEvent, GetButton(Button), True, 1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (Chromium1 <> nil) then
|
||||
begin
|
||||
TempEvent.x := MousePos.x;
|
||||
TempEvent.y := MousePos.y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
Chromium1.SendMouseWheelEvent(@TempEvent, 0, WheelDelta);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Resize(Sender: TObject);
|
||||
begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
function TForm1.getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
begin
|
||||
Result := EVENTFLAG_NONE;
|
||||
|
||||
if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN;
|
||||
if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN;
|
||||
if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN;
|
||||
if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
|
||||
if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
||||
if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
||||
end;
|
||||
|
||||
function TForm1.GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
begin
|
||||
case Button of
|
||||
TMouseButton.mbRight : Result := MBT_RIGHT;
|
||||
TMouseButton.mbMiddle : Result := MBT_MIDDLE;
|
||||
else Result := MBT_LEFT;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
SendCompMessage(CEF_BEFORECLOSE);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1BeforePopup(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.Chromium1CursorChange(Sender: TObject;
|
||||
const browser: ICefBrowser; cursor_: TCefCursorHandle;
|
||||
cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo;
|
||||
var aResult : boolean);
|
||||
begin
|
||||
Panel1.Cursor := CefCursorToWindowsCursor(cursorType);
|
||||
aResult := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1GetScreenInfo(Sender: TObject;
|
||||
const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out
|
||||
Result: Boolean);
|
||||
var
|
||||
TempRect : TCEFRect;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
TempRect.x := 0;
|
||||
TempRect.y := 0;
|
||||
TempRect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempRect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
|
||||
screenInfo.device_scale_factor := GlobalCEFApp.DeviceScaleFactor;
|
||||
screenInfo.depth := 0;
|
||||
screenInfo.depth_per_component := 0;
|
||||
screenInfo.is_monochrome := Ord(False);
|
||||
screenInfo.rect := TempRect;
|
||||
screenInfo.available_rect := TempRect;
|
||||
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1GetScreenPoint(Sender: TObject;
|
||||
const browser: ICefBrowser; viewX, viewY: Integer; var screenX,
|
||||
screenY: Integer; out Result: Boolean);
|
||||
var
|
||||
TempScreenPt, TempViewPt : TPoint;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
TempViewPt.x := LogicalToDevice(viewX, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempViewPt.y := LogicalToDevice(viewY, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
|
||||
screenX := TempScreenPt.x;
|
||||
screenY := TempScreenPt.y;
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1GetViewRect(Sender: TObject;
|
||||
const browser: ICefBrowser; var rect: TCefRect);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
rect.x := 0;
|
||||
rect.y := 0;
|
||||
rect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
rect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring;
|
||||
targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out
|
||||
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.Chromium1Paint(Sender: TObject; const browser: ICefBrowser;
|
||||
type_: TCefPaintElementType; dirtyRectsCount: NativeUInt;
|
||||
const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer
|
||||
);
|
||||
var
|
||||
src, dst: PByte;
|
||||
i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride : Integer;
|
||||
n : NativeUInt;
|
||||
TempWidth, TempHeight : integer;
|
||||
TempBufferBits : Pointer;
|
||||
TempForcedResize : boolean;
|
||||
TempBitmap : TBitmap;
|
||||
begin
|
||||
try
|
||||
FResizeCS.Acquire;
|
||||
TempForcedResize := False;
|
||||
|
||||
if Panel1.BeginBufferDraw then
|
||||
begin
|
||||
if (type_ = PET_POPUP) then
|
||||
begin
|
||||
if (FPopUpBitmap = nil) or
|
||||
(aWidth <> FPopUpBitmap.Width) or
|
||||
(aHeight <> FPopUpBitmap.Height) then
|
||||
begin
|
||||
if (FPopUpBitmap <> nil) then FPopUpBitmap.Free;
|
||||
|
||||
FPopUpBitmap := TBitmap.Create;
|
||||
FPopUpBitmap.PixelFormat := pf32bit;
|
||||
FPopUpBitmap.HandleType := bmDIB;
|
||||
FPopUpBitmap.Width := aWidth;
|
||||
FPopUpBitmap.Height := aHeight;
|
||||
end;
|
||||
|
||||
TempBitmap := FPopUpBitmap;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := FPopUpBitmap.Width;
|
||||
TempHeight := FPopUpBitmap.Height;
|
||||
end
|
||||
else
|
||||
begin
|
||||
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False));
|
||||
|
||||
TempBitmap := Panel1.Buffer;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := Panel1.BufferWidth;
|
||||
TempHeight := Panel1.BufferHeight;
|
||||
end;
|
||||
|
||||
if (TempBufferBits <> nil) then
|
||||
begin
|
||||
SrcStride := aWidth * SizeOf(TRGBQuad);
|
||||
n := 0;
|
||||
|
||||
while (n < dirtyRectsCount) do
|
||||
begin
|
||||
if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then
|
||||
begin
|
||||
TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
|
||||
if (TempLineSize > 0) then
|
||||
begin
|
||||
TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad));
|
||||
|
||||
src := @PByte(buffer)[TempSrcOffset];
|
||||
|
||||
i := 0;
|
||||
j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y);
|
||||
|
||||
while (i < j) do
|
||||
begin
|
||||
TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i];
|
||||
dst := @PByte(TempBufferBits)[TempDstOffset];
|
||||
|
||||
Move(src^, dst^, TempLineSize);
|
||||
|
||||
Inc(src, SrcStride);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
inc(n);
|
||||
end;
|
||||
|
||||
TempBitmap.EndUpdate;
|
||||
|
||||
if FShowPopup and (FPopUpBitmap <> nil) then
|
||||
Panel1.BufferDraw(FPopUpRect.Left, FPopUpRect.Top, FPopUpBitmap);
|
||||
end;
|
||||
|
||||
Panel1.EndBufferDraw;
|
||||
|
||||
if HandleAllocated then SendCompMessage(CEF_PENDINGINVALIDATE);
|
||||
|
||||
if (type_ = PET_VIEW) then
|
||||
begin
|
||||
if (TempForcedResize or FPendingResize) and
|
||||
HandleAllocated then
|
||||
SendCompMessage(CEF_PENDINGRESIZE);
|
||||
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
FResizeCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1PopupShow(Sender: TObject;
|
||||
const browser: ICefBrowser; aShow: Boolean);
|
||||
begin
|
||||
if aShow then
|
||||
FShowPopUp := True
|
||||
else
|
||||
begin
|
||||
FShowPopUp := False;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
|
||||
if (Chromium1 <> nil) then Chromium1.Invalidate(PET_VIEW);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1PopupSize(Sender: TObject;
|
||||
const browser: ICefBrowser; const rect: PCefRect);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
LogicalToDevice(rect^, GlobalCEFApp.DeviceScaleFactor);
|
||||
|
||||
FPopUpRect.Left := rect^.x;
|
||||
FPopUpRect.Top := rect^.y;
|
||||
FPopUpRect.Right := rect^.x + rect^.width - 1;
|
||||
FPopUpRect.Bottom := rect^.y + rect^.height - 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1Tooltip(Sender: TObject; const browser: ICefBrowser;
|
||||
var aText: ustring; out Result: Boolean);
|
||||
begin
|
||||
Panel1.hint := aText;
|
||||
Panel1.ShowHint := (length(aText) > 0);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
begin
|
||||
CanClose := FCanClose;
|
||||
|
||||
if not(FClosing) then
|
||||
begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FbFirst := False;
|
||||
FPopUpBitmap := nil;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
FShowPopUp := False;
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FDeviceBounds := nil;
|
||||
FResizeCS := TCriticalSection.Create;
|
||||
|
||||
FSelectedRange.from := 0;
|
||||
FSelectedRange.to_ := 0;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
||||
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
|
||||
|
||||
if (FDeviceBounds <> nil) then
|
||||
begin
|
||||
Finalize(FDeviceBounds);
|
||||
FDeviceBounds := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormHide(Sender: TObject);
|
||||
begin
|
||||
Chromium1.SendFocusEvent(False);
|
||||
Chromium1.WasHidden(True);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormShow(Sender: TObject);
|
||||
begin
|
||||
if Chromium1.Initialized then
|
||||
begin
|
||||
Chromium1.WasHidden(False);
|
||||
Chromium1.SendFocusEvent(True);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// opaque white background color
|
||||
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
|
||||
|
||||
if not(Chromium1.CreateBrowser(nil, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnEnter(Sender: TObject);
|
||||
begin
|
||||
Chromium1.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
||||
if not(Chromium1.CreateBrowser(nil, '')) and not(Chromium1.Initialized) then
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserCreated;
|
||||
begin
|
||||
Caption := 'Simple OSR Browser';
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserCloseFormMsg(Data: PtrInt);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TForm1.PendingResizeMsg(Data: PtrInt);
|
||||
begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
procedure TForm1.PendingInvalidateMsg(Data: PtrInt);
|
||||
begin
|
||||
Panel1.Invalidate;
|
||||
end;
|
||||
|
||||
function TForm1.SendCompMessage(aMsg : cardinal) : boolean;
|
||||
begin
|
||||
case aMsg of
|
||||
CEF_BEFORECLOSE : Application.QueueAsyncCall(@BrowserCloseFormMsg, 0);
|
||||
CEF_PENDINGRESIZE : Application.QueueAsyncCall(@PendingResizeMsg, 0);
|
||||
CEF_PENDINGINVALIDATE : Application.QueueAsyncCall(@PendingInvalidateMsg, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.DoResize;
|
||||
begin
|
||||
try
|
||||
FResizeCS.Acquire;
|
||||
|
||||
if FResizing then
|
||||
FPendingResize := True
|
||||
else
|
||||
if Panel1.BufferIsResized then
|
||||
Chromium1.Invalidate(PET_VIEW)
|
||||
else
|
||||
begin
|
||||
FResizing := True;
|
||||
Chromium1.WasResized;
|
||||
end;
|
||||
finally
|
||||
FResizeCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
2
demos/Lazarus_Linux/TinyBrowser2/00-Delete.bat
Normal file
2
demos/Lazarus_Linux/TinyBrowser2/00-Delete.bat
Normal file
@@ -0,0 +1,2 @@
|
||||
rmdir /S /Q lib
|
||||
rmdir /S /Q backup
|
88
demos/Lazarus_Linux/TinyBrowser2/TinyBrowser2.lpi
Normal file
88
demos/Lazarus_Linux/TinyBrowser2/TinyBrowser2.lpi
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="TinyBrowser2"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
</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="2">
|
||||
<Unit0>
|
||||
<Filename Value="TinyBrowser2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="uTinyBrowser2.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="..\..\..\bin\TinyBrowser2"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL -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>
|
68
demos/Lazarus_Linux/TinyBrowser2/TinyBrowser2.lpr
Normal file
68
demos/Lazarus_Linux/TinyBrowser2/TinyBrowser2.lpr
Normal file
@@ -0,0 +1,68 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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 TinyBrowser2;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
cmem,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces,
|
||||
uCEFApplication,
|
||||
uTinyBrowser2 in 'uTinyBrowser2.pas';
|
||||
|
||||
{.$R *.res}
|
||||
|
||||
{$IFDEF WIN32}
|
||||
// CEF needs to set the LARGEADDRESSAWARE ($20) flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||
{$SetPEFlags $20}
|
||||
{$ENDIF}
|
||||
|
||||
begin
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
GlobalCEFApp.RunMessageLoop;
|
||||
DestroyTinyBrowser;
|
||||
end;
|
||||
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
57
demos/Lazarus_Linux/TinyBrowser2/TinyBrowser2.lps
Normal file
57
demos/Lazarus_Linux/TinyBrowser2/TinyBrowser2.lps
Normal file
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="11"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="5">
|
||||
<Unit0>
|
||||
<Filename Value="TinyBrowser2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="28"/>
|
||||
<CursorPos X="36" Y="66"/>
|
||||
<UsageCount Value="21"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="uTinyBrowser2.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="83"/>
|
||||
<CursorPos X="86" Y="108"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\..\source\uCEFChromiumCore.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="46"/>
|
||||
<CursorPos X="95" Y="60"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\..\..\source\cef.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="22"/>
|
||||
<CursorPos Y="43"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\..\source\uCEFApplicationCore.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="2207"/>
|
||||
<CursorPos Y="2239"/>
|
||||
<UsageCount Value="10"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit4>
|
||||
</Units>
|
||||
<JumpHistory HistoryIndex="-1"/>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0" ActiveMode=""/>
|
||||
</RunParams>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
456
demos/Lazarus_Linux/TinyBrowser2/cef.inc
Normal file
456
demos/Lazarus_Linux/TinyBrowser2/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}
|
||||
|
193
demos/Lazarus_Linux/TinyBrowser2/uTinyBrowser2.pas
Normal file
193
demos/Lazarus_Linux/TinyBrowser2/uTinyBrowser2.pas
Normal file
@@ -0,0 +1,193 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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.
|
||||
*
|
||||
*)
|
||||
|
||||
unit uTinyBrowser2;
|
||||
|
||||
{$MODE Delphi}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils,
|
||||
uCEFInterfaces, uCEFTypes, uCEFChromiumCore;
|
||||
|
||||
type
|
||||
TTinyBrowser2 = class
|
||||
private
|
||||
FChromium : TChromiumCore;
|
||||
|
||||
procedure Chromium_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
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_OnOpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure AfterConstruction; override;
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
procedure DestroyTinyBrowser;
|
||||
|
||||
implementation
|
||||
|
||||
// This demo is similar to the cefsimple demo in the official CEF project.
|
||||
|
||||
// It doesn't use LCL to create forms from Lazarus code.
|
||||
// It just uses CEF to create a browser window as if it was a popup browser window.
|
||||
|
||||
// This browser doesn't use multiple threads to handle the browser and it doesn't use an external message pump.
|
||||
// For this reason we have to call GlobalCEFApp.RunMessageLoop to let CEF handle the message loop and
|
||||
// GlobalCEFApp.QuitMessageLoop when the browser has been destroyed.
|
||||
|
||||
// The destruction steps are much simpler for that reason.
|
||||
// In this demo it's only necessary to implement the TChromium.OnClose and TChromium.OnBeforeClose events.
|
||||
// The TChromium.OnClose event only sets aAction to cbaClose to continue closing the browser.
|
||||
// The TChromium.OnBeforeClose event calls GlobalCEFApp.QuitMessageLoop because the browser has been destroyed
|
||||
// and it's necessary to close the message loop.
|
||||
|
||||
uses
|
||||
uCEFApplication, uCEFConstants;
|
||||
|
||||
var
|
||||
TinyBrowser : TTinyBrowser2 = nil;
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
begin
|
||||
TinyBrowser := TTinyBrowser2.Create;
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
var
|
||||
TempHome, TempBinDir : ustring;
|
||||
begin
|
||||
TempHome := IncludeTrailingPathDelimiter(GetEnvironmentVariable('HOME'));
|
||||
TempBinDir := TempHome + 'Lazarus/CEF4Delphi/bin';
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.ExternalMessagePump := False;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
|
||||
// This is a workaround for the CEF4Delphi issue #324 :
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/324
|
||||
GlobalCEFApp.DisableFeatures := 'WinUseBrowserSpellChecker';
|
||||
|
||||
if DirectoryExists(TempBinDir) then
|
||||
begin
|
||||
GlobalCEFApp.FrameworkDirPath := TempBinDir;
|
||||
GlobalCEFApp.ResourcesDirPath := TempBinDir;
|
||||
GlobalCEFApp.LocalesDirPath := TempBinDir + '/locales';
|
||||
end;
|
||||
|
||||
// Add a debug log in the BIN directory
|
||||
GlobalCEFApp.LogFile := 'cef.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
end;
|
||||
|
||||
procedure DestroyTinyBrowser;
|
||||
begin
|
||||
if (TinyBrowser <> nil) then
|
||||
begin
|
||||
TinyBrowser.Free;
|
||||
TinyBrowser := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TTinyBrowser2.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
FChromium := nil;
|
||||
end;
|
||||
|
||||
destructor TTinyBrowser2.Destroy;
|
||||
begin
|
||||
if (FChromium <> nil) then
|
||||
begin
|
||||
FChromium.Free;
|
||||
FChromium := nil;
|
||||
end;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TTinyBrowser2.AfterConstruction;
|
||||
begin
|
||||
inherited AfterConstruction;
|
||||
|
||||
FChromium := TChromiumCore.Create(nil);
|
||||
FChromium.DefaultURL := 'https://www.google.com';
|
||||
FChromium.OnClose := Chromium_OnClose;
|
||||
FChromium.OnBeforeClose := Chromium_OnBeforeClose;
|
||||
FChromium.OnBeforePopup := Chromium_OnBeforePopup;
|
||||
FChromium.OnOpenUrlFromTab := Chromium_OnOpenUrlFromTab;
|
||||
FChromium.CreateBrowser('Tiny Browser 2');
|
||||
end;
|
||||
|
||||
procedure TTinyBrowser2.Chromium_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
aAction := cbaClose;
|
||||
end;
|
||||
|
||||
procedure TTinyBrowser2.Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
GlobalCEFApp.QuitMessageLoop;
|
||||
end;
|
||||
|
||||
procedure TTinyBrowser2.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 TTinyBrowser2.Chromium_OnOpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
userGesture: Boolean; out 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;
|
||||
|
||||
end.
|
Reference in New Issue
Block a user