You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Update to CEF 128.4.8
This commit is contained in:
@@ -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,10 +188,7 @@ 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;
|
||||
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,10 +130,7 @@ 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;
|
||||
CEFWindowParent1.Free;
|
||||
end;
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user