You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-08-04 21:32:54 +02:00
Demo BrowserWindowDom (Lazarus_any_OS)
This commit is contained in:
@ -0,0 +1,2 @@
|
|||||||
|
rmdir /S /Q lib
|
||||||
|
rmdir /S /Q backup
|
BIN
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/AppHelper.ico
Normal file
BIN
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/AppHelper.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="12"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<MainUnitHasScaledStatement Value="False"/>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<Title Value="AppHelper"/>
|
||||||
|
<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"/>
|
||||||
|
<DestinationDirectory Value="B:\laz_other\CEF4Delphi\demos\Lazarus Mac\SubProcess"/>
|
||||||
|
<CompressFinally Value="False"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="2">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="CEF4Delphi_Lazarus"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item2>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="2">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="AppHelper.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="..\uHelperProcessDom.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit1>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="..\..\..\..\bin\AppHelper"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<OtherUnitFiles Value=".."/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<IncludeAssertionCode Value="True"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<CodeGeneration>
|
||||||
|
<Checks>
|
||||||
|
<IOChecks Value="True"/>
|
||||||
|
<RangeChecks Value="True"/>
|
||||||
|
<OverflowChecks Value="True"/>
|
||||||
|
<StackChecks Value="True"/>
|
||||||
|
</Checks>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
|
</Debugging>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
</CompilerOptions>
|
||||||
|
</CONFIG>
|
@ -0,0 +1,73 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
program AppHelper;
|
||||||
|
|
||||||
|
(*
|
||||||
|
* The compiled exe should be copied into
|
||||||
|
* SimpleBrowser.app/Content/Frameworks/SimpleBrowser2 Helper.app/Content/MacOS/SimpleBrowser2 Helper
|
||||||
|
* including app bundle in SimpleBrowser2.app/Content/Frameworks/SimpleBrowser2 Helper.app
|
||||||
|
*)
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}
|
||||||
|
Interfaces, // this includes the LCL widgetset
|
||||||
|
uHelperProcessDom,
|
||||||
|
uCEFApplication, uCEFTypes, uCEFConstants, LazFileUtils, sysutils;
|
||||||
|
|
||||||
|
begin
|
||||||
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
InitProcessMessagesHandler;
|
||||||
|
|
||||||
|
// The main process and the subprocess *MUST* have the same GlobalCEFApp
|
||||||
|
// properties and events, specially FrameworkDirPath, ResourcesDirPath,
|
||||||
|
// LocalesDirPath, cache and UserDataPath paths.
|
||||||
|
{$IFDEF MACOSX}
|
||||||
|
GlobalCEFApp.InitLibLocationFromArgs;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
GlobalCEFApp.StartSubProcess;
|
||||||
|
GlobalCEFApp.Free;
|
||||||
|
GlobalCEFApp := nil;
|
||||||
|
end.
|
||||||
|
|
BIN
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/AppHelper.res
Normal file
BIN
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/AppHelper.res
Normal file
Binary file not shown.
468
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/cef.inc
Normal file
468
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/cef.inc
Normal file
@ -0,0 +1,468 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright � 2017 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
// The complete list of compiler versions is here :
|
||||||
|
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
|
||||||
|
|
||||||
|
{$DEFINE DELPHI_VERSION_UNKNOW}
|
||||||
|
|
||||||
|
// Delphi 5
|
||||||
|
{$IFDEF VER130}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 6
|
||||||
|
{$IFDEF VER140}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 7
|
||||||
|
{$IFDEF VER150}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 8
|
||||||
|
{$IFDEF VER160}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2005
|
||||||
|
{$IFDEF VER170}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF VER180}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
// Delphi 2007
|
||||||
|
{$IFDEF VER185}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
// Delphi 2006
|
||||||
|
{$ELSE}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2009
|
||||||
|
{$IFDEF VER200}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
//Delphi 2010
|
||||||
|
{$IFDEF VER210}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE
|
||||||
|
{$IFDEF VER220}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE2 (First FireMonkey and 64bit compiler)
|
||||||
|
{$IFDEF VER230}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE3
|
||||||
|
{$IFDEF VER240}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE4
|
||||||
|
{$IFDEF VER250}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE5
|
||||||
|
{$IFDEF VER260}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE6
|
||||||
|
{$IFDEF VER270}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE7
|
||||||
|
{$IFDEF VER280}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE8
|
||||||
|
{$IFDEF VER290}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$ENDIF VER290}
|
||||||
|
|
||||||
|
// Rad Studio 10 - Delphi Seattle
|
||||||
|
{$IFDEF VER300}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.1 - Delphi Berlin
|
||||||
|
{$IFDEF VER310}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.2 - Delphi Tokyo
|
||||||
|
{$IFDEF VER320}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.3 - Delphi Rio
|
||||||
|
{$IFDEF VER330}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.4 - Delphi Sydney
|
||||||
|
{$IFDEF VER340}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$DEFINE DELPHI27_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)}
|
||||||
|
{$DEFINE FPC_VER_320}
|
||||||
|
{$IFEND}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$DEFINE DELPHI27_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF DELPHI9_UP}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IF DEFINED(CPUX32) OR
|
||||||
|
DEFINED(CPU386) OR
|
||||||
|
DEFINED(CPUi386) OR
|
||||||
|
DEFINED(CPUPOWERPC32) OR
|
||||||
|
DEFINED(CPUSPARC32) OR
|
||||||
|
DEFINED(CPU32BITS) OR
|
||||||
|
DEFINED(CPUARM32) OR
|
||||||
|
DEFINED(WIN32) OR
|
||||||
|
DEFINED(IOS32) OR
|
||||||
|
DEFINED(MACOS32) OR
|
||||||
|
DEFINED(LINUX32) OR
|
||||||
|
DEFINED(POSIX32) OR
|
||||||
|
DEFINED(ANDROID32)}
|
||||||
|
{$DEFINE TARGET_32BITS}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// Delphi uses MACOS for the new MacOSX and DARWIN is not defined
|
||||||
|
// FPC uses DARWIN for the new MacOSX and MACOS is defined for the classic Macintosh OS (System 7)
|
||||||
|
// We define MACOSX to avoid conflicts in both situations
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF MACOS}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
57
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/create_mac_helper_apps.sh
Executable file
57
demos/Lazarus_any_OS/BrowserWindowDom/AppHelper/create_mac_helper_apps.sh
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
DEST=$1
|
||||||
|
SRC=$2
|
||||||
|
|
||||||
|
if [ "$SRC" = "" ];
|
||||||
|
then
|
||||||
|
SRC=$BASEDIR/../../../../bin/AppHelper.app
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "" ] || [ ! -e "$DEST" ] || [ ! -e "$SRC" ];
|
||||||
|
then
|
||||||
|
echo "Usage"
|
||||||
|
echo " $0 destpath/project.app"
|
||||||
|
echo " $0 destpath/project.app sourcedir/AppHelper.app"
|
||||||
|
echo
|
||||||
|
if [ ! -e "$DEST" ];
|
||||||
|
then
|
||||||
|
echo "Error: Target app bundle not found. (Did you compile AND create the bundle?)"
|
||||||
|
fi
|
||||||
|
if [ ! -e "$SRC" ];
|
||||||
|
then
|
||||||
|
echo "Error: Source (AppHelper) app bundle not found. (Did you compile AND create the bundle?)"
|
||||||
|
fi
|
||||||
|
exit;
|
||||||
|
fi
|
||||||
|
|
||||||
|
SRCAPP=$(basename "$SRC")
|
||||||
|
SRCAPP="${SRCAPP%\.app}"
|
||||||
|
DESTAPP=$(basename "$DEST")
|
||||||
|
DESTAPP="${DESTAPP%\.app}"
|
||||||
|
|
||||||
|
SUB=""
|
||||||
|
rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB"
|
||||||
|
sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist"
|
||||||
|
|
||||||
|
SUB=" (GPU)"
|
||||||
|
rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB"
|
||||||
|
sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist"
|
||||||
|
|
||||||
|
SUB=" (Renderer)"
|
||||||
|
rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB"
|
||||||
|
sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist"
|
||||||
|
|
||||||
|
SUB=" (Plugin)"
|
||||||
|
rm -rf "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
cp -r "$SRC" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app"
|
||||||
|
mv "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$SRCAPP" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/MacOS/$DESTAPP Helper$SUB"
|
||||||
|
sed -i '' "s/$SRCAPP/$DESTAPP Helper$SUB/g" "$DEST/Contents/Frameworks/$DESTAPP Helper$SUB.app/Contents/Info.plist"
|
||||||
|
|
BIN
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.ico
Normal file
BIN
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
88
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.lpi
Normal file
88
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.lpi
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="12"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<CompatibilityMode Value="True"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<Title Value="BrowserWindowDom"/>
|
||||||
|
<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"/>
|
||||||
|
<DestinationDirectory Value="B:/laz_other/CEF4Delphi/demos/Lazarus_any_OS/BrowserWindowDom"/>
|
||||||
|
<CompressFinally Value="False"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages Count="3">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="LazDebuggerGdbmi"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="CEF4Delphi_Lazarus"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item3>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units Count="5">
|
||||||
|
<Unit0>
|
||||||
|
<Filename Value="BrowserWindowDom.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit0>
|
||||||
|
<Unit1>
|
||||||
|
<Filename Value="uBrowserWindowDom.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="Form1"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
</Unit1>
|
||||||
|
<Unit2>
|
||||||
|
<Filename Value="initsubprocess.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="InitSubProcess"/>
|
||||||
|
</Unit2>
|
||||||
|
<Unit3>
|
||||||
|
<Filename Value="globalcefapplication.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<UnitName Value="GlobalCefApplication"/>
|
||||||
|
</Unit3>
|
||||||
|
<Unit4>
|
||||||
|
<Filename Value="uHelperProcessDom.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit4>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="../../../bin/BrowserWindowDom"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
|
</Debugging>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CustomOptions Value="-dUseCthreads"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
</CONFIG>
|
84
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.lpr
Normal file
84
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.lpr
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
|
||||||
|
(*
|
||||||
|
* Include the following files
|
||||||
|
* BrowserWindow.app/Contents/Frameworks/ExternalPumpBrowser Helper.app/
|
||||||
|
* files from the demos/Lazarus_Mac/AppHelper project
|
||||||
|
* use create_mac_helper.sh
|
||||||
|
*
|
||||||
|
* BrowserWindow.app/Contents/Frameworks/Chromium Embedded Framework.framework
|
||||||
|
* files from Release folder in cef download
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
|
||||||
|
program BrowserWindowDom;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}{$ENDIF}
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
InitSubProcess, // On Linux this unit must be used *before* the "interfaces" unit.
|
||||||
|
{$ENDIF}
|
||||||
|
Interfaces,
|
||||||
|
Forms,
|
||||||
|
uBrowserWindowDom, GlobalCefApplication,
|
||||||
|
uHelperProcessDom // Used here, for any OS where the main exe server as AppHelper too.
|
||||||
|
{ you can add units after this }
|
||||||
|
;
|
||||||
|
|
||||||
|
{$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
|
||||||
|
RequireDerivedFormResource:=True;
|
||||||
|
Application.Scaled := True;
|
||||||
|
Application.Initialize;
|
||||||
|
Application.CreateForm(TForm1, Form1);
|
||||||
|
Application.Run;
|
||||||
|
end.
|
||||||
|
|
BIN
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.res
Normal file
BIN
demos/Lazarus_any_OS/BrowserWindowDom/BrowserWindowDom.res
Normal file
Binary file not shown.
40
demos/Lazarus_any_OS/BrowserWindowDom/README.txt
Normal file
40
demos/Lazarus_any_OS/BrowserWindowDom/README.txt
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
BrowserWindow
|
||||||
|
|
||||||
|
# ABOUT
|
||||||
|
|
||||||
|
This example uses
|
||||||
|
TLazarusBrowserWindow
|
||||||
|
Examining DOM
|
||||||
|
|
||||||
|
TCEFWorkScheduler feeds the CEF messageloop by calling DoMessageLoopWork(). On Mac this is currently the only way to run the CEF messageloop.
|
||||||
|
|
||||||
|
|
||||||
|
# SETUP
|
||||||
|
|
||||||
|
** Windows
|
||||||
|
1) Download the CEF framework and place the content of the "Release" folder into the same folder as your exe.
|
||||||
|
Alternatively you can point "GlobalCEFApp.FrameworkDirPath" to the location with the libraries.
|
||||||
|
2) Run the project
|
||||||
|
|
||||||
|
** Linux
|
||||||
|
1) Download the CEF framework and place the content of the "Release" folder into the same folder as your exe.
|
||||||
|
Alternatively you can point "GlobalCEFApp.FrameworkDirPath" to the location with the libraries.
|
||||||
|
2) Run the project
|
||||||
|
|
||||||
|
Note:
|
||||||
|
- For your own Linux project you must modify the project source (lpr) and add "InitSubProcess" to the "uses" clause, so that it is in the list *before* the unit "Interfaces".
|
||||||
|
- The call to "DestroyGlobalCEFApp" must be in a unit *not* used by "unit InitSubProcess" (including not used in any nested way).
|
||||||
|
|
||||||
|
|
||||||
|
** Mac
|
||||||
|
1) Go to "project options" and create the "App Bundle"
|
||||||
|
2) Download the CEF framework and place the content of the "Release" folder into ExternalPumpBrowser.app/Contents/Frameworks/Chromium Embedded Framework.framework
|
||||||
|
You should have:
|
||||||
|
Chromium Embedded Framework
|
||||||
|
Libraries/*
|
||||||
|
Resources/*
|
||||||
|
3) Open project "AppHelper" (from the subfolder in this project's folder), create App Bundle and compile the AppHelper.
|
||||||
|
Run create_mac_helper.sh
|
||||||
|
4) Open project ExternalPumpBrowser, compile and run
|
||||||
|
|
||||||
|
|
468
demos/Lazarus_any_OS/BrowserWindowDom/cef.inc
Normal file
468
demos/Lazarus_any_OS/BrowserWindowDom/cef.inc
Normal file
@ -0,0 +1,468 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright � 2017 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
// The complete list of compiler versions is here :
|
||||||
|
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
|
||||||
|
|
||||||
|
{$DEFINE DELPHI_VERSION_UNKNOW}
|
||||||
|
|
||||||
|
// Delphi 5
|
||||||
|
{$IFDEF VER130}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 6
|
||||||
|
{$IFDEF VER140}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 7
|
||||||
|
{$IFDEF VER150}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 8
|
||||||
|
{$IFDEF VER160}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2005
|
||||||
|
{$IFDEF VER170}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF VER180}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
// Delphi 2007
|
||||||
|
{$IFDEF VER185}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
// Delphi 2006
|
||||||
|
{$ELSE}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2009
|
||||||
|
{$IFDEF VER200}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
//Delphi 2010
|
||||||
|
{$IFDEF VER210}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE
|
||||||
|
{$IFDEF VER220}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE2 (First FireMonkey and 64bit compiler)
|
||||||
|
{$IFDEF VER230}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE3
|
||||||
|
{$IFDEF VER240}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE4
|
||||||
|
{$IFDEF VER250}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE5
|
||||||
|
{$IFDEF VER260}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE6
|
||||||
|
{$IFDEF VER270}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE7
|
||||||
|
{$IFDEF VER280}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE8
|
||||||
|
{$IFDEF VER290}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$ENDIF VER290}
|
||||||
|
|
||||||
|
// Rad Studio 10 - Delphi Seattle
|
||||||
|
{$IFDEF VER300}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.1 - Delphi Berlin
|
||||||
|
{$IFDEF VER310}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.2 - Delphi Tokyo
|
||||||
|
{$IFDEF VER320}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.3 - Delphi Rio
|
||||||
|
{$IFDEF VER330}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.4 - Delphi Sydney
|
||||||
|
{$IFDEF VER340}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$DEFINE DELPHI27_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)}
|
||||||
|
{$DEFINE FPC_VER_320}
|
||||||
|
{$IFEND}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$DEFINE DELPHI27_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF DELPHI9_UP}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IF DEFINED(CPUX32) OR
|
||||||
|
DEFINED(CPU386) OR
|
||||||
|
DEFINED(CPUi386) OR
|
||||||
|
DEFINED(CPUPOWERPC32) OR
|
||||||
|
DEFINED(CPUSPARC32) OR
|
||||||
|
DEFINED(CPU32BITS) OR
|
||||||
|
DEFINED(CPUARM32) OR
|
||||||
|
DEFINED(WIN32) OR
|
||||||
|
DEFINED(IOS32) OR
|
||||||
|
DEFINED(MACOS32) OR
|
||||||
|
DEFINED(LINUX32) OR
|
||||||
|
DEFINED(POSIX32) OR
|
||||||
|
DEFINED(ANDROID32)}
|
||||||
|
{$DEFINE TARGET_32BITS}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// Delphi uses MACOS for the new MacOSX and DARWIN is not defined
|
||||||
|
// FPC uses DARWIN for the new MacOSX and MACOS is defined for the classic Macintosh OS (System 7)
|
||||||
|
// We define MACOSX to avoid conflicts in both situations
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF MACOS}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
13
demos/Lazarus_any_OS/BrowserWindowDom/create_mac_helper.sh
Executable file
13
demos/Lazarus_any_OS/BrowserWindowDom/create_mac_helper.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
CDIR=$(pwd)
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
./AppHelper/create_mac_helper_apps.sh ../../../bin/BrowserWindowDom.app
|
||||||
|
|
||||||
|
if [ "$(grep -i TCrCocoaApplication ../../../bin/BrowserWindowDom.app/Contents/Info.plist)" = "" ];
|
||||||
|
then
|
||||||
|
sed -i '' "1,4s/<dict>/<dict>\n <key>NSPrincipalClass<\/key>\n <string>TCrCocoaApplication<\/string>/" ../../../bin/BrowserWindowDom.app/Contents/Info.plist
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$CDIR"
|
118
demos/Lazarus_any_OS/BrowserWindowDom/globalcefapplication.pas
Normal file
118
demos/Lazarus_any_OS/BrowserWindowDom/globalcefapplication.pas
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit GlobalCefApplication;
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{.$DEFINE USE_MULTI_THREAD_LOOP} // Only Windows/Linux
|
||||||
|
{.$DEFINE USE_APP_HELPER} // Optional on Windows/Linux
|
||||||
|
|
||||||
|
{$IFDEF MACOSX}
|
||||||
|
{$UNDEF USE_MULTI_THREAD_LOOP} // Will fail on Mac
|
||||||
|
{$DEFINE USE_APP_HELPER} // Required on Mac
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFApplication, uCEFWorkScheduler, uCEFLazApplication, FileUtil,
|
||||||
|
uHelperProcessDom;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||||
|
begin
|
||||||
|
if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
begin
|
||||||
|
if GlobalCEFApp <> nil then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
{$IFnDEF USE_MULTI_THREAD_LOOP}
|
||||||
|
// 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);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
GlobalCEFApp := TCefLazApplication.Create;
|
||||||
|
GlobalCEFApp.CheckCEFFiles := False;
|
||||||
|
{$IFDEF USE_MULTI_THREAD_LOOP}
|
||||||
|
// On Windows/Linux CEF can use threads for the message-loop
|
||||||
|
GlobalCEFApp.MultiThreadedMessageLoop := True;
|
||||||
|
{$ELSE}
|
||||||
|
// use External Pump for message-loop
|
||||||
|
GlobalCEFApp.ExternalMessagePump := True;
|
||||||
|
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||||
|
GlobalCEFApp.OnScheduleMessagePumpWork := @GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFnDEF MACOSX}
|
||||||
|
{$IFDEF USE_APP_HELPER}
|
||||||
|
(* Use AppHelper as subprocess, instead of the main exe *)
|
||||||
|
GlobalCEFApp.BrowserSubprocessPath := 'AppHelper' + GetExeExt;
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF MACOSX}
|
||||||
|
(* Enable the below to prevent being asked for permission to access "Chromium Safe Storage"
|
||||||
|
If set to true, Cookies will not be encrypted.
|
||||||
|
*)
|
||||||
|
GlobalCEFApp.UseMockKeyChain := True;
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF LINUX}
|
||||||
|
// This is a workaround for the 'GPU is not usable error' issue :
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/issues/2964/gpu-is-not-usable-error-during-cef
|
||||||
|
GlobalCEFApp.DisableZygote := True; // this property adds the "--no-zygote" command line switch
|
||||||
|
{$ENDIF}
|
||||||
|
{
|
||||||
|
GlobalCEFApp.LogFile := 'cef.log';
|
||||||
|
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
InitProcessMessagesHandler; // This is for the AppHelper process.
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
61
demos/Lazarus_any_OS/BrowserWindowDom/initsubprocess.pas
Normal file
61
demos/Lazarus_any_OS/BrowserWindowDom/initsubprocess.pas
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit InitSubProcess;
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
GlobalCefApplication, uCEFApplication, uCEFWorkScheduler;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
initialization
|
||||||
|
CreateGlobalCEFApp;
|
||||||
|
if not GlobalCEFApp.StartMainProcess then begin
|
||||||
|
if GlobalCEFWorkScheduler <> nil then
|
||||||
|
GlobalCEFWorkScheduler.StopScheduler;
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
DestroyGlobalCEFWorkScheduler;
|
||||||
|
halt(0); // exit the subprocess
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
73
demos/Lazarus_any_OS/BrowserWindowDom/uBrowserWindowDom.lfm
Normal file
73
demos/Lazarus_any_OS/BrowserWindowDom/uBrowserWindowDom.lfm
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
object Form1: TForm1
|
||||||
|
Left = 473
|
||||||
|
Height = 589
|
||||||
|
Top = 227
|
||||||
|
Width = 967
|
||||||
|
Caption = 'Initializing browser. Please wait...'
|
||||||
|
ClientHeight = 589
|
||||||
|
ClientWidth = 967
|
||||||
|
OnCloseQuery = FormCloseQuery
|
||||||
|
OnCreate = FormCreate
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '2.1.0.0'
|
||||||
|
object AddressPnl: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 23
|
||||||
|
Top = 0
|
||||||
|
Width = 967
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 23
|
||||||
|
ClientWidth = 967
|
||||||
|
TabOrder = 0
|
||||||
|
object GoBtn: TButton
|
||||||
|
Left = 932
|
||||||
|
Height = 23
|
||||||
|
Top = 0
|
||||||
|
Width = 35
|
||||||
|
Align = alRight
|
||||||
|
Caption = 'Go'
|
||||||
|
OnClick = GoBtnClick
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object AddressEdt: TComboBox
|
||||||
|
Left = 0
|
||||||
|
Height = 23
|
||||||
|
Top = 0
|
||||||
|
Width = 932
|
||||||
|
Align = alClient
|
||||||
|
ItemHeight = 15
|
||||||
|
ItemIndex = 0
|
||||||
|
Items.Strings = (
|
||||||
|
'https://www.google.com'
|
||||||
|
'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending'
|
||||||
|
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close'
|
||||||
|
'https://www.w3schools.com/html/html5_video.asp'
|
||||||
|
'http://www.adobe.com/software/flash/about/'
|
||||||
|
'http://isflashinstalled.com/'
|
||||||
|
'chrome://version/'
|
||||||
|
'http://html5test.com/'
|
||||||
|
'https://www.w3schools.com/'
|
||||||
|
'http://webglsamples.org/'
|
||||||
|
'https://get.webgl.org/'
|
||||||
|
'https://www.youtube.com'
|
||||||
|
'https://html5demos.com/drag/'
|
||||||
|
'https://developers.google.com/maps/documentation/javascript/examples/streetview-embed?hl=fr'
|
||||||
|
'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe_name'
|
||||||
|
'https://www.browserleaks.com/webrtc'
|
||||||
|
'https://frames-per-second.appspot.com/'
|
||||||
|
)
|
||||||
|
TabOrder = 1
|
||||||
|
Text = 'https://www.google.com'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object LazarusBrowserWindow1: TLazarusBrowserWindow
|
||||||
|
Left = 0
|
||||||
|
Height = 566
|
||||||
|
Top = 23
|
||||||
|
Width = 967
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 1
|
||||||
|
OnBrowserClosed = LazarusBrowserWindow1BrowserClosed
|
||||||
|
end
|
||||||
|
end
|
258
demos/Lazarus_any_OS/BrowserWindowDom/uBrowserWindowDom.pas
Normal file
258
demos/Lazarus_any_OS/BrowserWindowDom/uBrowserWindowDom.pas
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uBrowserWindowDom;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
GlobalCefApplication,
|
||||||
|
uCEFLazarusCocoa, // required for Cocoa
|
||||||
|
SysUtils, Messages, Forms, Controls,
|
||||||
|
Dialogs, ExtCtrls, StdCtrls, LMessages, Menus,
|
||||||
|
uCEFTypes, uCEFInterfaces, uHelperProcessDom,
|
||||||
|
uCEFWorkScheduler, uCEFLazarusBrowserWindow, uCEFProcessMessage, Classes;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
TForm1 = class(TForm)
|
||||||
|
AddressEdt: TComboBox;
|
||||||
|
GoBtn: TButton;
|
||||||
|
AddressPnl: TPanel;
|
||||||
|
LazarusBrowserWindow1: TLazarusBrowserWindow;
|
||||||
|
mDomHere: TMenuItem;
|
||||||
|
|
||||||
|
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 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 GoBtnClick(Sender: TObject);
|
||||||
|
procedure LazarusBrowserWindow1BrowserClosed(Sender: TObject);
|
||||||
|
private
|
||||||
|
FContextXY: TPoint;
|
||||||
|
|
||||||
|
procedure DoBeforeContextMenu(Sender: TObject; const browser: ICefBrowser;
|
||||||
|
const frame: ICefFrame; const params: ICefContextMenuParams;
|
||||||
|
const model: ICefMenuModel);
|
||||||
|
procedure DoCaptureMenuXY;
|
||||||
|
procedure DoContextMenuCmd(Sender: TObject; const browser: ICefBrowser;
|
||||||
|
const frame: ICefFrame; const params: ICefContextMenuParams;
|
||||||
|
commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean);
|
||||||
|
procedure DoProcessMessageReceived(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
sourceProcess: TCefProcessId; const message: ICefProcessMessage; out
|
||||||
|
Result: Boolean);
|
||||||
|
protected
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||||
|
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
public
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Form1: TForm1;
|
||||||
|
|
||||||
|
|
||||||
|
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 TCEFLinkedWindowParent
|
||||||
|
|
||||||
|
// We need to use TCEFLinkedWindowParent in Linux to update the browser
|
||||||
|
// visibility and size automatically.
|
||||||
|
|
||||||
|
// Destruction steps
|
||||||
|
// =================
|
||||||
|
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||||
|
// 2. TChromium.OnClose sets aAction to cbaClose to destroy the browser, which triggers the TChromium.OnBeforeClose event.
|
||||||
|
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends CEF_BEFORECLOSE to close the form.
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFApplication;
|
||||||
|
|
||||||
|
{ TForm1 }
|
||||||
|
|
||||||
|
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
LazarusBrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.LazarusBrowserWindow1BrowserClosed(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Close;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.DoBeforeContextMenu(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
const params: ICefContextMenuParams; const model: ICefMenuModel);
|
||||||
|
begin
|
||||||
|
model.Clear;
|
||||||
|
model.AddItem(1, 'Get DOM');
|
||||||
|
TThread.Synchronize(nil, @DoCaptureMenuXY);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.DoCaptureMenuXY;
|
||||||
|
begin
|
||||||
|
FContextXY := LazarusBrowserWindow1.ScreenToClient(Mouse.CursorPos);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.DoContextMenuCmd(Sender: TObject; const browser: ICefBrowser;
|
||||||
|
const frame: ICefFrame; const params: ICefContextMenuParams;
|
||||||
|
commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean);
|
||||||
|
var
|
||||||
|
TempMsg : ICefProcessMessage;
|
||||||
|
begin
|
||||||
|
if commandId = 1 then
|
||||||
|
begin
|
||||||
|
TempMsg := TCefProcessMessageRef.New(MSG_REQUEST_DOM); // Same name than TCefCustomRenderProcessHandler.MessageName
|
||||||
|
TempMsg.ArgumentList.SetInt(0, FContextXY.X);
|
||||||
|
TempMsg.ArgumentList.SetInt(1, FContextXY.Y);
|
||||||
|
LazarusBrowserWindow1.Chromium.SendProcessMessage(PID_RENDERER, TempMsg);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.DoProcessMessageReceived(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
sourceProcess: TCefProcessId; const message: ICefProcessMessage; out
|
||||||
|
Result: Boolean);
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
case message.Name of
|
||||||
|
MSG_RESPONSE_DOM: begin
|
||||||
|
Caption := message.ArgumentList.GetString(0);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{$IFDEF WINDOWS}
|
||||||
|
procedure TForm1.WMEnterMenuLoop(var aMessage: TMessage);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.WMExitMenuLoop(var aMessage: TMessage);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
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.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.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
begin
|
||||||
|
LazarusBrowserWindow1.CloseBrowser(True);
|
||||||
|
|
||||||
|
CanClose := LazarusBrowserWindow1.IsClosed;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
LazarusBrowserWindow1.Chromium.OnBeforeContextMenu := @DoBeforeContextMenu;
|
||||||
|
LazarusBrowserWindow1.Chromium.OnContextMenuCommand := @DoContextMenuCmd;
|
||||||
|
LazarusBrowserWindow1.Chromium.OnProcessMessageReceived := @DoProcessMessageReceived;
|
||||||
|
|
||||||
|
LazarusBrowserWindow1.LoadURL(UTF8Decode(AddressEdt.Text));
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
{$IFDEF DARWIN} // $IFDEF MACOSX
|
||||||
|
AddCrDelegate;
|
||||||
|
{$ENDIF}
|
||||||
|
if GlobalCEFApp = nil then begin
|
||||||
|
CreateGlobalCEFApp;
|
||||||
|
if not GlobalCEFApp.StartMainProcess then begin
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
DestroyGlobalCEFWorkScheduler;
|
||||||
|
halt(0); // exit the subprocess
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
finalization
|
||||||
|
(* Destroy from this unit, which is used after "Interfaces". So this happens before the Application object is destroyed *)
|
||||||
|
if GlobalCEFWorkScheduler <> nil then
|
||||||
|
GlobalCEFWorkScheduler.StopScheduler;
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
DestroyGlobalCEFWorkScheduler;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
161
demos/Lazarus_any_OS/BrowserWindowDom/uHelperProcessDom.pas
Normal file
161
demos/Lazarus_any_OS/BrowserWindowDom/uHelperProcessDom.pas
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2021 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uHelperProcessDom;
|
||||||
|
|
||||||
|
(* The code in this unit is executed in the renderer sub-process
|
||||||
|
*)
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, uCEFApplication, uCEFInterfaces, uCEFDomVisitor, uCEFTypes,
|
||||||
|
uCEFProcessMessage;
|
||||||
|
|
||||||
|
const
|
||||||
|
MSG_REQUEST_DOM = 'MSG_REQUEST_DOM';
|
||||||
|
MSG_RESPONSE_DOM = 'MSG_RESPONSE_DOM';
|
||||||
|
|
||||||
|
procedure InitProcessMessagesHandler;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TDomVisitorFindXY }
|
||||||
|
|
||||||
|
TDomVisitorFindXY = class(TCefDomVisitorOwn)
|
||||||
|
protected
|
||||||
|
FFrame : ICefFrame;
|
||||||
|
FX, FY: Integer;
|
||||||
|
procedure visit(const document: ICefDomDocument); override;
|
||||||
|
public
|
||||||
|
constructor Create(AFrame: ICefFrame; X,Y: Integer); reintroduce; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TDomVisitorFindXY }
|
||||||
|
|
||||||
|
procedure TDomVisitorFindXY.visit(const document: ICefDomDocument);
|
||||||
|
var
|
||||||
|
node, foundNode: ICefDomNode;
|
||||||
|
nb: TCefRect;
|
||||||
|
TempMsg : ICefProcessMessage;
|
||||||
|
begin
|
||||||
|
node := document.GetBody;
|
||||||
|
foundNode := nil;
|
||||||
|
if node <> nil then
|
||||||
|
begin
|
||||||
|
nb := node.GetElementBounds;
|
||||||
|
if (FX >= nb.x) and (FX < nb.x + nb.width) and
|
||||||
|
(FY >= nb.y) and (FY < nb.y + nb.height)
|
||||||
|
then
|
||||||
|
begin
|
||||||
|
while node <> nil do
|
||||||
|
begin
|
||||||
|
foundNode := node;
|
||||||
|
if node.HasChildren then
|
||||||
|
begin
|
||||||
|
node := node.FirstChild;
|
||||||
|
while node <> nil do
|
||||||
|
begin
|
||||||
|
nb := node.GetElementBounds;
|
||||||
|
if (FX >= nb.x) and (FX < nb.x + nb.width) and
|
||||||
|
(FY >= nb.y) and (FY < nb.y + nb.height)
|
||||||
|
then
|
||||||
|
break // go outer loop
|
||||||
|
else
|
||||||
|
node := node.NextSibling;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
node := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TempMsg := TCefProcessMessageRef.New(MSG_RESPONSE_DOM); // Same name than TCefCustomRenderProcessHandler.MessageName
|
||||||
|
if foundNode <> nil then
|
||||||
|
TempMsg.ArgumentList.SetString(0, foundNode.AsMarkup)
|
||||||
|
else
|
||||||
|
TempMsg.ArgumentList.SetString(0, 'Not Found');
|
||||||
|
if (FFrame <> nil) and FFrame.IsValid then
|
||||||
|
FFrame.SendProcessMessage(PID_BROWSER, TempMsg);
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TDomVisitorFindXY.Create(AFrame: ICefFrame; X, Y: Integer);
|
||||||
|
begin
|
||||||
|
FFrame := AFrame;
|
||||||
|
FX := X;
|
||||||
|
FY := Y;
|
||||||
|
inherited Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure DoProcessMessageReceived(const browser: ICefBrowser;
|
||||||
|
const frame: ICefFrame; sourceProcess: TCefProcessId;
|
||||||
|
const message: ICefProcessMessage; var aHandled: boolean);
|
||||||
|
var
|
||||||
|
TempVisitor : TDomVisitorFindXY;
|
||||||
|
begin
|
||||||
|
aHandled := False;
|
||||||
|
case message.Name of
|
||||||
|
MSG_REQUEST_DOM: begin
|
||||||
|
if (frame <> nil) and frame.IsValid then
|
||||||
|
begin
|
||||||
|
TempVisitor := TDomVisitorFindXY.Create(
|
||||||
|
frame,
|
||||||
|
message.ArgumentList.GetInt(0),
|
||||||
|
message.ArgumentList.GetInt(1)
|
||||||
|
);
|
||||||
|
frame.VisitDom(TempVisitor);
|
||||||
|
end;
|
||||||
|
aHandled := True;
|
||||||
|
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure InitProcessMessagesHandler;
|
||||||
|
begin
|
||||||
|
GlobalCEFApp.OnProcessMessageReceived := @DoProcessMessageReceived;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
Reference in New Issue
Block a user