mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-15 07:45:56 +01:00
Update to CEF 128.4.8
This commit is contained in:
parent
ed52c6144c
commit
55a70a998e
14
README.md
14
README.md
@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
|
||||
|
||||
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the LICENSE.md file.
|
||||
|
||||
CEF4Delphi uses CEF 127.3.5 which includes Chromium 127.0.6533.120.
|
||||
CEF4Delphi uses CEF 128.4.8 which includes Chromium 128.0.6613.114.
|
||||
|
||||
The CEF binaries used by CEF4Delphi are available for download at Spotify :
|
||||
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_127.3.5%2Bg114ea2a%2Bchromium-127.0.6533.120_windows32.tar.bz2)
|
||||
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_127.3.5%2Bg114ea2a%2Bchromium-127.0.6533.120_windows64.tar.bz2)
|
||||
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_127.3.5%2Bg114ea2a%2Bchromium-127.0.6533.120_linux64.tar.bz2)
|
||||
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_127.3.5%2Bg114ea2a%2Bchromium-127.0.6533.120_linuxarm.tar.bz2)
|
||||
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_127.3.5%2Bg114ea2a%2Bchromium-127.0.6533.120_linuxarm64.tar.bz2)
|
||||
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_127.3.5%2Bg114ea2a%2Bchromium-127.0.6533.120_macosx64.tar.bz2)
|
||||
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_128.4.8%2Bg88b5034%2Bchromium-128.0.6613.114_windows32.tar.bz2)
|
||||
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_128.4.8%2Bg88b5034%2Bchromium-128.0.6613.114_windows64.tar.bz2)
|
||||
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_128.4.8%2Bg88b5034%2Bchromium-128.0.6613.114_linux64.tar.bz2)
|
||||
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_128.4.8%2Bg88b5034%2Bchromium-128.0.6613.114_linuxarm.tar.bz2)
|
||||
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_128.4.8%2Bg88b5034%2Bchromium-128.0.6613.114_linuxarm64.tar.bz2)
|
||||
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_128.4.8%2Bg88b5034%2Bchromium-128.0.6613.114_macosx64.tar.bz2)
|
||||
|
||||
CEF4Delphi was developed and tested on Delphi 12.1 and it has been tested in Delphi 6, Delphi XE, Delphi 10, Delphi 11 and Lazarus 3.4/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
||||
|
||||
|
@ -350,7 +350,7 @@ begin
|
||||
if aIndependent then
|
||||
begin
|
||||
TempCache := GlobalCEFApp.RootCache + '\cache' + inttostr(TBrowserTab(ParentTab).TabID);
|
||||
TempContext := TCefRequestContextRef.New(TempCache, '', '', False, False, False, FMXChromium1.ReqContextHandler)
|
||||
TempContext := TCefRequestContextRef.New(TempCache, '', '', False, False, FMXChromium1.ReqContextHandler)
|
||||
end
|
||||
else
|
||||
TempContext := nil;
|
||||
@ -365,6 +365,7 @@ begin
|
||||
TempRect.Bottom := round(TempClientRect.Bottom * TempScale);
|
||||
|
||||
FMXChromium1.DefaultUrl := FHomepage;
|
||||
FMXChromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
FMXChromium1.CreateBrowser(TempHandle, TempRect, '', TempContext);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
@ -291,6 +291,8 @@ begin
|
||||
FMXWindowParent := nil;
|
||||
FHomepage := '';
|
||||
|
||||
FMXChromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
FCustomWindowState := WindowState;
|
||||
{$ENDIF}
|
||||
|
@ -379,6 +379,8 @@ begin
|
||||
FClosing := False;
|
||||
FMXWindowParent := nil;
|
||||
|
||||
FMXChromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
FCustomWindowState := WindowState;
|
||||
{$ENDIF}
|
||||
|
@ -71,7 +71,6 @@ object CookieVisitorFrm: TCookieVisitorFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -39,7 +39,6 @@ type
|
||||
procedure Chromium1ContextMenuCommand(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean);
|
||||
procedure Chromium1CookiesDeleted(Sender: TObject; numDeleted: Integer);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1CookieSet(Sender: TObject; aSuccess: Boolean; aID: Integer);
|
||||
procedure Chromium1CookieVisitorDestroyed(Sender: TObject; aID: Integer);
|
||||
@ -58,7 +57,6 @@ type
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure ShowCookiesMsg(var aMessage : TMessage); message MINIBROWSER_SHOWCOOKIES;
|
||||
procedure CookiesDeletedMsg(var aMessage : TMessage); message MINIBROWSER_COOKIESDELETED;
|
||||
procedure CookieSetMsg(var aMessage : TMessage); message MINIBROWSER_COOKIESET;
|
||||
@ -94,9 +92,8 @@ uses
|
||||
// TChromium.DeleteCookies triggers TChromium.OnCookiesDeleted when the cookies have been deleted.
|
||||
// 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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -118,11 +115,6 @@ begin
|
||||
AddressBarPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TCookieVisitorFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TCookieVisitorFrm.ShowCookiesMsg(var aMessage : TMessage);
|
||||
begin
|
||||
SimpleTextViewerFrm.Memo1.Lines.Text := FText; // This should be protected by a mutex.
|
||||
@ -195,13 +187,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TCookieVisitorFrm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TCookieVisitorFrm.Chromium1ContextMenuCommand(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const params: ICefContextMenuParams; commandId: Integer;
|
||||
@ -300,6 +285,8 @@ begin
|
||||
Visible := False;
|
||||
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -105,6 +105,8 @@ begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
|
||||
ChromiumWindow1.ChromiumBrowser.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
|
||||
try
|
||||
try
|
||||
TempStream := TStringStream.Create('<!DOCTYPE html><html><body><p>test</p></body></html>', TEncoding.UTF8, false);
|
||||
@ -137,10 +139,13 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainForm.ChromiumWindow1BeforeClose(Sender: TObject);
|
||||
begin
|
||||
if not(FCanClose) then
|
||||
begin
|
||||
FCanClose := True;
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ChromiumWindow1Close(Sender: TObject);
|
||||
begin
|
||||
|
@ -99,7 +99,6 @@ object DOMVisitorFrm: TDOMVisitorFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||
Left = 16
|
||||
Top = 40
|
||||
|
@ -74,7 +74,6 @@ type
|
||||
procedure Chromium1ContextMenuCommand(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean);
|
||||
procedure Chromium1ProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1ConsoleMessage(Sender: TObject; const browser: ICefBrowser; level: TCefLogSeverity; const message, source: ustring; line: Integer; out Result: Boolean);
|
||||
procedure Chromium1DevToolsMethodResult(Sender: TObject; const browser: ICefBrowser; message_id: Integer; success: Boolean; const result: ICefValue);
|
||||
@ -101,7 +100,6 @@ type
|
||||
procedure SetErrorText(const aValue : string);
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure VisitDOMMsg(var aMessage : TMessage); message MINIBROWSER_VISITDOM_PARTIAL;
|
||||
procedure VisitDOM2Msg(var aMessage : TMessage); message MINIBROWSER_VISITDOM_FULL;
|
||||
procedure VisitDOM3Msg(var aMessage : TMessage); message MINIBROWSER_VISITDOM_JS;
|
||||
@ -210,12 +208,9 @@ uses
|
||||
|
||||
// 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
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls
|
||||
// TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the
|
||||
// form.
|
||||
|
||||
procedure SimpleDOMIteration(const aDocument: ICefDomDocument);
|
||||
@ -495,13 +490,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.Chromium1ConsoleMessage(Sender: TObject;
|
||||
const browser: ICefBrowser; level: TCefLogSeverity; const message, source: ustring;
|
||||
line: Integer; out Result: Boolean);
|
||||
@ -731,6 +719,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -767,11 +756,6 @@ begin
|
||||
GoBtn.Click;
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TDOMVisitorFrm.VisitDOMBtnClick(Sender: TObject);
|
||||
begin
|
||||
PostMessage(Handle, MINIBROWSER_VISITDOM_PARTIAL, 0, 0);
|
||||
|
@ -33,7 +33,6 @@ object MainForm: TMainForm
|
||||
Align = alLeft
|
||||
BevelOuter = bvNone
|
||||
TabOrder = 0
|
||||
ExplicitHeight = 656
|
||||
object CEFAddressPnl: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
@ -75,7 +74,6 @@ object MainForm: TMainForm
|
||||
Align = alClient
|
||||
Color = clWhite
|
||||
TabOrder = 1
|
||||
ExplicitHeight = 626
|
||||
end
|
||||
end
|
||||
object WVPnl: TPanel
|
||||
@ -87,8 +85,6 @@ object MainForm: TMainForm
|
||||
BevelOuter = bvNone
|
||||
ParentBackground = False
|
||||
TabOrder = 1
|
||||
ExplicitWidth = 519
|
||||
ExplicitHeight = 656
|
||||
object WVAddressPnl: TPanel
|
||||
Left = 0
|
||||
Top = 0
|
||||
@ -99,7 +95,6 @@ object MainForm: TMainForm
|
||||
Padding.Top = 5
|
||||
Padding.Bottom = 5
|
||||
TabOrder = 0
|
||||
ExplicitWidth = 519
|
||||
object WVAddressEdt: TEdit
|
||||
Left = 0
|
||||
Top = 5
|
||||
@ -109,7 +104,6 @@ object MainForm: TMainForm
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
Text = 'http://www.bing.com'
|
||||
ExplicitWidth = 488
|
||||
ExplicitHeight = 21
|
||||
end
|
||||
object WVGoBtn: TButton
|
||||
@ -122,7 +116,6 @@ object MainForm: TMainForm
|
||||
Caption = 'Go'
|
||||
TabOrder = 1
|
||||
OnClick = WVGoBtnClick
|
||||
ExplicitLeft = 488
|
||||
end
|
||||
end
|
||||
object WVWindowParent1: TWVWindowParent
|
||||
@ -135,15 +128,12 @@ object MainForm: TMainForm
|
||||
TabStop = True
|
||||
TabOrder = 1
|
||||
Browser = WVBrowser1
|
||||
ExplicitWidth = 519
|
||||
ExplicitHeight = 626
|
||||
end
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
|
||||
Left = 224
|
||||
Top = 256
|
||||
|
@ -43,7 +43,6 @@ type
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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, Result: Boolean);
|
||||
procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
|
||||
@ -63,7 +62,6 @@ type
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
@ -98,9 +96,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -123,6 +120,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -171,13 +169,6 @@ begin
|
||||
CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1OpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
@ -195,11 +186,6 @@ begin
|
||||
CEFWindowParent1.UpdateSize;
|
||||
end;
|
||||
|
||||
procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CEFGoBtnClick(Sender: TObject);
|
||||
begin
|
||||
if Chromium1.Initialized then
|
||||
|
@ -332,7 +332,6 @@ object EditorBrowserFrm: TEditorBrowserFrm
|
||||
OnContextMenuCommand = Chromium1ContextMenuCommand
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 56
|
||||
Top = 144
|
||||
end
|
||||
|
@ -69,7 +69,6 @@ type
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
|
||||
procedure Chromium1TextResultAvailable(Sender: TObject; const aText: ustring);
|
||||
@ -115,7 +114,6 @@ type
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
@ -143,9 +141,8 @@ uses
|
||||
|
||||
// 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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -179,6 +176,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -220,13 +218,6 @@ begin
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools');
|
||||
end;
|
||||
|
||||
procedure TEditorBrowserFrm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TEditorBrowserFrm.Chromium1ContextMenuCommand(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const params: ICefContextMenuParams; commandId: Integer;
|
||||
@ -487,11 +478,6 @@ begin
|
||||
Caption := 'Editor Browser';
|
||||
end;
|
||||
|
||||
procedure TEditorBrowserFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TEditorBrowserFrm.Timer1Timer(Sender: TObject);
|
||||
begin
|
||||
Timer1.Enabled := False;
|
||||
|
@ -93,7 +93,6 @@ object ExternalPumpBrowserFrm: TExternalPumpBrowserFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 56
|
||||
Top = 152
|
||||
end
|
||||
|
@ -32,7 +32,6 @@ type
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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);
|
||||
|
||||
@ -41,7 +40,6 @@ type
|
||||
FClosing : boolean;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -68,9 +66,8 @@ uses
|
||||
|
||||
// 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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64);
|
||||
begin
|
||||
@ -106,6 +103,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -141,12 +139,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
Caption := 'External Pump Browser';
|
||||
@ -155,11 +147,6 @@ begin
|
||||
GoBtn.Click;
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TExternalPumpBrowserFrm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
Chromium1.LoadURL(URLCbx.Text);
|
||||
|
@ -32,7 +32,6 @@ object MainForm: TMainForm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 208
|
||||
Top = 120
|
||||
end
|
||||
|
@ -25,7 +25,6 @@ type
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
@ -45,7 +44,6 @@ type
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
|
||||
procedure HandleKeyUp(const aMsg : TMsg; var aHandled : boolean);
|
||||
procedure HandleKeyDown(const aMsg : TMsg; var aHandled : boolean);
|
||||
@ -67,9 +65,8 @@ uses
|
||||
|
||||
// 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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -140,22 +137,11 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.UpdateSize;
|
||||
end;
|
||||
|
||||
procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
@ -203,6 +189,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -416,6 +416,7 @@ procedure TCTBForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TCTBForm.BrowserDestroyMsg(var aMessage: TMessage);
|
||||
|
@ -100,6 +100,7 @@ begin
|
||||
FCallback := nil;
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
ChromiumWindow1.ChromiumBrowser.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TJSDialogBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
@ -12,6 +12,7 @@ object JSEvalFrm: TJSEvalFrm
|
||||
Font.Style = []
|
||||
Position = poScreenCenter
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
TextHeight = 13
|
||||
object CEFWindowParent1: TCEFWindowParent
|
||||
|
@ -51,6 +51,7 @@ type
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
|
||||
private
|
||||
{ Private declarations }
|
||||
@ -202,6 +203,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TJSEvalFrm.FormShow(Sender: TObject);
|
||||
begin
|
||||
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
|
||||
|
@ -66,7 +66,6 @@ object JSExecutingFunctionsFrm: TJSExecutingFunctionsFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -41,7 +41,6 @@ type
|
||||
procedure Chromium1BeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel);
|
||||
procedure Chromium1ContextMenuCommand(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -50,7 +49,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -85,9 +83,8 @@ implementation
|
||||
|
||||
// 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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
uses
|
||||
uCEFProcessMessage, uMyV8Handler;
|
||||
@ -168,12 +165,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TJSExecutingFunctionsFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSExecutingFunctionsFrm.Chromium1ContextMenuCommand(
|
||||
Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const params: ICefContextMenuParams; commandId: Integer;
|
||||
@ -202,6 +193,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -267,9 +259,4 @@ begin
|
||||
GoBtn.Click;
|
||||
end;
|
||||
|
||||
procedure TJSExecutingFunctionsFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -440,6 +440,7 @@ procedure TJSExtensionFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionFrm.FormShow(Sender: TObject);
|
||||
|
@ -28,7 +28,6 @@ object JSExtensionFrm: TJSExtensionFrm
|
||||
Padding.Right = 5
|
||||
Padding.Bottom = 5
|
||||
TabOrder = 0
|
||||
ExplicitWidth = 974
|
||||
object Edit1: TEdit
|
||||
Left = 5
|
||||
Top = 5
|
||||
@ -38,7 +37,6 @@ object JSExtensionFrm: TJSExtensionFrm
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
Text = 'http://www.google.com'
|
||||
ExplicitWidth = 933
|
||||
ExplicitHeight = 21
|
||||
end
|
||||
object GoBtn: TButton
|
||||
@ -51,7 +49,6 @@ object JSExtensionFrm: TJSExtensionFrm
|
||||
Caption = 'Go'
|
||||
TabOrder = 1
|
||||
OnClick = GoBtnClick
|
||||
ExplicitLeft = 938
|
||||
end
|
||||
end
|
||||
object StatusBar1: TStatusBar
|
||||
@ -63,8 +60,6 @@ object JSExtensionFrm: TJSExtensionFrm
|
||||
item
|
||||
Width = 50
|
||||
end>
|
||||
ExplicitTop = 569
|
||||
ExplicitWidth = 974
|
||||
end
|
||||
object CEFWindowParent1: TCEFWindowParent
|
||||
Left = 0
|
||||
@ -73,8 +68,6 @@ object JSExtensionFrm: TJSExtensionFrm
|
||||
Height = 540
|
||||
Align = alClient
|
||||
TabOrder = 2
|
||||
ExplicitWidth = 974
|
||||
ExplicitHeight = 539
|
||||
end
|
||||
object Chromium1: TChromium
|
||||
OnProcessMessageReceived = Chromium1ProcessMessageReceived
|
||||
|
@ -49,10 +49,7 @@ type
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1ContextMenuCommand(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const params: ICefContextMenuParams; commandId: Integer;
|
||||
eventFlags: Cardinal; out Result: Boolean);
|
||||
procedure Chromium1ContextMenuCommand(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean);
|
||||
|
||||
protected
|
||||
FText : string;
|
||||
@ -294,7 +291,7 @@ end;
|
||||
procedure TJSExtensionFrm.Chromium1ContextMenuCommand(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const params: ICefContextMenuParams; commandId: Integer;
|
||||
eventFlags: Cardinal; out Result: Boolean);
|
||||
eventFlags: TCefEventFlags; out Result: Boolean);
|
||||
var
|
||||
TempPoint : TPoint;
|
||||
TempJSCode : string;
|
||||
@ -408,6 +405,7 @@ procedure TJSExtensionFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionFrm.FormShow(Sender: TObject);
|
||||
|
@ -74,7 +74,6 @@ object JSExtensionWithFunctionFrm: TJSExtensionWithFunctionFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -35,7 +35,6 @@ type
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1ProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -44,7 +43,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -75,9 +73,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
{$IFDEF DELPHI12_UP}procedure
|
||||
{$ELSE}class procedure TJSSimpleExtensionFrm.{$ENDIF}GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
@ -140,13 +137,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithFunctionFrm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithFunctionFrm.Chromium1ProcessMessageReceived(
|
||||
Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
|
||||
sourceProcess: TCefProcessId; const message: ICefProcessMessage;
|
||||
@ -169,6 +159,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -228,9 +219,4 @@ begin
|
||||
if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithFunctionFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -63,7 +63,6 @@ object JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -42,7 +41,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -76,9 +74,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
{$IFDEF DELPHI12_UP}procedure
|
||||
{$ELSE}class procedure TJSSimpleExtensionFrm.{$ENDIF}GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
@ -145,13 +142,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.Chromium1Close(
|
||||
Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.FormCloseQuery(
|
||||
Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -162,6 +152,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -221,9 +212,4 @@ begin
|
||||
GoBtn.Click;
|
||||
end;
|
||||
|
||||
procedure TJSExtensionWithObjectParameterFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -321,6 +321,7 @@ procedure TJSRTTIExtensionFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TJSRTTIExtensionFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
|
@ -245,6 +245,8 @@ begin
|
||||
FClosing := False;
|
||||
|
||||
FCritSection := TCriticalSection.Create;
|
||||
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||
|
@ -63,7 +63,6 @@ object JSSimpleExtensionFrm: TJSSimpleExtensionFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -42,7 +41,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -73,9 +71,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
{$IFDEF DELPHI12_UP}procedure
|
||||
{$ELSE}class procedure TJSSimpleExtensionFrm.{$ENDIF}GlobalCEFApp_OnWebKitInitializedEvent;
|
||||
@ -182,12 +179,6 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSSimpleExtensionFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleExtensionFrm.FormCloseQuery(
|
||||
Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -198,6 +189,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -207,9 +199,4 @@ begin
|
||||
FClosing := False;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleExtensionFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -63,7 +63,6 @@ object JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -42,7 +41,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -68,9 +66,8 @@ implementation
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
@ -170,13 +167,6 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.Chromium1Close(
|
||||
Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.FormCloseQuery(
|
||||
Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -187,6 +177,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -196,9 +187,4 @@ begin
|
||||
FClosing := False;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -63,7 +63,6 @@ object JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -43,7 +42,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -69,9 +67,8 @@ implementation
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -171,13 +168,6 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.Chromium1Close(
|
||||
Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.FormCloseQuery(
|
||||
Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -190,6 +180,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -202,9 +193,4 @@ begin
|
||||
FClosing := False;
|
||||
end;
|
||||
|
||||
procedure TJSSimpleWindowBindingFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -9,6 +9,7 @@
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">JSWindowBindingWithArrayBuffer</ProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
@ -824,6 +825,9 @@
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64x">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
@ -1117,6 +1121,7 @@
|
||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64x" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
|
@ -63,7 +63,6 @@ object JSWindowBindingWithArrayBufferFrm: TJSWindowBindingWithArrayBufferFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -42,7 +41,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -71,14 +69,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
|
||||
procedure FreeCustomArrayBufer(buffer : Pointer);
|
||||
begin
|
||||
if (buffer <> nil) then FreeMem(buffer);
|
||||
end;
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
const
|
||||
@ -86,27 +78,14 @@ const
|
||||
BUFFER_FILL_VALUE = 42; // Some ramdom value to fill the buffer
|
||||
var
|
||||
TempObject : ICefv8Value;
|
||||
TempCallback : ICefv8ArrayBufferReleaseCallback;
|
||||
TempBuffer : Pointer;
|
||||
begin
|
||||
// The ArrayBuffer in this demo has a "buffer" pointer but CEF uses a callback to free it when the JS garbage collector is triggered.
|
||||
// The garbage collector calls ICefv8ArrayBufferReleaseCallback.ReleaseBuffer to free the buffer and
|
||||
// CEF4Delphi has a TCefFastv8ArrayBufferReleaseCallback class that calls a custom procedure when
|
||||
// ICefv8ArrayBufferReleaseCallback.ReleaseBuffer is called.
|
||||
|
||||
GetMem(TempBuffer, BUFFER_LENGTH);
|
||||
FillChar(TempBuffer^, BUFFER_LENGTH, BUFFER_FILL_VALUE);
|
||||
|
||||
// TempCallback will execute FreeCustomArrayBufer when the garbage collector needs to free the buffer inside the "ArrayBuffer".
|
||||
TempCallback := TCefFastv8ArrayBufferReleaseCallback.Create(FreeCustomArrayBufer);
|
||||
TempObject := TCefv8ValueRef.NewArrayBuffer(TempBuffer, BUFFER_LENGTH, TempCallback);
|
||||
TempObject := TCefv8ValueRef.NewArrayBufferWithCopy(TempBuffer, BUFFER_LENGTH);
|
||||
|
||||
context.Global.SetValueByKey('myobj', TempObject, V8_PROPERTY_ATTRIBUTE_NONE);
|
||||
|
||||
// If you keep a reference to "TempObject" and you need to free the buffer immediately then call TempObject.NeuterArrayBuffer
|
||||
|
||||
// Read this for more information about ICefv8Value :
|
||||
// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefV8Value.html
|
||||
end;
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
@ -195,13 +174,6 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithArrayBufferFrm.Chromium1Close(
|
||||
Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithArrayBufferFrm.FormCloseQuery(
|
||||
Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -212,6 +184,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -221,9 +194,4 @@ begin
|
||||
FClosing := False;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithArrayBufferFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -63,7 +63,6 @@ object JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -42,7 +41,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -71,9 +69,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
@ -175,13 +172,6 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.Chromium1Close(
|
||||
Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.FormCloseQuery(
|
||||
Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -192,6 +182,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -201,9 +192,4 @@ begin
|
||||
FClosing := False;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithFunctionFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -63,7 +63,6 @@ object JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 32
|
||||
Top = 224
|
||||
end
|
||||
|
@ -33,7 +33,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -42,7 +41,6 @@ type
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -71,9 +69,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
||||
var
|
||||
@ -176,13 +173,6 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.Chromium1Close(
|
||||
Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.FormCloseQuery(
|
||||
Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -193,6 +183,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -202,9 +193,4 @@ begin
|
||||
FClosing := False;
|
||||
end;
|
||||
|
||||
procedure TJSWindowBindingWithObjectFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -78,7 +78,6 @@ object ChildForm: TChildForm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 592
|
||||
Top = 288
|
||||
end
|
||||
|
@ -34,7 +34,6 @@ type
|
||||
procedure Button1Click(Sender: TObject);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1LoadingStateChange(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
||||
procedure Chromium1StatusMessage(Sender: TObject; const browser: ICefBrowser; const value: ustring);
|
||||
@ -47,7 +46,6 @@ type
|
||||
|
||||
protected
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEFBROWSER_CREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEFBROWSER_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -63,9 +61,8 @@ implementation
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery calls TChromium.CloseBrowser
|
||||
// 2. TChromium.OnClose sends a CEF_DESTROY message to destroy CEFWindowParent1 in the main thread.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
uses
|
||||
uCEFRequestContext, uCEFApplication;
|
||||
@ -99,12 +96,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEFBROWSER_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1LoadingStateChange(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
||||
begin
|
||||
if isLoading then
|
||||
@ -138,6 +129,7 @@ begin
|
||||
FClosing := True;
|
||||
Panel1.Enabled := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -176,7 +168,7 @@ begin
|
||||
else
|
||||
TempCache := GlobalCEFApp.RootCache + '\cache' + inttostr(MainForm.BrowserCount);
|
||||
|
||||
TempContext := TCefRequestContextRef.New(TempCache, '', '', False, False, False, Chromium1.ReqContextHandler)
|
||||
TempContext := TCefRequestContextRef.New(TempCache, '', '', False, False, Chromium1.ReqContextHandler)
|
||||
end
|
||||
else
|
||||
TempContext := nil;
|
||||
@ -233,9 +225,4 @@ begin
|
||||
Panel1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TChildForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -78,7 +78,6 @@ object ChildForm: TChildForm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 592
|
||||
Top = 288
|
||||
end
|
||||
|
@ -34,7 +34,6 @@ type
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1LoadingStateChange(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
||||
procedure Chromium1StatusMessage(Sender: TObject; const browser: ICefBrowser; const value: ustring);
|
||||
@ -47,7 +46,6 @@ type
|
||||
|
||||
protected
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEFBROWSER_CREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEFBROWSER_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -63,9 +61,8 @@ implementation
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery calls TChromium.CloseBrowser
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
uses
|
||||
uCEFRequestContext, uCEFApplication;
|
||||
@ -100,12 +97,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEFBROWSER_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1LoadingStateChange(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
||||
begin
|
||||
if isLoading then
|
||||
@ -139,6 +130,7 @@ begin
|
||||
FClosing := True;
|
||||
Panel1.Enabled := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -172,7 +164,7 @@ begin
|
||||
TempCache := GlobalCEFApp.RootCache + '\cache2';
|
||||
|
||||
if MainForm.NewContextChk.Checked then
|
||||
TempContext := TCefRequestContextRef.New(TempCache, '', '', False, False, False)
|
||||
TempContext := TCefRequestContextRef.New(TempCache, '', '', False, False)
|
||||
else
|
||||
TempContext := nil;
|
||||
|
||||
@ -214,9 +206,4 @@ begin
|
||||
Button1.Click;
|
||||
end;
|
||||
|
||||
procedure TChildForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -313,7 +313,6 @@ object MediaRouterFrm: TMediaRouterFrm
|
||||
OnMediaSinkDeviceInfo = Chromium1MediaSinkDeviceInfo
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnSinks = Chromium1Sinks
|
||||
OnRoutes = Chromium1Routes
|
||||
OnRouteStateChanged = Chromium1RouteStateChanged
|
||||
|
@ -62,12 +62,11 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
|
||||
procedure Chromium1Sinks(Sender: TObject; const sinks: TCefMediaSinkArray);
|
||||
procedure Chromium1Routes(Sender: TObject; const routes: TCefMediaRouteArray);
|
||||
procedure Chromium1RouteStateChanged(Sender: TObject; const route: ICefMediaRoute; state: TCefMediaRouteConnectionState);
|
||||
procedure Chromium1RouteMessageReceived(Sender: TObject; const route: ICefMediaRoute; const message_: ustring);
|
||||
procedure Chromium1MediaRouteCreateFinished(Sender: TObject; result: Integer; const error: ustring; const route: ICefMediaRoute);
|
||||
procedure Chromium1MediaRouteCreateFinished(Sender: TObject; result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
|
||||
procedure Chromium1MediaSinkDeviceInfo(Sender: TObject; const ip_address: ustring; port: Integer; const model_name: ustring);
|
||||
|
||||
procedure Timer1Timer(Sender: TObject);
|
||||
@ -93,7 +92,6 @@ type
|
||||
FSinks : TCefMediaSinkInfoArray;
|
||||
FRoutes : TCefMediaRouteInfoArray;
|
||||
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure PendingLogLinesMsg(var aMessage : TMessage); message MEDIA_ROUTER_PENDING_LOG_LINES;
|
||||
procedure RefreshSinksMsg(var aMessage : TMessage); message MEDIA_ROUTER_REFRESH_SINKS;
|
||||
procedure RefreshRoutesMsg(var aMessage : TMessage); message MEDIA_ROUTER_REFRESH_ROUTES;
|
||||
@ -200,15 +198,8 @@ begin
|
||||
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.Chromium1MediaRouteCreateFinished(Sender: TObject;
|
||||
result: Integer; const error: ustring; const route: ICefMediaRoute);
|
||||
result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
|
||||
var
|
||||
TempMsg, TempID : string;
|
||||
begin
|
||||
@ -308,6 +299,7 @@ begin
|
||||
Chromium1.ExecuteDevToolsMethod(0, 'Cast.disable', nil);
|
||||
sleep(500);
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -319,6 +311,8 @@ begin
|
||||
FRoutes := nil;
|
||||
FMediaCS := TCriticalSection.Create;
|
||||
FLog := TStringList.Create;
|
||||
|
||||
//Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.FormDestroy(Sender: TObject);
|
||||
@ -423,11 +417,6 @@ begin
|
||||
Timer1.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TMediaRouterFrm.PendingLogLinesMsg(var aMessage : TMessage);
|
||||
begin
|
||||
if FClosing then exit;
|
||||
|
@ -25,6 +25,8 @@ const
|
||||
{$IFDEF WIN32}{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}{$ENDIF}
|
||||
|
||||
begin
|
||||
ReportMemoryLeaksOnShutdown := True;
|
||||
|
||||
CreateGlobalCEFApp;
|
||||
|
||||
if GlobalCEFApp.StartMainProcess then
|
||||
|
@ -306,7 +306,6 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
||||
OnDownloadUpdated = Chromium1DownloadUpdated
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnCertificateError = Chromium1CertificateError
|
||||
OnSelectClientCertificate = Chromium1SelectClientCertificate
|
||||
OnBeforeResourceLoad = Chromium1BeforeResourceLoad
|
||||
|
@ -64,6 +64,7 @@ const
|
||||
MINIBROWSER_CONTEXTMENU_COLORSCHEMESYSTEM = MENU_ID_USER_FIRST + 21;
|
||||
MINIBROWSER_CONTEXTMENU_COLORSCHEMELIGHT = MENU_ID_USER_FIRST + 22;
|
||||
MINIBROWSER_CONTEXTMENU_COLORSCHEMEDARK = MENU_ID_USER_FIRST + 23;
|
||||
MINIBROWSER_CONTEXTMENU_TASKMANAGER = MENU_ID_USER_FIRST + 24;
|
||||
|
||||
DEVTOOLS_SCREENSHOT_MSGID = 1001;
|
||||
DEVTOOLS_MHTML_MSGID = 1002;
|
||||
@ -155,7 +156,6 @@ type
|
||||
procedure Chromium1BeforeDownload(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const suggestedName: ustring; const callback: ICefBeforeDownloadCallback; var aResult : boolean);
|
||||
procedure Chromium1DownloadUpdated(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const callback: ICefDownloadItemCallback);
|
||||
procedure Chromium1BeforeResourceLoad(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const callback: ICefCallback; out Result: TCefReturnValue);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1RenderCompMsg(Sender: TObject; var aMessage : TMessage; var aHandled: Boolean);
|
||||
procedure Chromium1LoadingProgressChange(Sender: TObject; const browser: ICefBrowser; const progress: Double);
|
||||
@ -241,6 +241,8 @@ type
|
||||
procedure ShowDevTools; overload;
|
||||
procedure HideDevTools;
|
||||
|
||||
procedure ShowTaskManager;
|
||||
|
||||
procedure HandleKeyUp(const aMsg : TMsg; var aHandled : boolean);
|
||||
procedure HandleKeyDown(const aMsg : TMsg; var aHandled : boolean);
|
||||
procedure HandleBrowserInfo(const aResult : ICefValue);
|
||||
@ -254,7 +256,6 @@ type
|
||||
function ShowSaveFileDialog(var aFilePaths : TStringList) : boolean;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure ShowDevToolsMsg(var aMessage : TMessage); message MINIBROWSER_SHOWDEVTOOLS;
|
||||
procedure HideDevToolsMsg(var aMessage : TMessage); message MINIBROWSER_HIDEDEVTOOLS;
|
||||
procedure CopyAllTextMsg(var aMessage : TMessage); message MINIBROWSER_COPYALLTEXT;
|
||||
@ -296,13 +297,12 @@ implementation
|
||||
uses
|
||||
uPreferences, uCefStringMultimap, uCEFMiscFunctions, uSimpleTextViewer,
|
||||
uCEFClient, uFindFrm, uCEFDictionaryValue, uDirectorySelector, uSelectCertForm,
|
||||
uCEFWindowInfoWrapper;
|
||||
uCEFWindowInfoWrapper, uCEFTaskManager;
|
||||
|
||||
// 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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure GlobalCEFApp_OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace);
|
||||
begin
|
||||
@ -327,7 +327,6 @@ begin
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
GlobalCEFApp.UncaughtExceptionStackSize := 50;
|
||||
GlobalCEFApp.OnUncaughtException := GlobalCEFApp_OnUncaughtException;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.BackBtnClick(Sender: TObject);
|
||||
@ -424,6 +423,7 @@ begin
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_JSPRINTDOC, 'Print using Javascript');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWRESPONSE, 'Show server headers');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_BROWSERINFO, 'Browser information...');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_TASKMANAGER, 'Task Manager...');
|
||||
|
||||
if DevTools.Visible then
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS, 'Hide DevTools')
|
||||
@ -553,18 +553,6 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
if (browser <> nil) and
|
||||
(Chromium1.BrowserId = browser.Identifier) and
|
||||
(CEFWindowParent1 <> nil) then
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Chromium1ConsoleMessage(Sender: TObject;
|
||||
const browser: ICefBrowser; level: TCefLogSeverity;
|
||||
const message_, source: ustring; line: Integer; out Result: Boolean);
|
||||
@ -670,6 +658,9 @@ begin
|
||||
|
||||
MINIBROWSER_CONTEXTMENU_COLORSCHEMESYSTEM :
|
||||
Chromium1.SetChromeColorScheme(CEF_COLOR_VARIANT_SYSTEM, 0);
|
||||
|
||||
MINIBROWSER_CONTEXTMENU_TASKMANAGER :
|
||||
ShowTaskManager;
|
||||
end
|
||||
else
|
||||
case commandId of
|
||||
@ -1438,10 +1429,7 @@ end;
|
||||
|
||||
procedure TMiniBrowserFrm.FindText1Click(Sender: TObject);
|
||||
begin
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
Chromium1.ExecuteChromeCommand(IDC_FIND, CEF_WOD_CURRENT_TAB)
|
||||
else
|
||||
FindFrm.Show;
|
||||
Chromium1.ExecuteChromeCommand(IDC_FIND, CEF_WOD_CURRENT_TAB);
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Flushcookies1Click(Sender: TObject);
|
||||
@ -1465,8 +1453,6 @@ begin
|
||||
// stored browsers and not only the main browser.
|
||||
Chromium1.CloseAllBrowsers;
|
||||
|
||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
@ -1557,11 +1543,6 @@ begin
|
||||
NavControlPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
FreeAndNil(CEFWindowParent1);
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Acceptlanguage1Click(Sender: TObject);
|
||||
var
|
||||
TempLanguageList : ustring;
|
||||
@ -2018,6 +1999,54 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.ShowTaskManager;
|
||||
var
|
||||
TempTaskManager : ICefTaskManager;
|
||||
i : integer;
|
||||
TempIDs: TCefCustomInt64Array;
|
||||
TempInfo : TCustomTaskInfo;
|
||||
TempResult : string;
|
||||
begin
|
||||
TempTaskManager := TCefTaskManagerRef.New;
|
||||
|
||||
if assigned(TempTaskManager) and
|
||||
TempTaskManager.GetTaskIdsList(TempIDs) then
|
||||
begin
|
||||
TempResult := 'Task Manager Information :' + CRLF + CRLF;
|
||||
i := 0;
|
||||
|
||||
while (i < length(TempIDs)) do
|
||||
begin
|
||||
if TempTaskManager.GetTaskInfo(TempIDs[i], TempInfo) then
|
||||
begin
|
||||
TempResult := TempResult + 'id: ' + inttostr(TempInfo.id) + ', type: ';
|
||||
|
||||
case TempInfo.type_ of
|
||||
CEF_TASK_TYPE_BROWSER : TempResult := TempResult + 'browser';
|
||||
CEF_TASK_TYPE_GPU : TempResult := TempResult + 'GPU';
|
||||
CEF_TASK_TYPE_ZYGOTE : TempResult := TempResult + 'zygote';
|
||||
CEF_TASK_TYPE_UTILITY : TempResult := TempResult + 'utility';
|
||||
CEF_TASK_TYPE_RENDERER : TempResult := TempResult + 'renderer';
|
||||
CEF_TASK_TYPE_EXTENSION : TempResult := TempResult + 'extension';
|
||||
CEF_TASK_TYPE_GUEST : TempResult := TempResult + 'guest';
|
||||
CEF_TASK_TYPE_PLUGIN : TempResult := TempResult + 'plugin';
|
||||
CEF_TASK_TYPE_SANDBOX_HELPER : TempResult := TempResult + 'sandbox helper';
|
||||
CEF_TASK_TYPE_DEDICATED_WORKER : TempResult := TempResult + 'dedicated worker';
|
||||
CEF_TASK_TYPE_SHARED_WORKER : TempResult := TempResult + 'shared worker';
|
||||
CEF_TASK_TYPE_SERVICE_WORKER : TempResult := TempResult + 'service worker';
|
||||
else TempResult := TempResult + 'unknown';
|
||||
end;
|
||||
|
||||
TempResult := TempResult + ', title: ' + TempInfo.title + CRLF;
|
||||
end;
|
||||
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
showmessage(TempResult);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.WMMove(var aMessage : TWMMove);
|
||||
begin
|
||||
inherited;
|
||||
|
@ -341,6 +341,7 @@ begin
|
||||
// used when you call any method or property in TChromium.
|
||||
Chromium1.MultiBrowserMode := True;
|
||||
Chromium1.DefaultURL := MINIBROWSER_HOMEPAGE;
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.FormShow(Sender: TObject);
|
||||
|
@ -454,9 +454,6 @@ object Form1: TForm1
|
||||
'https://coveryourtracks.eff.org/'
|
||||
'https://ipleak.com/full-report/'
|
||||
'https://xsinator.com/testing.html')
|
||||
ExplicitLeft = 392
|
||||
ExplicitTop = 16
|
||||
ExplicitWidth = 145
|
||||
end
|
||||
end
|
||||
object CEFWindowParent1: TCEFWindowParent
|
||||
@ -479,7 +476,6 @@ object Form1: TForm1
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
|
||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||
Left = 56
|
||||
|
@ -62,7 +62,6 @@ type
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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, Result: Boolean);
|
||||
procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
|
||||
@ -83,7 +82,6 @@ type
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
|
||||
procedure HandleSetUserAgentResult(aSuccess : boolean; const aResult: ICefValue);
|
||||
procedure HandleSetTouchEmulationEnabledResult(aSuccess : boolean; const aResult: ICefValue);
|
||||
@ -113,9 +111,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
const
|
||||
DEVTOOLS_SETUSERAGENTOVERRIDE_MSGID = 1;
|
||||
@ -130,7 +127,6 @@ begin
|
||||
GlobalCEFApp.cache := 'cache';
|
||||
GlobalCEFApp.EnablePrintPreview := True;
|
||||
GlobalCEFApp.EnableGPU := True;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
{$IFDEF DEBUG}
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
@ -146,9 +142,6 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
@ -203,13 +196,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1DevToolsMethodResult(Sender: TObject;
|
||||
const browser: ICefBrowser; message_id: Integer; success: Boolean;
|
||||
const result: ICefValue);
|
||||
@ -262,11 +248,6 @@ begin
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
// This will load the URL in the edit box
|
||||
|
@ -94,7 +94,6 @@ object MainForm: TMainForm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
|
||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||
OnDevToolsRawEvent = Chromium1DevToolsRawEvent
|
||||
|
@ -40,7 +40,6 @@ type
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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, Result: Boolean);
|
||||
procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
|
||||
@ -63,7 +62,6 @@ type
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
|
||||
procedure AddLogLine(const aLogLine: string);
|
||||
public
|
||||
@ -95,9 +93,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
begin
|
||||
@ -108,6 +105,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -174,13 +172,6 @@ begin
|
||||
CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1DevToolsMethodResult(Sender: TObject;
|
||||
const browser: ICefBrowser; message_id: Integer; success: Boolean;
|
||||
const result: ICefValue);
|
||||
@ -221,11 +212,6 @@ begin
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TMainForm.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
// This will load the URL in the edit box
|
||||
|
@ -6,9 +6,10 @@
|
||||
<MainSource>PopupBrowser.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">PopupBrowser</ProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
@ -827,6 +828,9 @@
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64x">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
@ -1120,6 +1124,7 @@
|
||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64x" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
|
@ -672,9 +672,10 @@ begin
|
||||
Chromium1.ShutdownDragAndDrop;
|
||||
|
||||
if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap);
|
||||
if (FResizeCS <> nil) then FreeAndNil(FResizeCS);
|
||||
|
||||
if FClientInitialized and TMainForm(Owner).HandleAllocated then
|
||||
PostMessage(TMainForm(Owner).Handle, CEF_CHILDDESTROYED, 0, 0);
|
||||
if FClientInitialized and MainForm.HandleAllocated then
|
||||
PostMessage(MainForm.Handle, CEF_CHILDDESTROYED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TChildForm.FormHide(Sender: TObject);
|
||||
|
@ -46,6 +46,7 @@ type
|
||||
protected
|
||||
FChildForm : TChildForm;
|
||||
FCriticalSection : TCriticalSection;
|
||||
FChildCounter : cardinal; // Used to create unique child form names.
|
||||
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||
FClosingMainForm : boolean; // Set to True in the CloseQuery event.
|
||||
FClosingChildren : boolean; // Set to True in the CloseQuery event.
|
||||
@ -53,6 +54,7 @@ type
|
||||
function GetPopupChildCount : integer;
|
||||
|
||||
procedure ClosePopupChildren;
|
||||
procedure CreateChildForm;
|
||||
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
@ -103,7 +105,7 @@ uses
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 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.
|
||||
// 2. When all the child forms are closed then FormCloseQuery is triggered again, calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 3. TChromium.OnClose sends a CEF_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.
|
||||
|
||||
@ -111,15 +113,7 @@ procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.WindowlessRenderingEnabled := True;
|
||||
//GlobalCEFApp.LogFile := 'debug.log';
|
||||
//GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
{
|
||||
GlobalCEFApp.FrameworkDirPath := 'c:\cef';
|
||||
GlobalCEFApp.ResourcesDirPath := 'c:\cef';
|
||||
GlobalCEFApp.LocalesDirPath := 'c:\cef\locales';
|
||||
GlobalCEFApp.cache := 'c:\cef\cache';
|
||||
GlobalCEFApp.UserDataPath := 'c:\cef\User Data';
|
||||
}
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
@ -154,6 +148,7 @@ begin
|
||||
|
||||
Chromium1.DefaultURL := AddressEdt.Text;
|
||||
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||
@ -276,6 +271,18 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CreateChildForm;
|
||||
begin
|
||||
if (FChildCounter < high(cardinal)) then
|
||||
inc(FChildCounter)
|
||||
else
|
||||
FChildCounter := 1;
|
||||
|
||||
FChildForm := TChildForm.Create(self);
|
||||
FChildForm.Name := 'ChildForm_' + IntToStr(FChildCounter);
|
||||
FChildForm.Tag := FChildCounter;
|
||||
end;
|
||||
|
||||
procedure TMainForm.AppEventsMessage(var Msg: tagMSG; var Handled: Boolean);
|
||||
begin
|
||||
case Msg.message of
|
||||
@ -291,7 +298,8 @@ end;
|
||||
|
||||
procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
FChildForm := TChildForm.Create(self);
|
||||
CreateChildForm;
|
||||
|
||||
Caption := 'Popup Browser';
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
@ -309,7 +317,7 @@ begin
|
||||
if (FChildForm <> nil) then
|
||||
PostMessage(FChildForm.Handle, CEF_SHOWCHILD, 0, 0);
|
||||
|
||||
FChildForm := TChildForm.Create(self);
|
||||
CreateChildForm;
|
||||
finally
|
||||
FCriticalSection.Release;
|
||||
end;
|
||||
@ -317,7 +325,8 @@ end;
|
||||
|
||||
procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
if FClosingChildren and (PopupChildCount = 0) then Close;
|
||||
if FClosingChildren and (PopupChildCount = 0) then
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TMainForm.GoBtnClick(Sender: TObject);
|
||||
|
@ -9,6 +9,7 @@
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">PopupBrowser2</ProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
@ -827,6 +828,9 @@
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64x">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
@ -1120,6 +1124,7 @@
|
||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64x" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
|
@ -28,7 +28,6 @@ object ChildForm: TChildForm
|
||||
OnTitleChange = Chromium1TitleChange
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 24
|
||||
Top = 56
|
||||
end
|
||||
|
@ -23,12 +23,11 @@ type
|
||||
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
|
||||
procedure Chromium1BeforePopup(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 Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
|
||||
protected
|
||||
@ -41,7 +40,6 @@ type
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
|
||||
public
|
||||
procedure AfterConstruction; override;
|
||||
@ -143,12 +141,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
|
||||
begin
|
||||
Caption := title;
|
||||
@ -196,9 +188,6 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
@ -216,9 +205,4 @@ begin
|
||||
PostMessage(TMainForm(Owner).Handle, CEF_CHILDDESTROYED, 0, 0);
|
||||
end;
|
||||
|
||||
procedure TChildForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -71,7 +71,6 @@ object MainForm: TMainForm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 56
|
||||
Top = 152
|
||||
end
|
||||
|
@ -39,11 +39,11 @@ type
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
|
||||
|
||||
protected
|
||||
FChildForm : TChildForm;
|
||||
FCriticalSection : TCriticalSection;
|
||||
FChildCounter : cardinal; // Used to create unique child form names.
|
||||
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||
FClosingMainForm : boolean; // Set to True in the CloseQuery event.
|
||||
FClosingChildren : boolean; // Set to True in the CloseQuery event.
|
||||
@ -51,6 +51,7 @@ type
|
||||
function GetPopupChildCount : integer;
|
||||
|
||||
procedure ClosePopupChildren;
|
||||
procedure CreateChildForm;
|
||||
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
@ -58,7 +59,6 @@ type
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure CreateNextChildMsg(var aMessage : TMessage); message CEF_CREATENEXTCHILD;
|
||||
procedure ChildDestroyedMsg(var aMessage : TMessage); message CEF_CHILDDESTROYED;
|
||||
|
||||
@ -101,14 +101,12 @@ uses
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 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 CEF_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.
|
||||
// 2. When all the child forms are closed then FormCloseQuery is triggered again, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
//GlobalCEFApp.LogFile := 'cef.log';
|
||||
//GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
|
||||
end;
|
||||
@ -132,9 +130,6 @@ begin
|
||||
FClosingMainForm := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
@ -146,6 +141,7 @@ begin
|
||||
FClosingMainForm := False;
|
||||
FCanClose := False;
|
||||
FCriticalSection := TCriticalSection.Create;
|
||||
FChildCounter := 0;
|
||||
|
||||
Chromium1.DefaultURL := AddressEdt.Text;
|
||||
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||
@ -205,12 +201,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
function TMainForm.CreateClientHandler(var windowInfo : TCefWindowInfo;
|
||||
var client : ICefClient;
|
||||
const targetFrameName : string;
|
||||
@ -271,16 +261,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
procedure TMainForm.CreateChildForm;
|
||||
begin
|
||||
inc(FChildCounter);
|
||||
|
||||
FChildForm := TChildForm.Create(self);
|
||||
Caption := 'Popup Browser';
|
||||
AddressPnl.Enabled := True;
|
||||
FChildForm.Name := 'ChildForm_' + IntToStr(FChildCounter);
|
||||
end;
|
||||
|
||||
procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
CreateChildForm;
|
||||
|
||||
Caption := 'Popup Browser';
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CreateNextChildMsg(var aMessage : TMessage);
|
||||
@ -294,7 +288,7 @@ begin
|
||||
FChildForm.Show;
|
||||
end;
|
||||
|
||||
FChildForm := TChildForm.Create(self);
|
||||
CreateChildForm;
|
||||
finally
|
||||
FCriticalSection.Release;
|
||||
end;
|
||||
@ -302,7 +296,8 @@ end;
|
||||
|
||||
procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
if FClosingChildren and (PopupChildCount = 0) then Close;
|
||||
if FClosingChildren and (PopupChildCount = 0) then
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TMainForm.GoBtnClick(Sender: TObject);
|
||||
|
@ -91,7 +91,6 @@ object Form1: TForm1
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnBeforeResourceLoad = Chromium1BeforeResourceLoad
|
||||
Left = 56
|
||||
Top = 152
|
||||
|
@ -39,7 +39,6 @@ type
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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 Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforeResourceLoad(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; const callback: ICefCallback; out Result: TCefReturnValue);
|
||||
|
||||
@ -59,7 +58,6 @@ type
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
procedure ShowDataMsg(var aMessage : TMessage); message CEF_SHOWDATA;
|
||||
|
||||
procedure HandleRequest(const request : ICefRequest; aIsMain : boolean);
|
||||
@ -93,9 +91,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -113,6 +110,7 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -353,24 +351,12 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserCreatedMsg(var aMessage : TMessage);
|
||||
begin
|
||||
Caption := 'POST Inspector Browser';
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
// This will load the URL in the edit box
|
||||
|
@ -431,6 +431,8 @@ begin
|
||||
|
||||
// This event will receive the data
|
||||
TCustomResponseFilter(FFilter).OnFilter := Filter_OnFilter;
|
||||
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TResponseFilterBrowserFrm.FormDestroy(Sender: TObject);
|
||||
|
@ -205,6 +205,7 @@ procedure TSchemeRegistrationBrowserFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
// You can register the Scheme Handler Factory here or later, for example in a context menu command.
|
||||
CefRegisterSchemeHandlerFactory(CUSTOM_SCHEME_NAME, '', THelloScheme);
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TSchemeRegistrationBrowserFrm.FormShow(Sender: TObject);
|
||||
|
@ -104,6 +104,7 @@ begin
|
||||
|
||||
// The browser will load the URL in AddressEdt initially.
|
||||
ChromiumWindow1.ChromiumBrowser.DefaultURL := AddressEdt.Text;
|
||||
ChromiumWindow1.ChromiumBrowser.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormShow(Sender: TObject);
|
||||
|
Binary file not shown.
@ -70,7 +70,6 @@ object Form1: TForm1
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
|
||||
Left = 56
|
||||
Top = 152
|
||||
|
@ -32,7 +32,6 @@ type
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1BeforePopup(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, Result: Boolean);
|
||||
procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
|
||||
@ -50,7 +49,6 @@ type
|
||||
procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP;
|
||||
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
@ -83,9 +81,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event.
|
||||
// 2. TChromium.OnClose sends a CEF_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.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure CreateGlobalCEFApp;
|
||||
begin
|
||||
@ -93,7 +90,6 @@ begin
|
||||
GlobalCEFApp.cache := 'cache';
|
||||
GlobalCEFApp.EnablePrintPreview := True;
|
||||
GlobalCEFApp.EnableGPU := True;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
{$IFDEF DEBUG}
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
@ -109,9 +105,6 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
@ -159,13 +152,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1Close(Sender: TObject;
|
||||
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
|
||||
const browser: ICefBrowser; const frame: ICefFrame;
|
||||
const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||
@ -181,11 +167,6 @@ begin
|
||||
AddressPnl.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
begin
|
||||
// This will load the URL in the edit box
|
||||
|
@ -90,6 +90,8 @@ procedure TSimpleExternalPumpBrowserFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
|
||||
ChromiumWindow1.ChromiumBrowser.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TSimpleExternalPumpBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
@ -13,6 +13,7 @@ object Form1: TForm1
|
||||
Position = poScreenCenter
|
||||
OnActivate = FormActivate
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
TextHeight = 13
|
||||
object ChromiumWindow1: TChromiumWindow
|
||||
Left = 0
|
||||
|
@ -31,6 +31,7 @@ type
|
||||
|
||||
procedure ChromiumWindow1AfterCreated(Sender: TObject);
|
||||
procedure ChromiumWindow1Close(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
|
||||
private
|
||||
// You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned.
|
||||
@ -92,6 +93,11 @@ begin
|
||||
CanClose := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ChromiumWindow1.ChromiumBrowser.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormActivate(Sender: TObject);
|
||||
begin
|
||||
if ChromiumWindow1.Initialized then
|
||||
|
@ -35,17 +35,19 @@ type
|
||||
URLCbx: TComboBox;
|
||||
AddTabBtn: TButton;
|
||||
RemoveTabBtn: TButton;
|
||||
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
|
||||
procedure PageControl1Change(Sender: TObject);
|
||||
procedure AddTabBtnClick(Sender: TObject);
|
||||
procedure RemoveTabBtnClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure PageControl1Change(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
procedure BackBtnClick(Sender: TObject);
|
||||
procedure ForwardBtnClick(Sender: TObject);
|
||||
procedure ReloadBtnClick(Sender: TObject);
|
||||
procedure StopBtnClick(Sender: TObject);
|
||||
procedure GoBtnClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
|
||||
protected
|
||||
FClosingTab : boolean;
|
||||
@ -147,6 +149,7 @@ begin
|
||||
TempChromium.OnClose := Chromium_OnClose;
|
||||
TempChromium.OnBeforeClose := Chromium_OnBeforeClose;
|
||||
TempChromium.OnBeforePopup := Chromium_OnBeforePopup;
|
||||
TempChromium.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
|
||||
TempChromium.CreateBrowser(TempWindowParent, '');
|
||||
end;
|
||||
|
@ -273,6 +273,7 @@ end;
|
||||
procedure TBrowserFrame.CreateBrowser;
|
||||
begin
|
||||
Chromium1.DefaultURL := FHomepage;
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
Chromium1.CreateBrowser(CEFWindowParent1);
|
||||
end;
|
||||
|
||||
@ -283,10 +284,6 @@ begin
|
||||
FClosing := True;
|
||||
NavControlPnl.Enabled := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -235,10 +235,6 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
// Workaround for the missing TChormium.OnClose event when "Chrome runtime" is enabled.
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end
|
||||
else
|
||||
@ -251,6 +247,8 @@ begin
|
||||
FBrowserWasCreated := False;
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TChildForm.FormDestroy(Sender: TObject);
|
||||
|
@ -43,6 +43,7 @@ type
|
||||
FHiddenTab : TBrowserTab;
|
||||
FChildForm : TChildForm;
|
||||
FCriticalSection : TCriticalSection;
|
||||
FChildCounter : cardinal; // Used to create unique child form names.
|
||||
FCanClose : boolean;
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
FLastTabID : cardinal; // Used by NextTabID to generate unique tab IDs
|
||||
@ -56,6 +57,7 @@ type
|
||||
function CloseAllBrowsers : boolean;
|
||||
procedure CloseTab(aIndex : integer);
|
||||
procedure CreateHiddenBrowsers;
|
||||
procedure CreateChildForm;
|
||||
|
||||
procedure CEFInitializedMsg(var aMessage : TMessage); message CEF_INITIALIZED;
|
||||
procedure DestroyTabMsg(var aMessage : TMessage); message CEF_DESTROYTAB;
|
||||
@ -157,7 +159,6 @@ begin
|
||||
GlobalCEFApp.cache := 'cache';
|
||||
GlobalCEFApp.EnablePrintPreview := True;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.EnableButtonPnl;
|
||||
@ -275,6 +276,15 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.CreateChildForm;
|
||||
begin
|
||||
inc(FChildCounter);
|
||||
|
||||
FChildForm := TChildForm.Create(self);
|
||||
FChildForm.Name := 'ChildForm_' + IntToStr(FChildCounter);
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.CreateNextChildMsg(var aMessage : TMessage);
|
||||
begin
|
||||
try
|
||||
@ -291,7 +301,7 @@ begin
|
||||
FChildForm.Show;
|
||||
end;
|
||||
|
||||
FChildForm := TChildForm.Create(self);
|
||||
CreateChildForm;
|
||||
finally
|
||||
FCriticalSection.Release;
|
||||
end;
|
||||
@ -346,6 +356,7 @@ begin
|
||||
FLastTabID := 0;
|
||||
FChildForm := nil;
|
||||
FHiddenTab := nil;
|
||||
FChildCounter := 0;
|
||||
FCriticalSection := TCriticalSection.Create;
|
||||
end;
|
||||
|
||||
@ -419,7 +430,7 @@ begin
|
||||
FCriticalSection.Acquire;
|
||||
|
||||
if (FChildForm = nil) then
|
||||
FChildForm := TChildForm.Create(self);
|
||||
CreateChildForm;
|
||||
|
||||
if (FHiddenTab = nil) then
|
||||
begin
|
||||
@ -495,9 +506,6 @@ function TMainForm.DoOnBeforePopup(var windowInfo : TCefWindowInfo;
|
||||
const popupFeatures : TCefPopupFeatures;
|
||||
targetDisposition : TCefWindowOpenDisposition) : boolean;
|
||||
begin
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
Result := False
|
||||
else
|
||||
try
|
||||
FCriticalSection.Acquire;
|
||||
|
||||
@ -524,9 +532,6 @@ end;
|
||||
function TMainForm.DoOpenUrlFromTab(const targetUrl : string;
|
||||
targetDisposition : TCefWindowOpenDisposition) : boolean;
|
||||
begin
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
Result := True
|
||||
else
|
||||
try
|
||||
FCriticalSection.Acquire;
|
||||
|
||||
|
@ -255,9 +255,8 @@ begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.ExternalMessagePump := False;
|
||||
GlobalCEFApp.ChromeRuntime := True; // Enable this line to test the new "ChromeRuntime" mode. It's in experimental state.
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient; // This event is only used in "ChromeRuntime" mode
|
||||
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient;
|
||||
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
|
@ -72,15 +72,10 @@ begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.MultiThreadedMessageLoop := False;
|
||||
GlobalCEFApp.ExternalMessagePump := False;
|
||||
GlobalCEFApp.ChromeRuntime := True; // Enable this line to enable the "ChromeRuntime" mode. It's in experimental state.
|
||||
GlobalCEFApp.cache := 'cache';
|
||||
GlobalCEFApp.DisablePopupBlocking := True;
|
||||
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
|
||||
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient; // This event is only used in "ChromeRuntime" mode
|
||||
|
||||
// This is a workaround for the CEF4Delphi issue #324 :
|
||||
// https://github.com/salvadordf/CEF4Delphi/issues/324
|
||||
GlobalCEFApp.DisableFeatures := 'WinUseBrowserSpellChecker';
|
||||
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient;
|
||||
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
|
@ -32,7 +32,6 @@ object ChildForm: TChildForm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 184
|
||||
Top = 128
|
||||
end
|
||||
|
@ -28,7 +28,6 @@ type
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1PreKeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut, Result: Boolean);
|
||||
procedure Chromium1KeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out Result: Boolean);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -42,7 +41,6 @@ type
|
||||
|
||||
protected
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEFBROWSER_CREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEFBROWSER_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -65,9 +63,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery calls TChromium.CloseBrowser
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure TChildForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
@ -93,12 +90,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEFBROWSER_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
@ -179,6 +170,7 @@ begin
|
||||
begin
|
||||
FClosing := True;
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -234,9 +226,4 @@ begin
|
||||
Chromium1.LoadURL(FHomepage);
|
||||
end;
|
||||
|
||||
procedure TChildForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -9,6 +9,7 @@
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>3</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
<ProjectName Condition="'$(ProjectName)'==''">ToolBoxBrowser2</ProjectName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
@ -819,6 +820,9 @@
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64x">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
@ -1112,6 +1116,7 @@
|
||||
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win64x" Name="$(PROJECTNAME)"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
|
@ -32,7 +32,6 @@ object ChildForm: TChildForm
|
||||
OnBeforePopup = Chromium1BeforePopup
|
||||
OnAfterCreated = Chromium1AfterCreated
|
||||
OnBeforeClose = Chromium1BeforeClose
|
||||
OnClose = Chromium1Close
|
||||
Left = 184
|
||||
Top = 128
|
||||
end
|
||||
|
@ -28,7 +28,6 @@ type
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
|
||||
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
procedure Chromium1PreKeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut, Result: Boolean);
|
||||
procedure Chromium1KeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out Result: Boolean);
|
||||
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||
@ -42,7 +41,6 @@ type
|
||||
|
||||
protected
|
||||
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEFBROWSER_CREATED;
|
||||
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEFBROWSER_DESTROY;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||
@ -65,9 +63,8 @@ uses
|
||||
|
||||
// Destruction steps
|
||||
// =================
|
||||
// 1. FormCloseQuery calls TChromium.CloseBrowser
|
||||
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread.
|
||||
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
// 1. FormCloseQuery sets CanClose to FALSE, destroys CEFWindowParent1 and calls TChromium.CloseBrowser which triggers the TChromium.OnBeforeClose event.
|
||||
// 2. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
|
||||
|
||||
procedure TChildForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||
begin
|
||||
@ -93,12 +90,6 @@ begin
|
||||
Result := (targetDisposition in [CEF_WOD_NEW_FOREGROUND_TAB, CEF_WOD_NEW_BACKGROUND_TAB, CEF_WOD_NEW_POPUP, CEF_WOD_NEW_WINDOW]);
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||
begin
|
||||
PostMessage(Handle, CEFBROWSER_DESTROY, 0, 0);
|
||||
aAction := cbaDelay;
|
||||
end;
|
||||
|
||||
procedure TChildForm.Chromium1KeyEvent(Sender: TObject;
|
||||
const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle;
|
||||
out Result: Boolean);
|
||||
@ -179,7 +170,10 @@ begin
|
||||
FClosing := True;
|
||||
|
||||
if Chromium1.Initialized then
|
||||
Chromium1.CloseBrowser(True)
|
||||
begin
|
||||
Chromium1.CloseBrowser(True);
|
||||
CEFWindowParent1.Free;
|
||||
end
|
||||
else
|
||||
CanClose := True;
|
||||
end;
|
||||
@ -240,9 +234,4 @@ begin
|
||||
Chromium1.LoadURL(FHomepage);
|
||||
end;
|
||||
|
||||
procedure TChildForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||
begin
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -14,7 +14,6 @@ begin
|
||||
GlobalCEFApp.ShowMessageDlg := False;
|
||||
GlobalCEFApp.BlinkSettings := 'hideScrollbars';
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
GlobalCEFApp.StartSubProcess;
|
||||
DestroyGlobalCEFApp;
|
||||
end.
|
||||
|
@ -108,7 +108,6 @@ begin
|
||||
GlobalCEFApp.BlinkSettings := 'hideScrollbars'; // This setting removes all scrollbars to capture a cleaner snapshot
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
GlobalCEFApp.DisableZygote := True;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
GlobalCEFApp.StartMainProcess;
|
||||
end;
|
||||
|
||||
|
@ -124,6 +124,7 @@ begin
|
||||
FClosing := False;
|
||||
|
||||
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
|
@ -229,7 +229,6 @@ begin
|
||||
GlobalCEFApp.LogFile := 'debug.log';
|
||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||
GlobalCEFApp.EnablePrintPreview := True;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
end;
|
||||
|
||||
{Property setters and getters}
|
||||
@ -520,6 +519,7 @@ begin
|
||||
// used when you call any method or property in TChromium.
|
||||
Chromium1.MultiBrowserMode := True;
|
||||
Chromium1.DefaultURL := UTF8Decode(URLCbx.Text);
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
|
||||
// WebRTC's IP leaking can lowered/avoided by setting these preferences
|
||||
// To test this go to https://www.browserleaks.com/webrtc
|
||||
|
@ -14,7 +14,7 @@ object Form1: TForm1
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.2.0.4'
|
||||
LCLVersion = '3.4.0.0'
|
||||
object Splitter1: TSplitter
|
||||
Left = 739
|
||||
Height = 624
|
||||
@ -33,6 +33,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 624
|
||||
ClientWidth = 294
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object LogMem: TMemo
|
||||
Left = 0
|
||||
@ -53,6 +54,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 57
|
||||
ClientWidth = 294
|
||||
ParentBackground = False
|
||||
TabOrder = 1
|
||||
object CanEmulateBtn: TButton
|
||||
Left = 0
|
||||
@ -61,8 +63,8 @@ object Form1: TForm1
|
||||
Width = 294
|
||||
Align = alTop
|
||||
Caption = 'Can emulate'
|
||||
OnClick = CanEmulateBtnClick
|
||||
TabOrder = 0
|
||||
OnClick = CanEmulateBtnClick
|
||||
end
|
||||
object ClearDeviceMetricsOverrideBtn: TButton
|
||||
Left = 0
|
||||
@ -71,8 +73,8 @@ object Form1: TForm1
|
||||
Width = 294
|
||||
Align = alBottom
|
||||
Caption = 'Clear device metrics override'
|
||||
OnClick = ClearDeviceMetricsOverrideBtnClick
|
||||
TabOrder = 1
|
||||
OnClick = ClearDeviceMetricsOverrideBtnClick
|
||||
end
|
||||
end
|
||||
object Panel4: TPanel
|
||||
@ -84,6 +86,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 104
|
||||
ClientWidth = 294
|
||||
ParentBackground = False
|
||||
TabOrder = 2
|
||||
object GroupBox1: TGroupBox
|
||||
Left = 0
|
||||
@ -92,8 +95,9 @@ object Form1: TForm1
|
||||
Width = 294
|
||||
Align = alTop
|
||||
Caption = ' User agent '
|
||||
ClientHeight = 60
|
||||
ClientHeight = 58
|
||||
ClientWidth = 292
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object UserAgentCb: TComboBox
|
||||
Left = 0
|
||||
@ -135,8 +139,8 @@ object Form1: TForm1
|
||||
Width = 292
|
||||
Align = alBottom
|
||||
Caption = 'Override user agent'
|
||||
OnClick = OverrideUserAgentBtnClick
|
||||
TabOrder = 1
|
||||
OnClick = OverrideUserAgentBtnClick
|
||||
end
|
||||
end
|
||||
object EmulateTouchChk: TCheckBox
|
||||
@ -146,8 +150,8 @@ object Form1: TForm1
|
||||
Width = 294
|
||||
Align = alBottom
|
||||
Caption = 'Emulate Touch'
|
||||
OnClick = EmulateTouchChkClick
|
||||
TabOrder = 1
|
||||
OnClick = EmulateTouchChkClick
|
||||
end
|
||||
end
|
||||
object Panel5: TPanel
|
||||
@ -159,6 +163,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 205
|
||||
ClientWidth = 294
|
||||
ParentBackground = False
|
||||
TabOrder = 3
|
||||
object GroupBox2: TGroupBox
|
||||
Left = 0
|
||||
@ -167,8 +172,9 @@ object Form1: TForm1
|
||||
Width = 294
|
||||
Align = alClient
|
||||
Caption = ' Emulate device metrics '
|
||||
ClientHeight = 190
|
||||
ClientHeight = 188
|
||||
ClientWidth = 292
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object Panel6: TPanel
|
||||
Left = 0
|
||||
@ -179,6 +185,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 27
|
||||
ClientWidth = 292
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
Left = 0
|
||||
@ -209,6 +216,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 27
|
||||
ClientWidth = 292
|
||||
ParentBackground = False
|
||||
TabOrder = 1
|
||||
object Label2: TLabel
|
||||
Left = 0
|
||||
@ -237,8 +245,8 @@ object Form1: TForm1
|
||||
Width = 292
|
||||
Align = alBottom
|
||||
Caption = 'Override device metrics'
|
||||
OnClick = OverrideDeviceMetricsBtnClick
|
||||
TabOrder = 2
|
||||
OnClick = OverrideDeviceMetricsBtnClick
|
||||
end
|
||||
object Panel8: TPanel
|
||||
Left = 0
|
||||
@ -249,6 +257,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 27
|
||||
ClientWidth = 292
|
||||
ParentBackground = False
|
||||
TabOrder = 3
|
||||
object Label3: TLabel
|
||||
Left = 0
|
||||
@ -266,6 +275,7 @@ object Form1: TForm1
|
||||
Top = 0
|
||||
Width = 217
|
||||
Align = alClient
|
||||
EnableSets = False
|
||||
MaxLength = 4
|
||||
TabOrder = 0
|
||||
EditMask = '#.##;1;0'
|
||||
@ -282,6 +292,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 27
|
||||
ClientWidth = 292
|
||||
ParentBackground = False
|
||||
TabOrder = 4
|
||||
object Label4: TLabel
|
||||
Left = 0
|
||||
@ -321,6 +332,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 27
|
||||
ClientWidth = 292
|
||||
ParentBackground = False
|
||||
TabOrder = 5
|
||||
object Label5: TLabel
|
||||
Left = 0
|
||||
@ -354,6 +366,7 @@ object Form1: TForm1
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 624
|
||||
ClientWidth = 739
|
||||
ParentBackground = False
|
||||
TabOrder = 1
|
||||
object AddressPnl: TPanel
|
||||
Left = 0
|
||||
@ -365,6 +378,7 @@ object Form1: TForm1
|
||||
ClientHeight = 23
|
||||
ClientWidth = 739
|
||||
Enabled = False
|
||||
ParentBackground = False
|
||||
TabOrder = 0
|
||||
object AddressEdt: TEdit
|
||||
Left = 0
|
||||
@ -382,8 +396,8 @@ object Form1: TForm1
|
||||
Width = 31
|
||||
Align = alRight
|
||||
Caption = 'Go'
|
||||
OnClick = GoBtnClick
|
||||
TabOrder = 1
|
||||
OnClick = GoBtnClick
|
||||
end
|
||||
end
|
||||
object CEFLinkedWindowParent1: TCEFLinkedWindowParent
|
||||
|
@ -161,6 +161,7 @@ begin
|
||||
FClosing := False;
|
||||
FPendingMsgID := 0;
|
||||
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
procedure TForm1.GoBtnClick(Sender: TObject);
|
||||
|
@ -16,6 +16,7 @@ object ChildForm: TChildForm
|
||||
OnDestroy = FormDestroy
|
||||
OnShow = FormShow
|
||||
Position = poDefault
|
||||
LCLVersion = '3.4.0.0'
|
||||
object CEFLinkedWindowParent1: TCEFLinkedWindowParent
|
||||
Left = 0
|
||||
Height = 256
|
||||
|
@ -164,9 +164,6 @@ begin
|
||||
FClosing := True;
|
||||
Visible := False;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFLinkedWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -194,6 +191,8 @@ begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FClientInitialized := False;
|
||||
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
end;
|
||||
|
||||
// This is a workaround for the CEF issue #2026
|
||||
|
@ -15,7 +15,7 @@ object MainForm: TMainForm
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '3.2.0.0'
|
||||
LCLVersion = '3.4.0.0'
|
||||
object AddressPnl: TPanel
|
||||
Left = 0
|
||||
Height = 21
|
||||
|
@ -130,7 +130,6 @@ begin
|
||||
GlobalCEFApp := TCefApplication.Create;
|
||||
GlobalCEFApp.OnContextInitialized := @GlobalCEFApp_OnContextInitialized;
|
||||
GlobalCEFApp.SetCurrentDir := True;
|
||||
GlobalCEFApp.ChromeRuntime := True;
|
||||
end;
|
||||
|
||||
procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||
@ -151,9 +150,6 @@ begin
|
||||
begin
|
||||
FClosingMainForm := True;
|
||||
Chromium1.CloseBrowser(True);
|
||||
|
||||
if GlobalCEFApp.ChromeRuntime then
|
||||
CEFLinkedWindowParent1.Free;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -173,6 +169,7 @@ begin
|
||||
|
||||
Chromium1.DefaultURL := UTF8Decode(AddressEdt.Text);
|
||||
Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF);
|
||||
Chromium1.RuntimeStyle := CEF_RUNTIME_STYLE_ALLOY;
|
||||
|
||||
CreateHiddenChildForm;
|
||||
end;
|
||||
|
@ -10,7 +10,7 @@ object Form1: TForm1
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.0.10.0'
|
||||
LCLVersion = '3.4.0.0'
|
||||
object AddressPnl: TPanel
|
||||
Left = 0
|
||||
Height = 25
|
||||
@ -38,8 +38,8 @@ object Form1: TForm1
|
||||
Width = 31
|
||||
Align = alRight
|
||||
Caption = 'Go'
|
||||
OnClick = GoBtnClick
|
||||
TabOrder = 1
|
||||
OnClick = GoBtnClick
|
||||
end
|
||||
end
|
||||
object ChromiumWindow1: TChromiumWindow
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user