1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-04-17 06:57:13 +02:00

Update to CEF 3.3538.1848.g1d1fe01

This commit is contained in:
Salvador Díaz Fau 2018-10-26 10:32:10 +02:00
parent 87e0dcbd84
commit 627a77e8d2
7 changed files with 115 additions and 40 deletions

View File

@ -60,14 +60,14 @@ uses
const const
CEF_SUPPORTED_VERSION_MAJOR = 3; CEF_SUPPORTED_VERSION_MAJOR = 3;
CEF_SUPPORTED_VERSION_MINOR = 3497; CEF_SUPPORTED_VERSION_MINOR = 3538;
CEF_SUPPORTED_VERSION_RELEASE = 1841; CEF_SUPPORTED_VERSION_RELEASE = 1848;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 69; CEF_CHROMEELF_VERSION_MAJOR = 70;
CEF_CHROMEELF_VERSION_MINOR = 0; CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 3497; CEF_CHROMEELF_VERSION_RELEASE = 3538;
CEF_CHROMEELF_VERSION_BUILD = 100; CEF_CHROMEELF_VERSION_BUILD = 77;
LIBCEF_DLL = 'libcef.dll'; LIBCEF_DLL = 'libcef.dll';
CHROMEELF_DLL = 'chrome_elf.dll'; CHROMEELF_DLL = 'chrome_elf.dll';

View File

@ -72,6 +72,9 @@ type
protected protected
FData: Pointer; FData: Pointer;
function HasOneRef : boolean;
function HasAtLeastOneRef : boolean;
public public
constructor CreateData(size: Cardinal; owned : boolean = False); virtual; constructor CreateData(size: Cardinal; owned : boolean = False); virtual;
destructor Destroy; override; destructor Destroy; override;
@ -83,6 +86,9 @@ type
protected protected
FData: Pointer; FData: Pointer;
function HasOneRef : boolean;
function HasAtLeastOneRef : boolean;
public public
constructor Create(data: Pointer); virtual; constructor Create(data: Pointer); virtual;
destructor Destroy; override; destructor Destroy; override;
@ -138,6 +144,18 @@ begin
Result := Ord(False); Result := Ord(False);
end; end;
function cef_base_has_at_least_one_ref(self: PCefBaseRefCounted): Integer; stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefBaseRefCountedOwn) then
Result := Ord(TCefBaseRefCountedOwn(TempObject).FRefCount >= 1)
else
Result := Ord(False);
end;
procedure cef_base_add_ref_owned(self: PCefBaseRefCounted); stdcall; procedure cef_base_add_ref_owned(self: PCefBaseRefCounted); stdcall;
begin begin
// //
@ -153,6 +171,11 @@ begin
Result := 1; Result := 1;
end; end;
function cef_base_has_at_least_one_ref_owned(self: PCefBaseRefCounted): Integer; stdcall;
begin
Result := 1;
end;
constructor TCefBaseRefCountedOwn.CreateData(size: Cardinal; owned : boolean); constructor TCefBaseRefCountedOwn.CreateData(size: Cardinal; owned : boolean);
begin begin
GetMem(FData, size + SizeOf(Pointer)); GetMem(FData, size + SizeOf(Pointer));
@ -166,12 +189,14 @@ begin
PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref_owned; PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref_owned;
PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_owned; PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_owned;
PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref_owned; PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref_owned;
PCefBaseRefCounted(FData)^.has_at_least_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_at_least_one_ref_owned;
end end
else else
begin begin
PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref; PCefBaseRefCounted(FData)^.add_ref := {$IFDEF FPC}@{$ENDIF}cef_base_add_ref;
PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_ref; PCefBaseRefCounted(FData)^.release := {$IFDEF FPC}@{$ENDIF}cef_base_release_ref;
PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref; PCefBaseRefCounted(FData)^.has_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_one_ref;
PCefBaseRefCounted(FData)^.has_at_least_one_ref := {$IFDEF FPC}@{$ENDIF}cef_base_has_at_least_one_ref;
end; end;
end; end;
@ -206,6 +231,22 @@ begin
PCefBaseRefCounted(FData)^.add_ref(PCefBaseRefCounted(FData)); PCefBaseRefCounted(FData)^.add_ref(PCefBaseRefCounted(FData));
end; end;
function TCefBaseRefCountedOwn.HasOneRef : boolean;
begin
if (FData <> nil) and Assigned(PCefBaseRefCounted(FData)^.has_one_ref) then
Result := PCefBaseRefCounted(FData)^.has_one_ref(PCefBaseRefCounted(FData)) <> 0
else
Result := False;
end;
function TCefBaseRefCountedOwn.HasAtLeastOneRef : boolean;
begin
if (FData <> nil) and Assigned(PCefBaseRefCounted(FData)^.has_at_least_one_ref) then
Result := PCefBaseRefCounted(FData)^.has_at_least_one_ref(PCefBaseRefCounted(FData)) <> 0
else
Result := False;
end;
// *********************************************** // ***********************************************
// ************ TCefBaseRefCountedRef ************ // ************ TCefBaseRefCountedRef ************
@ -262,6 +303,16 @@ begin
end; end;
end; end;
function TCefBaseRefCountedRef.HasOneRef : boolean;
begin
Result := (PCefBaseRefCounted(FData)^.has_one_ref(PCefBaseRefCounted(FData)) <> 0);
end;
function TCefBaseRefCountedRef.HasAtLeastOneRef : boolean;
begin
Result := (PCefBaseRefCounted(FData)^.has_at_least_one_ref(PCefBaseRefCounted(FData)) <> 0);
end;
// ************************************************ // ************************************************
// *********** TLoggingInterfacedObject *********** // *********** TLoggingInterfacedObject ***********

