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 91.1.21
The TabbedBrowser2 demo for Windows can now open new tabs without losing the POST data.
This commit is contained in:
@@ -44,10 +44,10 @@ interface
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
Winapi.Windows, System.Classes, Winapi.Messages, Vcl.ComCtrls, Vcl.Controls,
|
||||
Vcl.Forms,
|
||||
Vcl.Forms, System.SysUtils,
|
||||
{$ELSE}
|
||||
Windows, Classes, Messages, ComCtrls, Controls,
|
||||
Forms,
|
||||
Forms, SysUtils,
|
||||
{$ENDIF}
|
||||
uCEFInterfaces, uCEFTypes, uBrowserFrame;
|
||||
|
||||
@@ -58,6 +58,8 @@ type
|
||||
FTabID : cardinal;
|
||||
|
||||
function GetParentForm : TCustomForm;
|
||||
function GetInitialized : boolean;
|
||||
function GetClosing : boolean;
|
||||
|
||||
function PostFormMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
|
||||
|
||||
@@ -69,13 +71,18 @@ type
|
||||
public
|
||||
constructor Create(AOwner: TComponent; aTabID : cardinal; const aCaption : string); reintroduce;
|
||||
procedure NotifyMoveOrResizeStarted;
|
||||
procedure CreateFrame(const aHomepage : string = '');
|
||||
procedure CreateBrowser(const aHomepage : string);
|
||||
procedure CloseBrowser;
|
||||
procedure ShowBrowser;
|
||||
procedure HideBrowser;
|
||||
function CreateClientHandler(var windowInfo : TCefWindowInfo; var client : ICefClient; const targetFrameName : string; const popupFeatures : TCefPopupFeatures) : boolean;
|
||||
function DoOnBeforePopup(var windowInfo : TCefWindowInfo; var client : ICefClient; const targetFrameName : string; const popupFeatures : TCefPopupFeatures; targetDisposition : TCefWindowOpenDisposition) : boolean;
|
||||
function DoOpenUrlFromTab(const targetUrl : string; targetDisposition : TCefWindowOpenDisposition) : boolean;
|
||||
|
||||
property TabID : cardinal read FTabID;
|
||||
property TabID : cardinal read FTabID;
|
||||
property Closing : boolean read GetClosing;
|
||||
property Initialized : boolean read GetInitialized;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@@ -107,6 +114,18 @@ begin
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TBrowserTab.GetInitialized : boolean;
|
||||
begin
|
||||
Result := (FBrowserFrame <> nil) and
|
||||
FBrowserFrame.Initialized;
|
||||
end;
|
||||
|
||||
function TBrowserTab.GetClosing : boolean;
|
||||
begin
|
||||
Result := (FBrowserFrame <> nil) and
|
||||
FBrowserFrame.Closing;
|
||||
end;
|
||||
|
||||
function TBrowserTab.PostFormMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
|
||||
var
|
||||
TempForm : TCustomForm;
|
||||
@@ -122,17 +141,28 @@ begin
|
||||
FBrowserFrame.NotifyMoveOrResizeStarted;
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.CreateFrame(const aHomepage : string);
|
||||
begin
|
||||
if (FBrowserFrame = nil) then
|
||||
begin
|
||||
FBrowserFrame := TBrowserFrame.Create(self);
|
||||
FBrowserFrame.Name := 'BrowserFrame' + IntToStr(TabID);
|
||||
FBrowserFrame.Parent := self;
|
||||
FBrowserFrame.Align := alClient;
|
||||
FBrowserFrame.Visible := True;
|
||||
FBrowserFrame.OnBrowserDestroyed := BrowserFrame_OnBrowserDestroyed;
|
||||
FBrowserFrame.OnBrowserTitleChange := BrowserFrame_OnBrowserTitleChange;
|
||||
FBrowserFrame.CreateAllHandles;
|
||||
end;
|
||||
|
||||
FBrowserFrame.Homepage := aHomepage;
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.CreateBrowser(const aHomepage : string);
|
||||
begin
|
||||
FBrowserFrame := TBrowserFrame.Create(self);
|
||||
FBrowserFrame.Parent := self;
|
||||
FBrowserFrame.Align := alClient;
|
||||
FBrowserFrame.Visible := True;
|
||||
FBrowserFrame.Homepage := aHomepage;
|
||||
FBrowserFrame.OnBrowserDestroyed := BrowserFrame_OnBrowserDestroyed;
|
||||
FBrowserFrame.OnBrowserTitleChange := BrowserFrame_OnBrowserTitleChange;
|
||||
CreateFrame(aHomepage);
|
||||
|
||||
FBrowserFrame.CreateBrowser;
|
||||
if (FBrowserFrame <> nil) then FBrowserFrame.CreateBrowser;
|
||||
end;
|
||||
|
||||
procedure TBrowserTab.CloseBrowser;
|
||||
@@ -162,17 +192,38 @@ begin
|
||||
Caption := aTitle;
|
||||
end;
|
||||
|
||||
function TBrowserTab.CreateClientHandler(var windowInfo : TCefWindowInfo;
|
||||
var client : ICefClient;
|
||||
const targetFrameName : string;
|
||||
const popupFeatures : TCefPopupFeatures) : boolean;
|
||||
function TBrowserTab.CreateClientHandler(var windowInfo : TCefWindowInfo;
|
||||
var client : ICefClient;
|
||||
const targetFrameName : string;
|
||||
const popupFeatures : TCefPopupFeatures) : boolean;
|
||||
begin
|
||||
Result := (FBrowserFrame <> nil) and
|
||||
FBrowserFrame.CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures);
|
||||
end;
|
||||
|
||||
function TBrowserTab.DoOnBeforePopup(var windowInfo : TCefWindowInfo;
|
||||
var client : ICefClient;
|
||||
const targetFrameName : string;
|
||||
const popupFeatures : TCefPopupFeatures;
|
||||
targetDisposition : TCefWindowOpenDisposition) : boolean;
|
||||
var
|
||||
TempForm : TCustomForm;
|
||||
begin
|
||||
TempForm := ParentForm;
|
||||
Result := (TempForm <> nil) and
|
||||
(TempForm is TMainForm) and
|
||||
TMainForm(TempForm).CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures);
|
||||
TMainForm(TempForm).DoOnBeforePopup(windowInfo, client, targetFrameName, popupFeatures, targetDisposition);
|
||||
end;
|
||||
|
||||
function TBrowserTab.DoOpenUrlFromTab(const targetUrl : string;
|
||||
targetDisposition : TCefWindowOpenDisposition) : boolean;
|
||||
var
|
||||
TempForm : TCustomForm;
|
||||
begin
|
||||
TempForm := ParentForm;
|
||||
Result := (TempForm <> nil) and
|
||||
(TempForm is TMainForm) and
|
||||
TMainForm(TempForm).DoOpenUrlFromTab(targetUrl, targetDisposition);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Reference in New Issue
Block a user