From 2173c94bf0bf8d3b3c9fd571bbb0dfd1e3c14f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Sun, 12 May 2019 10:50:27 +0200 Subject: [PATCH] SchemeRegistrationBrowser demo improvements - Added a local JavaScript file to show an alert dialog - Added more comments to the demo. --- bin/test.html | 5 ++++- bin/test.js | 5 +++++ .../uSchemeRegistrationBrowser.pas | 14 ++++++++++++++ update_CEF4Delphi.json | 2 +- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 bin/test.js diff --git a/bin/test.html b/bin/test.html index 90b8ec0e..1afcf670 100644 --- a/bin/test.html +++ b/bin/test.html @@ -1,5 +1,5 @@ - +


Local image

@@ -13,6 +13,9 @@ Local SWF file.
You need to install the Adobe Flash PPAPI plugin to view the SWF file.

+

+

+


Bigger image

diff --git a/bin/test.js b/bin/test.js new file mode 100644 index 00000000..a45d052b --- /dev/null +++ b/bin/test.js @@ -0,0 +1,5 @@ +function myAlertFunction() { + + alert('This alert dialog is declared in a local JS file.'); + +} diff --git a/demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas b/demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas index a249413e..ec302313 100644 --- a/demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas +++ b/demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas @@ -119,6 +119,17 @@ implementation uses uCEFSchemeHandlerFactory, uCEFMiscFunctions, uHelloScheme; +// This demo shows how to register a custom 'hello' scheme. + +// To register the scheme we use a resource handler in uHelloScheme.pas that inherits from TCefResourceHandlerOwn +// You can register the scheme in TForm.OnCreate or later. + +// IMPORTANT : If you notice that some functionality is missing in your application and the debug.log file shows +// weird warnings then register the 'http' or 'https' schemes instead of creating a custom scheme. + +// For more information about the resource handler read this page : +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefResourceHandler.html + // Destruction steps // ================= // 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event. @@ -134,6 +145,9 @@ procedure CreateGlobalCEFApp; begin GlobalCEFApp := TCefApplication.Create; GlobalCEFApp.OnRegCustomSchemes := GlobalCEFApp_OnRegCustomSchemes; + + // GlobalCEFApp.LogFile := 'debug.log'; + // GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE; end; procedure TSchemeRegistrationBrowserFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index a0c56b30..748ac7ab 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,7 +2,7 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 8, + "InternalVersion" : 9, "Name" : "cef4delphi_lazarus.lpk", "Version" : "74.1.16.0" }