View File

@ -339,6 +339,9 @@ type
function SendCompMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean; function SendCompMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
procedure ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent); procedure ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent);
procedure InitializeWindowInfo(aParentHandle : HWND; aParentRect : TRect; const aWindowName : ustring); virtual;
procedure InitializeDevToolsWindowInfo(aDevTools : TWinControl); virtual;
procedure FreeAndNilStub(var aStub : pointer); procedure FreeAndNilStub(var aStub : pointer);
procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer); procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
procedure WndProc(var aMessage: TMessage); procedure WndProc(var aMessage: TMessage);
@ -1147,11 +1150,7 @@ begin
CreateClientHandler(aParentHandle = 0) then CreateClientHandler(aParentHandle = 0) then
begin begin
GetSettings(FBrowserSettings); GetSettings(FBrowserSettings);
InitializeWindowInfo(aParentHandle, aParentRect, aWindowName);
if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, FCompHandle, aWindowName)
else
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName);
if (aContext <> nil) and (length(aCookiesPath) > 0) then if (aContext <> nil) and (length(aCookiesPath) > 0) then
@ -1175,6 +1174,24 @@ begin
end; end;
end; end;
procedure TChromium.InitializeWindowInfo( aParentHandle : HWND;
aParentRect : TRect;
const aWindowName : ustring);
begin
if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, FCompHandle, aWindowName)
else
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName);
end;
procedure TChromium.InitializeDevToolsWindowInfo(aDevTools : TWinControl);
begin
if (aDevTools <> nil) then
WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name)
else
WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME);
end;
procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl : TWinControl); procedure TChromium.InitializeDragAndDrop(const aDropTargetCtrl : TWinControl);
var var
TempDropTarget : IDropTarget; TempDropTarget : IDropTarget;
@ -2980,11 +2997,7 @@ begin
if Initialized then if Initialized then
begin begin
InitializeSettings(FDevBrowserSettings); InitializeSettings(FDevBrowserSettings);
InitializeDevToolsWindowInfo(aDevTools);
if (aDevTools <> nil) then
WindowInfoAsChild(FDevWindowInfo, aDevTools.Handle, aDevTools.ClientRect, aDevTools.Name)
else
WindowInfoAsPopUp(FDevWindowInfo, WindowHandle, DEVTOOLS_WINDOWNAME);
TempClient := TCefClientOwn.Create; TempClient := TCefClientOwn.Create;

View File

@ -395,6 +395,8 @@ type
['{1F9A7B44-DCDC-4477-9180-3ADD44BDEB7B}'] ['{1F9A7B44-DCDC-4477-9180-3ADD44BDEB7B}']
function Wrap: Pointer; function Wrap: Pointer;
function SameAs(aData : Pointer) : boolean; function SameAs(aData : Pointer) : boolean;
function HasOneRef : boolean;
function HasAtLeastOneRef : boolean;
end; end;
// TCefRunFileDialogCallback // TCefRunFileDialogCallback

View File

