You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-12-03 21:44:45 +02:00
Fixed the CustomResourceHandler demo
- Added TCEFSentinel to more demos
This commit is contained in:
@@ -159,7 +159,7 @@ begin
|
||||
if (FStream <> nil) and (DataOut <> nil) then
|
||||
begin
|
||||
BytesRead := FStream.Read(DataOut^, BytesToRead);
|
||||
Result := True;
|
||||
Result := (BytesRead > 0);
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
|
||||
@@ -88,7 +88,6 @@ type
|
||||
procedure Chromium_OnAfterCreated(Sender: TObject);
|
||||
procedure Chromium_OnGetResourceHandler(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; var aResourceHandler : ICefResourceHandler);
|
||||
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||
procedure Chromium_OnGetResourceRequestHandler(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; is_navigation, is_download: boolean; const request_initiator: ustring; var disable_default_handling: boolean; var aExternalResourceRequestHandler : ICefResourceRequestHandler; var aUseInternalResourceRequestHandler : boolean);
|
||||
|
||||
public
|
||||
{ Public declarations }
|
||||
@@ -163,7 +162,6 @@ procedure TMainForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
ChromiumWindow1.OnAfterCreated := Chromium_OnAfterCreated;
|
||||
ChromiumWindow1.ChromiumBrowser.OnGetResourceHandler := Chromium_OnGetResourceHandler;
|
||||
ChromiumWindow1.ChromiumBrowser.OnGetResourceRequestHandler := Chromium_OnGetResourceRequestHandler;
|
||||
ChromiumWindow1.ChromiumBrowser.OnBeforePopup := Chromium_OnBeforePopup;
|
||||
|
||||
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
|
||||
@@ -229,21 +227,6 @@ begin
|
||||
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium_OnGetResourceRequestHandler( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const frame : ICefFrame;
|
||||
const request : ICefRequest;
|
||||
is_navigation : boolean;
|
||||
is_download : boolean;
|
||||
const request_initiator : ustring;
|
||||
var disable_default_handling : boolean;
|
||||
var aExternalResourceRequestHandler : ICefResourceRequestHandler;
|
||||
var aUseInternalResourceRequestHandler : boolean);
|
||||
begin
|
||||
disable_default_handling := True;
|
||||
aUseInternalResourceRequestHandler := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
@@ -138,7 +138,6 @@ uses
|
||||
// After the request has been handled we send a custom message to the form (CEF_SHOWDATA)
|
||||
// to add the information to the TMemo safely in the main thread.
|
||||
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
|
||||
@@ -190,11 +190,7 @@ end;
|
||||
procedure TSimpleExternalPumpBrowserFrm.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 TSimpleExternalPumpBrowserFrm.GoBtnClick(Sender: TObject);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Unit0>
|
||||
<Filename Value="CookieVisitor.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<TopLine Value="44"/>
|
||||
<TopLine Value="40"/>
|
||||
<CursorPos X="25" Y="74"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
@@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="139"/>
|
||||
<CursorPos X="58" Y="150"/>
|
||||
<TopLine Value="131"/>
|
||||
<CursorPos X="82" Y="150"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -48,7 +48,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
<JumpHistory Count="12" HistoryIndex="11">
|
||||
<JumpHistory Count="14" HistoryIndex="13">
|
||||
<Position1>
|
||||
<Filename Value="CookieVisitor.lpr"/>
|
||||
</Position1>
|
||||
@@ -96,6 +96,14 @@
|
||||
<Filename Value="uCookieVisitor.pas"/>
|
||||
<Caret Line="149" Column="69" TopLine="139"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uCookieVisitor.pas"/>
|
||||
<Caret Line="150" Column="58" TopLine="139"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uCookieVisitor.pas"/>
|
||||
<Caret Line="155" Column="58" TopLine="144"/>
|
||||
</Position14>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -75,4 +75,9 @@ object CookieVisitorFrm: TCookieVisitorFrm
|
||||
left = 32
|
||||
top = 280
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 32
|
||||
top = 352
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFCookieManager, uCEFCookieVisitor, uCEFWinControl;
|
||||
uCEFCookieManager, uCEFCookieVisitor, uCEFWinControl, uCEFSentinel;
|
||||
|
||||
const
|
||||
MINIBROWSER_SHOWCOOKIES = WM_APP + $101;
|
||||
@@ -61,13 +61,18 @@ const
|
||||
MINIBROWSER_CONTEXTMENU_SETCOOKIE = MENU_ID_USER_FIRST + 3;
|
||||
|
||||
type
|
||||
|
||||
{ TCookieVisitorFrm }
|
||||
|
||||
TCookieVisitorFrm = class(TForm)
|
||||
AddressBarPnl: TPanel;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
Edit1: TEdit;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
@@ -141,7 +146,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 CreateGlobalCEFApp;
|
||||
begin
|
||||
@@ -234,12 +240,17 @@ begin
|
||||
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TCookieVisitorFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure TCookieVisitorFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TCookieVisitorFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TCookieVisitorFrm.Chromium1BeforeContextMenu(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const params: ICefContextMenuParams; const model: ICefMenuModel);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Unit0>
|
||||
<Filename Value="CRBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<TopLine Value="40"/>
|
||||
<TopLine Value="36"/>
|
||||
<CursorPos X="61" Y="62"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
@@ -21,9 +21,9 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="100"/>
|
||||
<CursorPos Y="115"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="88"/>
|
||||
<CursorPos X="82" Y="113"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -32,11 +32,11 @@
|
||||
<Unit2>
|
||||
<Filename Value="uCustomResourceHandler.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<WindowIndex Value="-1"/>
|
||||
<TopLine Value="-1"/>
|
||||
<CursorPos X="-1" Y="-1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="92"/>
|
||||
<CursorPos X="35" Y="134"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
@@ -56,22 +56,20 @@
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\..\..\source\uCEFChromium.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="750"/>
|
||||
<CursorPos X="92" Y="760"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="..\..\..\source\uCEFChromiumEvents.pas"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="114"/>
|
||||
<CursorPos X="3" Y="125"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit6>
|
||||
</Units>
|
||||
<JumpHistory Count="14" HistoryIndex="13">
|
||||
<JumpHistory Count="16" HistoryIndex="15">
|
||||
<Position1>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
</Position1>
|
||||
@@ -108,25 +106,33 @@
|
||||
<Caret Line="136" Column="59" TopLine="124"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\..\..\source\uCEFChromium.pas"/>
|
||||
<Caret Line="760" Column="16" TopLine="750"/>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="137" Column="84" TopLine="124"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="137" Column="84" TopLine="124"/>
|
||||
<Caret Line="87" Column="145" TopLine="76"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="87" Column="145" TopLine="76"/>
|
||||
<Caret Line="117" Column="69" TopLine="109"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="117" Column="69" TopLine="109"/>
|
||||
<Caret Line="73" Column="30" TopLine="59"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="73" Column="30" TopLine="59"/>
|
||||
<Filename Value="CRBrowser.lpr"/>
|
||||
<Caret Line="62" Column="61" TopLine="36"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="122" Column="44" TopLine="100"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="124" Column="44" TopLine="102"/>
|
||||
</Position16>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -131,7 +131,7 @@ begin
|
||||
if (FStream <> nil) and (DataOut <> nil) then
|
||||
begin
|
||||
BytesRead := FStream.Read(DataOut^, BytesToRead);
|
||||
Result := True;
|
||||
Result := (BytesRead > 0);
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 386
|
||||
Left = 377
|
||||
Height = 658
|
||||
Top = 91
|
||||
Top = 131
|
||||
Width = 781
|
||||
Caption = 'Custom Resource Browser'
|
||||
ClientHeight = 658
|
||||
@@ -66,4 +66,9 @@ object MainForm: TMainForm
|
||||
left = 48
|
||||
top = 240
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 48
|
||||
top = 320
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,19 +50,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFInterfaces, uCustomResourceHandler,
|
||||
uCEFConstants, uCEFTypes;
|
||||
uCEFConstants, uCEFTypes, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
ChromiumWindow1: TChromiumWindow;
|
||||
AddressBarPnl: TPanel;
|
||||
Edit1: TEdit;
|
||||
Button1: TButton;
|
||||
Timer1: TTimer;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Button1Click(Sender: TObject);
|
||||
@@ -107,7 +109,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
|
||||
@@ -155,6 +158,12 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
@@ -164,18 +173,13 @@ end;
|
||||
|
||||
procedure TMainForm.ChromiumWindow1BeforeClose(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TMainForm.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 TMainForm.Chromium_OnAfterCreated(Sender: TObject);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="294"/>
|
||||
<CursorPos Y="305"/>
|
||||
<TopLine Value="151"/>
|
||||
<CursorPos X="82" Y="163"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -61,45 +61,46 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit5>
|
||||
</Units>
|
||||
<JumpHistory Count="29" HistoryIndex="28">
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="DOMVisitor.lpr"/>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="303" Column="44" TopLine="285"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="303" Column="44" TopLine="285"/>
|
||||
<Caret Line="39" TopLine="19"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="39" TopLine="19"/>
|
||||
<Caret Line="305" Column="44" TopLine="287"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="305" Column="44" TopLine="287"/>
|
||||
<Caret Line="306" Column="64" TopLine="287"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="306" Column="64" TopLine="287"/>
|
||||
<Caret Line="261" Column="11" TopLine="243"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="261" Column="11" TopLine="243"/>
|
||||
<Caret Line="305" Column="81" TopLine="287"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="305" Column="81" TopLine="287"/>
|
||||
<Caret Line="305" Column="113" TopLine="287"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="305" Column="113" TopLine="287"/>
|
||||
<Caret Line="311" Column="59" TopLine="287"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="311" Column="59" TopLine="287"/>
|
||||
<Caret Line="261" Column="11" TopLine="109"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="261" Column="11" TopLine="109"/>
|
||||
<Caret Line="305" Column="44" TopLine="287"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
@@ -107,46 +108,46 @@
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="305" Column="44" TopLine="287"/>
|
||||
<Caret Line="483" TopLine="449"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="483" TopLine="449"/>
|
||||
<Caret Line="52" TopLine="33"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="52" TopLine="33"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="136" Column="8" TopLine="106"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="136" Column="8" TopLine="106"/>
|
||||
<Caret Line="305" Column="67" TopLine="289"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="305" Column="67" TopLine="289"/>
|
||||
<Caret Line="378" Column="16" TopLine="364"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="378" Column="16" TopLine="364"/>
|
||||
<Caret Line="121" Column="15" TopLine="111"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="121" Column="15" TopLine="111"/>
|
||||
<Caret Line="100" Column="43" TopLine="79"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="100" Column="43" TopLine="79"/>
|
||||
<Caret Line="338" Column="39" TopLine="331"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="338" Column="39" TopLine="331"/>
|
||||
<Caret Line="252" Column="77" TopLine="231"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="252" Column="77" TopLine="231"/>
|
||||
<Caret Line="260" Column="81" TopLine="260"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
@@ -154,28 +155,32 @@
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="260" Column="81" TopLine="260"/>
|
||||
<Caret Line="256" Column="53" TopLine="236"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="256" Column="53" TopLine="236"/>
|
||||
<Caret Line="276" Column="62" TopLine="263"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="276" Column="62" TopLine="263"/>
|
||||
<Caret Line="291" Column="74" TopLine="281"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="291" Column="74" TopLine="281"/>
|
||||
<Caret Line="371" Column="55" TopLine="358"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="371" Column="55" TopLine="358"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="DOMVisitor.lpr"/>
|
||||
<Caret Line="44" Column="13" TopLine="38"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="305" TopLine="294"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="uDOMVisitor.pas"/>
|
||||
<Caret Line="307" TopLine="296"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -104,4 +104,9 @@ object DOMVisitorFrm: TDOMVisitorFrm
|
||||
left = 16
|
||||
top = 96
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 16
|
||||
top = 160
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus,
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd,
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
const
|
||||
MINIBROWSER_VISITDOM_PARTIAL = WM_APP + $101;
|
||||
@@ -66,6 +66,7 @@ type
|
||||
{ TDOMVisitorFrm }
|
||||
|
||||
TDOMVisitorFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
AddressBarPnl: TPanel;
|
||||
@@ -75,6 +76,7 @@ type
|
||||
Panel1: TPanel;
|
||||
GoBtn: TButton;
|
||||
VisitDOMBtn: TButton;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject;
|
||||
@@ -157,7 +159,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 SimpleDOMIteration(const aDocument: ICefDomDocument);
|
||||
var
|
||||
@@ -325,8 +328,7 @@ end;
|
||||
procedure TDOMVisitorFrm.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.Chromium1BeforeContextMenu(Sender: TObject;
|
||||
@@ -429,6 +431,12 @@ begin
|
||||
Chromium1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.UpdateSize;
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="151"/>
|
||||
<CursorPos X="58" Y="175"/>
|
||||
<TopLine Value="152"/>
|
||||
<CursorPos X="82" Y="175"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -35,7 +35,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="6" HistoryIndex="5">
|
||||
<JumpHistory Count="9" HistoryIndex="8">
|
||||
<Position1>
|
||||
<Filename Value="uEditorBrowser.pas"/>
|
||||
<Caret Line="248" Column="66" TopLine="229"/>
|
||||
@@ -60,6 +60,18 @@
|
||||
<Filename Value="uEditorBrowser.pas"/>
|
||||
<Caret Line="354" Column="23" TopLine="337"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uEditorBrowser.pas"/>
|
||||
<Caret Line="175" Column="58" TopLine="151"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uEditorBrowser.pas"/>
|
||||
<Caret Line="180" Column="58" TopLine="156"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uEditorBrowser.pas"/>
|
||||
<Caret Line="239" TopLine="222"/>
|
||||
</Position9>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -987,4 +987,9 @@ object Form1: TForm1
|
||||
left = 128
|
||||
top = 200
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 56
|
||||
top = 272
|
||||
end
|
||||
end
|
||||
|
||||
@@ -48,10 +48,14 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ToolWin, ComCtrls,
|
||||
ImgList,
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
Timer1: TTimer;
|
||||
Chromium1: TChromium;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
@@ -88,6 +92,7 @@ type
|
||||
OutdentBtn: TToolButton;
|
||||
Separator7: TToolButton;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
|
||||
procedure FormShow(Sender: TObject);
|
||||
@@ -166,7 +171,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 CreateGlobalCEFApp;
|
||||
begin
|
||||
@@ -231,8 +237,7 @@ end;
|
||||
procedure TForm1.Chromium1BeforeClose(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1Close(Sender: TObject;
|
||||
@@ -436,6 +441,12 @@ begin
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.OpenBtnClick(Sender: TObject);
|
||||
begin
|
||||
OpenDialog1.Filter := 'HTML Files (*.html)|*.HTML';
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="106"/>
|
||||
<CursorPos Y="134"/>
|
||||
<TopLine Value="189"/>
|
||||
<CursorPos Y="219"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -46,7 +46,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
<JumpHistory Count="10" HistoryIndex="9">
|
||||
<JumpHistory Count="15" HistoryIndex="14">
|
||||
<Position1>
|
||||
<Filename Value="ExternalPumpBrowser.lpr"/>
|
||||
</Position1>
|
||||
@@ -85,6 +85,26 @@
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="84" Column="43" TopLine="57"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="122" Column="82" TopLine="100"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="124" Column="82" TopLine="102"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="179" TopLine="150"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="221" Column="43" TopLine="202"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uExternalPumpBrowser.pas"/>
|
||||
<Caret Line="69" TopLine="51"/>
|
||||
</Position15>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -74,7 +74,6 @@ object ExternalPumpBrowserFrm: TExternalPumpBrowserFrm
|
||||
Width = 1038
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
OnResize = CEFWindowParent1Resize
|
||||
end
|
||||
object Timer1: TTimer
|
||||
Enabled = False
|
||||
@@ -91,4 +90,9 @@ object ExternalPumpBrowserFrm: TExternalPumpBrowserFrm
|
||||
left = 56
|
||||
top = 152
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 56
|
||||
top = 216
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFTypes, uCEFConstants, uCEFInterfaces, uCEFWorkScheduler,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
@@ -58,13 +58,14 @@ type
|
||||
|
||||
TExternalPumpBrowserFrm = class(TForm)
|
||||
AddressPnl: TPanel;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
GoBtn: TButton;
|
||||
Timer1: TTimer;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
URLCbx: TComboBox;
|
||||
|
||||
procedure CEFWindowParent1Resize(Sender: TObject);
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
@@ -114,6 +115,13 @@ uses
|
||||
// This demo has a simple browser with a TChromium + TCEFWindowParent combination
|
||||
// It was necessary to destroy the browser following the destruction sequence described in the MDIBrowser demo.
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 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 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_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
begin
|
||||
if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS);
|
||||
@@ -167,8 +175,7 @@ end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.Chromium1BeforePopup(Sender: TObject;
|
||||
@@ -209,9 +216,10 @@ begin
|
||||
Chromium1.LoadURL(URLCbx.Text);
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.CEFWindowParent1Resize(Sender: TObject);
|
||||
procedure TExternalPumpBrowserFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.Timer1Timer(Sender: TObject);
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="95"/>
|
||||
<CursorPos Y="122"/>
|
||||
<TopLine Value="178"/>
|
||||
<CursorPos X="71" Y="190"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="5" HistoryIndex="4">
|
||||
<JumpHistory Count="7" HistoryIndex="6">
|
||||
<Position1>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
</Position1>
|
||||
@@ -50,6 +50,14 @@
|
||||
<Filename Value="FullScreenBrowser.lpr"/>
|
||||
<Caret Line="60" Column="22" TopLine="38"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="117" TopLine="149"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="122" TopLine="122"/>
|
||||
</Position7>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -43,4 +43,9 @@ object MainForm: TMainForm
|
||||
left = 272
|
||||
top = 120
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 344
|
||||
top = 120
|
||||
end
|
||||
end
|
||||
|
||||
@@ -51,13 +51,18 @@ uses
|
||||
Controls, Forms, Dialogs, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure Chromium1PreKeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg;
|
||||
out isKeyboardShortcut, Result: Boolean);
|
||||
@@ -114,6 +119,13 @@ implementation
|
||||
uses
|
||||
uCEFApplication;
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 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 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
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
@@ -166,8 +178,7 @@ end;
|
||||
|
||||
procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1BeforePopup(Sender: TObject;
|
||||
@@ -238,6 +249,12 @@ begin
|
||||
isKeyboardShortcut := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
CanClose := FCanClose;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="995"/>
|
||||
<CursorPos Y="1002"/>
|
||||
<TopLine Value="276"/>
|
||||
<CursorPos Y="293"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="41" Y="993" ID="1"/>
|
||||
|
||||
@@ -288,8 +288,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 CreateGlobalCEFApp;
|
||||
begin
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="176"/>
|
||||
<CursorPos Y="198"/>
|
||||
<TopLine Value="926"/>
|
||||
<CursorPos X="91" Y="945"/>
|
||||
<UsageCount Value="26"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -59,123 +59,127 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit5>
|
||||
</Units>
|
||||
<JumpHistory Count="29" HistoryIndex="28">
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="346" TopLine="343"/>
|
||||
<Caret Line="120" Column="5" TopLine="109"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="192" Column="54" TopLine="173"/>
|
||||
<Caret Line="47" Column="39" TopLine="42"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="194" Column="47" TopLine="173"/>
|
||||
<Caret Line="311" Column="51" TopLine="294"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="199" Column="13" TopLine="187"/>
|
||||
<Caret Line="97" Column="43" TopLine="84"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="120" Column="5" TopLine="109"/>
|
||||
<Caret Line="284" Column="57" TopLine="273"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="47" Column="39" TopLine="42"/>
|
||||
<Caret Line="323" Column="23" TopLine="299"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="311" Column="51" TopLine="294"/>
|
||||
<Caret Line="95" Column="36" TopLine="84"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="97" Column="43" TopLine="84"/>
|
||||
<Caret Line="271" TopLine="270"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="284" Column="57" TopLine="273"/>
|
||||
<Caret Line="286" Column="70" TopLine="270"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="323" Column="23" TopLine="299"/>
|
||||
<Caret Line="307" Column="11" TopLine="295"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="95" Column="36" TopLine="84"/>
|
||||
<Caret Line="322" TopLine="313"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="271" TopLine="270"/>
|
||||
<Caret Line="503" Column="53" TopLine="488"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="286" Column="70" TopLine="270"/>
|
||||
<Caret Line="92" Column="27" TopLine="92"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="307" Column="11" TopLine="295"/>
|
||||
<Caret Line="503" Column="11" TopLine="499"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="322" TopLine="313"/>
|
||||
<Caret Line="201" Column="11" TopLine="166"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="503" Column="53" TopLine="488"/>
|
||||
<Caret Line="982" Column="68" TopLine="963"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="92" Column="27" TopLine="92"/>
|
||||
<Caret Line="307" Column="39" TopLine="301"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="503" Column="11" TopLine="499"/>
|
||||
<Caret Line="82" Column="44" TopLine="77"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="201" Column="11" TopLine="166"/>
|
||||
<Caret Line="957" TopLine="939"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="982" Column="68" TopLine="963"/>
|
||||
<Caret Line="958" TopLine="939"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="307" Column="39" TopLine="301"/>
|
||||
<Caret Line="957" TopLine="939"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="82" Column="44" TopLine="77"/>
|
||||
<Caret Line="958" TopLine="939"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="957" TopLine="939"/>
|
||||
<Caret Line="960" TopLine="939"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="958" TopLine="939"/>
|
||||
<Filename Value="OSRExternalPumpBrowser.lpr"/>
|
||||
<Caret Line="61" Column="63" TopLine="41"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="957" TopLine="939"/>
|
||||
<Caret Line="169" Column="11" TopLine="153"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="958" TopLine="939"/>
|
||||
<Caret Line="198" TopLine="176"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="960" TopLine="939"/>
|
||||
<Caret Line="170" Column="82" TopLine="148"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="OSRExternalPumpBrowser.lpr"/>
|
||||
<Caret Line="61" Column="63" TopLine="41"/>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="217" Column="51" TopLine="196"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="169" Column="11" TopLine="153"/>
|
||||
<Caret Line="105" Column="30" TopLine="71"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="uOSRExternalPumpBrowser.pas"/>
|
||||
<Caret Line="282" TopLine="278"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -144,4 +144,9 @@ object OSRExternalPumpBrowserFrm: TOSRExternalPumpBrowserFrm
|
||||
left = 24
|
||||
top = 206
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 24
|
||||
top = 136
|
||||
end
|
||||
end
|
||||
|
||||
@@ -47,13 +47,14 @@ uses
|
||||
Windows, Messages, SysUtils, LCLType, Variants, Classes, SyncObjs, Graphics, Controls,
|
||||
Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||
uCEFWorkScheduler, Types;
|
||||
uCEFWorkScheduler, uCEFSentinel, Types;
|
||||
|
||||
type
|
||||
|
||||
{ TOSRExternalPumpBrowserFrm }
|
||||
|
||||
TOSRExternalPumpBrowserFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
chrmosr: TChromium;
|
||||
ComboBox1: TComboBox;
|
||||
@@ -64,6 +65,7 @@ type
|
||||
Timer1: TTimer;
|
||||
Panel1: TBufferPanel;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure GoBtnEnter(Sender: TObject);
|
||||
|
||||
@@ -164,7 +166,8 @@ var
|
||||
// 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.
|
||||
// Now we call 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;
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
@@ -208,6 +211,12 @@ begin
|
||||
chrmosr.LoadURL(ComboBox1.Text);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrIMECompositionRangeChanged( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const selected_range : PCefRange;
|
||||
@@ -269,8 +278,7 @@ end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TOSRExternalPumpBrowserFrm.Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="145"/>
|
||||
<CursorPos Y="150"/>
|
||||
<TopLine Value="333"/>
|
||||
<CursorPos X="22" Y="341"/>
|
||||
<UsageCount Value="22"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -56,7 +56,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit3>
|
||||
</Units>
|
||||
<JumpHistory Count="16" HistoryIndex="15">
|
||||
<JumpHistory Count="18" HistoryIndex="17">
|
||||
<Position1>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="81" Column="34" TopLine="68"/>
|
||||
@@ -121,6 +121,14 @@
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="110" Column="11" TopLine="94"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="143" Column="82" TopLine="112"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="145" Column="82" TopLine="114"/>
|
||||
</Position18>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -71,7 +71,12 @@ object MainForm: TMainForm
|
||||
top = 152
|
||||
end
|
||||
object ApplicationProperties1: TApplicationProperties
|
||||
left = 52
|
||||
top = 36
|
||||
left = 56
|
||||
top = 40
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 56
|
||||
top = 221
|
||||
end
|
||||
end
|
||||
|
||||
@@ -45,7 +45,7 @@ uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics,
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs,
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uChildForm,
|
||||
uCEFWinControl, uCEFChromiumEvents;
|
||||
uCEFWinControl, uCEFChromiumEvents, uCEFSentinel;
|
||||
|
||||
const
|
||||
CEF_CREATENEXTCHILD = WM_APP + $A50;
|
||||
@@ -59,11 +59,13 @@ type
|
||||
AddressPnl: TPanel;
|
||||
AddressEdt: TEdit;
|
||||
ApplicationProperties1: TApplicationProperties;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
GoBtn: TButton;
|
||||
Timer1: TTimer;
|
||||
Chromium1: TChromium;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
|
||||
@@ -139,7 +141,8 @@ uses
|
||||
// 1. FormCloseQuery sets CanClose to FALSE and it closes all child forms.
|
||||
// 2. When all the child forms are closed then FormCloseQuery is triggered again, sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 3. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 4. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 4. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 5. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
@@ -327,12 +330,17 @@ begin
|
||||
Chromium1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure TMainForm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<Unit0>
|
||||
<Filename Value="PopupBrowser2.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<TopLine Value="38"/>
|
||||
<TopLine Value="37"/>
|
||||
<CursorPos X="61" Y="64"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Loaded Value="True"/>
|
||||
@@ -22,11 +22,11 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="313"/>
|
||||
<CursorPos X="59" Y="328"/>
|
||||
<TopLine Value="128"/>
|
||||
<CursorPos X="58" Y="152"/>
|
||||
<UsageCount Value="23"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="58" Y="328" ID="1"/>
|
||||
<Item0 X="58" Y="338" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -85,124 +85,124 @@
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="uChildForm.pas"/>
|
||||
<Caret Line="62" Column="384" TopLine="51"/>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="344" Column="17" TopLine="320"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="199" Column="59" TopLine="183"/>
|
||||
<Caret Line="346" Column="19" TopLine="322"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="344" Column="17" TopLine="320"/>
|
||||
<Caret Line="197" Column="72" TopLine="182"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="346" Column="19" TopLine="322"/>
|
||||
<Caret Line="352" Column="56" TopLine="322"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="197" Column="72" TopLine="182"/>
|
||||
<Caret Line="332" TopLine="310"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="352" Column="56" TopLine="322"/>
|
||||
<Caret Line="334" Column="51" TopLine="310"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="332" TopLine="310"/>
|
||||
<Caret Line="67" TopLine="49"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="334" Column="51" TopLine="310"/>
|
||||
<Caret Line="340" TopLine="311"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="67" TopLine="49"/>
|
||||
<Caret Line="337" TopLine="311"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="340" TopLine="311"/>
|
||||
<Caret Line="343" Column="33" TopLine="314"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="337" TopLine="311"/>
|
||||
<Caret Line="337" TopLine="314"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="343" Column="33" TopLine="314"/>
|
||||
<Caret Line="346" Column="58" TopLine="320"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="337" TopLine="314"/>
|
||||
<Caret Line="337" TopLine="320"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="346" Column="58" TopLine="320"/>
|
||||
<Caret Line="184" Column="66" TopLine="175"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="337" TopLine="320"/>
|
||||
<Caret Line="337" Column="30" TopLine="322"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="184" Column="66" TopLine="175"/>
|
||||
<Caret Line="67" TopLine="49"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="337" Column="30" TopLine="322"/>
|
||||
<Caret Line="180" Column="40" TopLine="166"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="67" TopLine="49"/>
|
||||
<Caret Line="335" Column="59" TopLine="309"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="180" Column="40" TopLine="166"/>
|
||||
<Caret Line="333" Column="40" TopLine="309"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="335" Column="59" TopLine="309"/>
|
||||
<Caret Line="332" TopLine="309"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="333" Column="40" TopLine="309"/>
|
||||
<Caret Line="339" TopLine="309"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="332" TopLine="309"/>
|
||||
<Caret Line="188" Column="99" TopLine="177"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="339" TopLine="309"/>
|
||||
<Caret Line="343" Column="19" TopLine="333"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="188" Column="99" TopLine="177"/>
|
||||
<Caret Line="69" TopLine="52"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="343" Column="19" TopLine="333"/>
|
||||
<Caret Line="336" TopLine="321"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="69" TopLine="52"/>
|
||||
<Caret Line="335" TopLine="320"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="336" TopLine="321"/>
|
||||
<Caret Line="330" Column="32" TopLine="320"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="335" TopLine="320"/>
|
||||
<Caret Line="67" TopLine="49"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="330" Column="32" TopLine="320"/>
|
||||
<Caret Line="328" Column="59" TopLine="313"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="uMainForm.pas"/>
|
||||
<Caret Line="67" TopLine="49"/>
|
||||
<Caret Line="335" Column="59" TopLine="315"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
|
||||
@@ -74,4 +74,9 @@ object MainForm: TMainForm
|
||||
left = 56
|
||||
top = 216
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 56
|
||||
top = 288
|
||||
end
|
||||
end
|
||||
|
||||
@@ -59,11 +59,13 @@ type
|
||||
AddressPnl: TPanel;
|
||||
AddressEdt: TEdit;
|
||||
ApplicationProperties1: TApplicationProperties;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
GoBtn: TButton;
|
||||
Timer1: TTimer;
|
||||
Chromium1: TChromium;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
|
||||
@@ -139,13 +141,15 @@ uses
|
||||
// 1. FormCloseQuery sets CanClose to FALSE and it closes all child forms.
|
||||
// 2. When all the child forms are closed then FormCloseQuery is triggered again, sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 3. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
|
||||
// 4. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
// 4. TChromium.OnBeforeClose calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 5. TCEFSentinel.OnClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.EnableHighDPISupport := True;
|
||||
//GlobalCEFApp.LogFile := 'cef.log';
|
||||
//GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
@@ -325,12 +329,17 @@ begin
|
||||
Chromium1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure TMainForm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser;
|
||||
var aAction: TCefCloseBrowserAction);
|
||||
begin
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
<Unit0>
|
||||
<Filename Value="PostInspectorBrowser.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="37"/>
|
||||
<TopLine Value="36"/>
|
||||
<CursorPos Y="73"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
@@ -21,10 +20,13 @@
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="34"/>
|
||||
<CursorPos X="80" Y="157"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="124"/>
|
||||
<CursorPos Y="150"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
@@ -72,10 +74,18 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
</Units>
|
||||
<JumpHistory Count="1">
|
||||
<JumpHistory Count="3" HistoryIndex="2">
|
||||
<Position1>
|
||||
<Filename Value="PostInspectorBrowser.lpr"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="uPostInspectorBrowser.pas"/>
|
||||
<Caret Line="157" Column="80" TopLine="34"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="uPostInspectorBrowser.pas"/>
|
||||
<Caret Line="162" Column="80" TopLine="125"/>
|
||||
</Position3>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -94,4 +94,9 @@ object Form1: TForm1
|
||||
left = 56
|
||||
top = 152
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 56
|
||||
top = 216
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,14 +50,18 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
const
|
||||
CEF_SHOWDATA = WM_APP + $B00;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
AddressPnl: TPanel;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
GoBtn: TButton;
|
||||
Timer1: TTimer;
|
||||
Chromium1: TChromium;
|
||||
@@ -65,6 +69,7 @@ type
|
||||
Memo1: TMemo;
|
||||
AddressCb: TComboBox;
|
||||
Splitter1: TSplitter;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
@@ -136,13 +141,12 @@ uses
|
||||
// After the request has been handled we send a custom message to the form (CEF_SHOWDATA)
|
||||
// to add the information to the TMemo safely in the main thread.
|
||||
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 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 CreateGlobalCEFApp;
|
||||
begin
|
||||
@@ -391,8 +395,7 @@ end;
|
||||
|
||||
procedure TForm1.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1BeforePopup(Sender: TObject;
|
||||
@@ -433,6 +436,12 @@ begin
|
||||
Chromium1.LoadURL(AddressCb.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="113"/>
|
||||
<CursorPos Y="140"/>
|
||||
<TopLine Value="115"/>
|
||||
<CursorPos X="82" Y="135"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -54,7 +54,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit4>
|
||||
</Units>
|
||||
<JumpHistory Count="23" HistoryIndex="22">
|
||||
<JumpHistory Count="25" HistoryIndex="24">
|
||||
<Position1>
|
||||
<Filename Value="uHelloScheme.pas"/>
|
||||
<Caret Line="118" TopLine="115"/>
|
||||
@@ -147,6 +147,14 @@
|
||||
<Filename Value="uSchemeRegistrationBrowser.pas"/>
|
||||
<Caret Line="89" Column="43" TopLine="68"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="uSchemeRegistrationBrowser.pas"/>
|
||||
<Caret Line="140" TopLine="113"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="uSchemeRegistrationBrowser.pas"/>
|
||||
<Caret Line="145" TopLine="118"/>
|
||||
</Position25>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -79,4 +79,9 @@ object SchemeRegistrationBrowserFrm: TSchemeRegistrationBrowserFrm
|
||||
left = 16
|
||||
top = 96
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 16
|
||||
top = 160
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,20 +53,25 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFSchemeRegistrar,
|
||||
uCEFTypes, uCEFConstants, uCEFWinControl;
|
||||
uCEFTypes, uCEFConstants, uCEFWinControl, uCEFSentinel;
|
||||
|
||||
const
|
||||
MINIBROWSER_CONTEXTMENU_REGSCHEME = MENU_ID_USER_FIRST + 1;
|
||||
MINIBROWSER_CONTEXTMENU_CLEARFACT = MENU_ID_USER_FIRST + 2;
|
||||
|
||||
type
|
||||
|
||||
{ TSchemeRegistrationBrowserFrm }
|
||||
|
||||
TSchemeRegistrationBrowserFrm = class(TForm)
|
||||
AddressBarPnl: TPanel;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
GoBtn: TButton;
|
||||
CEFWindowParent1: TCEFWindowParent;
|
||||
Chromium1: TChromium;
|
||||
AddressCbx: TComboBox;
|
||||
Timer1: TTimer;
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure Chromium1AfterCreated(Sender: TObject;
|
||||
const browser: ICefBrowser);
|
||||
procedure Chromium1BeforeContextMenu(Sender: TObject;
|
||||
@@ -126,7 +131,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_OnRegCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
||||
begin
|
||||
@@ -144,13 +150,18 @@ begin
|
||||
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TSchemeRegistrationBrowserFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
procedure TSchemeRegistrationBrowserFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TSchemeRegistrationBrowserFrm.Chromium1BeforeClose(
|
||||
Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TSchemeRegistrationBrowserFrm.Chromium1BeforeContextMenu(
|
||||
Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const params: ICefContextMenuParams; const model: ICefMenuModel);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="116"/>
|
||||
<CursorPos Y="123"/>
|
||||
<TopLine Value="101"/>
|
||||
<CursorPos X="82" Y="123"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -38,7 +38,7 @@
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="4" HistoryIndex="3">
|
||||
<JumpHistory Count="6" HistoryIndex="5">
|
||||
<Position1>
|
||||
<Filename Value="uSimpleBrowser.pas"/>
|
||||
<Caret Line="4" Column="8"/>
|
||||
@@ -55,6 +55,14 @@
|
||||
<Filename Value="uSimpleBrowser.pas"/>
|
||||
<Caret Line="92" Column="11" TopLine="91"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uSimpleBrowser.pas"/>
|
||||
<Caret Line="123" TopLine="116"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uSimpleBrowser.pas"/>
|
||||
<Caret Line="128" TopLine="121"/>
|
||||
</Position6>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -65,4 +65,9 @@ object Form1: TForm1
|
||||
left = 56
|
||||
top = 88
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 56
|
||||
top = 154
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,15 +50,20 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = 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);
|
||||
@@ -114,7 +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;
|
||||
@@ -165,18 +171,13 @@ end;
|
||||
|
||||
procedure TForm1.ChromiumWindow1BeforeClose(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.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 TForm1.Chromium_OnBeforePopup(Sender: TObject;
|
||||
@@ -207,6 +208,12 @@ begin
|
||||
ChromiumWindow1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="uSimpleLazarusBrowser"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="147"/>
|
||||
<CursorPos X="22" Y="167"/>
|
||||
<TopLine Value="97"/>
|
||||
<CursorPos X="82" Y="127"/>
|
||||
<UsageCount Value="43"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -423,7 +423,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit54>
|
||||
</Units>
|
||||
<JumpHistory Count="10" HistoryIndex="9">
|
||||
<JumpHistory Count="9" HistoryIndex="8">
|
||||
<Position1>
|
||||
<Filename Value="usimplelazarusbrowser.pas"/>
|
||||
<Caret Line="67" Column="29" TopLine="57"/>
|
||||
@@ -457,13 +457,9 @@
|
||||
<Caret Line="26" Column="34"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="usimplelazarusbrowser.pas"/>
|
||||
<Caret Line="131" TopLine="136"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="usimplelazarusbrowser.pas"/>
|
||||
<Caret Line="133" TopLine="133"/>
|
||||
</Position10>
|
||||
</Position9>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -119,6 +119,13 @@ implementation
|
||||
|
||||
// This demo uses a TChromium and a TCEFWindowParent
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 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 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
|
||||
uCEFApplication;
|
||||
|
||||
|
||||
@@ -22,15 +22,15 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="102"/>
|
||||
<CursorPos Y="122"/>
|
||||
<TopLine Value="167"/>
|
||||
<CursorPos X="22" Y="183"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="7" HistoryIndex="6">
|
||||
<JumpHistory Count="9" HistoryIndex="8">
|
||||
<Position1>
|
||||
<Filename Value="SimpleExternalPumpBrowser.lpr"/>
|
||||
</Position1>
|
||||
@@ -58,6 +58,14 @@
|
||||
<Filename Value="uSimpleExternalPumpBrowser.pas"/>
|
||||
<Caret Line="89" Column="11" TopLine="73"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="uSimpleExternalPumpBrowser.pas"/>
|
||||
<Caret Line="105" Column="82" TopLine="87"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="uSimpleExternalPumpBrowser.pas"/>
|
||||
<Caret Line="110" Column="82" TopLine="92"/>
|
||||
</Position9>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -85,4 +85,9 @@ object SimpleExternalPumpBrowserFrm: TSimpleExternalPumpBrowserFrm
|
||||
left = 56
|
||||
top = 88
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 56
|
||||
top = 168
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,16 +50,21 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFTypes, uCEFConstants, uCEFInterfaces, uCEFWorkScheduler,
|
||||
uCEFChromiumWindow {, Vcl.ComCtrls, Vcl.AppEvnts};
|
||||
uCEFChromiumWindow, uCEFSentinel {, Vcl.ComCtrls, Vcl.AppEvnts};
|
||||
|
||||
type
|
||||
|
||||
{ TSimpleExternalPumpBrowserFrm }
|
||||
|
||||
TSimpleExternalPumpBrowserFrm = class(TForm)
|
||||
AddressPnl: TPanel;
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
GoBtn: TButton;
|
||||
Timer1: TTimer;
|
||||
URLCbx: TComboBox;
|
||||
ChromiumWindow1: TChromiumWindow;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
@@ -101,7 +106,8 @@ uses
|
||||
// It was necessary to destroy the browser with the following destruction sequence :
|
||||
// 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 GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
begin
|
||||
@@ -174,18 +180,13 @@ end;
|
||||
|
||||
procedure TSimpleExternalPumpBrowserFrm.ChromiumWindow1BeforeClose(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TSimpleExternalPumpBrowserFrm.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 TSimpleExternalPumpBrowserFrm.GoBtnClick(Sender: TObject);
|
||||
@@ -193,6 +194,12 @@ begin
|
||||
ChromiumWindow1.LoadURL(URLCbx.Text);
|
||||
end;
|
||||
|
||||
procedure TSimpleExternalPumpBrowserFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TSimpleExternalPumpBrowserFrm.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
||||
@@ -38,11 +38,11 @@
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="161"/>
|
||||
<CursorPos Y="178"/>
|
||||
<TopLine Value="906"/>
|
||||
<CursorPos Y="918"/>
|
||||
<UsageCount Value="42"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 X="40" Y="261" ID="4"/>
|
||||
<Item0 X="40" Y="270" ID="4"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -229,7 +229,7 @@
|
||||
<UsageCount Value="10"/>
|
||||
</Unit26>
|
||||
</Units>
|
||||
<JumpHistory Count="7" HistoryIndex="6">
|
||||
<JumpHistory Count="10" HistoryIndex="9">
|
||||
<Position1>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="204" Column="63" TopLine="19"/>
|
||||
@@ -258,6 +258,18 @@
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="155" Column="29" TopLine="139"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="184" Column="46" TopLine="161"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="187" Column="46" TopLine="164"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="usimplelazosrbrowser.pas"/>
|
||||
<Caret Line="174" Column="82" TopLine="176"/>
|
||||
</Position10>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -139,4 +139,9 @@ object Form1: TForm1
|
||||
left = 24
|
||||
top = 128
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 24
|
||||
top = 272
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,15 +42,17 @@ unit usimplelazosrbrowser;
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, SyncObjs,
|
||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types,
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel, uCEFChromiumEvents;
|
||||
Windows, LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes,
|
||||
SyncObjs, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types,
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||
uCEFChromiumEvents, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
NavControlPnl: TPanel;
|
||||
chrmosr: TChromium;
|
||||
ComboBox1: TComboBox;
|
||||
@@ -61,6 +63,7 @@ type
|
||||
Timer1: TTimer;
|
||||
Panel1: TBufferPanel;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure GoBtnEnter(Sender: TObject);
|
||||
|
||||
@@ -167,7 +170,8 @@ uses
|
||||
// 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.
|
||||
// Now we call 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;
|
||||
@@ -187,6 +191,12 @@ begin
|
||||
chrmosr.LoadURL(ComboBox1.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.chrmosrIMECompositionRangeChanged( Sender : TObject;
|
||||
const browser : ICefBrowser;
|
||||
const selected_range : PCefRange;
|
||||
@@ -248,8 +258,7 @@ end;
|
||||
|
||||
procedure TForm1.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="138"/>
|
||||
<CursorPos X="41" Y="160"/>
|
||||
<TopLine Value="149"/>
|
||||
<CursorPos Y="157"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -31,16 +32,15 @@
|
||||
<Unit2>
|
||||
<Filename Value="uCEFLoader.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="45"/>
|
||||
<TopLine Value="30"/>
|
||||
<CursorPos Y="68"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
<JumpHistory Count="4" HistoryIndex="3">
|
||||
<JumpHistory Count="6" HistoryIndex="5">
|
||||
<Position1>
|
||||
<Filename Value="SimpleBrowser.lpr"/>
|
||||
</Position1>
|
||||
@@ -56,6 +56,14 @@
|
||||
<Filename Value="uSimpleBrowser.pas"/>
|
||||
<Caret Line="81" Column="386" TopLine="60"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="uSimpleBrowser.pas"/>
|
||||
<Caret Line="114" Column="82" TopLine="90"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="uSimpleBrowser.pas"/>
|
||||
<Caret Line="119" Column="82" TopLine="95"/>
|
||||
</Position6>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -13,7 +13,7 @@ object Form1: TForm1
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.0.2.0'
|
||||
LCLVersion = '2.0.4.0'
|
||||
object ChromiumWindow1: TChromiumWindow
|
||||
Left = 0
|
||||
Height = 603
|
||||
@@ -63,4 +63,9 @@ object Form1: TForm1
|
||||
left = 80
|
||||
top = 88
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 80
|
||||
top = 168
|
||||
end
|
||||
end
|
||||
|
||||
@@ -50,15 +50,20 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = 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);
|
||||
@@ -110,7 +115,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 TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@@ -147,17 +153,12 @@ end;
|
||||
procedure TForm1.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 TForm1.ChromiumWindow1BeforeClose(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
CEFSentinel1.Start;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium_OnBeforePopup(Sender: TObject;
|
||||
@@ -188,6 +189,12 @@ begin
|
||||
ChromiumWindow1.LoadURL(AddressEdt.Text);
|
||||
end;
|
||||
|
||||
procedure TForm1.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TForm1.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="348"/>
|
||||
<CursorPos Y="365"/>
|
||||
<TopLine Value="134"/>
|
||||
<CursorPos X="82" Y="154"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Bookmarks Count="1">
|
||||
<Item0 Y="365" ID="1"/>
|
||||
<Item0 Y="367" ID="1"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
|
||||
@@ -150,7 +150,9 @@ implementation
|
||||
// This is the destruction sequence when the user closes the main form
|
||||
// 1. FormCloseQuery hides the form and calls CloseAllBrowsers which calls TChromium.CloseBrowser in all tabs and triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROYWNDPARENT message to destroy TCEFWindowParent in the main thread which triggers a TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sends a CEFBROWSER_CHECKTAGGEDTABS message to set the TAG property to 1 in the TabSheet containing the TChromium. Then sends WM_CLOSE in case all tabsheets have a TAG = 1.
|
||||
// 3. TChromium.OnBeforeClose sends a CEFBROWSER_CHECKTAGGEDTABS message to set the TAG property to 1 in the TabSheet containing the TChromium.
|
||||
// When all tabsheets have a TAG = 1 it calls TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when the renderer processes are closed.
|
||||
// 4. TCEFSentinel.OnClose sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
begin
|
||||
|
||||
@@ -22,12 +22,12 @@
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="204"/>
|
||||
<CursorPos X="68" Y="221"/>
|
||||
<TopLine Value="89"/>
|
||||
<CursorPos Y="112"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Bookmarks Count="2">
|
||||
<Item0 X="42" Y="143" ID="1"/>
|
||||
<Item1 X="65" Y="222" ID="2"/>
|
||||
<Item0 X="42" Y="144" ID="1"/>
|
||||
<Item1 X="65" Y="223" ID="2"/>
|
||||
</Bookmarks>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
|
||||
@@ -107,7 +107,8 @@ uses
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. Destroy all child forms
|
||||
// 2. Wait until all the child forms are closed before closing the main form and terminating the application.
|
||||
// 2. Wait until all the child forms are closed before calling TCEFSentinel.Start, which will trigger TCEFSentinel.OnClose when all renderer processes are closed
|
||||
// 3. TCEFSentinel.OnClose closes the main form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextInitialized;
|
||||
begin
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
<ComponentName Value="URLRequestFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="223"/>
|
||||
<CursorPos Y="204"/>
|
||||
<TopLine Value="335"/>
|
||||
<CursorPos X="23" Y="361"/>
|
||||
<UsageCount Value="21"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
@@ -37,31 +38,27 @@
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="..\..\..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="187"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="179"/>
|
||||
<CursorPos Y="208"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="..\..\..\source\uCEFInterfaces.pas"/>
|
||||
<EditorIndex Value="4"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1857"/>
|
||||
<CursorPos X="3" Y="1872"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="..\..\..\source\uCEFSentinel.pas"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="3"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="266"/>
|
||||
<CursorPos X="23" Y="292"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
</Units>
|
||||
<JumpHistory Count="16" HistoryIndex="15">
|
||||
<JumpHistory Count="15" HistoryIndex="14">
|
||||
<Position1>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
</Position1>
|
||||
@@ -90,41 +87,37 @@
|
||||
<Caret Line="344" Column="3" TopLine="55"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="..\..\..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<Caret Line="94" Column="30" TopLine="77"/>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="69" Column="39" TopLine="55"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="..\..\..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<Caret Line="149" Column="3" TopLine="134"/>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="195" Column="40" TopLine="171"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="..\..\..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<Caret Line="159" Column="11" TopLine="134"/>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="251" Column="73" TopLine="227"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="..\..\..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<Caret Line="69" Column="7" TopLine="54"/>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="301" Column="77" TopLine="277"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="69" Column="39" TopLine="55"/>
|
||||
<Caret Line="413" Column="61" TopLine="390"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="195" Column="40" TopLine="171"/>
|
||||
<Caret Line="204" TopLine="222"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="251" Column="73" TopLine="227"/>
|
||||
<Caret Line="215" TopLine="215"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="301" Column="77" TopLine="277"/>
|
||||
<Caret Line="226" Column="64" TopLine="205"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="uURLRequest.pas"/>
|
||||
<Caret Line="413" Column="61" TopLine="390"/>
|
||||
</Position16>
|
||||
</JumpHistory>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
|
||||
@@ -203,4 +203,9 @@ object URLRequestFrm: TURLRequestFrm
|
||||
left = 304
|
||||
top = 104
|
||||
end
|
||||
object CEFSentinel1: TCEFSentinel
|
||||
OnClose = CEFSentinel1Close
|
||||
left = 152
|
||||
top = 112
|
||||
end
|
||||
end
|
||||
|
||||
@@ -49,14 +49,19 @@ uses
|
||||
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics,
|
||||
Controls, Forms, Dialogs, ComCtrls, StdCtrls,
|
||||
{$ENDIF}
|
||||
uCEFInterfaces, uCEFUrlRequestClientComponent, uCEFRequest, uCEFUrlRequest;
|
||||
uCEFInterfaces, uCEFUrlRequestClientComponent, uCEFRequest, uCEFUrlRequest,
|
||||
uCEFSentinel;
|
||||
|
||||
const
|
||||
URLREQUEST_SUCCESS = WM_APP + $101;
|
||||
URLREQUEST_ERROR = WM_APP + $102;
|
||||
|
||||
type
|
||||
|
||||
{ TURLRequestFrm }
|
||||
|
||||
TURLRequestFrm = class(TForm)
|
||||
CEFSentinel1: TCEFSentinel;
|
||||
StatusBar1: TStatusBar;
|
||||
SaveDialog1: TSaveDialog;
|
||||
CEFUrlRequestClientComponent1: TCEFUrlRequestClientComponent;
|
||||
@@ -80,6 +85,7 @@ type
|
||||
PostParam2NameEdt: TEdit;
|
||||
PostParam2ValueEdt: TEdit;
|
||||
|
||||
procedure CEFSentinel1Close(Sender: TObject);
|
||||
procedure DownloadBtnClick(Sender: TObject);
|
||||
procedure SendPostReqBtnClick(Sender: TObject);
|
||||
|
||||
@@ -197,6 +203,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TURLRequestFrm.CEFSentinel1Close(Sender: TObject);
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TURLRequestFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
CanClose := FCanClose or not(FBusy);
|
||||
@@ -346,10 +358,7 @@ begin
|
||||
// Use request.response here to get a ICefResponse interface with all the response headers, status, error code, etc.
|
||||
|
||||
if FClosing then
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end
|
||||
CEFSentinel1.Start
|
||||
else
|
||||
if (request <> nil) and (request.RequestStatus = UR_SUCCESS) then
|
||||
PostMessage(Handle, URLREQUEST_SUCCESS, 0, 0)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"UpdateLazPackages" : [
|
||||
{
|
||||
"ForceNotify" : true,
|
||||
"InternalVersion" : 43,
|
||||
"InternalVersion" : 44,
|
||||
"Name" : "cef4delphi_lazarus.lpk",
|
||||
"Version" : "77.1.13.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user