mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-02-02 10:25:26 +02:00
Added GlobalCEFApp.DisablePDFExtension property
- Bug fix #89 - New SimpleLazOSRBrowser demo
This commit is contained in:
parent
8519c9b5d5
commit
bf402109bf
@ -48,7 +48,6 @@ uses
|
||||
Windows,
|
||||
{$ENDIF }
|
||||
uCEFApplication,
|
||||
uCEFConstants,
|
||||
uDOMVisitor in 'uDOMVisitor.pas' {DOMVisitorFrm};
|
||||
|
||||
{$R *.res}
|
||||
@ -56,25 +55,21 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.RemoteDebuggingPort := 9000;
|
||||
GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;
|
||||
|
||||
// Enabling the debug log file for then DOM visitor demo.
|
||||
// This adds lots of warnings to the console, specially if you run this inside VirtualBox.
|
||||
// Remove it if you don't want to use the DOM visitor
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_ERROR;
|
||||
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
//ReportMemoryLeaksOnShutdown := True;
|
||||
|
||||
Application.Initialize;
|
||||
Application.MainFormOnTaskbar := True;
|
||||
Application.CreateForm(TDOMVisitorFrm, DOMVisitorFrm);
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
// This is not really necessary to fix the bug #89 but if you free GlobalCEFApp in a different unit
|
||||
// then you can call 'FreeAndNil' without adding SysUtils to this DPR.
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -49,7 +49,6 @@ object DOMVisitorFrm: TDOMVisitorFrm
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
Text = 'https://www.google.com'
|
||||
ExplicitWidth = 764
|
||||
ExplicitHeight = 21
|
||||
end
|
||||
object Panel1: TPanel
|
||||
|
@ -126,10 +126,7 @@ type
|
||||
var
|
||||
DOMVisitorFrm: TDOMVisitorFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser;
|
||||
sourceProcess : TCefProcessId;
|
||||
const message : ICefProcessMessage;
|
||||
var aHandled : boolean);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -298,6 +295,19 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.RemoteDebuggingPort := 9000;
|
||||
GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;
|
||||
|
||||
// Enabling the debug log file for then DOM visitor demo.
|
||||
// This adds lots of warnings to the console, specially if you run this inside VirtualBox.
|
||||
// Remove it if you don't want to use the DOM visitor
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_ERROR;
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||
|
@ -43,11 +43,9 @@ uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Vcl.Forms,
|
||||
WinApi.Windows,
|
||||
System.SysUtils,
|
||||
{$ELSE}
|
||||
Forms,
|
||||
Windows,
|
||||
SysUtils,
|
||||
{$ENDIF }
|
||||
uCEFApplication,
|
||||
uCEFWorkScheduler,
|
||||
@ -60,17 +58,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -87,6 +77,6 @@ begin
|
||||
GlobalCEFWorkScheduler.StopScheduler;
|
||||
end;
|
||||
|
||||
FreeAndNil(GlobalCEFApp);
|
||||
FreeAndNil(GlobalCEFWorkScheduler);
|
||||
DestroyGlobalCEFApp;
|
||||
DestroyGlobalCEFWorkScheduler;
|
||||
end.
|
||||
|
@ -96,7 +96,7 @@ type
|
||||
var
|
||||
ExternalPumpBrowserFrm : TExternalPumpBrowserFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -113,6 +113,21 @@ begin
|
||||
if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
|
@ -45,7 +45,6 @@ uses
|
||||
{$IFDEF MSWINDOWS}
|
||||
WinApi.Windows,
|
||||
{$ENDIF}
|
||||
System.SysUtils,
|
||||
uCEFApplication,
|
||||
uFMXWorkScheduler,
|
||||
uFMXExternalPumpBrowser in 'uFMXExternalPumpBrowser.pas' {FMXExternalPumpBrowserFrm},
|
||||
@ -59,19 +58,9 @@ uses
|
||||
{$ENDIF}
|
||||
|
||||
begin
|
||||
// TFMXWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalFMXWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalFMXWorkScheduler := TFMXWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -85,6 +74,6 @@ begin
|
||||
GlobalFMXWorkScheduler.StopScheduler;
|
||||
end;
|
||||
|
||||
FreeAndNil(GlobalCEFApp);
|
||||
FreeAndNil(GlobalFMXWorkScheduler);
|
||||
DestroyGlobalCEFApp;
|
||||
DestroyGlobalFMXWorkScheduler;
|
||||
end.
|
||||
|
@ -164,7 +164,7 @@ var
|
||||
// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed.
|
||||
// Now we set FCanClose to True and send WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -179,6 +179,23 @@ begin
|
||||
if (GlobalFMXWorkScheduler <> nil) then GlobalFMXWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
// TFMXWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalFMXWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalFMXWorkScheduler := TFMXWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
end;
|
||||
|
||||
procedure TFMXExternalPumpBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
CanClose := FCanClose;
|
||||
|
@ -55,8 +55,7 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -65,6 +64,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -57,8 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnProcessMessageReceived := JSEvalFrm.RenderProcessHandler_OnProcessMessageReceivedEvent;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -71,6 +72,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -117,17 +117,13 @@ type
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure ParseEvalJsAnswer(const pMessage: ICefProcessMessage; pBrowser: ICefBrowser; pReturnValue : ICefv8Value; pException : ICefV8Exception);
|
||||
procedure ParseBinaryValue(const pBrowser : ICefBrowser; const aBinaryValue : ICefBinaryValue);
|
||||
|
||||
public
|
||||
procedure RenderProcessHandler_OnProcessMessageReceivedEvent(const pBrowser: ICefBrowser; uSourceProcess: TCefProcessId; const pMessage: ICefProcessMessage; var aHandled : boolean);
|
||||
end;
|
||||
|
||||
var
|
||||
JSEvalFrm: TJSEvalFrm;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.dfm}
|
||||
@ -139,7 +135,7 @@ uses
|
||||
|
||||
// Steps to evaluate some JavaScript code using the V8Context
|
||||
// ----------------------------------------------------------
|
||||
// 1. Set GlobalCEFApp.OnProcessMessageReceived to JSEvalFrm.RenderProcessHandler_OnProcessMessageReceivedEvent in the DPR file.
|
||||
// 1. Set GlobalCEFApp.OnProcessMessageReceived to RenderProcessHandler_OnProcessMessageReceivedEvent.
|
||||
// 2. To get the Javascript code in this demo we use a context menu that sends a MINIBROWSER_EVALJSCODE to the form.
|
||||
// 3. The EvalJSCodeMsg asks for the Javascript code and sends it to the renderer using a process message.
|
||||
// 4. RenderProcessHandler_OnProcessMessageReceivedEvent receives the process message and calls ParseEvalJsAnswer
|
||||
@ -153,7 +149,7 @@ uses
|
||||
|
||||
// This demo also has an example of binary parameters in process messages
|
||||
// ----------------------------------------------------------------------
|
||||
// 1. Set GlobalCEFApp.OnProcessMessageReceived to JSEvalFrm.RenderProcessHandler_OnProcessMessageReceivedEvent in the DPR file.
|
||||
// 1. Set GlobalCEFApp.OnProcessMessageReceived to RenderProcessHandler_OnProcessMessageReceivedEvent.
|
||||
// 2. The context menu has a 'Send JPEG image' option that sends a MINIBROWSER_JSBINPARAM message to the form.
|
||||
// 3. EvalJSBinParamMsg asks for a JPEG image and sends a process message with a ICefBinaryValue parameter to the
|
||||
// renderer process.
|
||||
@ -380,52 +376,10 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.RenderProcessHandler_OnProcessMessageReceivedEvent(const pBrowser : ICefBrowser;
|
||||
uSourceProcess : TCefProcessId;
|
||||
const pMessage : ICefProcessMessage;
|
||||
var aHandled : boolean);
|
||||
var
|
||||
pV8Context : ICefv8Context;
|
||||
pReturnValue : ICefv8Value;
|
||||
pException : ICefV8Exception;
|
||||
TempScript : string;
|
||||
TempBinValue : ICefBinaryValue;
|
||||
begin
|
||||
aHandled := False;
|
||||
|
||||
if (pMessage = nil) or (pMessage.ArgumentList = nil) then exit;
|
||||
|
||||
if (pMessage.Name = EVAL_JS) then
|
||||
begin
|
||||
TempScript := pMessage.ArgumentList.GetString(0);
|
||||
|
||||
if (length(TempScript) > 0) then
|
||||
begin
|
||||
pV8Context := pBrowser.MainFrame.GetV8Context;
|
||||
|
||||
if pV8Context.Enter then
|
||||
begin
|
||||
pV8Context.Eval(TempScript, '', 1, pReturnValue, pException);
|
||||
ParseEvalJsAnswer(pMessage, pBrowser, pReturnValue, pException);
|
||||
pV8Context.Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
aHandled := True;
|
||||
end
|
||||
else
|
||||
if (pMessage.Name = BINARY_PARAM_JS) then
|
||||
begin
|
||||
TempBinValue := pMessage.ArgumentList.GetBinary(0);
|
||||
ParseBinaryValue(pBrowser, TempBinValue);
|
||||
aHandled := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.ParseEvalJsAnswer(const pMessage : ICefProcessMessage;
|
||||
pBrowser : ICefBrowser;
|
||||
pReturnValue : ICefv8Value;
|
||||
pException : ICefV8Exception);
|
||||
procedure ParseEvalJsAnswer(const pMessage : ICefProcessMessage;
|
||||
pBrowser : ICefBrowser;
|
||||
pReturnValue : ICefv8Value;
|
||||
pException : ICefV8Exception);
|
||||
var
|
||||
pAnswer : ICefProcessMessage;
|
||||
strResult : String;
|
||||
@ -464,7 +418,7 @@ begin
|
||||
pBrowser.SendProcessMessage(PID_BROWSER, pAnswer);
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.ParseBinaryValue(const pBrowser : ICefBrowser; const aBinaryValue : ICefBinaryValue);
|
||||
procedure ParseBinaryValue(const pBrowser : ICefBrowser; const aBinaryValue : ICefBinaryValue);
|
||||
var
|
||||
pAnswer : ICefProcessMessage;
|
||||
TempBuffer : TBytes;
|
||||
@ -496,13 +450,61 @@ begin
|
||||
end;
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TJSEvalFrm.ParseBinaryValue', e) then raise;
|
||||
if CustomExceptionHandler('ParseBinaryValue', e) then raise;
|
||||
end;
|
||||
finally
|
||||
SetLength(TempBuffer, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure RenderProcessHandler_OnProcessMessageReceivedEvent(const pBrowser : ICefBrowser;
|
||||
uSourceProcess : TCefProcessId;
|
||||
const pMessage : ICefProcessMessage;
|
||||
var aHandled : boolean);
|
||||
var
|
||||
pV8Context : ICefv8Context;
|
||||
pReturnValue : ICefv8Value;
|
||||
pException : ICefV8Exception;
|
||||
TempScript : string;
|
||||
TempBinValue : ICefBinaryValue;
|
||||
begin
|
||||
aHandled := False;
|
||||
|
||||
if (pMessage = nil) or (pMessage.ArgumentList = nil) then exit;
|
||||
|
||||
if (pMessage.Name = EVAL_JS) then
|
||||
begin
|
||||
TempScript := pMessage.ArgumentList.GetString(0);
|
||||
|
||||
if (length(TempScript) > 0) then
|
||||
begin
|
||||
pV8Context := pBrowser.MainFrame.GetV8Context;
|
||||
|
||||
if pV8Context.Enter then
|
||||
begin
|
||||
pV8Context.Eval(TempScript, '', 1, pReturnValue, pException);
|
||||
ParseEvalJsAnswer(pMessage, pBrowser, pReturnValue, pException);
|
||||
pV8Context.Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
aHandled := True;
|
||||
end
|
||||
else
|
||||
if (pMessage.Name = BINARY_PARAM_JS) then
|
||||
begin
|
||||
TempBinValue := pMessage.ArgumentList.GetBinary(0);
|
||||
ParseBinaryValue(pBrowser, TempBinValue);
|
||||
aHandled := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnProcessMessageReceived := RenderProcessHandler_OnProcessMessageReceivedEvent;
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.Chromium1ProcessMessageReceived(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
sourceProcess : TCefProcessId;
|
||||
|
@ -57,9 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -71,6 +71,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -110,11 +110,7 @@ var
|
||||
GlobalCallbackFunc : ICefv8Value = 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);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -171,6 +167,13 @@ begin
|
||||
aHandled := False;
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;
|
||||
end;
|
||||
|
||||
procedure TJSExecutingFunctionsFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -58,8 +58,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -72,6 +73,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -116,7 +116,7 @@ type
|
||||
var
|
||||
JSExtensionFrm: TJSExtensionFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitialized;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -177,6 +177,12 @@ begin
|
||||
CefRegisterExtension('myextension', TempExtensionCode, TempHandler);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -57,8 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -70,6 +71,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -98,7 +98,7 @@ type
|
||||
var
|
||||
JSExtensionWithFunctionFrm: TJSExtensionWithFunctionFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -142,6 +142,12 @@ begin
|
||||
CefRegisterExtension('v8/test', TempExtensionCode, TempHandler);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithFunctionFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -57,8 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -70,6 +71,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -137,13 +137,13 @@
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
<DeployFile LocalName="JSExtension.exe" Configuration="Debug" Class="ProjectOutput"/>
|
||||
<DeployFile LocalName="..\..\..\bin\JSExtensionWithObjectParameter.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>JSExtensionWithObjectParameter.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="JSExtension.exe" Configuration="Debug" Class="ProjectOutput"/>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
|
@ -94,7 +94,7 @@ type
|
||||
var
|
||||
JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -145,6 +145,12 @@ begin
|
||||
CefRegisterExtension('v8/test', TempExtensionCode, TempHandler);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -58,9 +58,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized;
|
||||
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -73,6 +73,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -139,13 +139,13 @@
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
<DeployFile LocalName="JSExtension.exe" Configuration="Debug" Class="ProjectOutput"/>
|
||||
<DeployFile LocalName="..\..\bin\JSRTTIExtension.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>JSRTTIExtension.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployFile LocalName="JSExtension.exe" Configuration="Debug" Class="ProjectOutput"/>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
|
@ -114,7 +114,7 @@ type
|
||||
var
|
||||
JSRTTIExtensionFrm: TJSRTTIExtensionFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitialized;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -156,6 +156,12 @@ begin
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized;
|
||||
end;
|
||||
|
||||
procedure TJSRTTIExtensionFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -56,8 +56,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -69,6 +70,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -94,7 +94,7 @@ type
|
||||
var
|
||||
JSSimpleExtensionFrm: TJSSimpleExtensionFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -132,6 +132,12 @@ begin
|
||||
CefRegisterExtension('v8/test', TempExtensionCode, nil);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleExtensionFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -56,8 +56,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -69,6 +70,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -95,7 +95,7 @@ type
|
||||
var
|
||||
JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -125,6 +125,12 @@ begin
|
||||
context.Global.SetValueByKey('myval', TempValue, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -57,8 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -70,6 +71,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -94,7 +94,7 @@ type
|
||||
var
|
||||
JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -129,6 +129,12 @@ begin
|
||||
context.Global.SetValueByKey('myfunc', TempFunction, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -57,8 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -70,6 +71,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -94,7 +94,7 @@ type
|
||||
var
|
||||
JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -130,6 +130,12 @@ begin
|
||||
context.Global.SetValueByKey('myobj', TempObject, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(Edit1.Text);
|
||||
|
@ -56,9 +56,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -67,6 +67,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -28,7 +28,6 @@ object MainForm: TMainForm
|
||||
Enabled = False
|
||||
ShowCaption = False
|
||||
TabOrder = 0
|
||||
ExplicitWidth = 933
|
||||
object NewBtn: TSpeedButton
|
||||
Left = 4
|
||||
Top = 4
|
||||
|
@ -90,7 +90,7 @@ type
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -110,6 +110,12 @@ begin
|
||||
PostMessage(MainForm.Handle, CEFBROWSER_INITIALIZED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CreateMDIChild(const Name: string);
|
||||
var
|
||||
TempChild : TChildForm;
|
||||
|
@ -43,11 +43,9 @@ uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Vcl.Forms,
|
||||
WinApi.Windows,
|
||||
System.SysUtils,
|
||||
{$ELSE}
|
||||
Forms,
|
||||
Windows,
|
||||
SysUtils,
|
||||
{$ENDIF }
|
||||
uCEFApplication,
|
||||
uCEFWorkScheduler,
|
||||
@ -59,18 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -82,6 +71,6 @@ begin
|
||||
MainForm.Free;
|
||||
end;
|
||||
|
||||
FreeAndNil(GlobalCEFApp);
|
||||
FreeAndNil(GlobalCEFWorkScheduler);
|
||||
DestroyGlobalCEFApp;
|
||||
DestroyGlobalCEFWorkScheduler;
|
||||
end.
|
||||
|
@ -4,7 +4,7 @@ object MainForm: TMainForm
|
||||
Cursor = crAppStart
|
||||
Caption = 'Initializing browser. Please wait...'
|
||||
ClientHeight = 631
|
||||
ClientWidth = 709
|
||||
ClientWidth = 934
|
||||
Color = clAppWorkSpace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clBlack
|
||||
@ -21,13 +21,14 @@ object MainForm: TMainForm
|
||||
object ButtonPnl: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 709
|
||||
Width = 934
|
||||
Height = 30
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
Enabled = False
|
||||
ShowCaption = False
|
||||
TabOrder = 0
|
||||
ExplicitWidth = 709
|
||||
object NewBtn: TSpeedButton
|
||||
Left = 4
|
||||
Top = 4
|
||||
|
@ -91,8 +91,7 @@ type
|
||||
var
|
||||
MainForm : TMainForm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -117,6 +116,21 @@ begin
|
||||
if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CreateMDIChild(const Name: string);
|
||||
var
|
||||
TempChild : TChildForm;
|
||||
|
@ -43,11 +43,9 @@ uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Vcl.Forms,
|
||||
WinApi.Windows,
|
||||
System.SysUtils,
|
||||
{$ELSE}
|
||||
Forms,
|
||||
Windows,
|
||||
SysUtils,
|
||||
{$ENDIF }
|
||||
uCEFApplication,
|
||||
uCEFWorkScheduler,
|
||||
@ -59,19 +57,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -88,6 +76,6 @@ begin
|
||||
GlobalCEFWorkScheduler.StopScheduler;
|
||||
end;
|
||||
|
||||
FreeAndNil(GlobalCEFApp);
|
||||
FreeAndNil(GlobalCEFWorkScheduler);
|
||||
DestroyGlobalCEFApp;
|
||||
DestroyGlobalCEFWorkScheduler;
|
||||
end.
|
||||
|
@ -151,6 +151,7 @@ var
|
||||
// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed.
|
||||
// Now we set FCanClose to True and send WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
|
||||
implementation
|
||||
@ -170,6 +171,22 @@ begin
|
||||
if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.AppEventsMessage(var Msg: tagMSG; var Handled: Boolean);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
|
@ -56,8 +56,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnRegCustomSchemes := GlobalCEFApp_OnRegCustomSchemes;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -67,6 +68,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -110,7 +110,7 @@ type
|
||||
var
|
||||
SchemeRegistrationBrowserFrm: TSchemeRegistrationBrowserFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnRegCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -130,6 +130,12 @@ begin
|
||||
registrar.AddCustomScheme('hello', True, True, False, False, False, False);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnRegCustomSchemes := GlobalCEFApp_OnRegCustomSchemes;
|
||||
end;
|
||||
|
||||
procedure TSchemeRegistrationBrowserFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||
|
@ -71,8 +71,6 @@ begin
|
||||
GlobalCEFApp.UserDataPath := 'cef\User Data';
|
||||
}
|
||||
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
|
||||
// You *MUST* call GlobalCEFApp.StartMainProcess in a if..then clause
|
||||
// with the Application initialization inside the begin..end.
|
||||
// Read this https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||
|
@ -43,11 +43,9 @@ uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Vcl.Forms,
|
||||
WinApi.Windows,
|
||||
System.SysUtils,
|
||||
{$ELSE}
|
||||
Forms,
|
||||
Windows,
|
||||
SysUtils,
|
||||
{$ENDIF }
|
||||
uCEFApplication,
|
||||
uCEFWorkScheduler,
|
||||
@ -60,17 +58,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -87,6 +77,6 @@ begin
|
||||
GlobalCEFWorkScheduler.StopScheduler;
|
||||
end;
|
||||
|
||||
FreeAndNil(GlobalCEFApp);
|
||||
FreeAndNil(GlobalCEFWorkScheduler);
|
||||
DestroyGlobalCEFApp;
|
||||
DestroyGlobalCEFWorkScheduler;
|
||||
end.
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFTypes, uCEFConstants, uCEFInterfaces, uCEFWorkScheduler,
|
||||
uCEFChromiumWindow;
|
||||
uCEFChromiumWindow, Vcl.ComCtrls, Vcl.AppEvnts;
|
||||
|
||||
type
|
||||
TSimpleExternalPumpBrowserFrm = class(TForm)
|
||||
@ -86,7 +86,7 @@ type
|
||||
var
|
||||
SimpleExternalPumpBrowserFrm : TSimpleExternalPumpBrowserFrm;
|
||||
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -108,6 +108,20 @@ begin
|
||||
if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
// TCEFWorkScheduler will call cef_do_message_loop_work when
|
||||
// it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event.
|
||||
// GlobalCEFWorkScheduler needs to be created before the
|
||||
// GlobalCEFApp.StartMainProcess call.
|
||||
GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil);
|
||||
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.ExternalMessagePump := True;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork;
|
||||
end;
|
||||
|
||||
procedure TSimpleExternalPumpBrowserFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
|
@ -18,8 +18,7 @@ uses
|
||||
{$ENDIF}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.MustFreeLibrary := False;
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
|
||||
// In case you want to use custom directories for the CEF3 binaries, cache, cookies and user data.
|
||||
// If you don't set a cache directory the browser will use in-memory cache.
|
||||
@ -28,7 +27,6 @@ begin
|
||||
GlobalCEFApp.ResourcesDirPath := 'cef';
|
||||
GlobalCEFApp.LocalesDirPath := 'cef\locales';
|
||||
GlobalCEFApp.EnableGPU := True; // Enable hardware acceleration
|
||||
GlobalCEFApp.DisableGPUCache := True; // Disable the creation of a 'GPUCache' directory in the hard drive.
|
||||
GlobalCEFApp.cache := 'cef\cache';
|
||||
GlobalCEFApp.cookies := 'cef\cookies';
|
||||
GlobalCEFApp.UserDataPath := 'cef\User Data';
|
||||
@ -46,6 +44,5 @@ begin
|
||||
SimpleFMXBrowserFrm.Free;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
2
demos/SimpleLazOSRBrowser/00-Delete.bat
Normal file
2
demos/SimpleLazOSRBrowser/00-Delete.bat
Normal file
@ -0,0 +1,2 @@
|
||||
rmdir /S /Q lib
|
||||
rmdir /S /Q backup
|
BIN
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.ico
Normal file
BIN
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
92
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpi
Normal file
92
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpi
Normal file
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||
<MainUnitHasCreateFormStatements Value="False"/>
|
||||
<MainUnitHasTitleStatement Value="False"/>
|
||||
<MainUnitHasScaledStatement Value="False"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="SimpleLazOSRBrowser"/>
|
||||
<UseAppBundle Value="False"/>
|
||||
<ResourceType Value="res"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="CEF4Delphi_Lazarus"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleLazOSRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="..\..\bin\SimpleLazOSRBrowser"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<SyntaxMode Value="Delphi"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
68
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpr
Normal file
68
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpr
Normal file
@ -0,0 +1,68 @@
|
||||
// ************************************************************************
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||
// browser in Delphi applications.
|
||||
//
|
||||
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||
//
|
||||
// For more information about CEF4Delphi visit :
|
||||
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||
//
|
||||
// Copyright © 2018 Salvador Díaz Fau. All rights reserved.
|
||||
//
|
||||
// ************************************************************************
|
||||
// ************ vvvv Original license and comments below vvvv *************
|
||||
// ************************************************************************
|
||||
(*
|
||||
* Delphi Chromium Embedded 3
|
||||
*
|
||||
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||
* Web site : http://www.progdigy.com
|
||||
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||
*
|
||||
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||
* this source code without explicit permission.
|
||||
*
|
||||
*)
|
||||
|
||||
program SimpleLazOSRBrowser;
|
||||
|
||||
{$MODE OBJFPC}{$H+}
|
||||
|
||||
uses
|
||||
Forms,
|
||||
LCLIntf, LCLType, LMessages, Interfaces,
|
||||
uCEFApplication,
|
||||
usimplelazosrbrowser in 'uSimpleOSRBrowser.pas' {Form1};
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||
{$SetPEFlags $20}
|
||||
{$ENDIF}
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
262
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lps
Normal file
262
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lps
Normal file
@ -0,0 +1,262 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectSession>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="15">
|
||||
<Unit0>
|
||||
<Filename Value="SimpleLazOSRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="31"/>
|
||||
<CursorPos X="10" Y="43"/>
|
||||
<UsageCount Value="39"/>
|
||||
<Loaded Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="781"/>
|
||||
<CursorPos Y="788"/>
|
||||
<UsageCount Value="39"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 Y="558" ID="2"/>
|
||||
<Item1 X="43" Y="797" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="..\..\..\..\..\..\..\..\stefan.otto\Downloads\CEF4Delphi-master\CEF4Delphi-master\demos\SimpleOSRBrowser\uSimpleOSRBrowser.pas"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="67" Y="20"/>
|
||||
<UsageCount Value="9"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\source\uBufferPanel.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="138"/>
|
||||
<CursorPos X="28" Y="163"/>
|
||||
<UsageCount Value="16"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\..\lcl\lcltype.pp"/>
|
||||
<UnitName Value="LCLType"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1303"/>
|
||||
<CursorPos X="3" Y="1320"/>
|
||||
<UsageCount Value="13"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="C:\lazarus\lcl\forms.pp"/>
|
||||
<UnitName Value="Forms"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1549"/>
|
||||
<CursorPos X="15" Y="1493"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="C:\lazarus\lcl\graphics.pp"/>
|
||||
<UnitName Value="Graphics"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1376"/>
|
||||
<CursorPos X="90" Y="1389"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="C:\lazarus\lcl\lclintf.pas"/>
|
||||
<UnitName Value="LCLIntf"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="C:\lazarus\lcl\controls.pp"/>
|
||||
<UnitName Value="Controls"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="2054"/>
|
||||
<CursorPos X="82" Y="2074"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit8>
|
||||
<Unit9>
|
||||
<Filename Value="C:\lazarus\lcl\include\wincontrol.inc"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<TopLine Value="5880"/>
|
||||
<CursorPos Y="5898"/>
|
||||
<UsageCount Value="11"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit9>
|
||||
<Unit10>
|
||||
<Filename Value="C:\lazarus\lcl\widgetset\wscontrols.pp"/>
|
||||
<UnitName Value="WSControls"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="329"/>
|
||||
<CursorPos Y="331"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit10>
|
||||
<Unit11>
|
||||
<Filename Value="..\..\source\uCEFMiscFunctions.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="1508"/>
|
||||
<CursorPos X="23" Y="1519"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit11>
|
||||
<Unit12>
|
||||
<Filename Value="..\..\source\uCEFConstants.pas"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="361"/>
|
||||
<CursorPos X="3" Y="384"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit12>
|
||||
<Unit13>
|
||||
<Filename Value="C:\lazarus\lcl\include\application.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1696"/>
|
||||
<CursorPos X="3" Y="1701"/>
|
||||
<UsageCount Value="11"/>
|
||||
</Unit13>
|
||||
<Unit14>
|
||||
<Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\win\wininc\defines.inc"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<TopLine Value="4867"/>
|
||||
<CursorPos X="6" Y="4753"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit14>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="858" Column="69" TopLine="844"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="889" TopLine="862"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="85" Column="87" TopLine="67"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="90" Column="36" TopLine="67"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="248" Column="39" TopLine="218"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="288" TopLine="258"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="90" Column="36" TopLine="73"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="247" TopLine="224"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="441" Column="79" TopLine="420"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="96" Column="15" TopLine="86"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="195" Column="24" TopLine="183"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="612" TopLine="594"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="87" Column="15" TopLine="63"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="281" Column="21" TopLine="272"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="811" Column="82" TopLine="793"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="136" TopLine="113"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="549" Column="70" TopLine="534"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="78" Column="15" TopLine="75"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="809" TopLine="793"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="788" TopLine="770"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="792" Column="66" TopLine="770"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="87" Column="15" TopLine="61"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="329" Column="59" TopLine="323"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="78" Column="15" TopLine="70"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="789" Column="74" TopLine="781"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="C:\lazarus\lcl\include\wincontrol.inc"/>
|
||||
<Caret Line="7237" TopLine="7214"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="C:\lazarus\lcl\include\wincontrol.inc"/>
|
||||
<Caret Line="5898" TopLine="5880"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="788" TopLine="781"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="789" TopLine="781"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="..\..\source\uCEFMiscFunctions.pas"/>
|
||||
<Caret Line="1519" Column="23" TopLine="1508"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
</CONFIG>
|
BIN
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.res
Normal file
BIN
demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.res
Normal file
Binary file not shown.
139
demos/SimpleLazOSRBrowser/usimplelazosrbrowser.lfm
Normal file
139
demos/SimpleLazOSRBrowser/usimplelazosrbrowser.lfm
Normal file
@ -0,0 +1,139 @@
|
||||
object Form1: TForm1
|
||||
Left = 282
|
||||
Height = 565
|
||||
Top = 185
|
||||
Width = 800
|
||||
Caption = 'Simple OSR Browser - Initializing browser. Please wait...'
|
||||
ClientHeight = 565
|
||||
ClientWidth = 800
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'Tahoma'
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
OnHide = FormHide
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.8.4.0'
|
||||
object NavControlPnl: TPanel
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 800
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 21
|
||||
ClientWidth = 800
|
||||
Enabled = False
|
||||
TabOrder = 0
|
||||
object ComboBox1: TComboBox
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 731
|
||||
Align = alClient
|
||||
ItemHeight = 13
|
||||
Items.Strings = (
|
||||
'https://www.google.co'
|
||||
'https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_select_form'
|
||||
'https://www.briskbard.com'
|
||||
'https://frames-per-second.appspot.com/'
|
||||
)
|
||||
OnEnter = ComboBox1Enter
|
||||
TabOrder = 0
|
||||
Text = 'https://www.google.com'
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 731
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 69
|
||||
Align = alRight
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 21
|
||||
ClientWidth = 69
|
||||
TabOrder = 1
|
||||
object GoBtn: TButton
|
||||
Left = 4
|
||||
Height = 21
|
||||
Top = 0
|
||||
Width = 31
|
||||
Caption = 'Go'
|
||||
OnClick = GoBtnClick
|
||||
OnEnter = GoBtnEnter
|
||||
TabOrder = 0
|
||||
end
|
||||
object SnapshotBtn: TButton
|
||||
Left = 38
|
||||
Height = 21
|
||||
Hint = 'Take snapshot'
|
||||
Top = 0
|
||||
Width = 31
|
||||
Caption = 'µ'
|
||||
Font.CharSet = SYMBOL_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -24
|
||||
Font.Name = 'Webdings'
|
||||
OnClick = SnapshotBtnClick
|
||||
OnEnter = SnapshotBtnEnter
|
||||
ParentFont = False
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
end
|
||||
object Panel1: TBufferPanel
|
||||
Left = 0
|
||||
Height = 544
|
||||
Top = 21
|
||||
Width = 800
|
||||
Align = alClient
|
||||
Caption = 'Panel1'
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
OnClick = Panel1Click
|
||||
OnEnter = Panel1Enter
|
||||
OnExit = Panel1Exit
|
||||
OnMouseDown = Panel1MouseDown
|
||||
OnMouseMove = Panel1MouseMove
|
||||
OnMouseUp = Panel1MouseUp
|
||||
OnMouseWheel = Panel1MouseWheel
|
||||
OnKeyDown = Panel1KeyDown
|
||||
OnKeyPress = Panel1KeyPress
|
||||
OnKeyUp = Panel1KeyUp
|
||||
OnResize = Panel1Resize
|
||||
end
|
||||
object chrmosr: TChromium
|
||||
OnTooltip = chrmosrTooltip
|
||||
OnBeforePopup = chrmosrBeforePopup
|
||||
OnAfterCreated = chrmosrAfterCreated
|
||||
OnBeforeClose = chrmosrBeforeClose
|
||||
OnClose = chrmosrClose
|
||||
OnGetViewRect = chrmosrGetViewRect
|
||||
OnGetScreenPoint = chrmosrGetScreenPoint
|
||||
OnGetScreenInfo = chrmosrGetScreenInfo
|
||||
OnPopupShow = chrmosrPopupShow
|
||||
OnPopupSize = chrmosrPopupSize
|
||||
OnPaint = chrmosrPaint
|
||||
OnCursorChange = chrmosrCursorChange
|
||||
left = 24
|
||||
top = 56
|
||||
end
|
||||
object SaveDialog1: TSaveDialog
|
||||
Title = 'Save snapshot'
|
||||
DefaultExt = '.bmp'
|
||||
Filter = 'Bitmap files (*.bmp)|*.BMP'
|
||||
left = 24
|
||||
top = 200
|
||||
end
|
||||
object Timer1: TTimer
|
||||
Enabled = False
|
||||
Interval = 300
|
||||
OnTimer = Timer1Timer
|
||||
left = 24
|
||||
top = 128
|
||||
end
|
||||
end
|
874
demos/SimpleLazOSRBrowser/usimplelazosrbrowser.pas
Normal file
874
demos/SimpleLazOSRBrowser/usimplelazosrbrowser.pas
Normal file
@ -0,0 +1,874 @@
|
||||
// ************************************************************************
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||
// browser in Delphi applications.
|
||||
//
|
||||
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||
//
|
||||
// For more information about CEF4Delphi visit :
|
||||
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||
//
|
||||
// Copyright © 2018 Salvador Diaz Fau. All rights reserved.
|
||||
//
|
||||
// ************************************************************************
|
||||
// ************ vvvv Original license and comments below vvvv *************
|
||||
// ************************************************************************
|
||||
(*
|
||||
* Delphi Chromium Embedded 3
|
||||
*
|
||||
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||
* Web site : http://www.progdigy.com
|
||||
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||
*
|
||||
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||
* this source code without explicit permission.
|
||||
*
|
||||
*)
|
||||
|
||||
unit usimplelazosrbrowser;
|
||||
|
||||
{$MODE OBJFPC}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, SyncObjs,
|
||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uBufferPanel, Types;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
NavControlPnl: TPanel;
|
||||
chrmosr: TChromium;
|
||||
ComboBox1: TComboBox;
|
||||
Panel2: TPanel;
|
||||
GoBtn: TButton;
|
||||
SnapshotBtn: TButton;
|
||||
SaveDialog1: TSaveDialog;
|
||||
Timer1: TTimer;
|
||||
Panel1: TBufferPanel;
|
||||
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure GoBtnEnter(Sender: TObject);
|
||||
|
||||
procedure Panel1Enter(Sender: TObject);
|
||||
procedure Panel1Exit(Sender: TObject);
|
||||
procedure Panel1Resize(Sender: TObject);
|
||||
procedure Panel1Click(Sender: TObject);
|
||||
procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
procedure Panel1MouseLeave(Sender: TObject);
|
||||
procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
procedure Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure Panel1KeyPress(Sender: TObject; var Key: char);
|
||||
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormHide(Sender: TObject);
|
||||
procedure FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure chrmosrPaint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer);
|
||||
procedure chrmosrCursorChange(Sender: TObject; const browser: ICefBrowser; aCursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo);
|
||||
procedure chrmosrGetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect; out Result: Boolean);
|
||||
procedure chrmosrGetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean);
|
||||
procedure chrmosrGetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean);
|
||||
procedure chrmosrPopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean);
|
||||
procedure chrmosrPopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect);
|
||||
procedure chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
|
||||
procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||
procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||
procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
procedure SnapshotBtnClick(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
procedure SnapshotBtnEnter(Sender: TObject);
|
||||
procedure ComboBox1Enter(Sender: TObject);
|
||||
|
||||
protected
|
||||
FbFirst : boolean;
|
||||
FPopUpBitmap : TBitmap;
|
||||
FPopUpRect : TRect;
|
||||
FShowPopUp : boolean;
|
||||
FResizing : boolean;
|
||||
FPendingResize : boolean;
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean;
|
||||
FResizeCS : TCriticalSection;
|
||||
|
||||
FLastClickCount : integer;
|
||||
FLastClickTime : integer;
|
||||
FLastClickPoint : TPoint;
|
||||
FLastClickButton : TMouseButton;
|
||||
|
||||
function getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
function GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
procedure DoResize;
|
||||
procedure InitializeLastClick;
|
||||
function CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean;
|
||||
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMCaptureChanged(var aMessage : TMessage); message WM_CAPTURECHANGED;
|
||||
procedure WMCancelMode(var aMessage : TMessage); message WM_CANCELMODE;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
procedure WMSysChar(var aMessage: TMessage); message WM_SYSCHAR;
|
||||
procedure WMSysKeyDown(var aMessage: TMessage); message WM_SYSKEYDOWN;
|
||||
procedure WMSysKeyUp(var aMessage: TMessage); message WM_SYSKEYUP;
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE;
|
||||
procedure PendingInvalidateMsg(var aMessage : TMessage); message CEF_PENDINGINVALIDATE;
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math,
|
||||
uCEFMiscFunctions, uCEFApplication;
|
||||
|
||||
// This is the destruction sequence in OSR mode :
|
||||
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True).
|
||||
// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
|
||||
// set "Result" to false and CEF3 will destroy the internal browser immediately.
|
||||
// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed.
|
||||
// Now we set FCanClose to True and send WM_CLOSE to the form.
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
FResizeCS.Acquire;
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
FResizeCS.Release;
|
||||
|
||||
chrmosr.LoadURL(ComboBox1.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnEnter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrBeforePopup(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
||||
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
||||
var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean;
|
||||
var Result: Boolean);
|
||||
begin
|
||||
// For simplicity, this demo blocks all popup windows and new tabs
|
||||
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrCursorChange(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
aCursor : HICON;
|
||||
cursorType : TCefCursorType;
|
||||
const customCursorInfo : PCefCursorInfo);
|
||||
begin
|
||||
Panel1.Cursor := GefCursorToWindowsCursor(cursorType);
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrGetScreenInfo(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var screenInfo : TCefScreenInfo;
|
||||
out Result : Boolean);
|
||||
var
|
||||
TempRect : TCEFRect;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
TempRect.x := 0;
|
||||
TempRect.y := 0;
|
||||
TempRect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempRect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
|
||||
screenInfo.device_scale_factor := GlobalCEFApp.DeviceScaleFactor;
|
||||
screenInfo.depth := 0;
|
||||
screenInfo.depth_per_component := 0;
|
||||
screenInfo.is_monochrome := Ord(False);
|
||||
screenInfo.rect := TempRect;
|
||||
screenInfo.available_rect := TempRect;
|
||||
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrGetScreenPoint(Sender: TObject;
|
||||
const browser: ICefBrowser; viewX, viewY: Integer; var screenX,
|
||||
screenY: Integer; out Result: Boolean);
|
||||
var
|
||||
TempScreenPt, TempViewPt : TPoint;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
TempViewPt.x := LogicalToDevice(viewX, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempViewPt.y := LogicalToDevice(viewY, GlobalCEFApp.DeviceScaleFactor);
|
||||
TempScreenPt := Panel1.ClientToScreen(TempViewPt);
|
||||
screenX := TempScreenPt.x;
|
||||
screenY := TempScreenPt.y;
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrGetViewRect(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
var rect : TCefRect;
|
||||
out Result : Boolean);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
rect.x := 0;
|
||||
rect.y := 0;
|
||||
rect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor);
|
||||
rect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor);
|
||||
Result := True;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrPaint(Sender: TObject; const browser: ICefBrowser;
|
||||
kind: TCefPaintElementType; dirtyRectsCount: NativeUInt;
|
||||
const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth,
|
||||
aHeight: Integer);
|
||||
var
|
||||
src, dst: PByte;
|
||||
i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride : Integer;
|
||||
n : NativeUInt;
|
||||
TempWidth, TempHeight : integer;
|
||||
TempBufferBits : Pointer;
|
||||
TempForcedResize : boolean;
|
||||
TempBitmap : TBitmap;
|
||||
begin
|
||||
try
|
||||
FResizeCS.Acquire;
|
||||
TempForcedResize := False;
|
||||
|
||||
if Panel1.BeginBufferDraw then
|
||||
begin
|
||||
if (kind = PET_POPUP) then
|
||||
begin
|
||||
if (FPopUpBitmap = nil) or
|
||||
(aWidth <> FPopUpBitmap.Width) or
|
||||
(aHeight <> FPopUpBitmap.Height) then
|
||||
begin
|
||||
if (FPopUpBitmap <> nil) then FPopUpBitmap.Free;
|
||||
|
||||
FPopUpBitmap := TBitmap.Create;
|
||||
FPopUpBitmap.PixelFormat := pf32bit;
|
||||
FPopUpBitmap.HandleType := bmDIB;
|
||||
FPopUpBitmap.Width := aWidth;
|
||||
FPopUpBitmap.Height := aHeight;
|
||||
end;
|
||||
|
||||
TempBitmap := FPopUpBitmap;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := FPopUpBitmap.Width;
|
||||
TempHeight := FPopUpBitmap.Height;
|
||||
end
|
||||
else
|
||||
begin
|
||||
TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False));
|
||||
|
||||
TempBitmap := Panel1.Buffer;
|
||||
TempBitmap.BeginUpdate;
|
||||
|
||||
TempWidth := Panel1.BufferWidth;
|
||||
TempHeight := Panel1.BufferHeight;
|
||||
end;
|
||||
|
||||
if (TempBufferBits <> nil) then
|
||||
begin
|
||||
SrcStride := aWidth * SizeOf(TRGBQuad);
|
||||
n := 0;
|
||||
|
||||
while (n < dirtyRectsCount) do
|
||||
begin
|
||||
if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then
|
||||
begin
|
||||
TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
|
||||
if (TempLineSize > 0) then
|
||||
begin
|
||||
TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad);
|
||||
TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad));
|
||||
|
||||
src := @PByte(buffer)[TempSrcOffset];
|
||||
|
||||
i := 0;
|
||||
j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y);
|
||||
|
||||
while (i < j) do
|
||||
begin
|
||||
TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i];
|
||||
dst := @PByte(TempBufferBits)[TempDstOffset];
|
||||
|
||||
Move(src^, dst^, TempLineSize);
|
||||
|
||||
Inc(src, SrcStride);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
inc(n);
|
||||
end;
|
||||
|
||||
TempBitmap.EndUpdate;
|
||||
|
||||
if FShowPopup and (FPopUpBitmap <> nil) then
|
||||
Panel1.BufferDraw(FPopUpRect.Left, FPopUpRect.Top, FPopUpBitmap);
|
||||
end;
|
||||
|
||||
Panel1.EndBufferDraw;
|
||||
|
||||
if HandleAllocated then PostMessage(Handle, CEF_PENDINGINVALIDATE, 0, 0);
|
||||
|
||||
if (kind = PET_VIEW) then
|
||||
begin
|
||||
if (TempForcedResize or FPendingResize) and
|
||||
HandleAllocated then
|
||||
PostMessage(Handle, CEF_PENDINGRESIZE, 0, 0);
|
||||
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
FResizeCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrPopupShow(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
aShow : Boolean);
|
||||
begin
|
||||
if aShow then
|
||||
FShowPopUp := True
|
||||
else
|
||||
begin
|
||||
FShowPopUp := False;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
|
||||
if (chrmosr <> nil) then chrmosr.Invalidate(PET_VIEW);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrPopupSize(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const rect : PCefRect);
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then
|
||||
begin
|
||||
LogicalToDevice(rect^, GlobalCEFApp.DeviceScaleFactor);
|
||||
|
||||
FPopUpRect.Left := rect^.x;
|
||||
FPopUpRect.Top := rect^.y;
|
||||
FPopUpRect.Right := rect^.x + rect^.width - 1;
|
||||
FPopUpRect.Bottom := rect^.y + rect^.height - 1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean);
|
||||
begin
|
||||
Panel1.hint := aText;
|
||||
Panel1.ShowHint := (length(aText) > 0);
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.ComboBox1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
function TForm1.getModifiers(Shift: TShiftState): TCefEventFlags;
|
||||
begin
|
||||
Result := EVENTFLAG_NONE;
|
||||
|
||||
if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN;
|
||||
if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN;
|
||||
if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN;
|
||||
if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON;
|
||||
if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON;
|
||||
if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON;
|
||||
end;
|
||||
|
||||
function TForm1.GetButton(Button: TMouseButton): TCefMouseButtonType;
|
||||
begin
|
||||
case Button of
|
||||
TMouseButton.mbRight : Result := MBT_RIGHT;
|
||||
TMouseButton.mbMiddle : Result := MBT_MIDDLE;
|
||||
else Result := MBT_LEFT;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (chrmosr <> nil) then chrmosr.NotifyMoveOrResizeStarted;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMMoving(var aMessage : TMessage);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (chrmosr <> nil) then chrmosr.NotifyMoveOrResizeStarted;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMCaptureChanged(var aMessage : TMessage);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMCancelMode(var aMessage : TMessage);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMEnterMenuLoop(var aMessage: TMessage);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMExitMenuLoop(var aMessage: TMessage);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMSysChar(var aMessage: TMessage);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_CHAR;
|
||||
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
|
||||
TempKeyEvent.windows_key_code := aMessage.wParam;
|
||||
TempKeyEvent.native_key_code := aMessage.lParam;
|
||||
TempKeyEvent.is_system_key := ord(True);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMSysKeyDown(var aMessage: TMessage);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
|
||||
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
|
||||
TempKeyEvent.windows_key_code := aMessage.wParam;
|
||||
TempKeyEvent.native_key_code := aMessage.lParam;
|
||||
TempKeyEvent.is_system_key := ord(True);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.WMSysKeyUp(var aMessage: TMessage);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
inherited;
|
||||
|
||||
if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_KEYUP;
|
||||
TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam);
|
||||
TempKeyEvent.windows_key_code := aMessage.wParam;
|
||||
TempKeyEvent.native_key_code := aMessage.lParam;
|
||||
TempKeyEvent.is_system_key := ord(True);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
Caption := 'Simple Lazarus OSR Browser';
|
||||
NavControlPnl.Enabled := True;
|
||||
GoBtn.Click;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer);
|
||||
begin
|
||||
if (chrmosr <> nil) then
|
||||
begin
|
||||
chrmosr.NotifyScreenInfoChanged;
|
||||
chrmosr.WasResized;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
CanClose := FCanClose;
|
||||
|
||||
if not(FClosing) then
|
||||
begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
chrmosr.CloseBrowser(True);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FbFirst := False;
|
||||
FPopUpBitmap := nil;
|
||||
FPopUpRect := rect(0, 0, 0, 0);
|
||||
FShowPopUp := False;
|
||||
FResizing := False;
|
||||
FPendingResize := False;
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FResizeCS := TCriticalSection.Create;
|
||||
|
||||
InitializeLastClick;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
chrmosr.ShutdownDragAndDrop;
|
||||
|
||||
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormHide(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
chrmosr.WasHidden(True);
|
||||
end;
|
||||
|
||||
procedure TForm1.FormShow(Sender: TObject);
|
||||
begin
|
||||
if chrmosr.Initialized then
|
||||
begin
|
||||
chrmosr.WasHidden(False);
|
||||
chrmosr.SendFocusEvent(True);
|
||||
end
|
||||
else
|
||||
begin
|
||||
// opaque white background color
|
||||
chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||
|
||||
if chrmosr.CreateBrowser(nil, '') then
|
||||
chrmosr.InitializeDragAndDrop(Panel1)
|
||||
else
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Click(Sender: TObject);
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
Panel1.SetFocus;
|
||||
|
||||
if not(CancelPreviousClick(x, y, TempTime)) and (Button = FLastClickButton) then
|
||||
inc(FLastClickCount)
|
||||
else
|
||||
begin
|
||||
FLastClickPoint.x := x;
|
||||
FLastClickPoint.y := y;
|
||||
FLastClickCount := 1;
|
||||
end;
|
||||
|
||||
FLastClickTime := TempTime;
|
||||
FLastClickButton := Button;
|
||||
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseLeave(Sender: TObject);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempPoint : TPoint;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
GetCursorPos(TempPoint);
|
||||
TempPoint := Panel1.ScreenToclient(TempPoint);
|
||||
|
||||
if CancelPreviousClick(TempPoint.x, TempPoint.y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := TempPoint.x;
|
||||
TempEvent.y := TempPoint.y;
|
||||
TempEvent.modifiers := GetCefMouseModifiers;
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseMoveEvent(@TempEvent, True);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
TempTime : integer;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
if CancelPreviousClick(x, y, TempTime) then InitializeLastClick;
|
||||
|
||||
TempEvent.x := x;
|
||||
TempEvent.y := y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseMoveEvent(@TempEvent, False);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempEvent.x := X;
|
||||
TempEvent.y := Y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, FLastClickCount);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Resize(Sender: TObject);
|
||||
begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
procedure TForm1.PendingResizeMsg(var aMessage : TMessage);
|
||||
begin
|
||||
DoResize;
|
||||
end;
|
||||
|
||||
procedure TForm1.PendingInvalidateMsg(var aMessage : TMessage);
|
||||
begin
|
||||
Panel1.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TForm1.DoResize;
|
||||
begin
|
||||
try
|
||||
FResizeCS.Acquire;
|
||||
|
||||
if FResizing then
|
||||
FPendingResize := True
|
||||
else
|
||||
if Panel1.BufferIsResized then
|
||||
chrmosr.Invalidate(PET_VIEW)
|
||||
else
|
||||
begin
|
||||
FResizing := True;
|
||||
chrmosr.WasResized;
|
||||
end;
|
||||
finally
|
||||
FResizeCS.Release;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.InitializeLastClick;
|
||||
begin
|
||||
FLastClickCount := 0;
|
||||
FLastClickTime := 0;
|
||||
FLastClickPoint.x := 0;
|
||||
FLastClickPoint.y := 0;
|
||||
FLastClickButton := mbLeft;
|
||||
end;
|
||||
|
||||
function TForm1.CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean;
|
||||
begin
|
||||
aCurrentTime := GetMessageTime;
|
||||
|
||||
Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or
|
||||
(abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or
|
||||
(cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Enter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(True);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1Exit(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1KeyPress(Sender: TObject; var Key: char);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if Panel1.Focused then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_CHAR;
|
||||
TempKeyEvent.modifiers := GetCefKeyboardModifiers(WParam(Key), 0);
|
||||
TempKeyEvent.windows_key_code := ord(Key);
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
var
|
||||
TempKeyEvent : TCefKeyEvent;
|
||||
begin
|
||||
if (Key <> 0) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempKeyEvent.kind := KEYEVENT_KEYUP;
|
||||
TempKeyEvent.modifiers := getModifiers(Shift);
|
||||
TempKeyEvent.windows_key_code := Key;
|
||||
TempKeyEvent.native_key_code := 0;
|
||||
TempKeyEvent.is_system_key := ord(False);
|
||||
TempKeyEvent.character := #0;
|
||||
TempKeyEvent.unmodified_character := #0;
|
||||
TempKeyEvent.focus_on_editable_field := ord(False);
|
||||
|
||||
chrmosr.SendKeyEvent(@TempKeyEvent);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1MouseWheel(Sender: TObject; Shift: TShiftState;
|
||||
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||
var
|
||||
TempEvent : TCefMouseEvent;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and (chrmosr <> nil) then
|
||||
begin
|
||||
TempEvent.x := MousePos.x;
|
||||
TempEvent.y := MousePos.y;
|
||||
TempEvent.modifiers := getModifiers(Shift);
|
||||
DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor);
|
||||
chrmosr.SendMouseWheelEvent(@TempEvent, 0, WheelDelta);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.SnapshotBtnClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog1.Execute then Panel1.SaveToFile(SaveDialog1.FileName);
|
||||
end;
|
||||
|
||||
procedure TForm1.SnapshotBtnEnter(Sender: TObject);
|
||||
begin
|
||||
chrmosr.SendFocusEvent(False);
|
||||
end;
|
||||
|
||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
||||
if chrmosr.CreateBrowser(nil, '') then
|
||||
chrmosr.InitializeDragAndDrop(Panel1)
|
||||
else
|
||||
if not(chrmosr.Initialized) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
end.
|
@ -55,9 +55,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -69,6 +69,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -120,7 +120,7 @@ type
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -152,6 +152,12 @@ begin
|
||||
PostMessage(MainForm.Handle, CEFBROWSER_INITIALIZED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
end;
|
||||
|
||||
procedure TMainForm.AddTabBtnClick(Sender: TObject);
|
||||
var
|
||||
TempSheet : TTabSheet;
|
||||
|
@ -56,9 +56,9 @@ uses
|
||||
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.FlashEnabled := False;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
begin
|
||||
@ -67,6 +67,5 @@ begin
|
||||
Application.Run;
|
||||
end;
|
||||
|
||||
GlobalCEFApp.Free;
|
||||
GlobalCEFApp := nil;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -88,7 +88,7 @@ type
|
||||
var
|
||||
MainForm: TMainForm;
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
procedure CreateGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
@ -108,6 +108,12 @@ begin
|
||||
PostMessage(MainForm.Handle, CEFBROWSER_INITIALIZED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CreateToolboxChild(const ChildCaption, URL: string);
|
||||
var
|
||||
TempChild : TChildForm;
|
||||
|
@ -48,7 +48,7 @@ interface
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
{$IFDEF MSWINDOWS}Winapi.Windows, Winapi.Messages, Vcl.ExtCtrls, Vcl.Controls, Vcl.Graphics,{$ENDIF}
|
||||
System.Classes, System.SyncObjs, System.SysUtils;
|
||||
System.Classes, System.SyncObjs, System.SysUtils,
|
||||
{$ELSE}
|
||||
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Forms, Controls, Graphics,
|
||||
{$IFDEF FPC}
|
||||
@ -56,8 +56,9 @@ uses
|
||||
{$ELSE}
|
||||
Messages,
|
||||
{$ENDIF}
|
||||
ExtCtrls, SyncObjs, SysUtils;
|
||||
ExtCtrls, SyncObjs, SysUtils,
|
||||
{$ENDIF}
|
||||
uCEFConstants;
|
||||
|
||||
type
|
||||
TBufferPanel = class(TCustomPanel)
|
||||
@ -158,7 +159,8 @@ type
|
||||
property OnGetSiteInfo;
|
||||
property OnMouseDown;
|
||||
property OnMouseMove;
|
||||
property OnMouseUp;
|
||||
property OnMouseUp;
|
||||
property OnMouseWheel;
|
||||
property OnKeyDown;
|
||||
property OnKeyPress;
|
||||
property OnKeyUp;
|
||||
|
@ -127,6 +127,7 @@ type
|
||||
FGlobalContextInitialized : boolean;
|
||||
FSitePerProcess : boolean;
|
||||
FDisableWebSecurity : boolean;
|
||||
FDisablePDFExtension : boolean;
|
||||
FChromeVersionInfo : TFileVersionInfo;
|
||||
{$IFDEF FPC}
|
||||
FLibHandle : TLibHandle;
|
||||
@ -348,6 +349,7 @@ type
|
||||
property MuteAudio : boolean read FMuteAudio write FMuteAudio;
|
||||
property SitePerProcess : boolean read FSitePerProcess write FSitePerProcess;
|
||||
property DisableWebSecurity : boolean read FDisableWebSecurity write FDisableWebSecurity;
|
||||
property DisablePDFExtension : boolean read FDisablePDFExtension write FDisablePDFExtension;
|
||||
property ReRaiseExceptions : boolean read FReRaiseExceptions write FReRaiseExceptions;
|
||||
property DeviceScaleFactor : single read FDeviceScaleFactor;
|
||||
property CheckDevToolsResources : boolean read FCheckDevToolsResources write FCheckDevToolsResources;
|
||||
@ -396,6 +398,8 @@ type
|
||||
var
|
||||
GlobalCEFApp : TCefApplication = nil;
|
||||
|
||||
procedure DestroyGlobalCEFApp;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -412,6 +416,11 @@ uses
|
||||
uCEFLibFunctions, uCEFMiscFunctions, uCEFCommandLine, uCEFConstants,
|
||||
uCEFSchemeHandlerFactory, uCEFCookieManager, uCEFApp, uCEFRegisterCDMCallback;
|
||||
|
||||
procedure DestroyGlobalCEFApp;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) then FreeAndNil(GlobalCEFApp);
|
||||
end;
|
||||
|
||||
constructor TCefApplication.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
@ -466,6 +475,7 @@ begin
|
||||
FMuteAudio := False;
|
||||
FSitePerProcess := False;
|
||||
FDisableWebSecurity := False;
|
||||
FDisablePDFExtension := False;
|
||||
FReRaiseExceptions := False;
|
||||
FLibLoaded := False;
|
||||
FShowMessageDlg := True;
|
||||
@ -1320,6 +1330,9 @@ begin
|
||||
if FDisableWebSecurity then
|
||||
commandLine.AppendSwitch('--disable-web-security');
|
||||
|
||||
if FDisablePDFExtension then
|
||||
commandLine.AppendSwitch('--disable-pdf-extension');
|
||||
|
||||
if FSitePerProcess then
|
||||
commandLine.AppendSwitch('--site-per-process');
|
||||
|
||||
|
@ -1,204 +1,204 @@
|
||||
// ************************************************************************
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||
// browser in Delphi applications.
|
||||
//
|
||||
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||
//
|
||||
// For more information about CEF4Delphi visit :
|
||||
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||
//
|
||||
// Copyright © 2018 Salvador Diaz Fau. All rights reserved.
|
||||
//
|
||||
// ************************************************************************
|
||||
// ************ vvvv Original license and comments below vvvv *************
|
||||
// ************************************************************************
|
||||
(*
|
||||
* Delphi Chromium Embedded 3
|
||||
*
|
||||
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||
* Web site : http://www.progdigy.com
|
||||
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||
*
|
||||
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||
* this source code without explicit permission.
|
||||
*
|
||||
*)
|
||||
|
||||
unit uCEFConstants;
|
||||
|
||||
{$IFDEF FPC}
|
||||
// ************************************************************************
|
||||
// ***************************** CEF4Delphi *******************************
|
||||
// ************************************************************************
|
||||
//
|
||||
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||
// browser in Delphi applications.
|
||||
//
|
||||
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||
//
|
||||
// For more information about CEF4Delphi visit :
|
||||
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||
//
|
||||
// Copyright © 2018 Salvador Diaz Fau. All rights reserved.
|
||||
//
|
||||
// ************************************************************************
|
||||
// ************ vvvv Original license and comments below vvvv *************
|
||||
// ************************************************************************
|
||||
(*
|
||||
* Delphi Chromium Embedded 3
|
||||
*
|
||||
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||
* the specific language governing rights and limitations under the License.
|
||||
*
|
||||
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||
* Web site : http://www.progdigy.com
|
||||
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||
*
|
||||
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||
* this source code without explicit permission.
|
||||
*
|
||||
*)
|
||||
|
||||
unit uCEFConstants;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE OBJFPC}{$H+}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF CPUX64}
|
||||
{$ALIGN ON}
|
||||
{$MINENUMSIZE 4}
|
||||
{$ENDIF}
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Winapi.Messages;
|
||||
{$ELSE}
|
||||
Messages;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
// /include/internal/cef_types.h (cef_errorcode_t)
|
||||
ERR_NONE = 0;
|
||||
ERR_FAILED = -2;
|
||||
ERR_ABORTED = -3;
|
||||
ERR_INVALID_ARGUMENT = -4;
|
||||
ERR_INVALID_HANDLE = -5;
|
||||
ERR_FILE_NOT_FOUND = -6;
|
||||
ERR_TIMED_OUT = -7;
|
||||
ERR_FILE_TOO_BIG = -8;
|
||||
ERR_UNEXPECTED = -9;
|
||||
ERR_ACCESS_DENIED = -10;
|
||||
ERR_NOT_IMPLEMENTED = -11;
|
||||
ERR_CONNECTION_CLOSED = -100;
|
||||
ERR_CONNECTION_RESET = -101;
|
||||
ERR_CONNECTION_REFUSED = -102;
|
||||
ERR_CONNECTION_ABORTED = -103;
|
||||
ERR_CONNECTION_FAILED = -104;
|
||||
ERR_NAME_NOT_RESOLVED = -105;
|
||||
ERR_INTERNET_DISCONNECTED = -106;
|
||||
ERR_SSL_PROTOCOL_ERROR = -107;
|
||||
ERR_ADDRESS_INVALID = -108;
|
||||
ERR_ADDRESS_UNREACHABLE = -109;
|
||||
ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110;
|
||||
ERR_TUNNEL_CONNECTION_FAILED = -111;
|
||||
ERR_NO_SSL_VERSIONS_ENABLED = -112;
|
||||
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113;
|
||||
ERR_SSL_RENEGOTIATION_REQUESTED = -114;
|
||||
ERR_CERT_COMMON_NAME_INVALID = -200;
|
||||
ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID;
|
||||
ERR_CERT_DATE_INVALID = -201;
|
||||
ERR_CERT_AUTHORITY_INVALID = -202;
|
||||
ERR_CERT_CONTAINS_ERRORS = -203;
|
||||
ERR_CERT_NO_REVOCATION_MECHANISM = -204;
|
||||
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205;
|
||||
ERR_CERT_REVOKED = -206;
|
||||
ERR_CERT_INVALID = -207;
|
||||
ERR_CERT_WEAK_SIGNATURE_ALGORITHM = -208;
|
||||
ERR_CERT_NON_UNIQUE_NAME = -210;
|
||||
ERR_CERT_WEAK_KEY = -211;
|
||||
ERR_CERT_NAME_CONSTRAINT_VIOLATION = -212;
|
||||
ERR_CERT_VALIDITY_TOO_LONG = -213;
|
||||
ERR_CERT_END = ERR_CERT_VALIDITY_TOO_LONG;
|
||||
ERR_INVALID_URL = -300;
|
||||
ERR_DISALLOWED_URL_SCHEME = -301;
|
||||
ERR_UNKNOWN_URL_SCHEME = -302;
|
||||
ERR_TOO_MANY_REDIRECTS = -310;
|
||||
ERR_UNSAFE_REDIRECT = -311;
|
||||
ERR_UNSAFE_PORT = -312;
|
||||
ERR_INVALID_RESPONSE = -320;
|
||||
ERR_INVALID_CHUNKED_ENCODING = -321;
|
||||
ERR_METHOD_NOT_SUPPORTED = -322;
|
||||
ERR_UNEXPECTED_PROXY_AUTH = -323;
|
||||
ERR_EMPTY_RESPONSE = -324;
|
||||
ERR_RESPONSE_HEADERS_TOO_BIG = -325;
|
||||
ERR_CACHE_MISS = -400;
|
||||
ERR_INSECURE_RESPONSE = -501;
|
||||
|
||||
// /include/internal/cef_types.h (cef_cert_status_t)
|
||||
CERT_STATUS_NONE = 0;
|
||||
CERT_STATUS_COMMON_NAME_INVALID = 1 shl 0;
|
||||
CERT_STATUS_DATE_INVALID = 1 shl 1;
|
||||
CERT_STATUS_AUTHORITY_INVALID = 1 shl 2;
|
||||
CERT_STATUS_NO_REVOCATION_MECHANISM = 1 shl 4;
|
||||
CERT_STATUS_UNABLE_TO_CHECK_REVOCATION = 1 shl 5;
|
||||
CERT_STATUS_REVOKED = 1 shl 6;
|
||||
CERT_STATUS_INVALID = 1 shl 7;
|
||||
CERT_STATUS_WEAK_SIGNATURE_ALGORITHM = 1 shl 8;
|
||||
CERT_STATUS_NON_UNIQUE_NAME = 1 shl 10;
|
||||
CERT_STATUS_WEAK_KEY = 1 shl 11;
|
||||
CERT_STATUS_PINNED_KEY_MISSING = 1 shl 13;
|
||||
CERT_STATUS_NAME_CONSTRAINT_VIOLATION = 1 shl 14;
|
||||
CERT_STATUS_VALIDITY_TOO_LONG = 1 shl 15;
|
||||
CERT_STATUS_IS_EV = 1 shl 16;
|
||||
CERT_STATUS_REV_CHECKING_ENABLED = 1 shl 17;
|
||||
CERT_STATUS_SHA1_SIGNATURE_PRESENT = 1 shl 19;
|
||||
CERT_STATUS_CT_COMPLIANCE_FAILED = 1 shl 20;
|
||||
|
||||
CERT_STATUS_FIRST_ERROR = CERT_STATUS_COMMON_NAME_INVALID;
|
||||
CERT_STATUS_LAST_ERROR = CERT_STATUS_VALIDITY_TOO_LONG;
|
||||
|
||||
// /include/internal/cef_types.h (cef_v8_accesscontrol_t)
|
||||
V8_ACCESS_CONTROL_DEFAULT = 0;
|
||||
V8_ACCESS_CONTROL_ALL_CAN_READ = 1 shl 0;
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF CPUX64}
|
||||
{$ALIGN ON}
|
||||
{$MINENUMSIZE 4}
|
||||
{$ENDIF}
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Winapi.Messages;
|
||||
{$ELSE}
|
||||
Messages;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
// /include/internal/cef_types.h (cef_errorcode_t)
|
||||
ERR_NONE = 0;
|
||||
ERR_FAILED = -2;
|
||||
ERR_ABORTED = -3;
|
||||
ERR_INVALID_ARGUMENT = -4;
|
||||
ERR_INVALID_HANDLE = -5;
|
||||
ERR_FILE_NOT_FOUND = -6;
|
||||
ERR_TIMED_OUT = -7;
|
||||
ERR_FILE_TOO_BIG = -8;
|
||||
ERR_UNEXPECTED = -9;
|
||||
ERR_ACCESS_DENIED = -10;
|
||||
ERR_NOT_IMPLEMENTED = -11;
|
||||
ERR_CONNECTION_CLOSED = -100;
|
||||
ERR_CONNECTION_RESET = -101;
|
||||
ERR_CONNECTION_REFUSED = -102;
|
||||
ERR_CONNECTION_ABORTED = -103;
|
||||
ERR_CONNECTION_FAILED = -104;
|
||||
ERR_NAME_NOT_RESOLVED = -105;
|
||||
ERR_INTERNET_DISCONNECTED = -106;
|
||||
ERR_SSL_PROTOCOL_ERROR = -107;
|
||||
ERR_ADDRESS_INVALID = -108;
|
||||
ERR_ADDRESS_UNREACHABLE = -109;
|
||||
ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110;
|
||||
ERR_TUNNEL_CONNECTION_FAILED = -111;
|
||||
ERR_NO_SSL_VERSIONS_ENABLED = -112;
|
||||
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113;
|
||||
ERR_SSL_RENEGOTIATION_REQUESTED = -114;
|
||||
ERR_CERT_COMMON_NAME_INVALID = -200;
|
||||
ERR_CERT_BEGIN = ERR_CERT_COMMON_NAME_INVALID;
|
||||
ERR_CERT_DATE_INVALID = -201;
|
||||
ERR_CERT_AUTHORITY_INVALID = -202;
|
||||
ERR_CERT_CONTAINS_ERRORS = -203;
|
||||
ERR_CERT_NO_REVOCATION_MECHANISM = -204;
|
||||
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205;
|
||||
ERR_CERT_REVOKED = -206;
|
||||
ERR_CERT_INVALID = -207;
|
||||
ERR_CERT_WEAK_SIGNATURE_ALGORITHM = -208;
|
||||
ERR_CERT_NON_UNIQUE_NAME = -210;
|
||||
ERR_CERT_WEAK_KEY = -211;
|
||||
ERR_CERT_NAME_CONSTRAINT_VIOLATION = -212;
|
||||
ERR_CERT_VALIDITY_TOO_LONG = -213;
|
||||
ERR_CERT_END = ERR_CERT_VALIDITY_TOO_LONG;
|
||||
ERR_INVALID_URL = -300;
|
||||
ERR_DISALLOWED_URL_SCHEME = -301;
|
||||
ERR_UNKNOWN_URL_SCHEME = -302;
|
||||
ERR_TOO_MANY_REDIRECTS = -310;
|
||||
ERR_UNSAFE_REDIRECT = -311;
|
||||
ERR_UNSAFE_PORT = -312;
|
||||
ERR_INVALID_RESPONSE = -320;
|
||||
ERR_INVALID_CHUNKED_ENCODING = -321;
|
||||
ERR_METHOD_NOT_SUPPORTED = -322;
|
||||
ERR_UNEXPECTED_PROXY_AUTH = -323;
|
||||
ERR_EMPTY_RESPONSE = -324;
|
||||
ERR_RESPONSE_HEADERS_TOO_BIG = -325;
|
||||
ERR_CACHE_MISS = -400;
|
||||
ERR_INSECURE_RESPONSE = -501;
|
||||
|
||||
// /include/internal/cef_types.h (cef_cert_status_t)
|
||||
CERT_STATUS_NONE = 0;
|
||||
CERT_STATUS_COMMON_NAME_INVALID = 1 shl 0;
|
||||
CERT_STATUS_DATE_INVALID = 1 shl 1;
|
||||
CERT_STATUS_AUTHORITY_INVALID = 1 shl 2;
|
||||
CERT_STATUS_NO_REVOCATION_MECHANISM = 1 shl 4;
|
||||
CERT_STATUS_UNABLE_TO_CHECK_REVOCATION = 1 shl 5;
|
||||
CERT_STATUS_REVOKED = 1 shl 6;
|
||||
CERT_STATUS_INVALID = 1 shl 7;
|
||||
CERT_STATUS_WEAK_SIGNATURE_ALGORITHM = 1 shl 8;
|
||||
CERT_STATUS_NON_UNIQUE_NAME = 1 shl 10;
|
||||
CERT_STATUS_WEAK_KEY = 1 shl 11;
|
||||
CERT_STATUS_PINNED_KEY_MISSING = 1 shl 13;
|
||||
CERT_STATUS_NAME_CONSTRAINT_VIOLATION = 1 shl 14;
|
||||
CERT_STATUS_VALIDITY_TOO_LONG = 1 shl 15;
|
||||
CERT_STATUS_IS_EV = 1 shl 16;
|
||||
CERT_STATUS_REV_CHECKING_ENABLED = 1 shl 17;
|
||||
CERT_STATUS_SHA1_SIGNATURE_PRESENT = 1 shl 19;
|
||||
CERT_STATUS_CT_COMPLIANCE_FAILED = 1 shl 20;
|
||||
|
||||
CERT_STATUS_FIRST_ERROR = CERT_STATUS_COMMON_NAME_INVALID;
|
||||
CERT_STATUS_LAST_ERROR = CERT_STATUS_VALIDITY_TOO_LONG;
|
||||
|
||||
// /include/internal/cef_types.h (cef_v8_accesscontrol_t)
|
||||
V8_ACCESS_CONTROL_DEFAULT = 0;
|
||||
V8_ACCESS_CONTROL_ALL_CAN_READ = 1 shl 0;
|
||||
V8_ACCESS_CONTROL_ALL_CAN_WRITE = 1 shl 1;
|
||||
V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 shl 2;
|
||||
|
||||
// /include/internal/cef_types.h (cef_v8_propertyattribute_t)
|
||||
V8_PROPERTY_ATTRIBUTE_NONE = 0;
|
||||
V8_PROPERTY_ATTRIBUTE_READONLY = 1 shl 0;
|
||||
V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 shl 2;
|
||||
|
||||
// /include/internal/cef_types.h (cef_v8_propertyattribute_t)
|
||||
V8_PROPERTY_ATTRIBUTE_NONE = 0;
|
||||
V8_PROPERTY_ATTRIBUTE_READONLY = 1 shl 0;
|
||||
V8_PROPERTY_ATTRIBUTE_DONTENUM = 1 shl 1;
|
||||
V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 shl 2;
|
||||
|
||||
// /include/internal/cef_types.h (cef_transition_type_t)
|
||||
TT_LINK = 0;
|
||||
TT_EXPLICIT = 1;
|
||||
TT_AUTO_SUBFRAME = 3;
|
||||
TT_MANUAL_SUBFRAME = 4;
|
||||
TT_FORM_SUBMIT = 7;
|
||||
TT_RELOAD = 8;
|
||||
TT_SOURCE_MASK = $000000FF;
|
||||
TT_BLOCKED_FLAG = $00800000;
|
||||
TT_FORWARD_BACK_FLAG = $01000000;
|
||||
TT_CHAIN_START_FLAG = $10000000;
|
||||
TT_CHAIN_END_FLAG = $20000000;
|
||||
TT_CLIENT_REDIRECT_FLAG = $40000000;
|
||||
TT_SERVER_REDIRECT_FLAG = $80000000;
|
||||
TT_IS_REDIRECT_MASK = $C0000000;
|
||||
TT_QUALIFIER_MASK = $FFFFFF00;
|
||||
|
||||
// /include/internal/cef_types.h (cef_urlrequest_flags_t)
|
||||
UR_FLAG_NONE = 0;
|
||||
UR_FLAG_SKIP_CACHE = 1 shl 0;
|
||||
UR_FLAG_ONLY_FROM_CACHE = 1 shl 1;
|
||||
V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 shl 2;
|
||||
|
||||
// /include/internal/cef_types.h (cef_transition_type_t)
|
||||
TT_LINK = 0;
|
||||
TT_EXPLICIT = 1;
|
||||
TT_AUTO_SUBFRAME = 3;
|
||||
TT_MANUAL_SUBFRAME = 4;
|
||||
TT_FORM_SUBMIT = 7;
|
||||
TT_RELOAD = 8;
|
||||
TT_SOURCE_MASK = $000000FF;
|
||||
TT_BLOCKED_FLAG = $00800000;
|
||||
TT_FORWARD_BACK_FLAG = $01000000;
|
||||
TT_CHAIN_START_FLAG = $10000000;
|
||||
TT_CHAIN_END_FLAG = $20000000;
|
||||
TT_CLIENT_REDIRECT_FLAG = $40000000;
|
||||
TT_SERVER_REDIRECT_FLAG = $80000000;
|
||||
TT_IS_REDIRECT_MASK = $C0000000;
|
||||
TT_QUALIFIER_MASK = $FFFFFF00;
|
||||
|
||||
// /include/internal/cef_types.h (cef_urlrequest_flags_t)
|
||||
UR_FLAG_NONE = 0;
|
||||
UR_FLAG_SKIP_CACHE = 1 shl 0;
|
||||
UR_FLAG_ONLY_FROM_CACHE = 1 shl 1;
|
||||
UR_FLAG_ALLOW_STORED_CREDENTIALS = 1 shl 2;
|
||||
UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 shl 3;
|
||||
UR_FLAG_NO_DOWNLOAD_DATA = 1 shl 4;
|
||||
UR_FLAG_NO_RETRY_ON_5XX = 1 shl 5;
|
||||
UR_FLAG_STOP_ON_REDIRECT = 1 shl 6;
|
||||
|
||||
// /include/internal/cef_types.h (cef_dom_event_category_t)
|
||||
DOM_EVENT_CATEGORY_UNKNOWN = 0;
|
||||
DOM_EVENT_CATEGORY_UI = 1 shl 0;
|
||||
DOM_EVENT_CATEGORY_MOUSE = 1 shl 1;
|
||||
DOM_EVENT_CATEGORY_MUTATION = 1 shl 2;
|
||||
DOM_EVENT_CATEGORY_KEYBOARD = 1 shl 3;
|
||||
DOM_EVENT_CATEGORY_TEXT = 1 shl 4;
|
||||
DOM_EVENT_CATEGORY_COMPOSITION = 1 shl 5;
|
||||
DOM_EVENT_CATEGORY_DRAG = 1 shl 6;
|
||||
DOM_EVENT_CATEGORY_CLIPBOARD = 1 shl 7;
|
||||
DOM_EVENT_CATEGORY_MESSAGE = 1 shl 8;
|
||||
DOM_EVENT_CATEGORY_WHEEL = 1 shl 9;
|
||||
DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED = 1 shl 10;
|
||||
DOM_EVENT_CATEGORY_OVERFLOW = 1 shl 11;
|
||||
DOM_EVENT_CATEGORY_PAGE_TRANSITION = 1 shl 12;
|
||||
DOM_EVENT_CATEGORY_POPSTATE = 1 shl 13;
|
||||
DOM_EVENT_CATEGORY_PROGRESS = 1 shl 14;
|
||||
DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS = 1 shl 15;
|
||||
|
||||
// /include/internal/cef_types.h (cef_event_flags_t)
|
||||
EVENTFLAG_NONE = 0;
|
||||
EVENTFLAG_CAPS_LOCK_ON = 1 shl 0;
|
||||
UR_FLAG_NO_RETRY_ON_5XX = 1 shl 5;
|
||||
UR_FLAG_STOP_ON_REDIRECT = 1 shl 6;
|
||||
|
||||
// /include/internal/cef_types.h (cef_dom_event_category_t)
|
||||
DOM_EVENT_CATEGORY_UNKNOWN = 0;
|
||||
DOM_EVENT_CATEGORY_UI = 1 shl 0;
|
||||
DOM_EVENT_CATEGORY_MOUSE = 1 shl 1;
|
||||
DOM_EVENT_CATEGORY_MUTATION = 1 shl 2;
|
||||
DOM_EVENT_CATEGORY_KEYBOARD = 1 shl 3;
|
||||
DOM_EVENT_CATEGORY_TEXT = 1 shl 4;
|
||||
DOM_EVENT_CATEGORY_COMPOSITION = 1 shl 5;
|
||||
DOM_EVENT_CATEGORY_DRAG = 1 shl 6;
|
||||
DOM_EVENT_CATEGORY_CLIPBOARD = 1 shl 7;
|
||||
DOM_EVENT_CATEGORY_MESSAGE = 1 shl 8;
|
||||
DOM_EVENT_CATEGORY_WHEEL = 1 shl 9;
|
||||
DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED = 1 shl 10;
|
||||
DOM_EVENT_CATEGORY_OVERFLOW = 1 shl 11;
|
||||
DOM_EVENT_CATEGORY_PAGE_TRANSITION = 1 shl 12;
|
||||
DOM_EVENT_CATEGORY_POPSTATE = 1 shl 13;
|
||||
DOM_EVENT_CATEGORY_PROGRESS = 1 shl 14;
|
||||
DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS = 1 shl 15;
|
||||
|
||||
// /include/internal/cef_types.h (cef_event_flags_t)
|
||||
EVENTFLAG_NONE = 0;
|
||||
EVENTFLAG_CAPS_LOCK_ON = 1 shl 0;
|
||||
EVENTFLAG_SHIFT_DOWN = 1 shl 1;
|
||||
EVENTFLAG_CONTROL_DOWN = 1 shl 2;
|
||||
EVENTFLAG_ALT_DOWN = 1 shl 3;
|
||||
@ -209,8 +209,8 @@ const
|
||||
EVENTFLAG_NUM_LOCK_ON = 1 shl 8;
|
||||
EVENTFLAG_IS_KEY_PAD = 1 shl 9;
|
||||
EVENTFLAG_IS_LEFT = 1 shl 10;
|
||||
EVENTFLAG_IS_RIGHT = 1 shl 11;
|
||||
|
||||
EVENTFLAG_IS_RIGHT = 1 shl 11;
|
||||
|
||||
// /include/internal/cef_types.h (cef_drag_operations_mask_t)
|
||||
DRAG_OPERATION_NONE = 0;
|
||||
DRAG_OPERATION_COPY = 1 shl 0;
|
||||
@ -218,63 +218,63 @@ const
|
||||
DRAG_OPERATION_GENERIC = 1 shl 2;
|
||||
DRAG_OPERATION_PRIVATE = 1 shl 3;
|
||||
DRAG_OPERATION_MOVE = 1 shl 4;
|
||||
DRAG_OPERATION_DELETE = 1 shl 5;
|
||||
DRAG_OPERATION_EVERY = $FFFFFFFF;
|
||||
|
||||
// /include/internal/cef_types.h (cef_file_dialog_mode_t)
|
||||
FILE_DIALOG_TYPE_MASK = $000000FF;
|
||||
FILE_DIALOG_OVERWRITEPROMPT_FLAG = $01000000;
|
||||
FILE_DIALOG_HIDEREADONLY_FLAG = $02000000;
|
||||
|
||||
// /include/internal/cef_types.h (cef_uri_unescape_rule_t)
|
||||
UU_NONE = 0;
|
||||
UU_NORMAL = 1 shl 0;
|
||||
UU_SPACES = 1 shl 1;
|
||||
UU_PATH_SEPARATORS = 1 shl 2;
|
||||
UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS = 1 shl 3;
|
||||
UU_SPOOFING_AND_CONTROL_CHARS = 1 shl 4;
|
||||
UU_REPLACE_PLUS_WITH_SPACE = 1 shl 5;
|
||||
|
||||
// /include/internal/cef_types.h (cef_menu_id_t)
|
||||
MENU_ID_BACK = 100;
|
||||
DRAG_OPERATION_DELETE = 1 shl 5;
|
||||
DRAG_OPERATION_EVERY = $FFFFFFFF;
|
||||
|
||||
// /include/internal/cef_types.h (cef_file_dialog_mode_t)
|
||||
FILE_DIALOG_TYPE_MASK = $000000FF;
|
||||
FILE_DIALOG_OVERWRITEPROMPT_FLAG = $01000000;
|
||||
FILE_DIALOG_HIDEREADONLY_FLAG = $02000000;
|
||||
|
||||
// /include/internal/cef_types.h (cef_uri_unescape_rule_t)
|
||||
UU_NONE = 0;
|
||||
UU_NORMAL = 1 shl 0;
|
||||
UU_SPACES = 1 shl 1;
|
||||
UU_PATH_SEPARATORS = 1 shl 2;
|
||||
UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS = 1 shl 3;
|
||||
UU_SPOOFING_AND_CONTROL_CHARS = 1 shl 4;
|
||||
UU_REPLACE_PLUS_WITH_SPACE = 1 shl 5;
|
||||
|
||||
// /include/internal/cef_types.h (cef_menu_id_t)
|
||||
MENU_ID_BACK = 100;
|
||||
MENU_ID_FORWARD = 101;
|
||||
MENU_ID_RELOAD = 102;
|
||||
MENU_ID_RELOAD_NOCACHE = 103;
|
||||
MENU_ID_STOPLOAD = 104;
|
||||
MENU_ID_UNDO = 110;
|
||||
MENU_ID_REDO = 111;
|
||||
MENU_ID_CUT = 112;
|
||||
MENU_ID_COPY = 113;
|
||||
MENU_ID_PASTE = 114;
|
||||
MENU_ID_DELETE = 115;
|
||||
MENU_ID_SELECT_ALL = 116;
|
||||
MENU_ID_FIND = 130;
|
||||
MENU_ID_PRINT = 131;
|
||||
MENU_ID_VIEW_SOURCE = 132;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_0 = 200;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_1 = 201;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_2 = 202;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_3 = 203;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_4 = 204;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_LAST = 204;
|
||||
MENU_ID_NO_SPELLING_SUGGESTIONS = 205;
|
||||
MENU_ID_ADD_TO_DICTIONARY = 206;
|
||||
MENU_ID_CUSTOM_FIRST = 220;
|
||||
MENU_ID_CUSTOM_LAST = 250;
|
||||
MENU_ID_USER_FIRST = 26500;
|
||||
MENU_ID_USER_LAST = 28500;
|
||||
|
||||
// /include/internal/cef_types.h (cef_context_menu_type_flags_t)
|
||||
CM_TYPEFLAG_NONE = 0;
|
||||
CM_TYPEFLAG_PAGE = 1 shl 0;
|
||||
MENU_ID_RELOAD = 102;
|
||||
MENU_ID_RELOAD_NOCACHE = 103;
|
||||
MENU_ID_STOPLOAD = 104;
|
||||
MENU_ID_UNDO = 110;
|
||||
MENU_ID_REDO = 111;
|
||||
MENU_ID_CUT = 112;
|
||||
MENU_ID_COPY = 113;
|
||||
MENU_ID_PASTE = 114;
|
||||
MENU_ID_DELETE = 115;
|
||||
MENU_ID_SELECT_ALL = 116;
|
||||
MENU_ID_FIND = 130;
|
||||
MENU_ID_PRINT = 131;
|
||||
MENU_ID_VIEW_SOURCE = 132;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_0 = 200;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_1 = 201;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_2 = 202;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_3 = 203;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_4 = 204;
|
||||
MENU_ID_SPELLCHECK_SUGGESTION_LAST = 204;
|
||||
MENU_ID_NO_SPELLING_SUGGESTIONS = 205;
|
||||
MENU_ID_ADD_TO_DICTIONARY = 206;
|
||||
MENU_ID_CUSTOM_FIRST = 220;
|
||||
MENU_ID_CUSTOM_LAST = 250;
|
||||
MENU_ID_USER_FIRST = 26500;
|
||||
MENU_ID_USER_LAST = 28500;
|
||||
|
||||
// /include/internal/cef_types.h (cef_context_menu_type_flags_t)
|
||||
CM_TYPEFLAG_NONE = 0;
|
||||
CM_TYPEFLAG_PAGE = 1 shl 0;
|
||||
CM_TYPEFLAG_FRAME = 1 shl 1;
|
||||
CM_TYPEFLAG_LINK = 1 shl 2;
|
||||
CM_TYPEFLAG_MEDIA = 1 shl 3;
|
||||
CM_TYPEFLAG_SELECTION = 1 shl 4;
|
||||
CM_TYPEFLAG_EDITABLE = 1 shl 5;
|
||||
|
||||
// /include/internal/cef_types.h (cef_context_menu_media_state_flags_t)
|
||||
CM_MEDIAFLAG_NONE = 0;
|
||||
CM_TYPEFLAG_EDITABLE = 1 shl 5;
|
||||
|
||||
// /include/internal/cef_types.h (cef_context_menu_media_state_flags_t)
|
||||
CM_MEDIAFLAG_NONE = 0;
|
||||
CM_MEDIAFLAG_ERROR = 1 shl 0;
|
||||
CM_MEDIAFLAG_PAUSED = 1 shl 1;
|
||||
CM_MEDIAFLAG_MUTED = 1 shl 2;
|
||||
@ -284,10 +284,10 @@ const
|
||||
CM_MEDIAFLAG_HAS_VIDEO = 1 shl 6;
|
||||
CM_MEDIAFLAG_CONTROL_ROOT_ELEMENT = 1 shl 7;
|
||||
CM_MEDIAFLAG_CAN_PRINT = 1 shl 8;
|
||||
CM_MEDIAFLAG_CAN_ROTATE = 1 shl 9;
|
||||
|
||||
// /include/internal/cef_types.h (cef_context_menu_edit_state_flags_t)
|
||||
CM_EDITFLAG_NONE = 0;
|
||||
CM_MEDIAFLAG_CAN_ROTATE = 1 shl 9;
|
||||
|
||||
// /include/internal/cef_types.h (cef_context_menu_edit_state_flags_t)
|
||||
CM_EDITFLAG_NONE = 0;
|
||||
CM_EDITFLAG_CAN_UNDO = 1 shl 0;
|
||||
CM_EDITFLAG_CAN_REDO = 1 shl 1;
|
||||
CM_EDITFLAG_CAN_CUT = 1 shl 2;
|
||||
@ -295,20 +295,20 @@ const
|
||||
CM_EDITFLAG_CAN_PASTE = 1 shl 4;
|
||||
CM_EDITFLAG_CAN_DELETE = 1 shl 5;
|
||||
CM_EDITFLAG_CAN_SELECT_ALL = 1 shl 6;
|
||||
CM_EDITFLAG_CAN_TRANSLATE = 1 shl 7;
|
||||
|
||||
// /include/internal/cef_types.h (cef_ssl_version_t)
|
||||
SSL_CONNECTION_VERSION_UNKNOWN = 0;
|
||||
CM_EDITFLAG_CAN_TRANSLATE = 1 shl 7;
|
||||
|
||||
// /include/internal/cef_types.h (cef_ssl_version_t)
|
||||
SSL_CONNECTION_VERSION_UNKNOWN = 0;
|
||||
SSL_CONNECTION_VERSION_SSL2 = 1;
|
||||
SSL_CONNECTION_VERSION_SSL3 = 2;
|
||||
SSL_CONNECTION_VERSION_TLS1 = 3;
|
||||
SSL_CONNECTION_VERSION_TLS1_1 = 4;
|
||||
SSL_CONNECTION_VERSION_TLS1_2 = 5;
|
||||
SSL_CONNECTION_VERSION_QUIC = 7;
|
||||
|
||||
|
||||
// /include/internal/cef_types.h (cef_ssl_content_status_t)
|
||||
SSL_CONTENT_NORMAL_CONTENT = 0;
|
||||
SSL_CONTENT_DISPLAYED_INSECURE_CONTENT = 1 shl 0;
|
||||
SSL_CONTENT_DISPLAYED_INSECURE_CONTENT = 1 shl 0;
|
||||
SSL_CONTENT_RAN_INSECURE_CONTENT = 1 shl 1;
|
||||
|
||||
// /include/internal/cef_types.h (cef_json_writer_options_t)
|
||||
@ -327,72 +327,73 @@ const
|
||||
LOGSEVERITY_DISABLE = 99;
|
||||
|
||||
|
||||
//******************************************************
|
||||
//****************** OTHER CONSTANTS *******************
|
||||
//******************************************************
|
||||
|
||||
DEVTOOLS_WINDOWNAME = 'DevTools';
|
||||
|
||||
CEF_PROXYTYPE_DIRECT = 0;
|
||||
//******************************************************
|
||||
//****************** OTHER CONSTANTS *******************
|
||||
//******************************************************
|
||||
|
||||
DEVTOOLS_WINDOWNAME = 'DevTools';
|
||||
|
||||
CEF_PROXYTYPE_DIRECT = 0;
|
||||
CEF_PROXYTYPE_AUTODETECT = 1;
|
||||
CEF_PROXYTYPE_SYSTEM = 2;
|
||||
CEF_PROXYTYPE_FIXED_SERVERS = 3;
|
||||
CEF_PROXYTYPE_PAC_SCRIPT = 4;
|
||||
|
||||
CEF_CONTENT_SETTING_DEFAULT = 0;
|
||||
CEF_CONTENT_SETTING_ALLOW = 1;
|
||||
CEF_CONTENT_SETTING_BLOCK = 2;
|
||||
CEF_CONTENT_SETTING_ASK = 3;
|
||||
CEF_CONTENT_SETTING_SESSION_ONLY = 4;
|
||||
CEF_CONTENT_SETTING_NUM_SETTINGS = 5;
|
||||
|
||||
// Used in the severity parameter in the 'cef_log' function, also known as 'CefLog' in CEF4Delphi.
|
||||
CEF_LOG_SEVERITY_INFO = 0;
|
||||
CEF_LOG_SEVERITY_WARNING = 1;
|
||||
CEF_LOG_SEVERITY_ERROR = 2;
|
||||
|
||||
ZOOM_STEP_25 = 0;
|
||||
ZOOM_STEP_33 = 1;
|
||||
ZOOM_STEP_50 = 2;
|
||||
ZOOM_STEP_67 = 3;
|
||||
ZOOM_STEP_75 = 4;
|
||||
ZOOM_STEP_90 = 5;
|
||||
ZOOM_STEP_100 = 6;
|
||||
ZOOM_STEP_110 = 7;
|
||||
ZOOM_STEP_125 = 8;
|
||||
ZOOM_STEP_150 = 9;
|
||||
ZOOM_STEP_175 = 10;
|
||||
ZOOM_STEP_200 = 11;
|
||||
ZOOM_STEP_250 = 12;
|
||||
ZOOM_STEP_300 = 13;
|
||||
ZOOM_STEP_400 = 14;
|
||||
ZOOM_STEP_500 = 15;
|
||||
ZOOM_STEP_MIN = ZOOM_STEP_25;
|
||||
ZOOM_STEP_MAX = ZOOM_STEP_500;
|
||||
ZOOM_STEP_DEF = ZOOM_STEP_100;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
CEF_PREFERENCES_SAVED = WM_APP + $A00;
|
||||
CEF_DOONCLOSE = WM_APP + $A01;
|
||||
CEF_STARTDRAGGING = WM_APP + $A02;
|
||||
CEF_AFTERCREATED = WM_APP + $A03;
|
||||
CEF_PENDINGRESIZE = WM_APP + $A04;
|
||||
CEF_PUMPHAVEWORK = WM_APP + $A05;
|
||||
CEF_DESTROY = WM_APP + $A06;
|
||||
CEF_DOONBEFORECLOSE = WM_APP + $A07;
|
||||
{$ENDIF}
|
||||
|
||||
CEF_TIMER_MINIMUM = $0000000A;
|
||||
CEF_TIMER_MAXIMUM = $7FFFFFFF;
|
||||
CEF_TIMER_MAXDELAY = 1000 div 30; // 30fps
|
||||
CEF_TIMER_DEPLETEWORK_CYCLES = 10;
|
||||
CEF_TIMER_DEPLETEWORK_DELAY = 50;
|
||||
|
||||
CEF4DELPHI_URL = 'https://github.com/salvadordf/CEF4Delphi';
|
||||
CRLF = #13 + #10;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
||||
|
||||
CEF_PROXYTYPE_SYSTEM = 2;
|
||||
CEF_PROXYTYPE_FIXED_SERVERS = 3;
|
||||
CEF_PROXYTYPE_PAC_SCRIPT = 4;
|
||||
|
||||
CEF_CONTENT_SETTING_DEFAULT = 0;
|
||||
CEF_CONTENT_SETTING_ALLOW = 1;
|
||||
CEF_CONTENT_SETTING_BLOCK = 2;
|
||||
CEF_CONTENT_SETTING_ASK = 3;
|
||||
CEF_CONTENT_SETTING_SESSION_ONLY = 4;
|
||||
CEF_CONTENT_SETTING_NUM_SETTINGS = 5;
|
||||
|
||||
// Used in the severity parameter in the 'cef_log' function, also known as 'CefLog' in CEF4Delphi.
|
||||
CEF_LOG_SEVERITY_INFO = 0;
|
||||
CEF_LOG_SEVERITY_WARNING = 1;
|
||||
CEF_LOG_SEVERITY_ERROR = 2;
|
||||
|
||||
ZOOM_STEP_25 = 0;
|
||||
ZOOM_STEP_33 = 1;
|
||||
ZOOM_STEP_50 = 2;
|
||||
ZOOM_STEP_67 = 3;
|
||||
ZOOM_STEP_75 = 4;
|
||||
ZOOM_STEP_90 = 5;
|
||||
ZOOM_STEP_100 = 6;
|
||||
ZOOM_STEP_110 = 7;
|
||||
ZOOM_STEP_125 = 8;
|
||||
ZOOM_STEP_150 = 9;
|
||||
ZOOM_STEP_175 = 10;
|
||||
ZOOM_STEP_200 = 11;
|
||||
ZOOM_STEP_250 = 12;
|
||||
ZOOM_STEP_300 = 13;
|
||||
ZOOM_STEP_400 = 14;
|
||||
ZOOM_STEP_500 = 15;
|
||||
ZOOM_STEP_MIN = ZOOM_STEP_25;
|
||||
ZOOM_STEP_MAX = ZOOM_STEP_500;
|
||||
ZOOM_STEP_DEF = ZOOM_STEP_100;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
CEF_PREFERENCES_SAVED = WM_APP + $A00;
|
||||
CEF_DOONCLOSE = WM_APP + $A01;
|
||||
CEF_STARTDRAGGING = WM_APP + $A02;
|
||||
CEF_AFTERCREATED = WM_APP + $A03;
|
||||
CEF_PENDINGRESIZE = WM_APP + $A04;
|
||||
CEF_PUMPHAVEWORK = WM_APP + $A05;
|
||||
CEF_DESTROY = WM_APP + $A06;
|
||||
CEF_DOONBEFORECLOSE = WM_APP + $A07;
|
||||
CEF_PENDINGINVALIDATE = WM_APP + $A08;
|
||||
{$ENDIF}
|
||||
|
||||
CEF_TIMER_MINIMUM = $0000000A;
|
||||
CEF_TIMER_MAXIMUM = $7FFFFFFF;
|
||||
CEF_TIMER_MAXDELAY = 1000 div 30; // 30fps
|
||||
CEF_TIMER_DEPLETEWORK_CYCLES = 10;
|
||||
CEF_TIMER_DEPLETEWORK_DELAY = 50;
|
||||
|
||||
CEF4DELPHI_URL = 'https://github.com/salvadordf/CEF4Delphi';
|
||||
CRLF = #13 + #10;
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
|
||||
|
||||
|
@ -122,6 +122,8 @@ var
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
procedure DestroyGlobalCEFWorkScheduler;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -132,6 +134,10 @@ uses
|
||||
{$ENDIF}
|
||||
uCEFMiscFunctions, uCEFApplication;
|
||||
|
||||
procedure DestroyGlobalCEFWorkScheduler;
|
||||
begin
|
||||
if (GlobalCEFWorkScheduler <> nil) then FreeAndNil(GlobalCEFWorkScheduler);
|
||||
end;
|
||||
|
||||
constructor TCEFWorkScheduler.Create(AOwner: TComponent);
|
||||
begin
|
||||
|
@ -104,6 +104,8 @@ type
|
||||
var
|
||||
GlobalFMXWorkScheduler : TFMXWorkScheduler = nil;
|
||||
|
||||
procedure DestroyGlobalFMXWorkScheduler;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -111,6 +113,11 @@ uses
|
||||
FMX.Platform, FMX.Platform.Win, FMX.Forms,
|
||||
uCEFMiscFunctions, uCEFApplication;
|
||||
|
||||
procedure DestroyGlobalFMXWorkScheduler;
|
||||
begin
|
||||
if (GlobalFMXWorkScheduler <> nil) then FreeAndNil(GlobalFMXWorkScheduler);
|
||||
end;
|
||||
|
||||
constructor TFMXWorkScheduler.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
|
Loading…
x
Reference in New Issue
Block a user