@ -103,9 +103,9 @@ function cef_string_utf16_copy(const src: PChar16; src_len: NativeUInt; output:
function cef_string_copy(const src: PCefChar; src_len: NativeUInt; output: PCefString): Integer; function cef_string_copy(const src: PCefChar; src_len: NativeUInt; output: PCefString): Integer;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring = ''); procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring = ''; aExStyle : cardinal = 0);
procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''); procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''; aExStyle : cardinal = 0);
procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''); procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring = ''; aExStyle : cardinal = 0);
{$ENDIF} {$ENDIF}
{$IFDEF MACOS} {$IFDEF MACOS}
@ -483,9 +483,9 @@ begin
end; end;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring); procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : THandle; aRect : TRect; const aWindowName : ustring; aExStyle : cardinal);
begin begin
aWindowInfo.ex_style := 0; aWindowInfo.ex_style := aExStyle;
aWindowInfo.window_name := CefString(aWindowName); aWindowInfo.window_name := CefString(aWindowName);
aWindowInfo.style := WS_CHILD or WS_VISIBLE or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_TABSTOP; aWindowInfo.style := WS_CHILD or WS_VISIBLE or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_TABSTOP;
aWindowInfo.x := aRect.left; aWindowInfo.x := aRect.left;
@ -498,9 +498,9 @@ begin
aWindowInfo.window := 0; aWindowInfo.window := 0;
end; end;
procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring); procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring; aExStyle : cardinal);
begin begin
aWindowInfo.ex_style := 0; aWindowInfo.ex_style := aExStyle;
aWindowInfo.window_name := CefString(aWindowName); aWindowInfo.window_name := CefString(aWindowName);
aWindowInfo.style := WS_OVERLAPPEDWINDOW or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_VISIBLE; aWindowInfo.style := WS_OVERLAPPEDWINDOW or WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_VISIBLE;
aWindowInfo.x := integer(CW_USEDEFAULT); aWindowInfo.x := integer(CW_USEDEFAULT);
@ -513,9 +513,9 @@ begin
aWindowInfo.window := 0; aWindowInfo.window := 0;
end; end;
procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring); procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : THandle; const aWindowName : ustring; aExStyle : cardinal);
begin begin
aWindowInfo.ex_style := 0; aWindowInfo.ex_style := aExStyle;
aWindowInfo.window_name := CefString(aWindowName); aWindowInfo.window_name := CefString(aWindowName);
aWindowInfo.style := 0; aWindowInfo.style := 0;
aWindowInfo.x := 0; aWindowInfo.x := 0;

View File

@ -751,7 +751,8 @@ type
TCefTerminationStatus = ( TCefTerminationStatus = (
TS_ABNORMAL_TERMINATION, TS_ABNORMAL_TERMINATION,
TS_PROCESS_WAS_KILLED, TS_PROCESS_WAS_KILLED,
TS_PROCESS_CRASHED TS_PROCESS_CRASHED,
TS_PROCESS_OOM
); );
// /include/internal/cef_types.h (cef_path_key_t) // /include/internal/cef_types.h (cef_path_key_t)
@ -1189,6 +1190,7 @@ type
add_ref : procedure(self: PCefBaseRefCounted); stdcall; add_ref : procedure(self: PCefBaseRefCounted); stdcall;
release : function(self: PCefBaseRefCounted): Integer; stdcall; release : function(self: PCefBaseRefCounted): Integer; stdcall;
has_one_ref : function(self: PCefBaseRefCounted): Integer; stdcall; has_one_ref : function(self: PCefBaseRefCounted): Integer; stdcall;
has_at_least_one_ref : function(self: PCefBaseRefCounted): Integer; stdcall;
end; end;
// /include/capi/cef_base_capi.h (cef_base_scoped_t) // /include/capi/cef_base_capi.h (cef_base_scoped_t)

View File

@ -319,6 +319,7 @@ type
function GetParentForm : TCustomForm; function GetParentForm : TCustomForm;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
procedure InitializeWindowInfo(aParentHandle : HWND; aParentRect : TRect; const aWindowName : ustring); virtual;
procedure FreeAndNilStub(var aStub : pointer); procedure FreeAndNilStub(var aStub : pointer);
procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer); procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
procedure BrowserCompWndProc(var aMessage: TMessage); procedure BrowserCompWndProc(var aMessage: TMessage);
@ -1085,11 +1086,7 @@ begin
CreateClientHandler(aParentHandle = 0) then CreateClientHandler(aParentHandle = 0) then
begin begin
GetSettings(FBrowserSettings); GetSettings(FBrowserSettings);
InitializeWindowInfo(aParentHandle, aParentRect, aWindowName);
if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, 0, aWindowName)
else
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName);
if (aContext <> nil) and (length(aCookiesPath) > 0) then if (aContext <> nil) and (length(aCookiesPath) > 0) then
@ -1112,6 +1109,16 @@ begin
if CustomExceptionHandler('TFMXChromium.CreateBrowser', e) then raise; if CustomExceptionHandler('TFMXChromium.CreateBrowser', e) then raise;
end; end;
end; end;
procedure TFMXChromium.InitializeWindowInfo( aParentHandle : HWND;
aParentRect : TRect;
const aWindowName : ustring);
begin
if FIsOSR then
WindowInfoAsWindowless(FWindowInfo, 0, aWindowName)
else
WindowInfoAsChild(FWindowInfo, aParentHandle, aParentRect, aWindowName);
end;
{$ENDIF} {$ENDIF}
function TFMXChromium.ShareRequestContext(var aContext : ICefRequestContext; function TFMXChromium.ShareRequestContext(var aContext : ICefRequestContext;