1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-02-02 10:25:26 +02:00

Update to CEF 76.1.10

- Added GlobalCEFApp.UseFakeUIForMediaStream
- Added overloaded TCefBaseRefCountedOwn.SameAs
This commit is contained in:
Salvador Díaz Fau 2019-08-27 09:52:33 +02:00
parent 6663682880
commit 0acd59b3d2
20 changed files with 130 additions and 28 deletions

View File

@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador D
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 76.1.9 which includes Chromium 76.0.3809.87.
CEF4Delphi uses CEF 76.1.10 which includes Chromium 76.0.3809.87.
The CEF binaries used by CEF4Delphi are available for download at spotify :
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_76.1.9%2Bg2cf916e%2Bchromium-76.0.3809.87_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_76.1.9%2Bg2cf916e%2Bchromium-76.0.3809.87_windows64.tar.bz2)
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_76.1.10%2Bg20d771a%2Bchromium-76.0.3809.87_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_76.1.10%2Bg20d771a%2Bchromium-76.0.3809.87_windows64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.3 Rio and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.4/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -152,7 +152,7 @@ uses
// procedure with a PID_RENDERER parameter. The render process receives those messages in
// the GlobalCEFApp.OnProcessMessageReceived event.
// To send messages from the render process you must use the browser.SendProcessMessage
// To send messages from the render process you must use the frame.SendProcessMessage
// procedure with a PID_BROWSER parameter. The browser process receives those messages in
// the TChromium.OnProcessMessageReceived event.

View File

@ -154,11 +154,11 @@ uses
// extension called "myextension.mouseover".
// The TTestExtensionHandler.Execute function is executed in the renderer process and it
// can use the TCefv8ContextRef.Current.Browser.SendProcessMessage(PID_BROWSER, msg) function
// can use the TCefv8ContextRef.Current.Browser.MainFrame.SendProcessMessage(PID_BROWSER, msg) function
// to send a message with the results to the browser process.
// TCefv8ContextRef.Current returns the v8 context for the frame that is currently
// executing JavaScript, TCefv8ContextRef.Current.Browser.SendProcessMessage sends a message
// executing JavaScript, TCefv8ContextRef.Current.Browser.MainFrame.SendProcessMessage sends a message
// to the right browser even if you have created several browsers in one app.
// That message is received in the TChromium.OnProcessMessageReceived event.

View File

@ -135,10 +135,10 @@ uses
// TTestExtension can send information back to the browser with a process message.
// The TTestExtension.mouseover function do this by calling
// TCefv8ContextRef.Current.Browser.SendProcessMessage(PID_BROWSER, msg);
// TCefv8ContextRef.Current.Browser.MainFrame.SendProcessMessage(PID_BROWSER, msg);
// TCefv8ContextRef.Current returns the v8 context for the frame that is currently executing JS,
// TCefv8ContextRef.Current.Browser.SendProcessMessage should send a message to the right browser even
// TCefv8ContextRef.Current.Browser.MainFrame.SendProcessMessage should send a message to the right browser even
// if you have created several browsers in one app.
// That message is received in the TChromium.OnProcessMessageReceived event.

View File

@ -289,6 +289,7 @@ begin
GlobalCEFApp.DisableFeatures := 'NetworkService,OutOfBlinkCors';
GlobalCEFApp.LogFile := 'debug.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
//GlobalCEFApp.RemoteDebuggingPort := 19999;
end;
procedure TMiniBrowserFrm.BackBtnClick(Sender: TObject);

View File

@ -73,6 +73,7 @@ object Form1: TForm1
OnAfterCreated = Chromium1AfterCreated
OnBeforeClose = Chromium1BeforeClose
OnClose = Chromium1Close
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
Left = 56
Top = 152
end

View File

@ -79,6 +79,11 @@ type
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);
protected
// Variables to control when can we destroy the form safely
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
@ -189,6 +194,15 @@ begin
aAction := cbaDelay;
end;
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
userGesture: Boolean; out Result: Boolean);
begin
// For simplicity, this demo blocks all popup windows and new tabs
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
end;
procedure TForm1.BrowserCreatedMsg(var aMessage : TMessage);
begin
Caption := 'Simple Browser 2';

View File

