You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
Fixed the CustomResourceHandler demo
- Added TCEFSentinel to more demos
This commit is contained in:
@ -22,15 +22,15 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="103"/>
|
||||
<CursorPos X="58" Y="123"/>
|
||||
<TopLine Value="235"/>
|
||||
<CursorPos X="51" Y="233"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="5" HistoryIndex="4">
|
||||
<JumpHistory Count="11" HistoryIndex="10">
|
||||
<Position1>
|
||||
<Filename Value="JSDialogBrowser.lpr"/>
|
||||
</Position1>
|
||||
@ -50,6 +50,30 @@
|
||||
<Filename Value="uJSDialogBrowser.pas"/>
|
||||
<Caret Line="72" Column="32" TopLine="64"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSDialogBrowser.pas"/>
|
||||
<Caret Line="117" Column="82" TopLine="103"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uJSDialogBrowser.pas"/>
|
||||
<Caret Line="123" Column="82" TopLine="109"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uJSDialogBrowser.pas"/>
|
||||
<Caret Line="263" Column="40" TopLine="235"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uJSDialogBrowser.pas"/>
|
||||
<Caret Line="77" Column="15" TopLine="60"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uJSDialogBrowser.pas"/>
|
||||
<Caret Line="279" TopLine="275"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uJSDialogBrowser.pas"/>
|
||||
<Caret Line="93" Column="59" TopLine="82"/>
|
||||
</Position11>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -65,4 +65,9 @@ object JSDialogBrowserFrm: TJSDialogBrowserFrm
|
||||
left = 56
|
||||
top = 88
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 128
|
||||
top = 88
|
||||
end
|
||||
end
|
||||
|
@ -49,18 +49,24 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFInterfaces, uCEFTypes, uCEFConstants;
|
||||
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFInterfaces, uCEFTypes,
|
||||
uCEFConstants, uCEFSentinel;
|
||||
|
||||
const
|
||||
CEFBROWSER_SHOWJSDIALOG = WM_APP + $101;
|
||||
|
||||
type
|
||||
|
||||
{ TJSDialogBrowserFrm }
|
||||
|
||||
TJSDialogBrowserFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
ChromiumWindow1: TChromiumWindow;
|
||||
AddressPnl: TPanel;
|
||||
AddressEdt: TEdit;
|
||||
GoBtn: TButton;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
||||
@ -113,8 +119,8 @@ uses
|
||||
// =================
|
||||
// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event.
|
||||
// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event.
|
||||
// 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form.
|
||||
|
||||
// 3. TChromiumWindow.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -176,6 +182,12 @@ begin
|
||||
ChromiumWindow1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TJSDialogBrowserFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSDialogBrowserFrm.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
@ -211,15 +223,14 @@ begin
|
||||
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False;
|
||||
end;
|
||||
|
||||
procedure TJSDialogBrowserFrm.Chromium_OnJsdialog(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const originUrl : ustring;
|
||||
dialogType : TCefJsDialogType;
|
||||
const messageText : ustring;
|
||||
const defaultPromptText : ustring;
|
||||
const callback : ICefJsDialogCallback;
|
||||
out suppressMessage : Boolean;
|
||||
out Result : Boolean);
|
||||
procedure TJSDialogBrowserFrm.Chromium_OnJsdialog(Sender: TObject;
|
||||
const browser: ICefBrowser;
|
||||
const originUrl: ustring;
|
||||
dialogType: TCefJsDialogType;
|
||||
const messageText, defaultPromptText: ustring;
|
||||
const callback: ICefJsDialogCallback;
|
||||
out suppressMessage: Boolean;
|
||||
out Result: Boolean);
|
||||
begin
|
||||
// In this event we must store the dialog information and post a message to the main form to show the dialog
|
||||
FJSDialogInfoCS.Acquire;
|
||||
@ -248,18 +259,13 @@ end;
|
||||
|
||||
procedure TJSDialogBrowserFrm.ChromiumWindow1BeforeClose(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSDialogBrowserFrm.ChromiumWindow1Close(Sender: TObject);
|
||||
begin
|
||||
// DestroyChildWindow will destroy the child window created by CEF at the top of the Z order.
|
||||
if not(ChromiumWindow1.DestroyChildWindow) then
|
||||
begin
|
||||
FCanClose := True;
|
||||
Close;
|
||||
end;
|
||||
if not(ChromiumWindow1.DestroyChildWindow) then CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSDialogBrowserFrm.Chromium_OnBeforePopup(Sender: TObject;
|
||||
|
@ -22,11 +22,11 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="538"/>
|
||||
<CursorPos Y="542"/>
|
||||
<TopLine Value="169"/>
|
||||
<CursorPos X="82" Y="183"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="85" Y="477" ID="1"/>
|
||||
<Item0 X="85" Y="487" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -118,123 +118,123 @@
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="30" Column="122" TopLine="21"/>
|
||||
<Caret Line="115" Column="25" TopLine="79"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="55" Column="25" TopLine="21"/>
|
||||
<Caret Line="15" Column="103"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="115" Column="25" TopLine="79"/>
|
||||
<Caret Line="64" Column="90" TopLine="26"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="15" Column="103"/>
|
||||
<Caret Line="373" Column="76" TopLine="336"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="64" Column="90" TopLine="26"/>
|
||||
<Caret Line="470" Column="70" TopLine="433"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="373" Column="76" TopLine="336"/>
|
||||
<Caret Line="524" Column="40" TopLine="487"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="470" Column="70" TopLine="433"/>
|
||||
<Caret Line="555" Column="39" TopLine="518"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="524" Column="40" TopLine="487"/>
|
||||
<Caret Line="63" Column="18" TopLine="41"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="555" Column="39" TopLine="518"/>
|
||||
<Caret Line="373" Column="76" TopLine="336"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="63" Column="18" TopLine="41"/>
|
||||
<Filename Value="JSEval.lpr"/>
|
||||
<Caret Line="60" Column="76" TopLine="44"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="373" Column="76" TopLine="336"/>
|
||||
<Caret Line="125" Column="29" TopLine="114"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="JSEval.lpr"/>
|
||||
<Caret Line="60" Column="76" TopLine="44"/>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="536" Column="38" TopLine="518"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="125" Column="29" TopLine="114"/>
|
||||
<Caret Line="511" Column="75" TopLine="499"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="536" Column="38" TopLine="518"/>
|
||||
<Caret Line="463" Column="50" TopLine="452"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="511" Column="75" TopLine="499"/>
|
||||
<Caret Line="372" TopLine="360"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="463" Column="50" TopLine="452"/>
|
||||
<Caret Line="54" Column="73" TopLine="24"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="372" TopLine="360"/>
|
||||
<Caret Line="51" Column="90" TopLine="24"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="54" Column="73" TopLine="24"/>
|
||||
<Caret Line="59" Column="37" TopLine="24"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="51" Column="90" TopLine="24"/>
|
||||
<Caret Line="181" Column="63" TopLine="162"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="59" Column="37" TopLine="24"/>
|
||||
<Filename Value="JSEval.lpr"/>
|
||||
<Caret Line="60" Column="76" TopLine="41"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="181" Column="63" TopLine="162"/>
|
||||
<Caret Line="125" Column="11" TopLine="121"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="JSEval.lpr"/>
|
||||
<Caret Line="60" Column="76" TopLine="41"/>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="542" Column="86" TopLine="533"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="125" Column="11" TopLine="121"/>
|
||||
<Caret Line="94" Column="43" TopLine="77"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="542" Column="86" TopLine="533"/>
|
||||
<Caret Line="210" Column="39" TopLine="203"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="94" Column="43" TopLine="77"/>
|
||||
<Caret Line="86" Column="71" TopLine="76"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="210" Column="39" TopLine="203"/>
|
||||
<Caret Line="510" Column="62" TopLine="492"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="86" Column="71" TopLine="76"/>
|
||||
<Filename Value="JSEval.lpr"/>
|
||||
<Caret Line="60" Column="76" TopLine="41"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="510" Column="62" TopLine="492"/>
|
||||
<Caret Line="126" Column="11" TopLine="109"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="JSEval.lpr"/>
|
||||
<Caret Line="60" Column="76" TopLine="41"/>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="542" TopLine="538"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="uJSEval.pas"/>
|
||||
<Caret Line="126" Column="11" TopLine="109"/>
|
||||
<Caret Line="552" TopLine="548"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
|
@ -73,4 +73,9 @@ object JSEvalFrm: TJSEvalFrm
|
||||
left = 16
|
||||
top = 96
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 16
|
||||
top = 160
|
||||
end
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ uses
|
||||
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, Menus,
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, base64,
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
const
|
||||
MINIBROWSER_SHOWTEXTVIEWER = WM_APP + $101;
|
||||
@ -63,13 +63,18 @@ const
|
||||
BINARY_PARAM_JS = 'JSBinaryParameter';
|
||||
|
||||
type
|
||||
|
||||
{ TJSEvalFrm }
|
||||
|
||||
TJSEvalFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
AddressBarPnl: TPanel;
|
||||
GoBtn: TButton;
|
||||
AddressEdt: TEdit;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
@ -174,21 +179,26 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure TJSEvalFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
procedure TJSEvalFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.Chromium1BeforeContextMenu(Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
|
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="174"/>
|
||||
<CursorPos X="74" Y="179"/>
|
||||
<TopLine Value="194"/>
|
||||
<CursorPos X="22" Y="200"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -53,7 +53,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit4>
|
||||
</Units>
|
||||
<JumpHistory Count="9" HistoryIndex="8">
|
||||
<JumpHistory Count="11" HistoryIndex="10">
|
||||
<Position1>
|
||||
<Filename Value="uJSExecutingFunctions.pas"/>
|
||||
</Position1>
|
||||
@ -89,6 +89,14 @@
|
||||
<Filename Value="uJSExecutingFunctions.pas"/>
|
||||
<Caret Line="116" Column="11" TopLine="100"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uJSExecutingFunctions.pas"/>
|
||||
<Caret Line="140" Column="82" TopLine="138"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uJSExecutingFunctions.pas"/>
|
||||
<Caret Line="145" Column="82" TopLine="143"/>
|
||||
</Position11>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -72,4 +72,9 @@ object JSExecutingFunctionsFrm: TJSExecutingFunctionsFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 352
|
||||
end
|
||||
end
|
||||
|
@ -52,7 +52,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl;
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl, uCEFSentinel;
|
||||
|
||||
const
|
||||
JSDEMO_CONTEXTMENU_EXECFUNCTION = MENU_ID_USER_FIRST + 1;
|
||||
@ -60,13 +60,18 @@ const
|
||||
EXECFUNCTION_MSGNAME = 'execfunction';
|
||||
|
||||
type
|
||||
|
||||
{ TJSExecutingFunctionsFrm }
|
||||
|
||||
TJSExecutingFunctionsFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -136,7 +141,8 @@ implementation
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
uses
|
||||
uCEFProcessMessage, uMyV8Handler;
|
||||
@ -191,8 +197,7 @@ end;
|
||||
procedure TJSExecutingFunctionsFrm.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSExecutingFunctionsFrm.Chromium1BeforeContextMenu(
|
||||
@ -273,6 +278,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSExecutingFunctionsFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSExecutingFunctionsFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
|
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="303"/>
|
||||
<CursorPos Y="322"/>
|
||||
<TopLine Value="274"/>
|
||||
<CursorPos X="56" Y="286"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -50,98 +50,127 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
<JumpHistory Count="23" HistoryIndex="22">
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="125" Column="23" TopLine="106"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="125" Column="23" TopLine="106"/>
|
||||
<Caret Line="223" Column="56" TopLine="219"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="223" Column="56" TopLine="219"/>
|
||||
<Caret Line="98" Column="43" TopLine="94"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="98" Column="43" TopLine="94"/>
|
||||
<Caret Line="265" Column="39" TopLine="258"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="265" Column="39" TopLine="258"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uTestExtensionHandler.pas"/>
|
||||
<Caret Line="94" Column="56" TopLine="41"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="312" Column="54" TopLine="301"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="JSExtension.lpr"/>
|
||||
<Caret Line="60" Column="17" TopLine="42"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="126" TopLine="111"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="126" TopLine="111"/>
|
||||
<Caret Line="136" Column="39" TopLine="127"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="136" Column="39" TopLine="127"/>
|
||||
<Caret Line="144" Column="114" TopLine="127"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="144" Column="114" TopLine="127"/>
|
||||
<Caret Line="150" Column="74" TopLine="127"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="150" Column="74" TopLine="127"/>
|
||||
<Caret Line="199" Column="41" TopLine="173"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="199" Column="41" TopLine="173"/>
|
||||
<Caret Line="201" Column="92" TopLine="173"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="201" Column="92" TopLine="173"/>
|
||||
<Caret Line="205" Column="77" TopLine="173"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="205" Column="77" TopLine="173"/>
|
||||
<Caret Line="207" Column="18" TopLine="173"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="207" Column="18" TopLine="173"/>
|
||||
<Caret Line="31" Column="76"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="31" Column="76"/>
|
||||
<Caret Line="149" Column="96" TopLine="108"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="149" Column="96" TopLine="108"/>
|
||||
<Caret Line="150" Column="73" TopLine="127"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="150" Column="73" TopLine="127"/>
|
||||
<Caret Line="199" Column="40" TopLine="173"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="199" Column="40" TopLine="173"/>
|
||||
<Caret Line="201" Column="91" TopLine="173"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="201" Column="91" TopLine="173"/>
|
||||
<Caret Line="205" Column="75" TopLine="173"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="205" Column="75" TopLine="173"/>
|
||||
<Caret Line="61" Column="30" TopLine="47"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="61" Column="30" TopLine="47"/>
|
||||
<Caret Line="322" TopLine="303"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="324" TopLine="305"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="486" Column="3" TopLine="483"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="108" Column="15" TopLine="82"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="343" TopLine="339"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="486" Column="40" TopLine="483"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="108" Column="31" TopLine="81"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="uJSExtension.pas"/>
|
||||
<Caret Line="343" Column="22" TopLine="339"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -81,4 +81,9 @@ object JSExtensionFrm: TJSExtensionFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 365
|
||||
end
|
||||
end
|
||||
|
@ -52,7 +52,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
const
|
||||
MINIBROWSER_SHOWTEXTVIEWER = WM_APP + $100;
|
||||
@ -69,6 +69,7 @@ type
|
||||
{ TJSExtensionFrm }
|
||||
|
||||
TJSExtensionFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
@ -76,6 +77,7 @@ type
|
||||
Chromium1: TChromium;
|
||||
StatusPnl: TPanel;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1BeforeContextMenu(Sender: TObject;
|
||||
@ -338,8 +340,7 @@ end;
|
||||
procedure TJSExtensionFrm.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionFrm.Chromium1BeforeContextMenu(Sender: TObject;
|
||||
@ -479,6 +480,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSExtensionFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
|
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="149"/>
|
||||
<CursorPos Y="153"/>
|
||||
<TopLine Value="109"/>
|
||||
<CursorPos X="77" Y="130"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -56,7 +56,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit4>
|
||||
</Units>
|
||||
<JumpHistory Count="12" HistoryIndex="11">
|
||||
<JumpHistory Count="14" HistoryIndex="13">
|
||||
<Position1>
|
||||
<Filename Value="uJSExtensionWithFunction.pas"/>
|
||||
</Position1>
|
||||
@ -104,6 +104,14 @@
|
||||
<Filename Value="uJSExtensionWithFunction.pas"/>
|
||||
<Caret Line="105" Column="11" TopLine="89"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uJSExtensionWithFunction.pas"/>
|
||||
<Caret Line="168" TopLine="149"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uJSExtensionWithFunction.pas"/>
|
||||
<Caret Line="173" TopLine="154"/>
|
||||
</Position14>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -80,4 +80,9 @@ object JSExtensionWithFunctionFrm: TJSExtensionWithFunctionFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 360
|
||||
end
|
||||
end
|
||||
|
@ -52,10 +52,14 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSExtensionWithFunctionFrm }
|
||||
|
||||
TJSExtensionWithFunctionFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
@ -63,6 +67,7 @@ type
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
StatusBar1: TStatusBar;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -121,7 +126,8 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
var
|
||||
@ -165,8 +171,7 @@ end;
|
||||
procedure TJSExtensionWithFunctionFrm.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithFunctionFrm.Chromium1BeforePopup(Sender: TObject;
|
||||
@ -228,6 +233,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithFunctionFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithFunctionFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
|
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="133"/>
|
||||
<CursorPos Y="156"/>
|
||||
<TopLine Value="94"/>
|
||||
<CursorPos X="37" Y="125"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -37,7 +37,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="4" HistoryIndex="3">
|
||||
<JumpHistory Count="6" HistoryIndex="5">
|
||||
<Position1>
|
||||
<Filename Value="uJSExtensionWithObjectParameter.pas"/>
|
||||
</Position1>
|
||||
@ -53,6 +53,14 @@
|
||||
<Filename Value="uJSExtensionWithObjectParameter.pas"/>
|
||||
<Caret Line="181" Column="39" TopLine="151"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uJSExtensionWithObjectParameter.pas"/>
|
||||
<Caret Line="156" TopLine="133"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSExtensionWithObjectParameter.pas"/>
|
||||
<Caret Line="161" TopLine="138"/>
|
||||
</Position6>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -69,4 +69,9 @@ object JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 360
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSExtensionWithObjectParameterFrm }
|
||||
|
||||
TJSExtensionWithObjectParameterFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -120,7 +125,8 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
var
|
||||
@ -168,8 +174,7 @@ end;
|
||||
procedure TJSExtensionWithObjectParameterFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.Chromium1BeforePopup(
|
||||
@ -218,6 +223,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
|
@ -22,15 +22,15 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="122"/>
|
||||
<CursorPos Y="143"/>
|
||||
<TopLine Value="209"/>
|
||||
<CursorPos X="22" Y="234"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="4" HistoryIndex="3">
|
||||
<JumpHistory Count="7" HistoryIndex="6">
|
||||
<Position1>
|
||||
<Filename Value="uJSSimpleExtension.pas"/>
|
||||
</Position1>
|
||||
@ -46,6 +46,18 @@
|
||||
<Filename Value="uJSSimpleExtension.pas"/>
|
||||
<Caret Line="161" Column="39" TopLine="138"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uJSSimpleExtension.pas"/>
|
||||
<Caret Line="143" TopLine="122"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSSimpleExtension.pas"/>
|
||||
<Caret Line="148" TopLine="127"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uJSSimpleExtension.pas"/>
|
||||
<Caret Line="233" TopLine="215"/>
|
||||
</Position7>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -69,4 +69,9 @@ object JSSimpleExtensionFrm: TJSSimpleExtensionFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 352
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSSimpleExtensionFrm }
|
||||
|
||||
TJSSimpleExtensionFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -117,7 +122,8 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
var
|
||||
@ -173,6 +179,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleExtensionFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSSimpleExtensionFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
@ -219,8 +231,7 @@ end;
|
||||
procedure TJSSimpleExtensionFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleExtensionFrm.Chromium1Close(
|
||||
|
@ -22,15 +22,15 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="110"/>
|
||||
<CursorPos Y="135"/>
|
||||
<TopLine Value="223"/>
|
||||
<CursorPos X="22" Y="226"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="8" HistoryIndex="7">
|
||||
<JumpHistory Count="15" HistoryIndex="14">
|
||||
<Position1>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
</Position1>
|
||||
@ -62,6 +62,34 @@
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="158" Column="3" TopLine="147"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="118" Column="82" TopLine="110"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="123" Column="82" TopLine="115"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="159" Column="50" TopLine="141"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="86" Column="15" TopLine="59"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="225" TopLine="222"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="177" Column="47" TopLine="165"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="86" Column="15" TopLine="50"/>
|
||||
</Position15>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -69,4 +69,9 @@ object JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 360
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl;
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSSimpleWindowBindingFrm }
|
||||
|
||||
TJSSimpleWindowBindingFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -114,7 +119,8 @@ implementation
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
@ -165,6 +171,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
@ -211,8 +223,7 @@ end;
|
||||
procedure TJSSimpleWindowBindingFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.Chromium1Close(
|
||||
|
@ -8,8 +8,7 @@
|
||||
<Unit0>
|
||||
<Filename Value="JSSimpleWindowBinding.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="52"/>
|
||||
<TopLine Value="44"/>
|
||||
<CursorPos Y="68"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -21,16 +20,17 @@
|
||||
<ComponentName Value="JSSimpleWindowBindingFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="77"/>
|
||||
<CursorPos X="39" Y="134"/>
|
||||
<TopLine Value="175"/>
|
||||
<CursorPos X="22" Y="207"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="2" HistoryIndex="1">
|
||||
<JumpHistory Count="4" HistoryIndex="3">
|
||||
<Position1>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
</Position1>
|
||||
@ -38,6 +38,14 @@
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="75" Column="43" TopLine="55"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="117" Column="82" TopLine="101"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uJSSimpleWindowBinding.pas"/>
|
||||
<Caret Line="122" Column="82" TopLine="106"/>
|
||||
</Position4>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -14,7 +14,7 @@ object JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.0.2.0'
|
||||
LCLVersion = '2.0.4.0'
|
||||
object NavControlPnl: TPanel
|
||||
Left = 0
|
||||
Height = 21
|
||||
@ -69,4 +69,9 @@ object JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 352
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl;
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSSimpleWindowBindingFrm }
|
||||
|
||||
TJSSimpleWindowBindingFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -113,7 +118,8 @@ implementation
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
@ -146,6 +152,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
@ -192,8 +204,7 @@ end;
|
||||
procedure TJSSimpleWindowBindingFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.Chromium1Close(
|
||||
|
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="142"/>
|
||||
<CursorPos Y="160"/>
|
||||
<TopLine Value="96"/>
|
||||
<CursorPos X="82" Y="126"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -38,7 +38,7 @@
|
||||
<Loaded Value="True"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="3" HistoryIndex="2">
|
||||
<JumpHistory Count="5" HistoryIndex="4">
|
||||
<Position1>
|
||||
<Filename Value="uJSWindowBindingWithArrayBuffer.pas"/>
|
||||
<Caret Line="145" Column="60" TopLine="124"/>
|
||||
@ -51,6 +51,14 @@
|
||||
<Filename Value="uJSWindowBindingWithArrayBuffer.pas"/>
|
||||
<Caret Line="141" Column="81" TopLine="127"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uJSWindowBindingWithArrayBuffer.pas"/>
|
||||
<Caret Line="160" TopLine="142"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uJSWindowBindingWithArrayBuffer.pas"/>
|
||||
<Caret Line="165" TopLine="147"/>
|
||||
</Position5>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -69,4 +69,9 @@ object JSWindowBindingWithArrayBufferFrm: TJSWindowBindingWithArrayBufferFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 363
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSWindowBindingWithArrayBufferFrm }
|
||||
|
||||
TJSWindowBindingWithArrayBufferFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -117,7 +122,8 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure FreeCustomArrayBufer(buffer : Pointer);
|
||||
begin
|
||||
@ -189,6 +195,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithArrayBufferFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithArrayBufferFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
@ -235,8 +247,7 @@ end;
|
||||
procedure TJSWindowBindingWithArrayBufferFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithArrayBufferFrm.Chromium1Close(
|
||||
|
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="119"/>
|
||||
<CursorPos Y="140"/>
|
||||
<TopLine Value="227"/>
|
||||
<CursorPos X="21" Y="230"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -37,7 +37,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="3" HistoryIndex="2">
|
||||
<JumpHistory Count="8" HistoryIndex="7">
|
||||
<Position1>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
</Position1>
|
||||
@ -49,6 +49,26 @@
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="100" Column="11" TopLine="84"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="140" TopLine="119"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="145" TopLine="124"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="126" Column="82" TopLine="105"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="181" Column="39" TopLine="178"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uJSWindowBindingWithFunction.pas"/>
|
||||
<Caret Line="86" Column="15" TopLine="50"/>
|
||||
</Position8>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -69,4 +69,9 @@ object JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 352
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSWindowBindingWithFunctionFrm }
|
||||
|
||||
TJSWindowBindingWithFunctionFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -117,7 +122,8 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
@ -169,6 +175,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
@ -215,8 +227,7 @@ end;
|
||||
procedure TJSWindowBindingWithFunctionFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.Chromium1Close(
|
||||
|
@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="126"/>
|
||||
<CursorPos Y="141"/>
|
||||
<TopLine Value="102"/>
|
||||
<CursorPos X="82" Y="126"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@ -37,7 +37,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="5" HistoryIndex="4">
|
||||
<JumpHistory Count="7" HistoryIndex="6">
|
||||
<Position1>
|
||||
<Filename Value="uJSWindowBindingWithObject.pas"/>
|
||||
</Position1>
|
||||
@ -57,6 +57,14 @@
|
||||
<Filename Value="uJSWindowBindingWithObject.pas"/>
|
||||
<Caret Line="75" Column="43" TopLine="69"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uJSWindowBindingWithObject.pas"/>
|
||||
<Caret Line="141" TopLine="126"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uJSWindowBindingWithObject.pas"/>
|
||||
<Caret Line="146" TopLine="131"/>
|
||||
</Position7>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
@ -69,4 +69,9 @@ object JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm
|
||||
left = 32
|
||||
top = 288
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 360
|
||||
end
|
||||
end
|
||||
|
@ -52,16 +52,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TJSWindowBindingWithObjectFrm }
|
||||
|
||||
TJSWindowBindingWithObjectFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -117,7 +122,8 @@ uses
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 3. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
@ -172,6 +178,12 @@ begin
|
||||
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
@ -218,8 +230,7 @@ end;
|
||||
procedure TJSWindowBindingWithObjectFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.Chromium1Close(
|
||||
|
Reference in New Issue
Block a user