mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-01-13 10:22:04 +02:00
bug fix #68
This commit is contained in:
parent
b54a2861c4
commit
f5f1a767c9
@ -60,16 +60,6 @@ begin
|
|||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnProcessMessageReceived := JSEvalFrm.RenderProcessHandler_OnProcessMessageReceivedEvent;
|
GlobalCEFApp.OnProcessMessageReceived := JSEvalFrm.RenderProcessHandler_OnProcessMessageReceivedEvent;
|
||||||
|
|
||||||
// In case you want to use custom directories for the CEF3 binaries, cache, cookies and user data.
|
|
||||||
{
|
|
||||||
GlobalCEFApp.FrameworkDirPath := 'cef';
|
|
||||||
GlobalCEFApp.ResourcesDirPath := 'cef';
|
|
||||||
GlobalCEFApp.LocalesDirPath := 'cef\locales';
|
|
||||||
GlobalCEFApp.cache := 'cef\cache';
|
|
||||||
GlobalCEFApp.cookies := 'cef\cookies';
|
|
||||||
GlobalCEFApp.UserDataPath := 'cef\User Data';
|
|
||||||
}
|
|
||||||
|
|
||||||
if GlobalCEFApp.StartMainProcess then
|
if GlobalCEFApp.StartMainProcess then
|
||||||
begin
|
begin
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -41,19 +41,13 @@ program JSExecutingFunctions;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFInterfaces,
|
|
||||||
uCEFv8Value,
|
|
||||||
uCEFConstants,
|
|
||||||
uCEFTypes,
|
|
||||||
uJSExecutingFunctions in 'uJSExecutingFunctions.pas' {JSExecutingFunctionsFrm},
|
uJSExecutingFunctions in 'uJSExecutingFunctions.pas' {JSExecutingFunctionsFrm},
|
||||||
uMyV8Handler in 'uMyV8Handler.pas';
|
uMyV8Handler in 'uMyV8Handler.pas';
|
||||||
|
|
||||||
@ -62,32 +56,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
||||||
var
|
|
||||||
TempHandler : ICefv8Handler;
|
|
||||||
begin
|
|
||||||
TempHandler := TMyV8Handler.Create;
|
|
||||||
context.Global.SetValueByKey('register', TCefv8ValueRef.NewFunction('register', TempHandler), V8_PROPERTY_ATTRIBUTE_NONE);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser;
|
|
||||||
sourceProcess : TCefProcessId;
|
|
||||||
const message : ICefProcessMessage;
|
|
||||||
var aHandled : boolean);
|
|
||||||
var
|
|
||||||
arguments: TCefv8ValueArray;
|
|
||||||
begin
|
|
||||||
if (message.name = EXECFUNCTION_MSGNAME) then
|
|
||||||
begin
|
|
||||||
if (GlobalCallbackFunc <> nil) then
|
|
||||||
GlobalCallbackFunc.ExecuteFunctionWithContext(GlobalCallbackContext, nil, arguments);
|
|
||||||
|
|
||||||
aHandled := True;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
aHandled := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -49,7 +49,8 @@ uses
|
|||||||
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
||||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants;
|
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||||
|
uCEFConstants, uCEFv8Value;
|
||||||
|
|
||||||
const
|
const
|
||||||
JSDEMO_CONTEXTMENU_EXECFUNCTION = MENU_ID_USER_FIRST + 1;
|
JSDEMO_CONTEXTMENU_EXECFUNCTION = MENU_ID_USER_FIRST + 1;
|
||||||
@ -88,6 +89,12 @@ var
|
|||||||
GlobalCallbackFunc : ICefv8Value = nil;
|
GlobalCallbackFunc : ICefv8Value = nil;
|
||||||
GlobalCallbackContext : ICefv8Context = nil;
|
GlobalCallbackContext : ICefv8Context = nil;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser;
|
||||||
|
sourceProcess : TCefProcessId;
|
||||||
|
const aMessage : ICefProcessMessage;
|
||||||
|
var aHandled : boolean);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
@ -106,7 +113,36 @@ implementation
|
|||||||
// be executed.
|
// be executed.
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uCEFProcessMessage;
|
uCEFProcessMessage, uMyV8Handler;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
var
|
||||||
|
TempHandler : ICefv8Handler;
|
||||||
|
TempFunction : ICefv8Value;
|
||||||
|
begin
|
||||||
|
TempHandler := TMyV8Handler.Create;
|
||||||
|
TempFunction := TCefv8ValueRef.NewFunction('register', TempHandler);
|
||||||
|
|
||||||
|
context.Global.SetValueByKey('register', TempFunction, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser;
|
||||||
|
sourceProcess : TCefProcessId;
|
||||||
|
const aMessage : ICefProcessMessage;
|
||||||
|
var aHandled : boolean);
|
||||||
|
var
|
||||||
|
arguments: TCefv8ValueArray;
|
||||||
|
begin
|
||||||
|
if (aMessage.name = EXECFUNCTION_MSGNAME) then
|
||||||
|
begin
|
||||||
|
if (GlobalCallbackFunc <> nil) then
|
||||||
|
GlobalCallbackFunc.ExecuteFunctionWithContext(GlobalCallbackContext, nil, arguments);
|
||||||
|
|
||||||
|
aHandled := True;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
aHandled := False;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSExecutingFunctionsFrm.GoBtnClick(Sender: TObject);
|
procedure TJSExecutingFunctionsFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
@ -41,21 +41,13 @@ program JSExtension;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFMiscFunctions,
|
|
||||||
uCEFConstants,
|
|
||||||
uCEFRenderProcessHandler,
|
|
||||||
uCEFInterfaces,
|
|
||||||
uCEFv8Handler,
|
|
||||||
uCEFTypes,
|
|
||||||
uJSExtension in 'uJSExtension.pas' {JSExtensionFrm},
|
uJSExtension in 'uJSExtension.pas' {JSExtensionFrm},
|
||||||
uTestExtensionHandler in 'uTestExtensionHandler.pas',
|
uTestExtensionHandler in 'uTestExtensionHandler.pas',
|
||||||
uSimpleTextViewer in 'uSimpleTextViewer.pas' {SimpleTextViewerFrm};
|
uSimpleTextViewer in 'uSimpleTextViewer.pas' {SimpleTextViewerFrm};
|
||||||
@ -65,34 +57,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnWebKitInitialized;
|
|
||||||
var
|
|
||||||
TempExtensionCode : string;
|
|
||||||
TempHandler : ICefv8Handler;
|
|
||||||
begin
|
|
||||||
// This is a JS extension example with 2 functions and several parameters.
|
|
||||||
// Please, read the "JavaScript Integration" wiki page at
|
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
|
||||||
|
|
||||||
TempExtensionCode := 'var myextension;' +
|
|
||||||
'if (!myextension)' +
|
|
||||||
' myextension = {};' +
|
|
||||||
'(function() {' +
|
|
||||||
' myextension.mouseover = function(a) {' +
|
|
||||||
' native function mouseover();' +
|
|
||||||
' mouseover(a);' +
|
|
||||||
' };' +
|
|
||||||
' myextension.sendresulttobrowser = function(b,c) {' +
|
|
||||||
' native function sendresulttobrowser();' +
|
|
||||||
' sendresulttobrowser(b,c);' +
|
|
||||||
' };' +
|
|
||||||
'})();';
|
|
||||||
|
|
||||||
TempHandler := TTestExtensionHandler.Create;
|
|
||||||
|
|
||||||
CefRegisterExtension('myextension', TempExtensionCode, TempHandler);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized;
|
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -97,12 +97,14 @@ type
|
|||||||
var
|
var
|
||||||
JSExtensionFrm: TJSExtensionFrm;
|
JSExtensionFrm: TJSExtensionFrm;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitialized;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uSimpleTextViewer, uCEFMiscFunctions;
|
uSimpleTextViewer, uCEFMiscFunctions, uTestExtensionHandler;
|
||||||
|
|
||||||
// The CEF3 document describing extensions is here :
|
// The CEF3 document describing extensions is here :
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
@ -122,6 +124,34 @@ uses
|
|||||||
// Even if you create several TChromium objects you should have no problem because each of them will have its own
|
// Even if you create several TChromium objects you should have no problem because each of them will have its own
|
||||||
// TChromium.OnProcessMessageReceived event to receive the messages from the extension.
|
// TChromium.OnProcessMessageReceived event to receive the messages from the extension.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitialized;
|
||||||
|
var
|
||||||
|
TempExtensionCode : string;
|
||||||
|
TempHandler : ICefv8Handler;
|
||||||
|
begin
|
||||||
|
// This is a JS extension example with 2 functions and several parameters.
|
||||||
|
// Please, read the "JavaScript Integration" wiki page at
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
|
TempExtensionCode := 'var myextension;' +
|
||||||
|
'if (!myextension)' +
|
||||||
|
' myextension = {};' +
|
||||||
|
'(function() {' +
|
||||||
|
' myextension.mouseover = function(a) {' +
|
||||||
|
' native function mouseover();' +
|
||||||
|
' mouseover(a);' +
|
||||||
|
' };' +
|
||||||
|
' myextension.sendresulttobrowser = function(b,c) {' +
|
||||||
|
' native function sendresulttobrowser();' +
|
||||||
|
' sendresulttobrowser(b,c);' +
|
||||||
|
' };' +
|
||||||
|
'})();';
|
||||||
|
|
||||||
|
TempHandler := TTestExtensionHandler.Create;
|
||||||
|
|
||||||
|
CefRegisterExtension('myextension', TempExtensionCode, TempHandler);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSExtensionFrm.GoBtnClick(Sender: TObject);
|
procedure TJSExtensionFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.LoadURL(Edit1.Text);
|
Chromium1.LoadURL(Edit1.Text);
|
||||||
|
@ -41,17 +41,13 @@ program JSExtensionWithFunction;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFMiscFunctions,
|
|
||||||
uCEFInterfaces,
|
|
||||||
uJSExtensionWithFunction in 'uJSExtensionWithFunction.pas' {JSExtensionWithFunctionFrm},
|
uJSExtensionWithFunction in 'uJSExtensionWithFunction.pas' {JSExtensionWithFunctionFrm},
|
||||||
uMyV8Handler in 'uMyV8Handler.pas';
|
uMyV8Handler in 'uMyV8Handler.pas';
|
||||||
|
|
||||||
@ -60,29 +56,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
|
||||||
var
|
|
||||||
TempExtensionCode : string;
|
|
||||||
TempHandler : ICefv8Handler;
|
|
||||||
begin
|
|
||||||
// This is the JS extension example with a function in the "JavaScript Integration" wiki page at
|
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
|
||||||
|
|
||||||
TempExtensionCode := 'var test;' +
|
|
||||||
'if (!test)' +
|
|
||||||
' test = {};' +
|
|
||||||
'(function() {' +
|
|
||||||
' test.myfunc = function() {' +
|
|
||||||
' native function myfunc();' +
|
|
||||||
' return myfunc();' +
|
|
||||||
' };' +
|
|
||||||
'})();';
|
|
||||||
|
|
||||||
TempHandler := TMyV8Handler.Create;
|
|
||||||
|
|
||||||
CefRegisterExtension('v8/test', TempExtensionCode, TempHandler);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -74,16 +74,44 @@ type
|
|||||||
var
|
var
|
||||||
JSExtensionWithFunctionFrm: TJSExtensionWithFunctionFrm;
|
JSExtensionWithFunctionFrm: TJSExtensionWithFunctionFrm;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uMyV8Handler;
|
||||||
|
|
||||||
// The CEF3 document describing JavaScript integration is here :
|
// The CEF3 document describing JavaScript integration is here :
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
// The HTML file in this demo has a button that shows the contents of 'test.myfunc()'
|
// The HTML file in this demo has a button that shows the contents of 'test.myfunc()'
|
||||||
// which was registered in the GlobalCEFApp.OnWebKitInitialized event.
|
// which was registered in the GlobalCEFApp.OnWebKitInitialized event.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
var
|
||||||
|
TempExtensionCode : string;
|
||||||
|
TempHandler : ICefv8Handler;
|
||||||
|
begin
|
||||||
|
// This is the JS extension example with a function in the "JavaScript Integration" wiki page at
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
|
TempExtensionCode := 'var test;' +
|
||||||
|
'if (!test)' +
|
||||||
|
' test = {};' +
|
||||||
|
'(function() {' +
|
||||||
|
' test.myfunc = function() {' +
|
||||||
|
' native function myfunc();' +
|
||||||
|
' return myfunc();' +
|
||||||
|
' };' +
|
||||||
|
'})();';
|
||||||
|
|
||||||
|
TempHandler := TMyV8Handler.Create;
|
||||||
|
|
||||||
|
CefRegisterExtension('v8/test', TempExtensionCode, TempHandler);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSExtensionWithFunctionFrm.GoBtnClick(Sender: TObject);
|
procedure TJSExtensionWithFunctionFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.LoadURL(Edit1.Text);
|
Chromium1.LoadURL(Edit1.Text);
|
||||||
|
@ -41,17 +41,13 @@ program JSExtensionWithObjectParameter;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFMiscFunctions,
|
|
||||||
uCEFInterfaces,
|
|
||||||
uJSExtensionWithObjectParameter in 'uJSExtensionWithObjectParameter.pas' {JSExtensionWithObjectParameterFrm},
|
uJSExtensionWithObjectParameter in 'uJSExtensionWithObjectParameter.pas' {JSExtensionWithObjectParameterFrm},
|
||||||
uMyV8Handler in 'uMyV8Handler.pas';
|
uMyV8Handler in 'uMyV8Handler.pas';
|
||||||
|
|
||||||
@ -60,33 +56,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
|
||||||
var
|
|
||||||
TempExtensionCode : string;
|
|
||||||
TempHandler : ICefv8Handler;
|
|
||||||
begin
|
|
||||||
// This is the JS extension example with a function in the "JavaScript Integration" wiki page at
|
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
|
||||||
|
|
||||||
TempExtensionCode := 'var test;' +
|
|
||||||
'if (!test)' +
|
|
||||||
' test = {};' +
|
|
||||||
'(function() {' +
|
|
||||||
' test.__defineGetter__(' + quotedstr('myparam') + ', function() {' +
|
|
||||||
' native function GetMyParam();' +
|
|
||||||
' return GetMyParam();' +
|
|
||||||
' });' +
|
|
||||||
' test.__defineSetter__(' + quotedstr('myparam') + ', function(b) {' +
|
|
||||||
' native function SetMyParam();' +
|
|
||||||
' if(b) SetMyParam(b);' +
|
|
||||||
' });' +
|
|
||||||
'})();';
|
|
||||||
|
|
||||||
TempHandler := TMyV8Handler.Create;
|
|
||||||
|
|
||||||
CefRegisterExtension('v8/test', TempExtensionCode, TempHandler);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
@ -98,7 +67,7 @@ begin
|
|||||||
Application.MainFormOnTaskbar := True;
|
Application.MainFormOnTaskbar := True;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Application.CreateForm(TJSExtensionWithObjectParameterFrm, JSExtensionWithObjectParameterFrm);
|
Application.CreateForm(TJSExtensionWithObjectParameterFrm, JSExtensionWithObjectParameterFrm);
|
||||||
Application.Run;
|
Application.Run;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
GlobalCEFApp.Free;
|
GlobalCEFApp.Free;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -74,10 +74,15 @@ type
|
|||||||
var
|
var
|
||||||
JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm;
|
JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uMyV8Handler;
|
||||||
|
|
||||||
// The CEF3 document describing JavaScript integration is here :
|
// The CEF3 document describing JavaScript integration is here :
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
@ -87,6 +92,33 @@ implementation
|
|||||||
// This demo is based in the code comments for the cef_register_extension function in the file
|
// This demo is based in the code comments for the cef_register_extension function in the file
|
||||||
// /include/capi/cef_v8_capi.h
|
// /include/capi/cef_v8_capi.h
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
var
|
||||||
|
TempExtensionCode : string;
|
||||||
|
TempHandler : ICefv8Handler;
|
||||||
|
begin
|
||||||
|
// This is the JS extension example with a function in the "JavaScript Integration" wiki page at
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
|
TempExtensionCode := 'var test;' +
|
||||||
|
'if (!test)' +
|
||||||
|
' test = {};' +
|
||||||
|
'(function() {' +
|
||||||
|
' test.__defineGetter__(' + quotedstr('myparam') + ', function() {' +
|
||||||
|
' native function GetMyParam();' +
|
||||||
|
' return GetMyParam();' +
|
||||||
|
' });' +
|
||||||
|
' test.__defineSetter__(' + quotedstr('myparam') + ', function(b) {' +
|
||||||
|
' native function SetMyParam();' +
|
||||||
|
' if(b) SetMyParam(b);' +
|
||||||
|
' });' +
|
||||||
|
'})();';
|
||||||
|
|
||||||
|
TempHandler := TMyV8Handler.Create;
|
||||||
|
|
||||||
|
CefRegisterExtension('v8/test', TempExtensionCode, TempHandler);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSExtensionWithObjectParameterFrm.GoBtnClick(Sender: TObject);
|
procedure TJSExtensionWithObjectParameterFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.LoadURL(Edit1.Text);
|
Chromium1.LoadURL(Edit1.Text);
|
||||||
|
@ -41,17 +41,13 @@ program JSSimpleExtension;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFMiscFunctions,
|
|
||||||
uCEFTypes,
|
|
||||||
uJSSimpleExtension in 'uJSSimpleExtension.pas' {JSSimpleExtensionFrm};
|
uJSSimpleExtension in 'uJSSimpleExtension.pas' {JSSimpleExtensionFrm};
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
@ -59,23 +55,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
|
||||||
var
|
|
||||||
TempExtensionCode : string;
|
|
||||||
begin
|
|
||||||
// This is the first JS extension example in the "JavaScript Integration" wiki page at
|
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
|
||||||
|
|
||||||
TempExtensionCode := 'var test;' +
|
|
||||||
'if (!test)' +
|
|
||||||
' test = {};' +
|
|
||||||
'(function() {' +
|
|
||||||
' test.myval = ' + quotedstr('My Value!') + ';' +
|
|
||||||
'})();';
|
|
||||||
|
|
||||||
CefRegisterExtension('v8/test', TempExtensionCode, nil);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
@ -45,6 +45,17 @@
|
|||||||
<Cfg_2>true</Cfg_2>
|
<Cfg_2>true</Cfg_2>
|
||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Debug with optimization' or '$(Cfg_3)'!=''">
|
||||||
|
<Cfg_3>true</Cfg_3>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_3)'=='true') or '$(Cfg_3_Win32)'!=''">
|
||||||
|
<Cfg_3_Win32>true</Cfg_3_Win32>
|
||||||
|
<CfgParent>Cfg_3</CfgParent>
|
||||||
|
<Cfg_3>true</Cfg_3>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base)'!=''">
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
<VerInfo_Locale>3082</VerInfo_Locale>
|
<VerInfo_Locale>3082</VerInfo_Locale>
|
||||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||||
@ -100,6 +111,18 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_3_Win32)'!=''">
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
|
||||||
|
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||||
|
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||||
|
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
@ -108,17 +131,21 @@
|
|||||||
<DCCReference Include="uJSSimpleExtension.pas">
|
<DCCReference Include="uJSSimpleExtension.pas">
|
||||||
<Form>JSSimpleExtensionFrm</Form>
|
<Form>JSSimpleExtensionFrm</Form>
|
||||||
</DCCReference>
|
</DCCReference>
|
||||||
|
<BuildConfiguration Include="Base">
|
||||||
|
<Key>Base</Key>
|
||||||
|
</BuildConfiguration>
|
||||||
<BuildConfiguration Include="Release">
|
<BuildConfiguration Include="Release">
|
||||||
<Key>Cfg_2</Key>
|
<Key>Cfg_2</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
</BuildConfiguration>
|
</BuildConfiguration>
|
||||||
<BuildConfiguration Include="Base">
|
|
||||||
<Key>Base</Key>
|
|
||||||
</BuildConfiguration>
|
|
||||||
<BuildConfiguration Include="Debug">
|
<BuildConfiguration Include="Debug">
|
||||||
<Key>Cfg_1</Key>
|
<Key>Cfg_1</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
</BuildConfiguration>
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Debug with optimization">
|
||||||
|
<Key>Cfg_3</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||||
|
@ -74,16 +74,38 @@ type
|
|||||||
var
|
var
|
||||||
JSSimpleExtensionFrm: TJSSimpleExtensionFrm;
|
JSSimpleExtensionFrm: TJSSimpleExtensionFrm;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions;
|
||||||
|
|
||||||
// The CEF3 document describing JavaScript integration is here :
|
// The CEF3 document describing JavaScript integration is here :
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
// The HTML file in this demo has a button that shows the contents of 'test.myval'
|
// The HTML file in this demo has a button that shows the contents of 'test.myval'
|
||||||
// which was registered in the GlobalCEFApp.OnWebKitInitialized event.
|
// which was registered in the GlobalCEFApp.OnWebKitInitialized event.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||||
|
var
|
||||||
|
TempExtensionCode : string;
|
||||||
|
begin
|
||||||
|
// This is the first JS extension example in the "JavaScript Integration" wiki page at
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
|
TempExtensionCode := 'var test;' +
|
||||||
|
'if (!test)' +
|
||||||
|
' test = {};' +
|
||||||
|
'(function() {' +
|
||||||
|
' test.myval = ' + quotedstr('My Value!') + ';' +
|
||||||
|
'})();';
|
||||||
|
|
||||||
|
CefRegisterExtension('v8/test', TempExtensionCode, nil);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSSimpleExtensionFrm.GoBtnClick(Sender: TObject);
|
procedure TJSSimpleExtensionFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.LoadURL(Edit1.Text);
|
Chromium1.LoadURL(Edit1.Text);
|
||||||
|
@ -41,18 +41,13 @@ program JSSimpleWindowBinding;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFInterfaces,
|
|
||||||
uCEFv8Value,
|
|
||||||
uCEFConstants,
|
|
||||||
uJSSimpleWindowBinding in 'uJSSimpleWindowBinding.pas' {JSSimpleWindowBindingFrm};
|
uJSSimpleWindowBinding in 'uJSSimpleWindowBinding.pas' {JSSimpleWindowBindingFrm};
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
@ -60,14 +55,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
||||||
begin
|
|
||||||
// This is the first JS Window Binding example in the "JavaScript Integration" wiki page at
|
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
|
||||||
|
|
||||||
context.Global.SetValueByKey('myval', TCefv8ValueRef.NewString('My Value!'), V8_PROPERTY_ATTRIBUTE_NONE);;
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -49,7 +49,8 @@ uses
|
|||||||
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
||||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants;
|
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||||
|
uCEFConstants, uCEFv8Value;
|
||||||
|
|
||||||
type
|
type
|
||||||
TJSSimpleWindowBindingFrm = class(TForm)
|
TJSSimpleWindowBindingFrm = class(TForm)
|
||||||
@ -74,6 +75,8 @@ type
|
|||||||
var
|
var
|
||||||
JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm;
|
JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
@ -84,6 +87,18 @@ implementation
|
|||||||
// The HTML file in this demo has a button that shows the contents of 'window.myval'
|
// The HTML file in this demo has a button that shows the contents of 'window.myval'
|
||||||
// which was set in the GlobalCEFApp.OnContextCreated event.
|
// which was set in the GlobalCEFApp.OnContextCreated event.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
var
|
||||||
|
TempValue : ICEFv8Value;
|
||||||
|
begin
|
||||||
|
// This is the first JS Window Binding example in the "JavaScript Integration" wiki page at
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
|
TempValue := TCefv8ValueRef.NewString('My Value!');
|
||||||
|
|
||||||
|
context.Global.SetValueByKey('myval', TempValue, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSSimpleWindowBindingFrm.GoBtnClick(Sender: TObject);
|
procedure TJSSimpleWindowBindingFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.LoadURL(Edit1.Text);
|
Chromium1.LoadURL(Edit1.Text);
|
||||||
|
@ -41,18 +41,13 @@ program JSWindowBindingWithFunction;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFInterfaces,
|
|
||||||
uCEFv8Value,
|
|
||||||
uCEFConstants,
|
|
||||||
uJSWindowBindingWithFunction in 'uJSWindowBindingWithFunction.pas' {JSWindowBindingWithFunctionFrm},
|
uJSWindowBindingWithFunction in 'uJSWindowBindingWithFunction.pas' {JSWindowBindingWithFunctionFrm},
|
||||||
uMyV8Handler in 'uMyV8Handler.pas';
|
uMyV8Handler in 'uMyV8Handler.pas';
|
||||||
|
|
||||||
@ -61,18 +56,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
||||||
var
|
|
||||||
TempHandler : ICefv8Handler;
|
|
||||||
begin
|
|
||||||
// This is the JS Window Binding example with a function in the "JavaScript Integration" wiki page at
|
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
|
||||||
|
|
||||||
TempHandler := TMyV8Handler.Create;
|
|
||||||
|
|
||||||
context.Global.SetValueByKey('myfunc', TCefv8ValueRef.NewFunction('myfunc', TempHandler), V8_PROPERTY_ATTRIBUTE_NONE);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -74,16 +74,35 @@ type
|
|||||||
var
|
var
|
||||||
JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm;
|
JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFv8Value, uMyV8Handler;
|
||||||
|
|
||||||
// The CEF3 document describing JavaScript integration is here :
|
// The CEF3 document describing JavaScript integration is here :
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
// The HTML file in this demo has a button that shows the result of 'window.myfunc()'
|
// The HTML file in this demo has a button that shows the result of 'window.myfunc()'
|
||||||
// which was set in the GlobalCEFApp.OnContextCreated event.
|
// which was set in the GlobalCEFApp.OnContextCreated event.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
var
|
||||||
|
TempHandler : ICefv8Handler;
|
||||||
|
TempFunction : ICefv8Value;
|
||||||
|
begin
|
||||||
|
// This is the JS Window Binding example with a function in the "JavaScript Integration" wiki page at
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
|
TempHandler := TMyV8Handler.Create;
|
||||||
|
TempFunction := TCefv8ValueRef.NewFunction('myfunc', TempHandler);
|
||||||
|
|
||||||
|
context.Global.SetValueByKey('myfunc', TempFunction, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSWindowBindingWithFunctionFrm.GoBtnClick(Sender: TObject);
|
procedure TJSWindowBindingWithFunctionFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.LoadURL(Edit1.Text);
|
Chromium1.LoadURL(Edit1.Text);
|
||||||
|
@ -41,18 +41,13 @@ program JSWindowBindingWithObject;
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
WinApi.Windows,
|
|
||||||
Vcl.Forms,
|
Vcl.Forms,
|
||||||
System.SysUtils,
|
WinApi.Windows,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Forms,
|
Forms,
|
||||||
Windows,
|
Windows,
|
||||||
SysUtils,
|
|
||||||
{$ENDIF }
|
{$ENDIF }
|
||||||
uCEFApplication,
|
uCEFApplication,
|
||||||
uCEFInterfaces,
|
|
||||||
uCEFv8Value,
|
|
||||||
uCEFConstants,
|
|
||||||
uJSWindowBindingWithObject in 'uJSWindowBindingWithObject.pas' {JSWindowBindingWithObjectFrm},
|
uJSWindowBindingWithObject in 'uJSWindowBindingWithObject.pas' {JSWindowBindingWithObjectFrm},
|
||||||
uMyV8Accessor in 'uMyV8Accessor.pas';
|
uMyV8Accessor in 'uMyV8Accessor.pas';
|
||||||
|
|
||||||
@ -61,21 +56,6 @@ uses
|
|||||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
||||||
var
|
|
||||||
TempAccessor : ICefV8Accessor;
|
|
||||||
TempObject : ICefv8Value;
|
|
||||||
begin
|
|
||||||
// This is the first JS Window Binding example in the "JavaScript Integration" wiki page at
|
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
|
||||||
|
|
||||||
TempAccessor := TMyV8Accessor.Create;
|
|
||||||
TempObject := TCefv8ValueRef.NewObject(TempAccessor, nil);
|
|
||||||
TempObject.SetValueByKey('myval', TCefv8ValueRef.NewString('My Value!'), V8_PROPERTY_ATTRIBUTE_NONE);
|
|
||||||
|
|
||||||
context.Global.SetValueByKey('myobj', TempObject, V8_PROPERTY_ATTRIBUTE_NONE);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GlobalCEFApp := TCefApplication.Create;
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||||
|
@ -100,6 +100,7 @@
|
|||||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||||
|
<BT_BuildType>Debug</BT_BuildType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
|
@ -74,16 +74,36 @@ type
|
|||||||
var
|
var
|
||||||
JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm;
|
JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm;
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFv8Value, uMyV8Accessor;
|
||||||
|
|
||||||
// The CEF3 document describing JavaScript integration is here :
|
// The CEF3 document describing JavaScript integration is here :
|
||||||
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
// The HTML file in this demo has a button that shows the contents of 'window.myobj.myval'
|
// The HTML file in this demo has a button that shows the contents of 'window.myobj.myval'
|
||||||
// which was set in the GlobalCEFApp.OnContextCreated event.
|
// which was set in the GlobalCEFApp.OnContextCreated event.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
|
var
|
||||||
|
TempAccessor : ICefV8Accessor;
|
||||||
|
TempObject : ICefv8Value;
|
||||||
|
begin
|
||||||
|
// This is the first JS Window Binding example in the "JavaScript Integration" wiki page at
|
||||||
|
// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md
|
||||||
|
|
||||||
|
TempAccessor := TMyV8Accessor.Create;
|
||||||
|
TempObject := TCefv8ValueRef.NewObject(TempAccessor, nil);
|
||||||
|
TempObject.SetValueByKey('myval', TCefv8ValueRef.NewString('My Value!'), V8_PROPERTY_ATTRIBUTE_NONE);
|
||||||
|
|
||||||
|
context.Global.SetValueByKey('myobj', TempObject, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJSWindowBindingWithObjectFrm.GoBtnClick(Sender: TObject);
|
procedure TJSWindowBindingWithObjectFrm.GoBtnClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Chromium1.LoadURL(Edit1.Text);
|
Chromium1.LoadURL(Edit1.Text);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<FrameworkType>VCL</FrameworkType>
|
<FrameworkType>VCL</FrameworkType>
|
||||||
<MainSource>MiniBrowser.dpr</MainSource>
|
<MainSource>MiniBrowser.dpr</MainSource>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
<Config Condition="'$(Config)'==''">Release</Config>
|
||||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||||
<TargetedPlatforms>1</TargetedPlatforms>
|
<TargetedPlatforms>1</TargetedPlatforms>
|
||||||
<AppType>Application</AppType>
|
<AppType>Application</AppType>
|
||||||
|
@ -9,23 +9,22 @@ package CEF4Delphi;
|
|||||||
{$EXTENDEDSYNTAX ON}
|
{$EXTENDEDSYNTAX ON}
|
||||||
{$IMPORTEDDATA ON}
|
{$IMPORTEDDATA ON}
|
||||||
{$IOCHECKS ON}
|
{$IOCHECKS ON}
|
||||||
{$LOCALSYMBOLS ON}
|
{$LOCALSYMBOLS OFF}
|
||||||
{$LONGSTRINGS ON}
|
{$LONGSTRINGS ON}
|
||||||
{$OPENSTRINGS ON}
|
{$OPENSTRINGS ON}
|
||||||
{$OPTIMIZATION OFF}
|
{$OPTIMIZATION ON}
|
||||||
{$OVERFLOWCHECKS OFF}
|
{$OVERFLOWCHECKS OFF}
|
||||||
{$RANGECHECKS OFF}
|
{$RANGECHECKS OFF}
|
||||||
{$REFERENCEINFO ON}
|
{$REFERENCEINFO OFF}
|
||||||
{$SAFEDIVIDE OFF}
|
{$SAFEDIVIDE OFF}
|
||||||
{$STACKFRAMES ON}
|
{$STACKFRAMES OFF}
|
||||||
{$TYPEDADDRESS OFF}
|
{$TYPEDADDRESS OFF}
|
||||||
{$VARSTRINGCHECKS ON}
|
{$VARSTRINGCHECKS ON}
|
||||||
{$WRITEABLECONST OFF}
|
{$WRITEABLECONST OFF}
|
||||||
{$MINENUMSIZE 1}
|
{$MINENUMSIZE 1}
|
||||||
{$IMAGEBASE $400000}
|
{$IMAGEBASE $400000}
|
||||||
{$DEFINE DEBUG}
|
{$DEFINE RELEASE}
|
||||||
{$ENDIF IMPLICITBUILDING}
|
{$ENDIF IMPLICITBUILDING}
|
||||||
{$DESCRIPTION 'CEF4Delphi'}
|
|
||||||
{$IMPLICITBUILD OFF}
|
{$IMPLICITBUILD OFF}
|
||||||
|
|
||||||
requires
|
requires
|
||||||
@ -157,6 +156,8 @@ contains
|
|||||||
uCEFGetExtensionResourceCallback in 'uCEFGetExtensionResourceCallback.pas',
|
uCEFGetExtensionResourceCallback in 'uCEFGetExtensionResourceCallback.pas',
|
||||||
uCEFExtension in 'uCEFExtension.pas',
|
uCEFExtension in 'uCEFExtension.pas',
|
||||||
uCEFExtensionHandler in 'uCEFExtensionHandler.pas',
|
uCEFExtensionHandler in 'uCEFExtensionHandler.pas',
|
||||||
uBufferPanel in 'uBufferPanel.pas';
|
uBufferPanel in 'uBufferPanel.pas',
|
||||||
|
uCEFApp in 'uCEFApp.pas';
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -39,6 +39,23 @@
|
|||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
<Base>true</Base>
|
<Base>true</Base>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
|
||||||
|
<Cfg_2_Win32>true</Cfg_2_Win32>
|
||||||
|
<CfgParent>Cfg_2</CfgParent>
|
||||||
|
<Cfg_2>true</Cfg_2>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Config)'=='Debug with optimization' or '$(Cfg_3)'!=''">
|
||||||
|
<Cfg_3>true</Cfg_3>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_3)'=='true') or '$(Cfg_3_Win32)'!=''">
|
||||||
|
<Cfg_3_Win32>true</Cfg_3_Win32>
|
||||||
|
<CfgParent>Cfg_3</CfgParent>
|
||||||
|
<Cfg_3>true</Cfg_3>
|
||||||
|
<Base>true</Base>
|
||||||
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Base)'!=''">
|
<PropertyGroup Condition="'$(Base)'!=''">
|
||||||
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
|
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
|
||||||
<GenPackage>true</GenPackage>
|
<GenPackage>true</GenPackage>
|
||||||
@ -90,6 +107,17 @@
|
|||||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||||
<DCC_DebugInformation>0</DCC_DebugInformation>
|
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Cfg_3_Win32)'!=''">
|
||||||
|
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||||
|
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||||
|
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||||
|
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||||
|
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DelphiCompile Include="$(MainSource)">
|
<DelphiCompile Include="$(MainSource)">
|
||||||
<MainSource>MainSource</MainSource>
|
<MainSource>MainSource</MainSource>
|
||||||
@ -221,17 +249,22 @@
|
|||||||
<DCCReference Include="uCEFExtension.pas"/>
|
<DCCReference Include="uCEFExtension.pas"/>
|
||||||
<DCCReference Include="uCEFExtensionHandler.pas"/>
|
<DCCReference Include="uCEFExtensionHandler.pas"/>
|
||||||
<DCCReference Include="uBufferPanel.pas"/>
|
<DCCReference Include="uBufferPanel.pas"/>
|
||||||
|
<DCCReference Include="uCEFApp.pas"/>
|
||||||
|
<BuildConfiguration Include="Base">
|
||||||
|
<Key>Base</Key>
|
||||||
|
</BuildConfiguration>
|
||||||
<BuildConfiguration Include="Release">
|
<BuildConfiguration Include="Release">
|
||||||
<Key>Cfg_2</Key>
|
<Key>Cfg_2</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
</BuildConfiguration>
|
</BuildConfiguration>
|
||||||
<BuildConfiguration Include="Base">
|
|
||||||
<Key>Base</Key>
|
|
||||||
</BuildConfiguration>
|
|
||||||
<BuildConfiguration Include="Debug">
|
<BuildConfiguration Include="Debug">
|
||||||
<Key>Cfg_1</Key>
|
<Key>Cfg_1</Key>
|
||||||
<CfgParent>Base</CfgParent>
|
<CfgParent>Base</CfgParent>
|
||||||
</BuildConfiguration>
|
</BuildConfiguration>
|
||||||
|
<BuildConfiguration Include="Debug with optimization">
|
||||||
|
<Key>Cfg_3</Key>
|
||||||
|
<CfgParent>Base</CfgParent>
|
||||||
|
</BuildConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||||
|
@ -154,6 +154,7 @@ contains
|
|||||||
uCEFGetExtensionResourceCallback in 'uCEFGetExtensionResourceCallback.pas',
|
uCEFGetExtensionResourceCallback in 'uCEFGetExtensionResourceCallback.pas',
|
||||||
uCEFExtension in 'uCEFExtension.pas',
|
uCEFExtension in 'uCEFExtension.pas',
|
||||||
uCEFExtensionHandler in 'uCEFExtensionHandler.pas',
|
uCEFExtensionHandler in 'uCEFExtensionHandler.pas',
|
||||||
uBufferPanel in 'uBufferPanel.pas';
|
uBufferPanel in 'uBufferPanel.pas',
|
||||||
|
uCEFApp in 'uCEFApp.pas';
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
248
source/uCEFApp.pas
Normal file
248
source/uCEFApp.pas
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 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 uCEFApp;
|
||||||
|
|
||||||
|
{$IFNDEF CPUX64}
|
||||||
|
{$ALIGN ON}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF DELPHI16_UP}
|
||||||
|
WinApi.Windows, System.Classes, System.UITypes,
|
||||||
|
{$ELSE}
|
||||||
|
Windows, Classes,
|
||||||
|
{$ENDIF}
|
||||||
|
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar, uCEFApplication;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefAppOwn = class(TCefBaseRefCountedOwn, ICefApp)
|
||||||
|
protected
|
||||||
|
procedure OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine); virtual; abstract;
|
||||||
|
procedure OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef); virtual; abstract;
|
||||||
|
procedure GetResourceBundleHandler(var aHandler : ICefResourceBundleHandler); virtual; abstract;
|
||||||
|
procedure GetBrowserProcessHandler(var aHandler : ICefBrowserProcessHandler); virtual; abstract;
|
||||||
|
procedure GetRenderProcessHandler(var aHandler : ICefRenderProcessHandler); virtual; abstract;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCustomCefApp = class(TCefAppOwn)
|
||||||
|
protected
|
||||||
|
FCefApp : TCefApplication;
|
||||||
|
|
||||||
|
procedure OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine); override;
|
||||||
|
procedure OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef); override;
|
||||||
|
procedure GetResourceBundleHandler(var aHandler : ICefResourceBundleHandler); override;
|
||||||
|
procedure GetBrowserProcessHandler(var aHandler : ICefBrowserProcessHandler); override;
|
||||||
|
procedure GetRenderProcessHandler(var aHandler : ICefRenderProcessHandler); override;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF DELPHI16_UP}
|
||||||
|
System.SysUtils,
|
||||||
|
{$ELSE}
|
||||||
|
SysUtils,
|
||||||
|
{$ENDIF}
|
||||||
|
uCEFLibFunctions, uCEFMiscFunctions, uCEFCommandLine, uCEFConstants;
|
||||||
|
|
||||||
|
|
||||||
|
// TCefAppOwn
|
||||||
|
|
||||||
|
procedure cef_app_on_before_command_line_processing(self: PCefApp;
|
||||||
|
const process_type: PCefString;
|
||||||
|
command_line: PCefCommandLine); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
||||||
|
TCefAppOwn(TempObject).OnBeforeCommandLineProcessing(CefString(process_type), TCefCommandLineRef.UnWrap(command_line));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure cef_app_on_register_custom_schemes(self: PCefApp; registrar: PCefSchemeRegistrar); stdcall;
|
||||||
|
var
|
||||||
|
TempWrapper : TCefSchemeRegistrarRef;
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
TempWrapper := nil;
|
||||||
|
|
||||||
|
try
|
||||||
|
try
|
||||||
|
TempWrapper := TCefSchemeRegistrarRef.Create(registrar);
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
||||||
|
TCefAppOwn(TempObject).OnRegisterCustomSchemes(TempWrapper);
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('cef_app_on_register_custom_schemes', e) then raise;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
if (TempWrapper <> nil) then FreeAndNil(TempWrapper);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function cef_app_get_resource_bundle_handler(self: PCefApp): PCefResourceBundleHandler; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
TempHandler : ICefResourceBundleHandler;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
TempHandler := nil;
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
||||||
|
begin
|
||||||
|
TCefAppOwn(TempObject).GetResourceBundleHandler(TempHandler);
|
||||||
|
Result := CefGetData(TempHandler);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function cef_app_get_browser_process_handler(self: PCefApp): PCefBrowserProcessHandler; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
TempHandler : ICefBrowserProcessHandler;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
TempHandler := nil;
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
||||||
|
begin
|
||||||
|
TCefAppOwn(TempObject).GetBrowserProcessHandler(TempHandler);
|
||||||
|
Result := CefGetData(TempHandler);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function cef_app_get_render_process_handler(self: PCefApp): PCefRenderProcessHandler; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
TempHandler : ICefRenderProcessHandler;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
TempHandler := nil;
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
||||||
|
begin
|
||||||
|
TCefAppOwn(TempObject).GetRenderProcessHandler(TempHandler);
|
||||||
|
Result := CefGetData(TempHandler);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TCefAppOwn.Create;
|
||||||
|
begin
|
||||||
|
inherited CreateData(SizeOf(TCefApp));
|
||||||
|
|
||||||
|
with PCefApp(FData)^ do
|
||||||
|
begin
|
||||||
|
on_before_command_line_processing := cef_app_on_before_command_line_processing;
|
||||||
|
on_register_custom_schemes := cef_app_on_register_custom_schemes;
|
||||||
|
get_resource_bundle_handler := cef_app_get_resource_bundle_handler;
|
||||||
|
get_browser_process_handler := cef_app_get_browser_process_handler;
|
||||||
|
get_render_process_handler := cef_app_get_render_process_handler;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
// TCustomCefApp
|
||||||
|
|
||||||
|
|
||||||
|
constructor TCustomCefApp.Create(const aCefApp : TCefApplication);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
|
FCefApp := aCefApp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TCustomCefApp.Destroy;
|
||||||
|
begin
|
||||||
|
FCefApp := nil;
|
||||||
|
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCefApp.OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnBeforeCommandLineProcessing(processType, commandLine);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCefApp.OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnRegisterCustomSchemes(registrar);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCefApp.GetResourceBundleHandler(var aHandler : ICefResourceBundleHandler);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then
|
||||||
|
FCefApp.Internal_CopyResourceBundleHandler(aHandler)
|
||||||
|
else
|
||||||
|
aHandler := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCefApp.GetBrowserProcessHandler(var aHandler : ICefBrowserProcessHandler);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then
|
||||||
|
FCefApp.Internal_CopyBrowserProcessHandler(aHandler)
|
||||||
|
else
|
||||||
|
aHandler := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomCefApp.GetRenderProcessHandler(var aHandler : ICefRenderProcessHandler);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then
|
||||||
|
FCefApp.Internal_CopyRenderProcessHandler(aHandler)
|
||||||
|
else
|
||||||
|
aHandler := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -52,8 +52,7 @@ uses
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
Windows, Classes,
|
Windows, Classes,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar,
|
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
|
||||||
uCEFBrowserProcessHandler, uCEFResourceBundleHandler, uCEFRenderProcessHandler;
|
|
||||||
|
|
||||||
const
|
const
|
||||||
CEF_SUPPORTED_VERSION_MAJOR = 3;
|
CEF_SUPPORTED_VERSION_MAJOR = 3;
|
||||||
@ -70,8 +69,6 @@ const
|
|||||||
CHROMEELF_DLL = 'chrome_elf.dll';
|
CHROMEELF_DLL = 'chrome_elf.dll';
|
||||||
|
|
||||||
type
|
type
|
||||||
TInternalApp = class;
|
|
||||||
|
|
||||||
TCefApplication = class
|
TCefApplication = class
|
||||||
protected
|
protected
|
||||||
FMustShutDown : boolean;
|
FMustShutDown : boolean;
|
||||||
@ -129,14 +126,14 @@ type
|
|||||||
FChromeVersionInfo : TFileVersionInfo;
|
FChromeVersionInfo : TFileVersionInfo;
|
||||||
FLibHandle : THandle;
|
FLibHandle : THandle;
|
||||||
FOnRegisterCustomSchemes : TOnRegisterCustomSchemes;
|
FOnRegisterCustomSchemes : TOnRegisterCustomSchemes;
|
||||||
FResourceBundleHandler : ICefResourceBundleHandler;
|
|
||||||
FBrowserProcessHandler : ICefBrowserProcessHandler;
|
|
||||||
FRenderProcessHandler : ICefRenderProcessHandler;
|
|
||||||
FAppSettings : TCefSettings;
|
FAppSettings : TCefSettings;
|
||||||
FDeviceScaleFactor : single;
|
FDeviceScaleFactor : single;
|
||||||
FCheckDevToolsResources : boolean;
|
FCheckDevToolsResources : boolean;
|
||||||
FDisableGPUCache : boolean;
|
FDisableGPUCache : boolean;
|
||||||
FProcessType : TCefProcessType;
|
FProcessType : TCefProcessType;
|
||||||
|
FResourceBundleHandler : ICefResourceBundleHandler;
|
||||||
|
FBrowserProcessHandler : ICefBrowserProcessHandler;
|
||||||
|
FRenderProcessHandler : ICefRenderProcessHandler;
|
||||||
|
|
||||||
// ICefBrowserProcessHandler
|
// ICefBrowserProcessHandler
|
||||||
FOnContextInitializedEvent : TOnContextInitializedEvent;
|
FOnContextInitializedEvent : TOnContextInitializedEvent;
|
||||||
@ -168,6 +165,12 @@ type
|
|||||||
function GetChromeVersion : string;
|
function GetChromeVersion : string;
|
||||||
function GetLibCefPath : string;
|
function GetLibCefPath : string;
|
||||||
function GetChromeElfPath : string;
|
function GetChromeElfPath : string;
|
||||||
|
function GetMustCreateResourceBundleHandler : boolean;
|
||||||
|
function GetMustCreateBrowserProcessHandler : boolean;
|
||||||
|
function GetMustCreateRenderProcessHandler : boolean;
|
||||||
|
function GetHasResourceBundleHandler : boolean;
|
||||||
|
function GetHasBrowserProcessHandler : boolean;
|
||||||
|
function GetHasRenderProcessHandler : boolean;
|
||||||
|
|
||||||
function LoadCEFlibrary : boolean; virtual;
|
function LoadCEFlibrary : boolean; virtual;
|
||||||
function Load_cef_app_capi_h : boolean;
|
function Load_cef_app_capi_h : boolean;
|
||||||
@ -224,9 +227,6 @@ type
|
|||||||
procedure ShowErrorMessageDlg(const aError : string); virtual;
|
procedure ShowErrorMessageDlg(const aError : string); virtual;
|
||||||
function ParseProcessType : TCefProcessType;
|
function ParseProcessType : TCefProcessType;
|
||||||
procedure CreateAppHandlers;
|
procedure CreateAppHandlers;
|
||||||
procedure CreateBrowserProcessHandler;
|
|
||||||
procedure CreateResourceBundleHandler;
|
|
||||||
procedure CreateRenderProcessHandler;
|
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
@ -241,9 +241,9 @@ type
|
|||||||
// ICefResourceBundleHandler and ICefRenderProcessHandler should use them.
|
// ICefResourceBundleHandler and ICefRenderProcessHandler should use them.
|
||||||
procedure Internal_OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
|
procedure Internal_OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
|
||||||
procedure Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
procedure Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
||||||
procedure Internal_OnGetResourceBundleHandler(var aCefResourceBundleHandler : ICefResourceBundleHandler);
|
procedure Internal_CopyRenderProcessHandler(var aHandler : ICefRenderProcessHandler);
|
||||||
procedure Internal_OnGetBrowserProcessHandler(var aCefBrowserProcessHandler : ICefBrowserProcessHandler);
|
procedure Internal_CopyResourceBundleHandler(var aHandler : ICefResourceBundleHandler);
|
||||||
procedure Internal_OnGetRenderProcessHandler(var aCefRenderProcessHandler : ICefRenderProcessHandler);
|
procedure Internal_CopyBrowserProcessHandler(var aHandler : ICefBrowserProcessHandler);
|
||||||
procedure Internal_OnContextInitialized;
|
procedure Internal_OnContextInitialized;
|
||||||
procedure Internal_OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
procedure Internal_OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
||||||
procedure Internal_OnRenderProcessThreadCreated(const extraInfo: ICefListValue);
|
procedure Internal_OnRenderProcessThreadCreated(const extraInfo: ICefListValue);
|
||||||
@ -323,6 +323,15 @@ type
|
|||||||
property LocalesRequired : ustring read FLocalesRequired write FLocalesRequired;
|
property LocalesRequired : ustring read FLocalesRequired write FLocalesRequired;
|
||||||
property CustomFlashPath : ustring read FCustomFlashPath write FCustomFlashPath;
|
property CustomFlashPath : ustring read FCustomFlashPath write FCustomFlashPath;
|
||||||
property ProcessType : TCefProcessType read FProcessType;
|
property ProcessType : TCefProcessType read FProcessType;
|
||||||
|
property MustCreateResourceBundleHandler : boolean read GetMustCreateResourceBundleHandler;
|
||||||
|
property MustCreateBrowserProcessHandler : boolean read GetMustCreateBrowserProcessHandler;
|
||||||
|
property MustCreateRenderProcessHandler : boolean read GetMustCreateRenderProcessHandler;
|
||||||
|
property HasResourceBundleHandler : boolean read GetHasResourceBundleHandler;
|
||||||
|
property HasBrowserProcessHandler : boolean read GetHasBrowserProcessHandler;
|
||||||
|
property HasRenderProcessHandler : boolean read GetHasRenderProcessHandler;
|
||||||
|
property ResourceBundleHandler : ICefResourceBundleHandler read FResourceBundleHandler write FResourceBundleHandler;
|
||||||
|
property BrowserProcessHandler : ICefBrowserProcessHandler read FBrowserProcessHandler write FBrowserProcessHandler;
|
||||||
|
property RenderProcessHandler : ICefRenderProcessHandler read FRenderProcessHandler write FRenderProcessHandler;
|
||||||
|
|
||||||
property OnRegCustomSchemes : TOnRegisterCustomSchemes read FOnRegisterCustomSchemes write FOnRegisterCustomSchemes;
|
property OnRegCustomSchemes : TOnRegisterCustomSchemes read FOnRegisterCustomSchemes write FOnRegisterCustomSchemes;
|
||||||
|
|
||||||
@ -350,80 +359,6 @@ type
|
|||||||
property OnProcessMessageReceived : TOnProcessMessageReceivedEvent read FOnProcessMessageReceived write FOnProcessMessageReceived;
|
property OnProcessMessageReceived : TOnProcessMessageReceivedEvent read FOnProcessMessageReceived write FOnProcessMessageReceived;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCefAppOwn = class(TCefBaseRefCountedOwn, ICefApp)
|
|
||||||
protected
|
|
||||||
procedure OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine); virtual; abstract;
|
|
||||||
procedure OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef); virtual; abstract;
|
|
||||||
function GetResourceBundleHandler: ICefResourceBundleHandler; virtual; abstract;
|
|
||||||
function GetBrowserProcessHandler: ICefBrowserProcessHandler; virtual; abstract;
|
|
||||||
function GetRenderProcessHandler: ICefRenderProcessHandler; virtual; abstract;
|
|
||||||
|
|
||||||
public
|
|
||||||
constructor Create; virtual;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TInternalApp = class(TCefAppOwn)
|
|
||||||
protected
|
|
||||||
FCefApp : TCefApplication;
|
|
||||||
|
|
||||||
procedure OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine); override;
|
|
||||||
procedure OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef); override;
|
|
||||||
function GetResourceBundleHandler: ICefResourceBundleHandler; override;
|
|
||||||
function GetBrowserProcessHandler: ICefBrowserProcessHandler; override;
|
|
||||||
function GetRenderProcessHandler: ICefRenderProcessHandler; override;
|
|
||||||
|
|
||||||
public
|
|
||||||
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
|
||||||
destructor Destroy; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TCefCustomBrowserProcessHandler = class(TCefBrowserProcessHandlerOwn)
|
|
||||||
protected
|
|
||||||
FCefApp : TCefApplication;
|
|
||||||
|
|
||||||
procedure OnContextInitialized; override;
|
|
||||||
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); override;
|
|
||||||
procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue); override;
|
|
||||||
procedure OnScheduleMessagePumpWork(const delayMs: Int64); override;
|
|
||||||
|
|
||||||
public
|
|
||||||
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
|
||||||
destructor Destroy; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TCefCustomResourceBundleHandler = class(TCefResourceBundleHandlerOwn)
|
|
||||||
protected
|
|
||||||
FCefApp : TCefApplication;
|
|
||||||
|
|
||||||
function GetLocalizedString(stringid: Integer; var stringVal: ustring): Boolean; override;
|
|
||||||
function GetDataResource(resourceId: Integer; var data: Pointer; var dataSize: NativeUInt): Boolean; override;
|
|
||||||
function GetDataResourceForScale(resourceId: Integer; scaleFactor: TCefScaleFactor; var data: Pointer; var dataSize: NativeUInt): Boolean; override;
|
|
||||||
|
|
||||||
public
|
|
||||||
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
|
||||||
destructor Destroy; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TCefCustomRenderProcessHandler = class(TCefRenderProcessHandlerOwn)
|
|
||||||
protected
|
|
||||||
FCefApp : TCefApplication;
|
|
||||||
|
|
||||||
procedure OnRenderThreadCreated(const extraInfo: ICefListValue); override;
|
|
||||||
procedure OnWebKitInitialized; override;
|
|
||||||
procedure OnBrowserCreated(const browser: ICefBrowser); override;
|
|
||||||
procedure OnBrowserDestroyed(const browser: ICefBrowser); override;
|
|
||||||
function OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; navigationType: TCefNavigationType; isRedirect: Boolean): Boolean; override;
|
|
||||||
procedure OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); override;
|
|
||||||
procedure OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); override;
|
|
||||||
procedure OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace); override;
|
|
||||||
procedure OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode); override;
|
|
||||||
function OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const aMessage : ICefProcessMessage): Boolean; override;
|
|
||||||
|
|
||||||
public
|
|
||||||
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
|
||||||
destructor Destroy; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
GlobalCEFApp : TCefApplication = nil;
|
GlobalCEFApp : TCefApplication = nil;
|
||||||
|
|
||||||
@ -436,7 +371,8 @@ uses
|
|||||||
Math, {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} SysUtils, Dialogs,
|
Math, {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} SysUtils, Dialogs,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFLibFunctions, uCEFMiscFunctions, uCEFCommandLine, uCEFConstants,
|
uCEFLibFunctions, uCEFMiscFunctions, uCEFCommandLine, uCEFConstants,
|
||||||
uCEFSchemeHandlerFactory, uCEFCookieManager;
|
uCEFSchemeHandlerFactory, uCEFCookieManager, uCEFApp,
|
||||||
|
uCEFBrowserProcessHandler, uCEFResourceBundleHandler, uCEFRenderProcessHandler;
|
||||||
|
|
||||||
constructor TCefApplication.Create;
|
constructor TCefApplication.Create;
|
||||||
begin
|
begin
|
||||||
@ -488,9 +424,6 @@ begin
|
|||||||
FFastUnload := False;
|
FFastUnload := False;
|
||||||
FDisableSafeBrowsing := False;
|
FDisableSafeBrowsing := False;
|
||||||
FOnRegisterCustomSchemes := nil;
|
FOnRegisterCustomSchemes := nil;
|
||||||
FResourceBundleHandler := nil;
|
|
||||||
FBrowserProcessHandler := nil;
|
|
||||||
FRenderProcessHandler := nil;
|
|
||||||
FEnableHighDPISupport := False;
|
FEnableHighDPISupport := False;
|
||||||
FMuteAudio := False;
|
FMuteAudio := False;
|
||||||
FReRaiseExceptions := False;
|
FReRaiseExceptions := False;
|
||||||
@ -502,6 +435,9 @@ begin
|
|||||||
FDisableGPUCache := False;
|
FDisableGPUCache := False;
|
||||||
FLocalesRequired := '';
|
FLocalesRequired := '';
|
||||||
FProcessType := ParseProcessType;
|
FProcessType := ParseProcessType;
|
||||||
|
FResourceBundleHandler := nil;
|
||||||
|
FBrowserProcessHandler := nil;
|
||||||
|
FRenderProcessHandler := nil;
|
||||||
|
|
||||||
// ICefBrowserProcessHandler
|
// ICefBrowserProcessHandler
|
||||||
FOnContextInitializedEvent := nil;
|
FOnContextInitializedEvent := nil;
|
||||||
@ -561,54 +497,6 @@ begin
|
|||||||
FCustomCommandLineValues := TStringList.Create;
|
FCustomCommandLineValues := TStringList.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.CreateAppHandlers;
|
|
||||||
begin
|
|
||||||
if FSingleProcess then
|
|
||||||
begin
|
|
||||||
CreateBrowserProcessHandler;
|
|
||||||
CreateResourceBundleHandler;
|
|
||||||
CreateRenderProcessHandler;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
case FProcessType of
|
|
||||||
ptBrowser :
|
|
||||||
begin
|
|
||||||
CreateBrowserProcessHandler;
|
|
||||||
CreateResourceBundleHandler;
|
|
||||||
end;
|
|
||||||
|
|
||||||
ptRenderer : CreateRenderProcessHandler;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefApplication.CreateBrowserProcessHandler;
|
|
||||||
begin
|
|
||||||
FBrowserProcessHandler := TCefCustomBrowserProcessHandler.Create(self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefApplication.CreateResourceBundleHandler;
|
|
||||||
begin
|
|
||||||
if assigned(FOnGetLocalizedStringEvent) or
|
|
||||||
assigned(FOnGetDataResourceEvent) or
|
|
||||||
assigned(FOnGetDataResourceForScaleEvent) then
|
|
||||||
FResourceBundleHandler := TCefCustomResourceBundleHandler.Create(self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefApplication.CreateRenderProcessHandler;
|
|
||||||
begin
|
|
||||||
if assigned(FOnRenderThreadCreated) or
|
|
||||||
assigned(FOnWebKitInitialized) or
|
|
||||||
assigned(FOnBrowserCreated) or
|
|
||||||
assigned(FOnBrowserDestroyed) or
|
|
||||||
assigned(FOnBeforeNavigation) or
|
|
||||||
assigned(FOnContextCreated) or
|
|
||||||
assigned(FOnContextReleased) or
|
|
||||||
assigned(FOnUncaughtException) or
|
|
||||||
assigned(FOnFocusedNodeChanged) or
|
|
||||||
assigned(FOnProcessMessageReceived) then
|
|
||||||
FRenderProcessHandler := TCefCustomRenderProcessHandler.Create(self);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefApplication.AddCustomCommandLine(const aCommandLine, aValue : string);
|
procedure TCefApplication.AddCustomCommandLine(const aCommandLine, aValue : string);
|
||||||
begin
|
begin
|
||||||
if (FCustomCommandLines <> nil) then FCustomCommandLines.Add(aCommandLine);
|
if (FCustomCommandLines <> nil) then FCustomCommandLines.Add(aCommandLine);
|
||||||
@ -628,7 +516,7 @@ begin
|
|||||||
|
|
||||||
if LoadCEFlibrary then
|
if LoadCEFlibrary then
|
||||||
begin
|
begin
|
||||||
TempApp := TInternalApp.Create(self);
|
TempApp := TCustomCefApp.Create(self);
|
||||||
Result := InitializeLibrary(TempApp);
|
Result := InitializeLibrary(TempApp);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -647,7 +535,7 @@ begin
|
|||||||
try
|
try
|
||||||
if CheckCEFLibrary and LoadCEFlibrary then
|
if CheckCEFLibrary and LoadCEFlibrary then
|
||||||
begin
|
begin
|
||||||
TempApp := TInternalApp.Create(self);
|
TempApp := TCustomCefApp.Create(self);
|
||||||
|
|
||||||
if (ExecuteProcess(TempApp) < 0) then
|
if (ExecuteProcess(TempApp) < 0) then
|
||||||
begin
|
begin
|
||||||
@ -819,7 +707,7 @@ begin
|
|||||||
try
|
try
|
||||||
if not(FSingleProcess) and LoadCEFlibrary then
|
if not(FSingleProcess) and LoadCEFlibrary then
|
||||||
begin
|
begin
|
||||||
TempApp := TInternalApp.Create(self);
|
TempApp := TCustomCefApp.Create(self);
|
||||||
Result := (ExecuteProcess(TempApp) >= 0);
|
Result := (ExecuteProcess(TempApp) >= 0);
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
@ -1043,6 +931,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCefApplication.CreateAppHandlers;
|
||||||
|
begin
|
||||||
|
if MustCreateBrowserProcessHandler then
|
||||||
|
FBrowserProcessHandler := TCefCustomBrowserProcessHandler.Create(self);
|
||||||
|
|
||||||
|
if MustCreateResourceBundleHandler then
|
||||||
|
FResourceBundleHandler := TCefCustomResourceBundleHandler.Create(self);
|
||||||
|
|
||||||
|
if MustCreateRenderProcessHandler then
|
||||||
|
FRenderProcessHandler := TCefCustomRenderProcessHandler.Create(self);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.Internal_OnContextInitialized;
|
procedure TCefApplication.Internal_OnContextInitialized;
|
||||||
begin
|
begin
|
||||||
InitializeCookies;
|
InitializeCookies;
|
||||||
@ -1109,7 +1009,10 @@ end;
|
|||||||
|
|
||||||
procedure TCefApplication.Internal_OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; navigationType: TCefNavigationType; isRedirect: Boolean; var aStopNavigation : boolean);
|
procedure TCefApplication.Internal_OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; navigationType: TCefNavigationType; isRedirect: Boolean; var aStopNavigation : boolean);
|
||||||
begin
|
begin
|
||||||
if assigned(FOnBeforeNavigation) then FOnBeforeNavigation(browser, frame, request, navigationType, isRedirect, aStopNavigation);
|
if assigned(FOnBeforeNavigation) then
|
||||||
|
FOnBeforeNavigation(browser, frame, request, navigationType, isRedirect, aStopNavigation)
|
||||||
|
else
|
||||||
|
aStopNavigation := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.Internal_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
procedure TCefApplication.Internal_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
@ -1134,7 +1037,10 @@ end;
|
|||||||
|
|
||||||
procedure TCefApplication.Internal_OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage; var aHandled : boolean);
|
procedure TCefApplication.Internal_OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage; var aHandled : boolean);
|
||||||
begin
|
begin
|
||||||
if assigned(FOnProcessMessageReceived) then FOnProcessMessageReceived(browser, sourceProcess, aMessage, aHandled);
|
if assigned(FOnProcessMessageReceived) then
|
||||||
|
FOnProcessMessageReceived(browser, sourceProcess, aMessage, aHandled)
|
||||||
|
else
|
||||||
|
aHandled := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.Internal_OnBeforeCommandLineProcessing(const processType : ustring;
|
procedure TCefApplication.Internal_OnBeforeCommandLineProcessing(const processType : ustring;
|
||||||
@ -1220,19 +1126,76 @@ begin
|
|||||||
if assigned(FOnRegisterCustomSchemes) then FOnRegisterCustomSchemes(registrar);
|
if assigned(FOnRegisterCustomSchemes) then FOnRegisterCustomSchemes(registrar);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.Internal_OnGetResourceBundleHandler(var aCefResourceBundleHandler : ICefResourceBundleHandler);
|
procedure TCefApplication.Internal_CopyRenderProcessHandler(var aHandler : ICefRenderProcessHandler);
|
||||||
begin
|
begin
|
||||||
if (FResourceBundleHandler <> nil) then aCefResourceBundleHandler := FResourceBundleHandler;
|
if (FRenderProcessHandler <> nil) then
|
||||||
|
aHandler := FRenderProcessHandler
|
||||||
|
else
|
||||||
|
aHandler := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.Internal_OnGetBrowserProcessHandler(var aCefBrowserProcessHandler : ICefBrowserProcessHandler);
|
procedure TCefApplication.Internal_CopyResourceBundleHandler(var aHandler : ICefResourceBundleHandler);
|
||||||
begin
|
begin
|
||||||
if (FBrowserProcessHandler <> nil) then aCefBrowserProcessHandler := FBrowserProcessHandler;
|
if (FResourceBundleHandler <> nil) then
|
||||||
|
aHandler := FResourceBundleHandler
|
||||||
|
else
|
||||||
|
aHandler := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefApplication.Internal_OnGetRenderProcessHandler(var aCefRenderProcessHandler : ICefRenderProcessHandler);
|
procedure TCefApplication.Internal_CopyBrowserProcessHandler(var aHandler : ICefBrowserProcessHandler);
|
||||||
begin
|
begin
|
||||||
if (FRenderProcessHandler <> nil) then aCefRenderProcessHandler := FRenderProcessHandler;
|
if (FBrowserProcessHandler <> nil) then
|
||||||
|
aHandler := FBrowserProcessHandler
|
||||||
|
else
|
||||||
|
aHandler := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefApplication.GetMustCreateResourceBundleHandler : boolean;
|
||||||
|
begin
|
||||||
|
Result := not(HasResourceBundleHandler) and
|
||||||
|
(FSingleProcess or
|
||||||
|
((FProcessType = ptBrowser) and
|
||||||
|
(assigned(FOnGetLocalizedStringEvent) or
|
||||||
|
assigned(FOnGetDataResourceEvent) or
|
||||||
|
assigned(FOnGetDataResourceForScaleEvent))));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefApplication.GetMustCreateBrowserProcessHandler : boolean;
|
||||||
|
begin
|
||||||
|
Result := not(HasBrowserProcessHandler) and
|
||||||
|
(FSingleProcess or (FProcessType = ptBrowser));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefApplication.GetMustCreateRenderProcessHandler : boolean;
|
||||||
|
begin
|
||||||
|
Result := not(HasRenderProcessHandler) and
|
||||||
|
(FSingleProcess or
|
||||||
|
((FProcessType = ptRenderer) and
|
||||||
|
(assigned(FOnRenderThreadCreated) or
|
||||||
|
assigned(FOnWebKitInitialized) or
|
||||||
|
assigned(FOnBrowserCreated) or
|
||||||
|
assigned(FOnBrowserDestroyed) or
|
||||||
|
assigned(FOnBeforeNavigation) or
|
||||||
|
assigned(FOnContextCreated) or
|
||||||
|
assigned(FOnContextReleased) or
|
||||||
|
assigned(FOnUncaughtException) or
|
||||||
|
assigned(FOnFocusedNodeChanged) or
|
||||||
|
assigned(FOnProcessMessageReceived))));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefApplication.GetHasResourceBundleHandler : boolean;
|
||||||
|
begin
|
||||||
|
Result := (FResourceBundleHandler <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefApplication.GetHasBrowserProcessHandler : boolean;
|
||||||
|
begin
|
||||||
|
Result := (FBrowserProcessHandler <> nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefApplication.GetHasRenderProcessHandler : boolean;
|
||||||
|
begin
|
||||||
|
Result := (FRenderProcessHandler <> nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefApplication.LoadCEFlibrary : boolean;
|
function TCefApplication.LoadCEFlibrary : boolean;
|
||||||
@ -1844,307 +1807,4 @@ begin
|
|||||||
assigned(cef_trace_event_async_end);
|
assigned(cef_trace_event_async_end);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
// TCefAppOwn
|
|
||||||
|
|
||||||
procedure cef_app_on_before_command_line_processing(self: PCefApp;
|
|
||||||
const process_type: PCefString;
|
|
||||||
command_line: PCefCommandLine); stdcall;
|
|
||||||
var
|
|
||||||
TempObject : TObject;
|
|
||||||
begin
|
|
||||||
TempObject := CefGetObject(self);
|
|
||||||
|
|
||||||
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
|
||||||
TCefAppOwn(TempObject).OnBeforeCommandLineProcessing(CefString(process_type), TCefCommandLineRef.UnWrap(command_line));
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure cef_app_on_register_custom_schemes(self: PCefApp; registrar: PCefSchemeRegistrar); stdcall;
|
|
||||||
var
|
|
||||||
TempWrapper : TCefSchemeRegistrarRef;
|
|
||||||
TempObject : TObject;
|
|
||||||
begin
|
|
||||||
TempWrapper := nil;
|
|
||||||
|
|
||||||
try
|
|
||||||
try
|
|
||||||
TempWrapper := TCefSchemeRegistrarRef.Create(registrar);
|
|
||||||
TempObject := CefGetObject(self);
|
|
||||||
|
|
||||||
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
|
||||||
TCefAppOwn(TempObject).OnRegisterCustomSchemes(TempWrapper);
|
|
||||||
except
|
|
||||||
on e : exception do
|
|
||||||
if CustomExceptionHandler('cef_app_on_register_custom_schemes', e) then raise;
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
if (TempWrapper <> nil) then FreeAndNil(TempWrapper);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function cef_app_get_resource_bundle_handler(self: PCefApp): PCefResourceBundleHandler; stdcall;
|
|
||||||
var
|
|
||||||
TempObject : TObject;
|
|
||||||
begin
|
|
||||||
TempObject := CefGetObject(self);
|
|
||||||
|
|
||||||
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
|
||||||
Result := CefGetData(TCefAppOwn(TempObject).GetResourceBundleHandler)
|
|
||||||
else
|
|
||||||
Result := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function cef_app_get_browser_process_handler(self: PCefApp): PCefBrowserProcessHandler; stdcall;
|
|
||||||
var
|
|
||||||
TempObject : TObject;
|
|
||||||
begin
|
|
||||||
TempObject := CefGetObject(self);
|
|
||||||
|
|
||||||
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
|
||||||
Result := CefGetData(TCefAppOwn(TempObject).GetBrowserProcessHandler)
|
|
||||||
else
|
|
||||||
Result := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function cef_app_get_render_process_handler(self: PCefApp): PCefRenderProcessHandler; stdcall;
|
|
||||||
var
|
|
||||||
TempObject : TObject;
|
|
||||||
begin
|
|
||||||
TempObject := CefGetObject(self);
|
|
||||||
|
|
||||||
if (TempObject <> nil) and (TempObject is TCefAppOwn) then
|
|
||||||
Result := CefGetData(TCefAppOwn(TempObject).GetRenderProcessHandler)
|
|
||||||
else
|
|
||||||
Result := nil;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
constructor TCefAppOwn.Create;
|
|
||||||
begin
|
|
||||||
inherited CreateData(SizeOf(TCefApp));
|
|
||||||
|
|
||||||
with PCefApp(FData)^ do
|
|
||||||
begin
|
|
||||||
on_before_command_line_processing := cef_app_on_before_command_line_processing;
|
|
||||||
on_register_custom_schemes := cef_app_on_register_custom_schemes;
|
|
||||||
get_resource_bundle_handler := cef_app_get_resource_bundle_handler;
|
|
||||||
get_browser_process_handler := cef_app_get_browser_process_handler;
|
|
||||||
get_render_process_handler := cef_app_get_render_process_handler;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// TInternalApp
|
|
||||||
|
|
||||||
procedure TInternalApp.OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnBeforeCommandLineProcessing(processType, commandLine);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TInternalApp.OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnRegisterCustomSchemes(registrar);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TInternalApp.GetResourceBundleHandler: ICefResourceBundleHandler;
|
|
||||||
begin
|
|
||||||
Result := nil;
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnGetResourceBundleHandler(Result);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TInternalApp.GetBrowserProcessHandler: ICefBrowserProcessHandler;
|
|
||||||
begin
|
|
||||||
Result := nil;
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnGetBrowserProcessHandler(Result);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TInternalApp.GetRenderProcessHandler: ICefRenderProcessHandler;
|
|
||||||
begin
|
|
||||||
Result := nil;
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnGetRenderProcessHandler(Result);
|
|
||||||
end;
|
|
||||||
|
|
||||||
constructor TInternalApp.Create(const aCefApp : TCefApplication);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
|
|
||||||
FCefApp := aCefApp;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TInternalApp.Destroy;
|
|
||||||
begin
|
|
||||||
FCefApp := nil;
|
|
||||||
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// TCefCustomBrowserProcessHandler
|
|
||||||
|
|
||||||
constructor TCefCustomBrowserProcessHandler.Create(const aCefApp : TCefApplication);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
|
|
||||||
FCefApp := aCefApp;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TCefCustomBrowserProcessHandler.Destroy;
|
|
||||||
begin
|
|
||||||
FCefApp := nil;
|
|
||||||
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomBrowserProcessHandler.OnContextInitialized;
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnContextInitialized;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomBrowserProcessHandler.OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnBeforeChildProcessLaunch(commandLine);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomBrowserProcessHandler.OnRenderProcessThreadCreated(const extraInfo: ICefListValue);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnRenderProcessThreadCreated(extraInfo);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomBrowserProcessHandler.OnScheduleMessagePumpWork(const delayMs: Int64);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnScheduleMessagePumpWork(delayMs);
|
|
||||||
end;
|
|
||||||
|
|
||||||
// TCefCustomResourceBundleHandler
|
|
||||||
|
|
||||||
constructor TCefCustomResourceBundleHandler.Create(const aCefApp : TCefApplication);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
|
|
||||||
FCefApp := aCefApp;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TCefCustomResourceBundleHandler.Destroy;
|
|
||||||
begin
|
|
||||||
FCefApp := nil;
|
|
||||||
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCefCustomResourceBundleHandler.GetLocalizedString(stringid : Integer;
|
|
||||||
var stringVal : ustring): Boolean;
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then
|
|
||||||
Result := FCefApp.Internal_GetLocalizedString(stringid, stringVal)
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCefCustomResourceBundleHandler.GetDataResource(resourceId : Integer;
|
|
||||||
var data : Pointer;
|
|
||||||
var dataSize : NativeUInt): Boolean;
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then
|
|
||||||
Result := FCefApp.Internal_GetDataResource(resourceId, data, dataSize)
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCefCustomResourceBundleHandler.GetDataResourceForScale(resourceId : Integer;
|
|
||||||
scaleFactor : TCefScaleFactor;
|
|
||||||
var data : Pointer;
|
|
||||||
var dataSize : NativeUInt): Boolean;
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then
|
|
||||||
Result := FCefApp.Internal_GetDataResourceForScale(resourceId, scaleFactor, data, dataSize)
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// TCefCustomRenderProcessHandler
|
|
||||||
|
|
||||||
constructor TCefCustomRenderProcessHandler.Create(const aCefApp : TCefApplication);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
|
|
||||||
FCefApp := aCefApp;
|
|
||||||
end;
|
|
||||||
|
|
||||||
destructor TCefCustomRenderProcessHandler.Destroy;
|
|
||||||
begin
|
|
||||||
FCefApp := nil;
|
|
||||||
|
|
||||||
inherited Destroy;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnRenderThreadCreated(const extraInfo: ICefListValue);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnRenderThreadCreated(extraInfo);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnWebKitInitialized;
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnWebKitInitialized;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnBrowserCreated(const browser: ICefBrowser);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnBrowserCreated(browser);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnBrowserDestroyed(const browser: ICefBrowser);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnBrowserDestroyed(browser);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCefCustomRenderProcessHandler.OnBeforeNavigation(const browser : ICefBrowser;
|
|
||||||
const frame : ICefFrame;
|
|
||||||
const request : ICefRequest;
|
|
||||||
navigationType : TCefNavigationType;
|
|
||||||
isRedirect : Boolean): Boolean;
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then
|
|
||||||
FCefApp.Internal_OnBeforeNavigation(browser, frame, request, navigationType, isRedirect, Result)
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnContextCreated(const browser : ICefBrowser;
|
|
||||||
const frame : ICefFrame;
|
|
||||||
const context : ICefv8Context);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnContextCreated(browser, frame, context);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnContextReleased(const browser : ICefBrowser;
|
|
||||||
const frame : ICefFrame;
|
|
||||||
const context : ICefv8Context);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnContextReleased(browser, frame, context);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnUncaughtException(const browser : ICefBrowser;
|
|
||||||
const frame : ICefFrame;
|
|
||||||
const context : ICefv8Context;
|
|
||||||
const exception : ICefV8Exception;
|
|
||||||
const stackTrace : ICefV8StackTrace);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnUncaughtException(browser, frame, context, exception, stackTrace);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefCustomRenderProcessHandler.OnFocusedNodeChanged(const browser : ICefBrowser;
|
|
||||||
const frame : ICefFrame;
|
|
||||||
const node : ICefDomNode);
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then FCefApp.Internal_OnFocusedNodeChanged(browser, frame, node);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCefCustomRenderProcessHandler.OnProcessMessageReceived(const browser : ICefBrowser;
|
|
||||||
sourceProcess : TCefProcessId;
|
|
||||||
const aMessage : ICefProcessMessage): Boolean;
|
|
||||||
begin
|
|
||||||
if (FCefApp <> nil) then
|
|
||||||
FCefApp.Internal_OnProcessMessageReceived(browser, sourceProcess, aMessage, Result)
|
|
||||||
else
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -55,7 +55,7 @@ type
|
|||||||
FData: Pointer;
|
FData: Pointer;
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor CreateData(size: Cardinal; owned: Boolean = False); virtual;
|
constructor CreateData(size: Cardinal; owned : boolean = False); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
function Wrap: Pointer;
|
function Wrap: Pointer;
|
||||||
end;
|
end;
|
||||||
@ -88,7 +88,7 @@ begin
|
|||||||
TCefBaseRefCountedOwn(TempObject)._AddRef;
|
TCefBaseRefCountedOwn(TempObject)._AddRef;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function cef_base_release(self: PCefBaseRefCounted): Integer; stdcall;
|
function cef_base_release_ref(self: PCefBaseRefCounted): Integer; stdcall;
|
||||||
var
|
var
|
||||||
TempObject : TObject;
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
@ -127,7 +127,7 @@ begin
|
|||||||
Result := 1;
|
Result := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCefBaseRefCountedOwn.CreateData(size: Cardinal; owned: Boolean);
|
constructor TCefBaseRefCountedOwn.CreateData(size: Cardinal; owned : boolean);
|
||||||
begin
|
begin
|
||||||
GetMem(FData, size + SizeOf(Pointer));
|
GetMem(FData, size + SizeOf(Pointer));
|
||||||
PPointer(FData)^ := Self;
|
PPointer(FData)^ := Self;
|
||||||
@ -144,7 +144,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
PCefBaseRefCounted(FData)^.add_ref := cef_base_add_ref;
|
PCefBaseRefCounted(FData)^.add_ref := cef_base_add_ref;
|
||||||
PCefBaseRefCounted(FData)^.release := cef_base_release;
|
PCefBaseRefCounted(FData)^.release := cef_base_release_ref;
|
||||||
PCefBaseRefCounted(FData)^.has_one_ref := cef_base_has_one_ref;
|
PCefBaseRefCounted(FData)^.has_one_ref := cef_base_has_one_ref;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -47,48 +47,93 @@ unit uCEFBrowserProcessHandler;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFApplication;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCefBrowserProcessHandlerOwn = class(TCefBaseRefCountedOwn, ICefBrowserProcessHandler)
|
TCefBrowserProcessHandlerOwn = class(TCefBaseRefCountedOwn, ICefBrowserProcessHandler)
|
||||||
protected
|
protected
|
||||||
procedure OnContextInitialized; virtual;
|
procedure OnContextInitialized; virtual; abstract;
|
||||||
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); virtual;
|
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); virtual; abstract;
|
||||||
procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue); virtual;
|
procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue); virtual; abstract;
|
||||||
procedure OnScheduleMessagePumpWork(const delayMs: Int64); virtual;
|
function GetPrintHandler : ICefPrintHandler; virtual;
|
||||||
|
procedure OnScheduleMessagePumpWork(const delayMs: Int64); virtual; abstract;
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TCefCustomBrowserProcessHandler = class(TCefBrowserProcessHandlerOwn)
|
||||||
|
protected
|
||||||
|
FCefApp : TCefApplication;
|
||||||
|
|
||||||
|
procedure OnContextInitialized; override;
|
||||||
|
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); override;
|
||||||
|
procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue); override;
|
||||||
|
procedure OnScheduleMessagePumpWork(const delayMs: Int64); override;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFCommandLine, uCEFListValue;
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFCommandLine, uCEFListValue, uCEFConstants;
|
||||||
|
|
||||||
procedure cef_browser_process_handler_on_context_initialized(self: PCefBrowserProcessHandler); stdcall;
|
procedure cef_browser_process_handler_on_context_initialized(self: PCefBrowserProcessHandler); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefBrowserProcessHandlerOwn(CefGetObject(self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnContextInitialized;
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefBrowserProcessHandlerOwn) then
|
||||||
|
TCefBrowserProcessHandlerOwn(TempObject).OnContextInitialized;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_browser_process_handler_on_before_child_process_launch(
|
procedure cef_browser_process_handler_on_before_child_process_launch(self : PCefBrowserProcessHandler;
|
||||||
self: PCefBrowserProcessHandler; command_line: PCefCommandLine); stdcall;
|
command_line : PCefCommandLine); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefBrowserProcessHandlerOwn(CefGetObject(self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnBeforeChildProcessLaunch(TCefCommandLineRef.UnWrap(command_line));
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefBrowserProcessHandlerOwn) then
|
||||||
|
TCefBrowserProcessHandlerOwn(TempObject).OnBeforeChildProcessLaunch(TCefCommandLineRef.UnWrap(command_line));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_browser_process_handler_on_render_process_thread_created(
|
procedure cef_browser_process_handler_on_render_process_thread_created(self : PCefBrowserProcessHandler;
|
||||||
self: PCefBrowserProcessHandler; extra_info: PCefListValue); stdcall;
|
extra_info : PCefListValue); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefBrowserProcessHandlerOwn(CefGetObject(self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnRenderProcessThreadCreated(TCefListValueRef.UnWrap(extra_info));
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefBrowserProcessHandlerOwn) then
|
||||||
|
TCefBrowserProcessHandlerOwn(TempObject).OnRenderProcessThreadCreated(TCefListValueRef.UnWrap(extra_info));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_browser_process_handler_on_schedule_message_pump_work(self: PCefBrowserProcessHandler; delay_ms: Int64); stdcall;
|
function cef_browser_process_handler_get_print_handler(self: PCefBrowserProcessHandler): PCefPrintHandler; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
TCefBrowserProcessHandlerOwn(CefGetObject(self)).OnScheduleMessagePumpWork(delay_ms);
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefBrowserProcessHandlerOwn) then
|
||||||
|
Result := CefGetData(TCefBrowserProcessHandlerOwn(TempObject).GetPrintHandler)
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure cef_browser_process_handler_on_schedule_message_pump_work(self : PCefBrowserProcessHandler;
|
||||||
|
delay_ms : Int64); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefBrowserProcessHandlerOwn) then
|
||||||
|
TCefBrowserProcessHandlerOwn(TempObject).OnScheduleMessagePumpWork(delay_ms);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCefBrowserProcessHandlerOwn.Create;
|
constructor TCefBrowserProcessHandlerOwn.Create;
|
||||||
@ -100,29 +145,52 @@ begin
|
|||||||
on_context_initialized := cef_browser_process_handler_on_context_initialized;
|
on_context_initialized := cef_browser_process_handler_on_context_initialized;
|
||||||
on_before_child_process_launch := cef_browser_process_handler_on_before_child_process_launch;
|
on_before_child_process_launch := cef_browser_process_handler_on_before_child_process_launch;
|
||||||
on_render_process_thread_created := cef_browser_process_handler_on_render_process_thread_created;
|
on_render_process_thread_created := cef_browser_process_handler_on_render_process_thread_created;
|
||||||
get_print_handler := nil; // linux
|
get_print_handler := cef_browser_process_handler_get_print_handler;
|
||||||
on_schedule_message_pump_work := cef_browser_process_handler_on_schedule_message_pump_work;
|
on_schedule_message_pump_work := cef_browser_process_handler_on_schedule_message_pump_work;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefBrowserProcessHandlerOwn.OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
function TCefBrowserProcessHandlerOwn.GetPrintHandler : ICefPrintHandler;
|
||||||
begin
|
begin
|
||||||
|
Result := nil; // only linux
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefBrowserProcessHandlerOwn.OnContextInitialized;
|
|
||||||
begin
|
|
||||||
|
|
||||||
|
// TCefCustomBrowserProcessHandler
|
||||||
|
|
||||||
|
|
||||||
|
constructor TCefCustomBrowserProcessHandler.Create(const aCefApp : TCefApplication);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
|
FCefApp := aCefApp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefBrowserProcessHandlerOwn.OnRenderProcessThreadCreated(const extraInfo: ICefListValue);
|
destructor TCefCustomBrowserProcessHandler.Destroy;
|
||||||
begin
|
begin
|
||||||
|
FCefApp := nil;
|
||||||
|
|
||||||
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefBrowserProcessHandlerOwn.OnScheduleMessagePumpWork(const delayMs: Int64);
|
procedure TCefCustomBrowserProcessHandler.OnContextInitialized;
|
||||||
begin
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnContextInitialized;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomBrowserProcessHandler.OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnBeforeChildProcessLaunch(commandLine);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomBrowserProcessHandler.OnRenderProcessThreadCreated(const extraInfo: ICefListValue);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnRenderProcessThreadCreated(extraInfo);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomBrowserProcessHandler.OnScheduleMessagePumpWork(const delayMs: Int64);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnScheduleMessagePumpWork(delayMs);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -92,7 +92,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefDragHandlerOwn.Create;
|
constructor TCefDragHandlerOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefDragHandler), False);
|
CreateData(SizeOf(TCefDragHandler));
|
||||||
with PCefDragHandler(FData)^ do
|
with PCefDragHandler(FData)^ do
|
||||||
begin
|
begin
|
||||||
on_drag_enter := cef_drag_handler_on_drag_enter;
|
on_drag_enter := cef_drag_handler_on_drag_enter;
|
||||||
|
@ -82,7 +82,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefFindHandlerOwn.Create;
|
constructor TCefFindHandlerOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefFindHandler), False);
|
CreateData(SizeOf(TCefFindHandler));
|
||||||
|
|
||||||
with PCefFindHandler(FData)^ do on_find_result := cef_find_handler_on_find_result;
|
with PCefFindHandler(FData)^ do on_find_result := cef_find_handler_on_find_result;
|
||||||
end;
|
end;
|
||||||
|
@ -101,6 +101,7 @@ type
|
|||||||
ICefExtensionHandler = interface;
|
ICefExtensionHandler = interface;
|
||||||
ICefExtension = interface;
|
ICefExtension = interface;
|
||||||
ICefStreamReader = interface;
|
ICefStreamReader = interface;
|
||||||
|
ICefLoadHandler = interface;
|
||||||
|
|
||||||
TCefv8ValueArray = array of ICefv8Value;
|
TCefv8ValueArray = array of ICefv8Value;
|
||||||
TCefX509CertificateArray = array of ICefX509Certificate;
|
TCefX509CertificateArray = array of ICefX509Certificate;
|
||||||
@ -828,13 +829,6 @@ type
|
|||||||
count, total: Integer; out deleteCookie: Boolean): Boolean;
|
count, total: Integer; out deleteCookie: Boolean): Boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ICefResourceBundleHandler = interface(ICefBaseRefCounted)
|
|
||||||
['{09C264FD-7E03-41E3-87B3-4234E82B5EA2}']
|
|
||||||
function GetLocalizedString(stringId: Integer; var stringVal: ustring): Boolean;
|
|
||||||
function GetDataResource(resourceId: Integer; var data: Pointer; var dataSize: NativeUInt): Boolean;
|
|
||||||
function GetDataResourceForScale(resourceId: Integer; scaleFactor: TCefScaleFactor; var data: Pointer; var dataSize: NativeUInt): Boolean;
|
|
||||||
end;
|
|
||||||
|
|
||||||
ICefCommandLine = interface(ICefBaseRefCounted)
|
ICefCommandLine = interface(ICefBaseRefCounted)
|
||||||
['{6B43D21B-0F2C-4B94-B4E6-4AF0D7669D8E}']
|
['{6B43D21B-0F2C-4B94-B4E6-4AF0D7669D8E}']
|
||||||
function IsValid: Boolean;
|
function IsValid: Boolean;
|
||||||
@ -860,11 +854,19 @@ type
|
|||||||
property CommandLineString: ustring read GetCommandLineString;
|
property CommandLineString: ustring read GetCommandLineString;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ICefResourceBundleHandler = interface(ICefBaseRefCounted)
|
||||||
|
['{09C264FD-7E03-41E3-87B3-4234E82B5EA2}']
|
||||||
|
function GetLocalizedString(stringId: Integer; var stringVal: ustring): Boolean;
|
||||||
|
function GetDataResource(resourceId: Integer; var data: Pointer; var dataSize: NativeUInt): Boolean;
|
||||||
|
function GetDataResourceForScale(resourceId: Integer; scaleFactor: TCefScaleFactor; var data: Pointer; var dataSize: NativeUInt): Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
ICefBrowserProcessHandler = interface(ICefBaseRefCounted)
|
ICefBrowserProcessHandler = interface(ICefBaseRefCounted)
|
||||||
['{27291B7A-C0AE-4EE0-9115-15C810E22F6C}']
|
['{27291B7A-C0AE-4EE0-9115-15C810E22F6C}']
|
||||||
procedure OnContextInitialized;
|
procedure OnContextInitialized;
|
||||||
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
||||||
procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue);
|
procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue);
|
||||||
|
function GetPrintHandler : ICefPrintHandler;
|
||||||
procedure OnScheduleMessagePumpWork(const delayMs: Int64);
|
procedure OnScheduleMessagePumpWork(const delayMs: Int64);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -874,20 +876,22 @@ type
|
|||||||
procedure OnWebKitInitialized;
|
procedure OnWebKitInitialized;
|
||||||
procedure OnBrowserCreated(const browser: ICefBrowser);
|
procedure OnBrowserCreated(const browser: ICefBrowser);
|
||||||
procedure OnBrowserDestroyed(const browser: ICefBrowser);
|
procedure OnBrowserDestroyed(const browser: ICefBrowser);
|
||||||
|
function GetLoadHandler : ICefLoadHandler;
|
||||||
|
function OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; navigationType: TCefNavigationType; isRedirect: Boolean): Boolean;
|
||||||
procedure OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
procedure OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
procedure OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
procedure OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||||
procedure OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace);
|
procedure OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace);
|
||||||
procedure OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
|
procedure OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
|
||||||
function OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean;
|
function OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage): Boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
ICefApp = interface(ICefBaseRefCounted)
|
ICefApp = interface(ICefBaseRefCounted)
|
||||||
['{970CA670-9070-4642-B188-7D8A22DAEED4}']
|
['{970CA670-9070-4642-B188-7D8A22DAEED4}']
|
||||||
procedure OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
|
procedure OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
|
||||||
procedure OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
procedure OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
||||||
function GetResourceBundleHandler: ICefResourceBundleHandler;
|
procedure GetResourceBundleHandler(var aHandler : ICefResourceBundleHandler);
|
||||||
function GetBrowserProcessHandler: ICefBrowserProcessHandler;
|
procedure GetBrowserProcessHandler(var aHandler : ICefBrowserProcessHandler);
|
||||||
function GetRenderProcessHandler: ICefRenderProcessHandler;
|
procedure GetRenderProcessHandler(var aHandler : ICefRenderProcessHandler);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCefCookieVisitorProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(
|
TCefCookieVisitorProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(
|
||||||
|
@ -119,7 +119,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefMenuModelDelegateOwn.Create;
|
constructor TCefMenuModelDelegateOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefMenuModelDelegate), False);
|
CreateData(SizeOf(TCefMenuModelDelegate));
|
||||||
|
|
||||||
with PCefMenuModelDelegate(FData)^ do
|
with PCefMenuModelDelegate(FData)^ do
|
||||||
begin
|
begin
|
||||||
|
@ -83,7 +83,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefNavigationEntryVisitorOwn.Create;
|
constructor TCefNavigationEntryVisitorOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefNavigationEntryVisitor), False);
|
CreateData(SizeOf(TCefNavigationEntryVisitor));
|
||||||
with PCefNavigationEntryVisitor(FData)^ do
|
with PCefNavigationEntryVisitor(FData)^ do
|
||||||
visit := cef_navigation_entry_visitor_visit;
|
visit := cef_navigation_entry_visitor_visit;
|
||||||
end;
|
end;
|
||||||
|
@ -90,7 +90,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefPdfPrintCallbackOwn.Create;
|
constructor TCefPdfPrintCallbackOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefPdfPrintCallback), False);
|
CreateData(SizeOf(TCefPdfPrintCallback));
|
||||||
|
|
||||||
PCefPdfPrintCallback(FData).on_pdf_print_finished := cef_pdf_print_callback_on_pdf_print_finished;
|
PCefPdfPrintCallback(FData).on_pdf_print_finished := cef_pdf_print_callback_on_pdf_print_finished;
|
||||||
end;
|
end;
|
||||||
|
@ -209,7 +209,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefRenderHandlerOwn.Create;
|
constructor TCefRenderHandlerOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefRenderHandler), False);
|
CreateData(SizeOf(TCefRenderHandler));
|
||||||
|
|
||||||
with PCefRenderHandler(FData)^ do
|
with PCefRenderHandler(FData)^ do
|
||||||
begin
|
begin
|
||||||
|
@ -53,111 +53,206 @@ uses
|
|||||||
Classes,
|
Classes,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFListValue, uCEFBrowser, uCEFFrame, uCEFRequest,
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFListValue, uCEFBrowser, uCEFFrame, uCEFRequest,
|
||||||
uCEFv8Context, uCEFv8Exception, uCEFv8StackTrace, uCEFDomNode, uCEFProcessMessage;
|
uCEFv8Context, uCEFv8Exception, uCEFv8StackTrace, uCEFDomNode, uCEFProcessMessage, uCEFApplication;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCefRenderProcessHandlerOwn = class(TCefBaseRefCountedOwn, ICefRenderProcessHandler)
|
TCefRenderProcessHandlerOwn = class(TCefBaseRefCountedOwn, ICefRenderProcessHandler)
|
||||||
protected
|
protected
|
||||||
procedure OnRenderThreadCreated(const extraInfo: ICefListValue); virtual;
|
procedure OnRenderThreadCreated(const extraInfo: ICefListValue); virtual; abstract;
|
||||||
procedure OnWebKitInitialized; virtual;
|
procedure OnWebKitInitialized; virtual; abstract;
|
||||||
procedure OnBrowserCreated(const browser: ICefBrowser); virtual;
|
procedure OnBrowserCreated(const browser: ICefBrowser); virtual; abstract;
|
||||||
procedure OnBrowserDestroyed(const browser: ICefBrowser); virtual;
|
procedure OnBrowserDestroyed(const browser: ICefBrowser); virtual; abstract;
|
||||||
function GetLoadHandler: PCefLoadHandler; virtual;
|
function GetLoadHandler: ICefLoadHandler; virtual;
|
||||||
function OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; navigationType: TCefNavigationType; isRedirect: Boolean): Boolean; virtual;
|
function OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; navigationType: TCefNavigationType; isRedirect: Boolean): Boolean; virtual;
|
||||||
procedure OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); virtual;
|
procedure OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); virtual; abstract;
|
||||||
procedure OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); virtual;
|
procedure OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); virtual; abstract;
|
||||||
procedure OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace); virtual;
|
procedure OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace); virtual; abstract;
|
||||||
procedure OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode); virtual;
|
procedure OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode); virtual; abstract;
|
||||||
function OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; virtual;
|
function OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage): Boolean; virtual;
|
||||||
public
|
public
|
||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TCefCustomRenderProcessHandler = class(TCefRenderProcessHandlerOwn)
|
||||||
|
protected
|
||||||
|
FCefApp : TCefApplication;
|
||||||
|
|
||||||
|
procedure OnRenderThreadCreated(const extraInfo: ICefListValue); override;
|
||||||
|
procedure OnWebKitInitialized; override;
|
||||||
|
procedure OnBrowserCreated(const browser: ICefBrowser); override;
|
||||||
|
procedure OnBrowserDestroyed(const browser: ICefBrowser); override;
|
||||||
|
function OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; navigationType: TCefNavigationType; isRedirect: Boolean): Boolean; override;
|
||||||
|
procedure OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); override;
|
||||||
|
procedure OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); override;
|
||||||
|
procedure OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace); override;
|
||||||
|
procedure OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode); override;
|
||||||
|
function OnProcessMessageReceived(const browser: ICefBrowser; sourceProcess: TCefProcessId; const aMessage : ICefProcessMessage): Boolean; override;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uCEFMiscFunctions, uCEFLibFunctions;
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFConstants;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_render_thread_created(self: PCefRenderProcessHandler; extra_info: PCefListValue); stdcall;
|
procedure cef_render_process_handler_on_render_thread_created(self : PCefRenderProcessHandler;
|
||||||
|
extra_info : PCefListValue); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnRenderThreadCreated(TCefListValueRef.UnWrap(extra_info));
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
TCefRenderProcessHandlerOwn(TempObject).OnRenderThreadCreated(TCefListValueRef.UnWrap(extra_info));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_web_kit_initialized(self: PCefRenderProcessHandler); stdcall;
|
procedure cef_render_process_handler_on_web_kit_initialized(self: PCefRenderProcessHandler); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnWebKitInitialized;
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
TCefRenderProcessHandlerOwn(TempObject).OnWebKitInitialized;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_browser_created(self: PCefRenderProcessHandler; browser: PCefBrowser); stdcall;
|
procedure cef_render_process_handler_on_browser_created(self : PCefRenderProcessHandler;
|
||||||
|
browser : PCefBrowser); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnBrowserCreated(TCefBrowserRef.UnWrap(browser));
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
TCefRenderProcessHandlerOwn(TempObject).OnBrowserCreated(TCefBrowserRef.UnWrap(browser));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_browser_destroyed(self: PCefRenderProcessHandler;
|
procedure cef_render_process_handler_on_browser_destroyed(self : PCefRenderProcessHandler;
|
||||||
browser: PCefBrowser); stdcall;
|
browser : PCefBrowser); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnBrowserDestroyed(TCefBrowserRef.UnWrap(browser));
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
TCefRenderProcessHandlerOwn(TempObject).OnBrowserDestroyed(TCefBrowserRef.UnWrap(browser));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function cef_render_process_handler_get_load_handler(self: PCefRenderProcessHandler): PCefLoadHandler; stdcall;
|
function cef_render_process_handler_get_load_handler(self: PCefRenderProcessHandler): PCefLoadHandler; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
Result := GetLoadHandler();
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
Result := CefGetData(TCefRenderProcessHandlerOwn(TempObject).GetLoadHandler)
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function cef_render_process_handler_on_before_navigation(self: PCefRenderProcessHandler;
|
function cef_render_process_handler_on_before_navigation(self : PCefRenderProcessHandler;
|
||||||
browser: PCefBrowser; frame: PCefFrame; request: PCefRequest;
|
browser : PCefBrowser;
|
||||||
navigation_type: TCefNavigationType; is_redirect: Integer): Integer; stdcall;
|
frame : PCefFrame;
|
||||||
|
request : PCefRequest;
|
||||||
|
navigation_type : TCefNavigationType;
|
||||||
|
is_redirect : Integer): Integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
Result := Ord(OnBeforeNavigation(TCefBrowserRef.UnWrap(browser),
|
|
||||||
TCefFrameRef.UnWrap(frame), TCefRequestRef.UnWrap(request),
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
navigation_type, is_redirect <> 0));
|
Result := Ord(TCefRenderProcessHandlerOwn(TempObject).OnBeforeNavigation(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
TCefRequestRef.UnWrap(request),
|
||||||
|
navigation_type,
|
||||||
|
is_redirect <> 0))
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_context_created(self: PCefRenderProcessHandler;
|
procedure cef_render_process_handler_on_context_created(self : PCefRenderProcessHandler;
|
||||||
browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); stdcall;
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame;
|
||||||
|
context : PCefv8Context); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnContextCreated(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), TCefv8ContextRef.UnWrap(context));
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
TCefRenderProcessHandlerOwn(TempObject).OnContextCreated(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
TCefv8ContextRef.UnWrap(context));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_context_released(self: PCefRenderProcessHandler;
|
procedure cef_render_process_handler_on_context_released(self : PCefRenderProcessHandler;
|
||||||
browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); stdcall;
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame;
|
||||||
|
context : PCefv8Context); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnContextReleased(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), TCefv8ContextRef.UnWrap(context));
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
TCefRenderProcessHandlerOwn(TempObject).OnContextReleased(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
TCefv8ContextRef.UnWrap(context));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_uncaught_exception(self: PCefRenderProcessHandler;
|
procedure cef_render_process_handler_on_uncaught_exception(self : PCefRenderProcessHandler;
|
||||||
browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context;
|
browser : PCefBrowser;
|
||||||
exception: PCefV8Exception; stackTrace: PCefV8StackTrace); stdcall;
|
frame : PCefFrame;
|
||||||
|
context : PCefv8Context;
|
||||||
|
exception : PCefV8Exception;
|
||||||
|
stackTrace : PCefV8StackTrace); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnUncaughtException(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame),
|
|
||||||
TCefv8ContextRef.UnWrap(context), TCefV8ExceptionRef.UnWrap(exception),
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
TCefV8StackTraceRef.UnWrap(stackTrace));
|
TCefRenderProcessHandlerOwn(TempObject).OnUncaughtException(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
TCefv8ContextRef.UnWrap(context),
|
||||||
|
TCefV8ExceptionRef.UnWrap(exception),
|
||||||
|
TCefV8StackTraceRef.UnWrap(stackTrace));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure cef_render_process_handler_on_focused_node_changed(self: PCefRenderProcessHandler;
|
procedure cef_render_process_handler_on_focused_node_changed(self : PCefRenderProcessHandler;
|
||||||
browser: PCefBrowser; frame: PCefFrame; node: PCefDomNode); stdcall;
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame;
|
||||||
|
node : PCefDomNode); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
OnFocusedNodeChanged(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame),
|
|
||||||
TCefDomNodeRef.UnWrap(node));
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
TCefRenderProcessHandlerOwn(TempObject).OnFocusedNodeChanged(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
TCefDomNodeRef.UnWrap(node));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function cef_render_process_handler_on_process_message_received(self: PCefRenderProcessHandler;
|
function cef_render_process_handler_on_process_message_received(self : PCefRenderProcessHandler;
|
||||||
browser: PCefBrowser; source_process: TCefProcessId;
|
browser : PCefBrowser;
|
||||||
message: PCefProcessMessage): Integer; stdcall;
|
source_process : TCefProcessId;
|
||||||
|
message_ : PCefProcessMessage): Integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do
|
TempObject := CefGetObject(self);
|
||||||
Result := Ord(OnProcessMessageReceived(TCefBrowserRef.UnWrap(browser), source_process,
|
|
||||||
TCefProcessMessageRef.UnWrap(message)));
|
if (TempObject <> nil) and (TempObject is TCefRenderProcessHandlerOwn) then
|
||||||
|
Result := Ord(TCefRenderProcessHandlerOwn(TempObject).OnProcessMessageReceived(TCefBrowserRef.UnWrap(browser),
|
||||||
|
source_process,
|
||||||
|
TCefProcessMessageRef.UnWrap(message_)))
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -184,74 +279,113 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefRenderProcessHandlerOwn.GetLoadHandler: PCefLoadHandler;
|
function TCefRenderProcessHandlerOwn.GetLoadHandler: ICefLoadHandler;
|
||||||
begin
|
begin
|
||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefRenderProcessHandlerOwn.OnBeforeNavigation(
|
function TCefRenderProcessHandlerOwn.OnBeforeNavigation(const browser : ICefBrowser;
|
||||||
const browser: ICefBrowser; const frame: ICefFrame;
|
const frame : ICefFrame;
|
||||||
const request: ICefRequest; navigationType: TCefNavigationType;
|
const request : ICefRequest;
|
||||||
isRedirect: Boolean): Boolean;
|
navigationType : TCefNavigationType;
|
||||||
|
isRedirect : Boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnBrowserCreated(
|
function TCefRenderProcessHandlerOwn.OnProcessMessageReceived(const browser : ICefBrowser;
|
||||||
const browser: ICefBrowser);
|
sourceProcess : TCefProcessId;
|
||||||
begin
|
const aMessage : ICefProcessMessage): Boolean;
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnBrowserDestroyed(
|
|
||||||
const browser: ICefBrowser);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnContextCreated(
|
|
||||||
const browser: ICefBrowser; const frame: ICefFrame;
|
|
||||||
const context: ICefv8Context);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnContextReleased(
|
|
||||||
const browser: ICefBrowser; const frame: ICefFrame;
|
|
||||||
const context: ICefv8Context);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnFocusedNodeChanged(
|
|
||||||
const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
|
|
||||||
begin
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCefRenderProcessHandlerOwn.OnProcessMessageReceived(
|
|
||||||
const browser: ICefBrowser; sourceProcess: TCefProcessId;
|
|
||||||
const message: ICefProcessMessage): Boolean;
|
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnRenderThreadCreated(const extraInfo: ICefListValue);
|
|
||||||
begin
|
|
||||||
|
|
||||||
|
// TCefCustomRenderProcessHandler
|
||||||
|
|
||||||
|
|
||||||
|
constructor TCefCustomRenderProcessHandler.Create(const aCefApp : TCefApplication);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
|
FCefApp := aCefApp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnUncaughtException(
|
destructor TCefCustomRenderProcessHandler.Destroy;
|
||||||
const browser: ICefBrowser; const frame: ICefFrame;
|
|
||||||
const context: ICefv8Context; const exception: ICefV8Exception;
|
|
||||||
const stackTrace: ICefV8StackTrace);
|
|
||||||
begin
|
begin
|
||||||
|
FCefApp := nil;
|
||||||
|
|
||||||
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefRenderProcessHandlerOwn.OnWebKitInitialized;
|
procedure TCefCustomRenderProcessHandler.OnRenderThreadCreated(const extraInfo: ICefListValue);
|
||||||
begin
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnRenderThreadCreated(extraInfo);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomRenderProcessHandler.OnWebKitInitialized;
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnWebKitInitialized;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomRenderProcessHandler.OnBrowserCreated(const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnBrowserCreated(browser);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomRenderProcessHandler.OnBrowserDestroyed(const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnBrowserDestroyed(browser);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefCustomRenderProcessHandler.OnBeforeNavigation(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const request : ICefRequest;
|
||||||
|
navigationType : TCefNavigationType;
|
||||||
|
isRedirect : Boolean): Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited OnBeforeNavigation(browser, frame, request, navigationType, isRedirect);
|
||||||
|
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnBeforeNavigation(browser, frame, request, navigationType, isRedirect, Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomRenderProcessHandler.OnContextCreated(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const context : ICefv8Context);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnContextCreated(browser, frame, context);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomRenderProcessHandler.OnContextReleased(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const context : ICefv8Context);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnContextReleased(browser, frame, context);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomRenderProcessHandler.OnUncaughtException(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const context : ICefv8Context;
|
||||||
|
const exception : ICefV8Exception;
|
||||||
|
const stackTrace : ICefV8StackTrace);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnUncaughtException(browser, frame, context, exception, stackTrace);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefCustomRenderProcessHandler.OnFocusedNodeChanged(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const node : ICefDomNode);
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnFocusedNodeChanged(browser, frame, node);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefCustomRenderProcessHandler.OnProcessMessageReceived(const browser : ICefBrowser;
|
||||||
|
sourceProcess : TCefProcessId;
|
||||||
|
const aMessage : ICefProcessMessage): Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited OnProcessMessageReceived(browser, sourceProcess, aMessage);
|
||||||
|
|
||||||
|
if (FCefApp <> nil) then FCefApp.Internal_OnProcessMessageReceived(browser, sourceProcess, aMessage, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -117,7 +117,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefRequestContextHandlerOwn.Create;
|
constructor TCefRequestContextHandlerOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefRequestContextHandler), False);
|
CreateData(SizeOf(TCefRequestContextHandler));
|
||||||
|
|
||||||
with PCefRequestContextHandler(FData)^ do
|
with PCefRequestContextHandler(FData)^ do
|
||||||
begin
|
begin
|
||||||
|
@ -114,7 +114,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefResolveCallbackOwn.Create;
|
constructor TCefResolveCallbackOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefResolveCallback), False);
|
CreateData(SizeOf(TCefResolveCallback));
|
||||||
|
|
||||||
with PCefResolveCallback(FData)^ do
|
with PCefResolveCallback(FData)^ do
|
||||||
on_resolve_completed := cef_resolve_callback_on_resolve_completed;
|
on_resolve_completed := cef_resolve_callback_on_resolve_completed;
|
||||||
|
@ -47,7 +47,7 @@ unit uCEFResourceBundleHandler;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFApplication;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCefResourceBundleHandlerOwn = class(TCefBaseRefCountedOwn, ICefResourceBundleHandler)
|
TCefResourceBundleHandlerOwn = class(TCefBaseRefCountedOwn, ICefResourceBundleHandler)
|
||||||
@ -60,28 +60,57 @@ type
|
|||||||
constructor Create; virtual;
|
constructor Create; virtual;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TCefCustomResourceBundleHandler = class(TCefResourceBundleHandlerOwn)
|
||||||
|
protected
|
||||||
|
FCefApp : TCefApplication;
|
||||||
|
|
||||||
|
function GetLocalizedString(stringid: Integer; var stringVal: ustring): Boolean; override;
|
||||||
|
function GetDataResource(resourceId: Integer; var data: Pointer; var dataSize: NativeUInt): Boolean; override;
|
||||||
|
function GetDataResourceForScale(resourceId: Integer; scaleFactor: TCefScaleFactor; var data: Pointer; var dataSize: NativeUInt): Boolean; override;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create(const aCefApp : TCefApplication); reintroduce;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uCEFMiscFunctions, uCEFLibFunctions;
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFConstants;
|
||||||
|
|
||||||
function cef_resource_bundle_handler_get_localized_string(self : PCefResourceBundleHandler;
|
function cef_resource_bundle_handler_get_localized_string(self : PCefResourceBundleHandler;
|
||||||
string_id : Integer;
|
string_id : Integer;
|
||||||
string_val : PCefString): Integer; stdcall;
|
string_val : PCefString): Integer; stdcall;
|
||||||
var
|
var
|
||||||
str: ustring;
|
TempString : ustring;
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
Result := Ord(TCefResourceBundleHandlerOwn(CefGetObject(self)).GetLocalizedString(string_id, str));
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
if (Result <> 0) then string_val^ := CefString(str);
|
if (TempObject <> nil) and (TempObject is TCefResourceBundleHandlerOwn) then
|
||||||
|
begin
|
||||||
|
TempString := '';
|
||||||
|
Result := Ord(TCefResourceBundleHandlerOwn(TempObject).GetLocalizedString(string_id, TempString));
|
||||||
|
|
||||||
|
if (Result <> 0) then string_val^ := CefString(TempString);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function cef_resource_bundle_handler_get_data_resource(self : PCefResourceBundleHandler;
|
function cef_resource_bundle_handler_get_data_resource(self : PCefResourceBundleHandler;
|
||||||
resource_id : Integer;
|
resource_id : Integer;
|
||||||
var data : Pointer;
|
var data : Pointer;
|
||||||
var data_size : NativeUInt): Integer; stdcall;
|
var data_size : NativeUInt): Integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
Result := Ord(TCefResourceBundleHandlerOwn(CefGetObject(self)).GetDataResource(resource_id, data, data_size));
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefResourceBundleHandlerOwn) then
|
||||||
|
Result := Ord(TCefResourceBundleHandlerOwn(TempObject).GetDataResource(resource_id, data, data_size))
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function cef_resource_bundle_handler_get_data_resource_for_scale(self: PCefResourceBundleHandler;
|
function cef_resource_bundle_handler_get_data_resource_for_scale(self: PCefResourceBundleHandler;
|
||||||
@ -89,8 +118,15 @@ function cef_resource_bundle_handler_get_data_resource_for_scale(self: PCefResou
|
|||||||
scale_factor : TCefScaleFactor;
|
scale_factor : TCefScaleFactor;
|
||||||
var data : Pointer;
|
var data : Pointer;
|
||||||
var data_size : NativeUInt): Integer; stdcall;
|
var data_size : NativeUInt): Integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
begin
|
begin
|
||||||
Result := Ord(TCefResourceBundleHandlerOwn(CefGetObject(self)).GetDataResourceForScale(resource_id, scale_factor, data, data_size));
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefResourceBundleHandlerOwn) then
|
||||||
|
Result := Ord(TCefResourceBundleHandlerOwn(TempObject).GetDataResourceForScale(resource_id, scale_factor, data, data_size))
|
||||||
|
else
|
||||||
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TCefResourceBundleHandlerOwn.Create;
|
constructor TCefResourceBundleHandlerOwn.Create;
|
||||||
@ -105,4 +141,52 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
// TCefCustomResourceBundleHandler
|
||||||
|
|
||||||
|
|
||||||
|
constructor TCefCustomResourceBundleHandler.Create(const aCefApp : TCefApplication);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
|
FCefApp := aCefApp;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TCefCustomResourceBundleHandler.Destroy;
|
||||||
|
begin
|
||||||
|
FCefApp := nil;
|
||||||
|
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefCustomResourceBundleHandler.GetLocalizedString(stringid : Integer;
|
||||||
|
var stringVal : ustring): Boolean;
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then
|
||||||
|
Result := FCefApp.Internal_GetLocalizedString(stringid, stringVal)
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefCustomResourceBundleHandler.GetDataResource(resourceId : Integer;
|
||||||
|
var data : Pointer;
|
||||||
|
var dataSize : NativeUInt): Boolean;
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then
|
||||||
|
Result := FCefApp.Internal_GetDataResource(resourceId, data, dataSize)
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefCustomResourceBundleHandler.GetDataResourceForScale(resourceId : Integer;
|
||||||
|
scaleFactor : TCefScaleFactor;
|
||||||
|
var data : Pointer;
|
||||||
|
var dataSize : NativeUInt): Boolean;
|
||||||
|
begin
|
||||||
|
if (FCefApp <> nil) then
|
||||||
|
Result := FCefApp.Internal_GetDataResourceForScale(resourceId, scaleFactor, data, dataSize)
|
||||||
|
else
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -78,7 +78,7 @@ end;
|
|||||||
|
|
||||||
constructor TCefResponseFilterOwn.Create;
|
constructor TCefResponseFilterOwn.Create;
|
||||||
begin
|
begin
|
||||||
CreateData(SizeOf(TCefResponseFilter), False);
|
CreateData(SizeOf(TCefResponseFilter));
|
||||||
with PCefResponseFilter(FData)^ do
|
with PCefResponseFilter(FData)^ do
|
||||||
begin
|
begin
|
||||||
init_filter := cef_response_filter_init_filter;
|
init_filter := cef_response_filter_init_filter;
|
||||||
|
@ -1542,7 +1542,7 @@ type
|
|||||||
on_context_released: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); stdcall;
|
on_context_released: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); stdcall;
|
||||||
on_uncaught_exception: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context; exception: PCefV8Exception; stackTrace: PCefV8StackTrace); stdcall;
|
on_uncaught_exception: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context; exception: PCefV8Exception; stackTrace: PCefV8StackTrace); stdcall;
|
||||||
on_focused_node_changed: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; frame: PCefFrame; node: PCefDomNode); stdcall;
|
on_focused_node_changed: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; frame: PCefFrame; node: PCefDomNode); stdcall;
|
||||||
on_process_message_received: function(self: PCefRenderProcessHandler; browser: PCefBrowser; source_process: TCefProcessId; message: PCefProcessMessage): Integer; stdcall;
|
on_process_message_received: function(self: PCefRenderProcessHandler; browser: PCefBrowser; source_process: TCefProcessId; message_: PCefProcessMessage): Integer; stdcall;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// /include/capi/cef_request_handler_capi.h (cef_request_handler_t)
|
// /include/capi/cef_request_handler_capi.h (cef_request_handler_t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user