@ -422,7 +422,7 @@ begin
end;
end;
procedure TForm1.chrmosrPaint(Sender : TObject;
procedure TForm1.chrmosrPaint( Sender : TObject;
const browser : ICefBrowser;
kind : TCefPaintElementType;
dirtyRectsCount : NativeUInt;

View File

@ -72,6 +72,7 @@ type
procedure CEFUrlRequestClientComponent1DownloadProgress(Sender: TObject; const request: ICefUrlRequest; current, total: Int64);
procedure CEFUrlRequestClientComponent1RequestComplete(Sender: TObject; const request: ICefUrlRequest);
procedure CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject);
private
FStream : TMemoryStream;
FCanClose : boolean;

View File

@ -144,7 +144,7 @@ uses
// procedure with a PID_RENDERER parameter. The render process receives those messages in
// the GlobalCEFApp.OnProcessMessageReceived event.
// To send messages from the render process you must use the browser.SendProcessMessage
// To send messages from the render process you must use the frame.SendProcessMessage
// procedure with a PID_BROWSER parameter. The browser process receives those messages in
// the TChromium.OnProcessMessageReceived event.

View File

@ -1,4 +1,4 @@
// ************************************************************************
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
@ -159,11 +159,11 @@ uses
// extension called "myextension.mouseover".
// The TTestExtensionHandler.Execute function is executed in the renderer process and it
// can use the TCefv8ContextRef.Current.Browser.SendProcessMessage(PID_BROWSER, msg) function
// can use the TCefv8ContextRef.Current.Browser.MainFrame.SendProcessMessage(PID_BROWSER, msg) function
// to send a message with the results to the browser process.
// TCefv8ContextRef.Current returns the v8 context for the frame that is currently
// executing JavaScript, TCefv8ContextRef.Current.Browser.SendProcessMessage sends a message
// executing JavaScript, TCefv8ContextRef.Current.Browser.MainFrame.SendProcessMessage sends a message
// to the right browser even if you have created several browsers in one app.
// That message is received in the TChromium.OnProcessMessageReceived event.

View File

@ -42,7 +42,6 @@
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="uSimpleBrowser2"/>
</Unit1>
</Units>
</ProjectOptions>

View File

@ -4,11 +4,11 @@
<PathDelim Value="\"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="54">
<Units Count="55">
<Unit0>
<Filename Value="SimpleBrowser2.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<EditorIndex Value="2"/>
<CursorPos X="34" Y="26"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
@ -35,8 +35,8 @@
<ResourceBaseClass Value="Form"/>
<UnitName Value="uSimpleLazarusBrowser"/>
<IsVisibleTab Value="True"/>
<TopLine Value="98"/>
<CursorPos X="69" Y="125"/>
<TopLine Value="158"/>
<CursorPos X="7" Y="183"/>
<UsageCount Value="43"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
@ -416,8 +416,15 @@
<CursorPos X="3" Y="133"/>
<UsageCount Value="10"/>
</Unit53>
<Unit54>
<Filename Value="..\..\..\source\uCEFApplication.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="37"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit54>
</Units>
<JumpHistory Count="3" HistoryIndex="2">
<JumpHistory Count="7" HistoryIndex="6">
<Position1>
<Filename Value="usimplelazarusbrowser.pas"/>
<Caret Line="67" Column="29" TopLine="57"/>
@ -430,6 +437,22 @@
<Filename Value="SimpleBrowser2.lpr"/>
<Caret Line="26" Column="34"/>
</Position3>
<Position4>
<Filename Value="usimplelazarusbrowser.pas"/>
<Caret Line="118" Column="47" TopLine="56"/>
</Position4>
<Position5>
<Filename Value="usimplelazarusbrowser.pas"/>
<Caret Line="179" Column="36" TopLine="176"/>
</Position5>
<Position6>
<Filename Value="usimplelazarusbrowser.pas"/>
<Caret Line="181" TopLine="19"/>
</Position6>
<Position7>
<Filename Value="usimplelazarusbrowser.pas"/>
<Caret Line="75" Column="83" TopLine="43"/>
</Position7>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

View File

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 201
Left = 407
Height = 574
Top = 182
Top = 183
Width = 878
Caption = 'Initializing browser. Please wait...'
ClientHeight = 574
@ -62,6 +62,7 @@ object Form1: TForm1
OnAfterCreated = Chromium1AfterCreated
OnBeforeClose = Chromium1BeforeClose
OnClose = Chromium1Close
OnOpenUrlFromTab = Chromium1OpenUrlFromTab
left = 40
top = 136
end

View File

@ -67,6 +67,10 @@ type
var noJavascriptAccess: Boolean; var Result: Boolean);
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser;
var aAction : TCefCloseBrowserAction);
procedure Chromium1OpenUrlFromTab(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame;
const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition;
userGesture: Boolean; out Result: Boolean);
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
@ -167,6 +171,15 @@ procedure TForm1.Chromium1BeforePopup(Sender: TObject;
begin
// For simplicity, this demo blocks all popup windows and new tabs
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
end;
procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring;
targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out
Result: Boolean);
begin
// For simplicity, this demo blocks all popup windows and new tabs
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
end;
procedure TForm1.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);

View File

@ -21,7 +21,7 @@
</CompilerOptions>
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
<License Value="MPL 1.1"/>
<Version Major="76" Minor="1" Release="9"/>
<Version Major="76" Minor="1" Release="10"/>
<Files Count="143">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -62,7 +62,7 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 76;
CEF_SUPPORTED_VERSION_MINOR = 1;
CEF_SUPPORTED_VERSION_RELEASE = 9;
CEF_SUPPORTED_VERSION_RELEASE = 10;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 76;
@ -121,6 +121,7 @@ type
FFlashEnabled : boolean;
FEnableMediaStream : boolean;
FEnableSpeechInput : boolean;
FUseFakeUIForMediaStream : boolean;
FEnableGPU : boolean;
FCheckCEFFiles : boolean;
FLibLoaded : boolean;
@ -389,6 +390,7 @@ type
property FlashEnabled : boolean read FFlashEnabled write FFlashEnabled;
property EnableMediaStream : boolean read FEnableMediaStream write FEnableMediaStream;
property EnableSpeechInput : boolean read FEnableSpeechInput write FEnableSpeechInput;
property UseFakeUIForMediaStream : boolean read FUseFakeUIForMediaStream write FUseFakeUIForMediaStream;
property EnableGPU : boolean read FEnableGPU write FEnableGPU;
property CheckCEFFiles : boolean read FCheckCEFFiles write FCheckCEFFiles;
property ShowMessageDlg : boolean read FShowMessageDlg write FShowMessageDlg;
@ -578,6 +580,7 @@ begin
FFlashEnabled := True;
FEnableMediaStream := True;
FEnableSpeechInput := True;
FUseFakeUIForMediaStream := False;
FEnableGPU := False;
FCustomCommandLines := nil;
FCustomCommandLineValues := nil;
@ -1608,6 +1611,9 @@ begin
commandLine.AppendSwitchWithValue('--enable-media-stream', IntToStr(Ord(FEnableMediaStream)));
commandLine.AppendSwitchWithValue('--enable-speech-input', IntToStr(Ord(FEnableSpeechInput)));
if FUseFakeUIForMediaStream then
commandLine.AppendSwitch('--use-fake-ui-for-media-stream');
if not(FEnableGPU) then
begin
commandLine.AppendSwitch('--disable-gpu');

View File

@ -76,7 +76,8 @@ type
public
constructor CreateData(size: Cardinal; owned : boolean = False); virtual;
destructor Destroy; override;
function SameAs(aData : Pointer) : boolean;
function SameAs(aData : Pointer) : boolean; overload;
function SameAs(const aBaseRefCounted : ICefBaseRefCounted) : boolean; overload;
function Wrap: Pointer;
end;
@ -90,7 +91,8 @@ type
public
constructor Create(data: Pointer); virtual;
destructor Destroy; override;
function SameAs(aData : Pointer) : boolean;
function SameAs(aData : Pointer) : boolean; overload;
function SameAs(const aBaseRefCounted : ICefBaseRefCounted) : boolean; overload;
function Wrap: Pointer;
class function UnWrap(data: Pointer): ICefBaseRefCounted;
end;
@ -221,6 +223,26 @@ begin
Result := (FData = aData);
end;
function TCefBaseRefCountedOwn.SameAs(const aBaseRefCounted : ICefBaseRefCounted) : boolean;
var
TempData : Pointer;
begin
Result := False;
if (aBaseRefCounted <> nil) then
begin
TempData := aBaseRefCounted.Wrap;
if (TempData <> nil) then
begin
Result := SameAs(TempData);
if assigned(PCefBaseRefCounted(TempData)^.release) then
PCefBaseRefCounted(TempData)^.release(PCefBaseRefCounted(TempData));
end;
end;
end;
function TCefBaseRefCountedOwn.Wrap: Pointer;
begin
Result := FData;
@ -280,6 +302,26 @@ begin
Result := (FData = aData);
end;
function TCefBaseRefCountedRef.SameAs(const aBaseRefCounted : ICefBaseRefCounted) : boolean;
var
TempData : Pointer;
begin
Result := False;
if (aBaseRefCounted <> nil) then
begin
TempData := aBaseRefCounted.Wrap;
if (TempData <> nil) then
begin
Result := SameAs(TempData);
if assigned(PCefBaseRefCounted(TempData)^.release) then
PCefBaseRefCounted(TempData)^.release(PCefBaseRefCounted(TempData));
end;
end;
end;
class function TCefBaseRefCountedRef.UnWrap(data: Pointer): ICefBaseRefCounted;
begin
if (data <> nil) then

View File

@ -442,7 +442,8 @@ type
ICefBaseRefCounted = interface
['{1F9A7B44-DCDC-4477-9180-3ADD44BDEB7B}']
function Wrap: Pointer;
function SameAs(aData : Pointer) : boolean;
function SameAs(aData : Pointer) : boolean; overload;
function SameAs(const aBaseRefCounted : ICefBaseRefCounted) : boolean; overload;
function HasOneRef : boolean;
function HasAtLeastOneRef : boolean;
end;

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 21,
"InternalVersion" : 22,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "76.1.9.0"
"Version" : "76.1.10.0"
}
],
"UpdatePackageData" : {