1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-09-30 21:28:55 +02:00

Update to CEF 80.1.2

- Added TCEFMediaObserverComponent
- Removed TBufferPanel.OnWrongSize
- Removed TFMXBufferPanel.OnWrongSize
This commit is contained in:
Salvador Díaz Fau
2020-03-29 17:31:42 +02:00
parent beb287e22c
commit 1984ab16ba
61 changed files with 1742 additions and 272 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 80.0.8 which includes Chromium 80.0.3987.132.
CEF4Delphi uses CEF 80.1.2 which includes Chromium 80.0.3987.149.
The CEF binaries used by CEF4Delphi are available for download at spotify :
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_80.0.8%2Bgf96cd1d%2Bchromium-80.0.3987.132_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_80.0.8%2Bgf96cd1d%2Bchromium-80.0.3987.132_windows64.tar.bz2)
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_80.1.2%2Bg9d2a31e%2Bchromium-80.0.3987.149_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_80.1.2%2Bg9d2a31e%2Bchromium-80.0.3987.149_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.6/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@@ -103,7 +103,6 @@ object FMXExternalPumpBrowserFrm: TFMXExternalPumpBrowserFrm
OnMouseWheel = Panel1MouseWheel
OnKeyUp = Panel1KeyUp
OnKeyDown = Panel1KeyDown
OnWrongSize = Panel1WrongSize
end
object chrmosr: TFMXChromium
OnTooltip = chrmosrTooltip

View File

@@ -80,7 +80,6 @@ type
procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean);
procedure Panel1KeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
procedure Panel1KeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState);
procedure Panel1WrongSize(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
@@ -130,7 +129,7 @@ type
function GetMousePosition(var aPoint : TPointF) : boolean;
procedure InitializeLastClick;
function CancelPreviousClick(const x, y : single; var aCurrentTime : integer) : boolean;
function SendCompMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function SendCompMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
function ArePointerEventsSupported : boolean;
function HandlePenEvent(const aID : uint32; aMsg : cardinal) : boolean;
function HandleTouchEvent(const aID : uint32; aMsg : cardinal) : boolean; overload;
@@ -527,11 +526,6 @@ begin
DoResize;
end;
procedure TFMXExternalPumpBrowserFrm.Panel1WrongSize(Sender: TObject);
begin
DoResize;
end;
procedure TFMXExternalPumpBrowserFrm.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
@@ -1148,7 +1142,7 @@ begin
{$ENDIF}
end;
function TFMXExternalPumpBrowserFrm.SendCompMessage(aMsg, wParam : cardinal; lParam : integer) : boolean;
function TFMXExternalPumpBrowserFrm.SendCompMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
{$IFDEF MSWINDOWS}
var
TempHandle : TWinWindowHandle;
@@ -1156,7 +1150,7 @@ var
begin
{$IFDEF MSWINDOWS}
TempHandle := WindowHandleToPlatform(Handle);
Result := WinApi.Windows.PostMessage(TempHandle.Wnd, aMsg, wParam, lParam);
Result := WinApi.Windows.PostMessage(TempHandle.Wnd, aMsg, aWParam, aLParam);
{$ELSE}
Result := False;
{$ENDIF}

View File

@@ -109,7 +109,7 @@ type
property NextTabID : cardinal read GetNextTabID;
public
function PostCustomMessage(aMessage : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
procedure NotifyMoveOrResizeStarted;
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
end;
@@ -452,7 +452,7 @@ begin
end;
end;
function TMainForm.PostCustomMessage(aMessage, wParam : cardinal; lParam : integer) : boolean;
function TMainForm.PostCustomMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
{$IFDEF MSWINDOWS}
var
TempHWND : HWND;
@@ -460,7 +460,7 @@ var
begin
{$IFDEF MSWINDOWS}
TempHWND := FmxHandleToHWND(Handle);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMessage, wParam, lParam);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMsg, aWParam, aLParam);
{$ELSE}
Result := False;
{$ENDIF}

View File

@@ -127,7 +127,6 @@ object BrowserFrame: TBrowserFrame
OnMouseWheel = FMXBufferPanel1MouseWheel
OnKeyUp = FMXBufferPanel1KeyUp
OnKeyDown = FMXBufferPanel1KeyDown
OnWrongSize = FMXBufferPanel1WrongSize
end
object FMXChromium1: TFMXChromium
OnLoadError = FMXChromium1LoadError

View File

@@ -75,7 +75,6 @@ type
procedure FMXBufferPanel1Enter(Sender: TObject);
procedure FMXBufferPanel1Exit(Sender: TObject);
procedure FMXBufferPanel1Resize(Sender: TObject);
procedure FMXBufferPanel1WrongSize(Sender: TObject);
procedure FMXBufferPanel1Click(Sender: TObject);
procedure FMXBufferPanel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
procedure FMXBufferPanel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single);
@@ -518,11 +517,6 @@ begin
DoResize;
end;
procedure TBrowserFrame.FMXBufferPanel1WrongSize(Sender: TObject);
begin
DoResize;
end;
procedure TBrowserFrame.FMXChromium1AddressChange(Sender: TObject;
const browser: ICefBrowser; const frame: ICefFrame; const url: ustring);
begin

View File

@@ -101,7 +101,7 @@ type
procedure HandleSYSKEYDOWN(const aMessage : TMsg);
procedure HandleSYSKEYUP(const aMessage : TMsg);
function HandlePOINTER(const aMessage : TMsg) : boolean;
function PostCustomMessage(aMessage : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
procedure NotifyMoveOrResizeStarted;
function GetMousePosition(var aPoint : TPointF) : boolean;
procedure SetBounds(ALeft: Integer; ATop: Integer; AWidth: Integer; AHeight: Integer); override;
@@ -346,12 +346,12 @@ begin
end;
end;
function TMainForm.PostCustomMessage(aMessage, wParam : cardinal; lParam : integer) : boolean;
function TMainForm.PostCustomMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
var
TempHWND : HWND;
begin
TempHWND := FmxHandleToHWND(Handle);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMessage, wParam, lParam);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMsg, aWParam, aLParam);
end;
procedure TMainForm.BrowserTabCtrlChange(Sender: TObject);

View File

@@ -83,7 +83,7 @@ type
procedure ResizeChild;
procedure CreateFMXWindowParent;
function GetFMXWindowParentRect : System.Types.TRect;
function PostCustomMessage(aMessage : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
procedure NotifyMoveOrResizeStarted;
{$IFDEF MSWINDOWS}
@@ -119,7 +119,7 @@ uses
// 3. TFMXChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
function TChildForm.PostCustomMessage(aMessage, wParam : cardinal; lParam : integer) : boolean;
function TChildForm.PostCustomMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
{$IFDEF MSWINDOWS}
var
TempHWND : HWND;
@@ -131,7 +131,7 @@ begin
if (Handle <> nil) then
begin
TempHWND := FmxHandleToHWND(Handle);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMessage, wParam, lParam);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMsg, aWParam, aLParam);
end;
{$ENDIF}
end;

View File

@@ -74,7 +74,7 @@ type
procedure CreateToolboxChild(const ChildCaption, URL: string);
procedure CloseAllChildForms;
function PostCustomMessage(aMessage : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
protected
{$IFDEF MSWINDOWS}
@@ -148,7 +148,7 @@ begin
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
end;
function TMainForm.PostCustomMessage(aMessage, wParam : cardinal; lParam : integer) : boolean;
function TMainForm.PostCustomMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
{$IFDEF MSWINDOWS}
var
TempHWND : HWND;
@@ -160,7 +160,7 @@ begin
if (Handle <> nil) then
begin
TempHWND := FmxHandleToHWND(Handle);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMessage, wParam, lParam);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMsg, aWParam, aLParam);
end;
{$ENDIF}
end;

View File

@@ -102,7 +102,7 @@ type
procedure ResizeChild;
procedure CreateFMXWindowParent;
function GetFMXWindowParentRect : System.Types.TRect;
function PostCustomMessage(aMessage : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function PostCustomMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
{$IFDEF MSWINDOWS}
function GetCurrentWindowState : TWindowState;
@@ -235,7 +235,7 @@ begin
end;
end;
function TSimpleFMXBrowserFrm.PostCustomMessage(aMessage, wParam : cardinal; lParam : integer) : boolean;
function TSimpleFMXBrowserFrm.PostCustomMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
{$IFDEF MSWINDOWS}
var
TempHWND : HWND;
@@ -243,7 +243,7 @@ var
begin
{$IFDEF MSWINDOWS}
TempHWND := FmxHandleToHWND(Handle);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMessage, wParam, lParam);
Result := (TempHWND <> 0) and WinApi.Windows.PostMessage(TempHWND, aMsg, aWParam, aLParam);
{$ELSE}
Result := False;
{$ENDIF}

View File

@@ -335,7 +335,7 @@ end;
procedure TCookieVisitorFrm.Chromium1CookieSet(Sender: TObject;
aSuccess: Boolean; aID: Integer);
begin
PostMessage(Handle, MINIBROWSER_COOKIESET, ord(aSuccess), aID);
PostMessage(Handle, MINIBROWSER_COOKIESET, WPARAM(aSuccess), aID);
end;
procedure TCookieVisitorFrm.Chromium1CookiesVisited(Sender: TObject;

View File

@@ -31,7 +31,6 @@ object Form1: TForm1
OnPointerDown = Panel1PointerDown
OnPointerUp = Panel1PointerUp
OnPointerUpdate = Panel1PointerUpdate
OnWrongSize = Panel1WrongSize
Align = alClient
Caption = 'Panel1'
TabOrder = 0

View File

@@ -89,7 +89,6 @@ type
procedure Panel1PointerDown(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
procedure Panel1PointerUp(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
procedure Panel1PointerUpdate(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
procedure Panel1WrongSize(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
@@ -939,11 +938,6 @@ begin
DoResize;
end;
procedure TForm1.Panel1WrongSize(Sender: TObject);
begin
DoResize;
end;
procedure TForm1.PendingResizeMsg(var aMessage : TMessage);
begin
DoResize;

View File

@@ -824,12 +824,12 @@ end;
procedure TMiniBrowserFrm.Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean);
begin
PostMessage(Handle, MINIBROWSER_PDFPRINT_END, 0, ord(aResultOK));
PostMessage(Handle, MINIBROWSER_PDFPRINT_END, 0, LPARAM(aResultOK));
end;
procedure TMiniBrowserFrm.Chromium1PrefsAvailable(Sender: TObject; aResultOK: Boolean);
begin
PostMessage(Handle, MINIBROWSER_PREFS_AVLBL, 0, ord(aResultOK));
PostMessage(Handle, MINIBROWSER_PREFS_AVLBL, 0, LPARAM(aResultOK));
end;
procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject;

View File

@@ -114,7 +114,6 @@ object Form1: TForm1
OnPointerUp = Panel1PointerUp
OnPointerUpdate = Panel1PointerUpdate
OnPaintParentBkg = Panel1PaintParentBkg
OnWrongSize = Panel1WrongSize
Align = alClient
Ctl3D = False
ParentCtl3D = False

View File

@@ -92,7 +92,6 @@ type
procedure Panel1PointerDown(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
procedure Panel1PointerUp(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
procedure Panel1PointerUpdate(Sender: TObject; var aMessage: TMessage; var aHandled: Boolean);
procedure Panel1WrongSize(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
@@ -182,8 +181,45 @@ uses
{$ENDIF}
uCEFMiscFunctions, uCEFApplication;
// Chromium renders the web contents asynchronously. It uses multiple processes
// and threads which makes it complicated to keep the correct browser size.
// In one hand you have the main application thread where the form is resized by
// the user. On the other hand, Chromium renders the contents asynchronously
// with the last browser size available, which may have changed by the time
// Chromium renders the page.
// For this reason we need to keep checking the real size and call
// TChromium.WasResized when we detect that Chromium has an incorrect size.
// TChromium.WasResized triggers the TChromium.OnGetViewRect event to let CEF
// read the current browser size and then it triggers TChromium.OnPaint when the
// contents are finally rendered.
// TChromium.WasResized --> (time passes) --> TChromium.OnGetViewRect --> (time passes) --> TChromium.OnPaint
// You have to assume that the real browser size can change between those calls
// and events.
// This demo uses a couple of fields called "FResizing" and "FPendingResize" to
// reduce the number of TChromium.WasResized calls.
// FResizing is set to True before the TChromium.WasResized call and it's set to
// False at the end of the TChromium.OnPaint event.
// FPendingResize is set to True when the browser changed its size while
// FResizing was True. The FPendingResize value is checked at the end of
// TChromium.OnPaint to check the browser size again because it changed while
// Chromium was rendering the page.
// The TChromium.OnPaint event in the demo also calls
// TBufferPanel.UpdateBufferDimensions and TBufferPanel.BufferIsResized to check
// the width and height of the buffer parameter, and the internal buffer size in
// the TBufferPanel component.
// This is the destruction sequence in OSR mode :
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True).
// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and
// calls chrmosr.CloseBrowser(True).
// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to
// set "Result" to false and CEF will destroy the internal browser immediately.
// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed.
@@ -1114,11 +1150,6 @@ begin
DoResize;
end;
procedure TForm1.Panel1WrongSize(Sender: TObject);
begin
DoResize;
end;
procedure TForm1.PendingResizeMsg(var aMessage : TMessage);
begin
DoResize;

View File

@@ -103,6 +103,8 @@ type
procedure NotifyMoveOrResizeStarted;
procedure CreateBrowser;
procedure CloseBrowser;
procedure ShowBrowser;
procedure HideBrowser;
property Closing : boolean read FClosing;
property Homepage : string read FHomepage write FHomepage;
@@ -155,6 +157,20 @@ begin
end;
end;
procedure TBrowserFrame.ShowBrowser;
begin
Chromium1.WasHidden(False);
Chromium1.SendFocusEvent(True);
Chromium1.AudioMuted := False;
end;
procedure TBrowserFrame.HideBrowser;
begin
Chromium1.SendFocusEvent(False);
Chromium1.WasHidden(True);
Chromium1.AudioMuted := True;
end;
procedure TBrowserFrame.ForwardBtnClick(Sender: TObject);
begin
Chromium1.GoForward;

View File

@@ -59,7 +59,7 @@ type
function GetParentForm : TCustomForm;
function PostFormMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function PostFormMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
procedure BrowserFrame_OnBrowserDestroyed(Sender: TObject);
procedure BrowserFrame_OnBrowserTitleChange(Sender: TObject; const aTitle : string);
@@ -71,6 +71,8 @@ type
procedure NotifyMoveOrResizeStarted;
procedure CreateBrowser(const aHomepage : string);
procedure CloseBrowser;
procedure ShowBrowser;
procedure HideBrowser;
property TabID : cardinal read FTabID;
end;
@@ -104,14 +106,14 @@ begin
Result := nil;
end;
function TBrowserTab.PostFormMessage(aMsg, wParam : cardinal; lParam : integer) : boolean;
function TBrowserTab.PostFormMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
var
TempForm : TCustomForm;
begin
TempForm := ParentForm;
Result := (TempForm <> nil) and
TempForm.HandleAllocated and
PostMessage(TempForm.Handle, aMsg, wParam, lParam);
PostMessage(TempForm.Handle, aMsg, aWParam, aLParam);
end;
procedure TBrowserTab.NotifyMoveOrResizeStarted;
@@ -137,6 +139,16 @@ begin
if (FBrowserFrame <> nil) then FBrowserFrame.CloseBrowser;
end;
procedure TBrowserTab.ShowBrowser;
begin
if (FBrowserFrame <> nil) then FBrowserFrame.ShowBrowser;
end;
procedure TBrowserTab.HideBrowser;
begin
if (FBrowserFrame <> nil) then FBrowserFrame.HideBrowser;
end;
procedure TBrowserTab.BrowserFrame_OnBrowserDestroyed(Sender: TObject);
begin
// This event is executed in a CEF thread so we have to send a message to

View File

@@ -253,7 +253,7 @@ end;
procedure TCookieVisitorFrm.Chromium1CookieSet(Sender: TObject;
aSuccess: boolean; aID: integer);
begin
PostMessage(Handle, MINIBROWSER_COOKIESET, ord(aSuccess), aID);
PostMessage(Handle, MINIBROWSER_COOKIESET, WPARAM(aSuccess), aID);
end;
procedure TCookieVisitorFrm.Chromium1CookiesVisited(Sender: TObject;

View File

@@ -836,12 +836,12 @@ end;
procedure TMiniBrowserFrm.Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean);
begin
PostMessage(Handle, MINIBROWSER_PDFPRINT_END, 0, ord(aResultOK));
PostMessage(Handle, MINIBROWSER_PDFPRINT_END, 0, LPARAM(aResultOK));
end;
procedure TMiniBrowserFrm.Chromium1PrefsAvailable(Sender: TObject; aResultOK: Boolean);
begin
PostMessage(Handle, MINIBROWSER_PREFS_AVLBL, 0, ord(aResultOK));
PostMessage(Handle, MINIBROWSER_PREFS_AVLBL, 0, LPARAM(aResultOK));
end;
procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject;

View File

@@ -4,13 +4,13 @@
<PathDelim Value="\"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="6">
<Units Count="10">
<Unit0>
<Filename Value="OSRExternalPumpBrowser.lpr"/>
<IsPartOfProject Value="True"/>
<TopLine Value="41"/>
<CursorPos X="63" Y="61"/>
<UsageCount Value="26"/>
<UsageCount Value="27"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit0>
@@ -22,9 +22,9 @@
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="456"/>
<CursorPos X="19" Y="488"/>
<UsageCount Value="26"/>
<TopLine Value="31"/>
<CursorPos X="117" Y="38"/>
<UsageCount Value="27"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
@@ -58,127 +58,153 @@
<CursorPos Y="5683"/>
<UsageCount Value="10"/>
</Unit5>
<Unit6>
<Filename Value="..\..\..\source\uCEFMediaObserver.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="266"/>
<CursorPos X="13" Y="86"/>
<UsageCount Value="10"/>
</Unit6>
<Unit7>
<Filename Value="..\..\..\source\uCEFLinkedWindowParent.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="61"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="..\..\..\source\uCEFChromiumCore.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="904"/>
<CursorPos Y="925"/>
<UsageCount Value="10"/>
</Unit8>
<Unit9>
<Filename Value="..\..\..\source\uCEFMediaObserverComponent.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="115"/>
<UsageCount Value="10"/>
</Unit9>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="271" TopLine="270"/>
<Caret Line="286" Column="70" TopLine="270"/>
</Position1>
<Position2>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="286" Column="70" TopLine="270"/>
<Caret Line="307" Column="11" TopLine="295"/>
</Position2>
<Position3>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="307" Column="11" TopLine="295"/>
<Caret Line="322" TopLine="313"/>
</Position3>
<Position4>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="322" TopLine="313"/>
<Caret Line="503" Column="53" TopLine="488"/>
</Position4>
<Position5>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="503" Column="53" TopLine="488"/>
<Caret Line="92" Column="27" TopLine="92"/>
</Position5>
<Position6>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="92" Column="27" TopLine="92"/>
<Caret Line="503" Column="11" TopLine="499"/>
</Position6>
<Position7>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="503" Column="11" TopLine="499"/>
<Caret Line="201" Column="11" TopLine="166"/>
</Position7>
<Position8>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="201" Column="11" TopLine="166"/>
<Caret Line="982" Column="68" TopLine="963"/>
</Position8>
<Position9>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="982" Column="68" TopLine="963"/>
<Caret Line="307" Column="39" TopLine="301"/>
</Position9>
<Position10>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="307" Column="39" TopLine="301"/>
<Caret Line="82" Column="44" TopLine="77"/>
</Position10>
<Position11>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="82" Column="44" TopLine="77"/>
<Caret Line="957" TopLine="939"/>
</Position11>
<Position12>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="957" TopLine="939"/>
<Caret Line="958" TopLine="939"/>
</Position12>
<Position13>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="958" TopLine="939"/>
<Caret Line="957" TopLine="939"/>
</Position13>
<Position14>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="957" TopLine="939"/>
<Caret Line="958" TopLine="939"/>
</Position14>
<Position15>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="958" TopLine="939"/>
<Caret Line="960" TopLine="939"/>
</Position15>
<Position16>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="960" TopLine="939"/>
</Position16>
<Position17>
<Filename Value="OSRExternalPumpBrowser.lpr"/>
<Caret Line="61" Column="63" TopLine="41"/>
</Position16>
<Position17>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="169" Column="11" TopLine="153"/>
</Position17>
<Position18>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="169" Column="11" TopLine="153"/>
<Caret Line="198" TopLine="176"/>
</Position18>
<Position19>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="198" TopLine="176"/>
<Caret Line="170" Column="82" TopLine="148"/>
</Position19>
<Position20>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="170" Column="82" TopLine="148"/>
<Caret Line="217" Column="51" TopLine="196"/>
</Position20>
<Position21>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="217" Column="51" TopLine="196"/>
<Caret Line="105" Column="30" TopLine="71"/>
</Position21>
<Position22>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="105" Column="30" TopLine="71"/>
<Caret Line="282" TopLine="278"/>
</Position22>
<Position23>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="282" TopLine="278"/>
<Caret Line="945" Column="91" TopLine="926"/>
</Position23>
<Position24>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="945" Column="91" TopLine="926"/>
<Caret Line="944" Column="91" TopLine="925"/>
</Position24>
<Position25>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="944" Column="91" TopLine="925"/>
<Caret Line="943" Column="110" TopLine="925"/>
</Position25>
<Position26>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="943" Column="110" TopLine="925"/>
<Caret Line="7" Column="109"/>
</Position26>
<Position27>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="7" Column="109"/>
<Caret Line="168" Column="26" TopLine="145"/>
</Position27>
<Position28>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="168" Column="26" TopLine="145"/>
<Caret Line="337" Column="52" TopLine="312"/>
</Position28>
<Position29>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="337" Column="52" TopLine="312"/>
<Caret Line="94" Column="15" TopLine="81"/>
</Position29>
<Position30>
<Filename Value="uOSRExternalPumpBrowser.pas"/>
<Caret Line="94" Column="15" TopLine="81"/>
<Caret Line="488" Column="19" TopLine="456"/>
</Position30>
</JumpHistory>
<RunParams>

View File

@@ -1,98 +0,0 @@
object SimpleExternalPumpBrowserFrm: TSimpleExternalPumpBrowserFrm
Left = 0
Top = 0
Caption = 'Initializing browser. Please wait...'
ClientHeight = 624
ClientWidth = 1038
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object AddressPnl: TPanel
Left = 0
Top = 0
Width = 1038
Height = 30
Align = alTop
BevelOuter = bvNone
Enabled = False
Padding.Left = 5
Padding.Top = 5
Padding.Right = 5
Padding.Bottom = 5
ShowCaption = False
TabOrder = 0
object GoBtn: TButton
Left = 1002
Top = 5
Width = 31
Height = 20
Margins.Left = 5
Align = alRight
Caption = 'Go'
TabOrder = 0
OnClick = GoBtnClick
end
object URLCbx: TComboBox
Left = 5
Top = 5
Width = 997
Height = 21
Align = alClient
ItemIndex = 0
TabOrder = 1
Text = 'https://www.google.com'
Items.Strings = (
'https://www.google.com'
'https://www.whatismybrowser.com/detect/what-http-headers-is-my-b' +
'rowser-sending'
'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close'
'https://www.w3schools.com/html/html5_video.asp'
'http://www.adobe.com/software/flash/about/'
'http://isflashinstalled.com/'
'chrome://version/'
'http://html5test.com/'
'https://www.w3schools.com/'
'http://webglsamples.org/'
'https://get.webgl.org/'
'https://www.youtube.com'
'https://html5demos.com/drag/'
'https://developers.google.com/maps/documentation/javascript/exam' +
'ples/streetview-embed?hl=fr'
'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe' +
'_name'
'https://www.browserleaks.com/webrtc'
'https://frames-per-second.appspot.com/')
end
end
object ChromiumWindow1: TChromiumWindow
Left = 0
Top = 30
Width = 1038
Height = 594
Align = alClient
TabOrder = 1
OnClose = ChromiumWindow1Close
OnBeforeClose = ChromiumWindow1BeforeClose
OnAfterCreated = ChromiumWindow1AfterCreated
end
object Timer1: TTimer
Enabled = False
Interval = 300
OnTimer = Timer1Timer
Left = 56
Top = 88
end
end

View File

@@ -4,12 +4,13 @@
<PathDelim Value="\"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="27">
<Units Count="28">
<Unit0>
<Filename Value="SimpleOSRBrowser.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="34"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="30"/>
<CursorPos X="77" Y="11"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
@@ -37,9 +38,8 @@
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<TopLine Value="359"/>
<CursorPos X="23" Y="375"/>
<TopLine Value="43"/>
<CursorPos X="93" Y="376"/>
<UsageCount Value="42"/>
<Bookmarks Count="1">
<Item0 X="40" Y="262" ID="4"/>
@@ -228,8 +228,16 @@
<CursorPos X="67" Y="17"/>
<UsageCount Value="10"/>
</Unit26>
<Unit27>
<Filename Value="..\..\..\source\uCEFBufferPanel.pas"/>
<EditorIndex Value="1"/>
<TopLine Value="417"/>
<CursorPos X="10" Y="400"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit27>
</Units>
<JumpHistory Count="17" HistoryIndex="16">
<JumpHistory Count="20" HistoryIndex="19">
<Position1>
<Filename Value="usimplelazosrbrowser.pas"/>
<Caret Line="204" Column="63" TopLine="19"/>
@@ -298,6 +306,18 @@
<Filename Value="usimplelazosrbrowser.pas"/>
<Caret Line="91" Column="15" TopLine="85"/>
</Position17>
<Position18>
<Filename Value="usimplelazosrbrowser.pas"/>
<Caret Line="376" Column="93" TopLine="43"/>
</Position18>
<Position19>
<Filename Value="..\..\..\source\uCEFBufferPanel.pas"/>
<Caret Line="154" Column="57" TopLine="135"/>
</Position19>
<Position20>
<Filename Value="..\..\..\source\uCEFBufferPanel.pas"/>
<Caret Line="263" TopLine="269"/>
</Position20>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

View File

@@ -1,4 +1,4 @@
// ************************************************************************
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
@@ -56,7 +56,7 @@ type
function GetParentForm : TCustomForm;
function PostFormMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function PostFormMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
procedure BrowserFrame_OnBrowserDestroyed(Sender: TObject);
procedure BrowserFrame_OnBrowserTitleChange(Sender: TObject; const aTitle : string);
@@ -101,14 +101,14 @@ begin
Result := nil;
end;
function TBrowserTab.PostFormMessage(aMsg, wParam : cardinal; lParam : integer) : boolean;
function TBrowserTab.PostFormMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
var
TempForm : TCustomForm;
begin
TempForm := ParentForm;
Result := (TempForm <> nil) and
TempForm.HandleAllocated and
PostMessage(TempForm.Handle, aMsg, wParam, lParam);
PostMessage(TempForm.Handle, aMsg, aWParam, aLParam);
end;
procedure TBrowserTab.NotifyMoveOrResizeStarted;

View File

@@ -22,7 +22,7 @@ package CEF4Delphi;
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $54C00000}
{$IMAGEBASE $400000}
{$DEFINE DEBUG}
{$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'CEF4Delphi'}
@@ -175,7 +175,16 @@ contains
uCEFResourceReadCallback in '..\source\uCEFResourceReadCallback.pas',
uCEFSentinel in '..\source\uCEFSentinel.pas',
uCEFApplicationCore in '..\source\uCEFApplicationCore.pas',
uCEFOAuth2Helper in '..\source\uCEFOAuth2Helper.pas';
uCEFOAuth2Helper in '..\source\uCEFOAuth2Helper.pas',
uCEFMediaObserver in '..\source\uCEFMediaObserver.pas',
uCEFMediaRoute in '..\source\uCEFMediaRoute.pas',
uCEFMediaRouteCreateCallback in '..\source\uCEFMediaRouteCreateCallback.pas',
uCEFMediaRouter in '..\source\uCEFMediaRouter.pas',
uCEFMediaSink in '..\source\uCEFMediaSink.pas',
uCEFMediaSource in '..\source\uCEFMediaSource.pas',
uCEFRegistration in '..\source\uCEFRegistration.pas',
uCEFMediaObserverComponent in '..\source\uCEFMediaObserverComponent.pas',
uCEFMediaObserverEvents in '..\source\uCEFMediaObserverEvents.pas';
end.

View File

@@ -270,6 +270,15 @@
<DCCReference Include="..\source\uCEFSentinel.pas"/>
<DCCReference Include="..\source\uCEFApplicationCore.pas"/>
<DCCReference Include="..\source\uCEFOAuth2Helper.pas"/>
<DCCReference Include="..\source\uCEFMediaObserver.pas"/>
<DCCReference Include="..\source\uCEFMediaRoute.pas"/>
<DCCReference Include="..\source\uCEFMediaRouteCreateCallback.pas"/>
<DCCReference Include="..\source\uCEFMediaRouter.pas"/>
<DCCReference Include="..\source\uCEFMediaSink.pas"/>
<DCCReference Include="..\source\uCEFMediaSource.pas"/>
<DCCReference Include="..\source\uCEFRegistration.pas"/>
<DCCReference Include="..\source\uCEFMediaObserverComponent.pas"/>
<DCCReference Include="..\source\uCEFMediaObserverEvents.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>

View File

@@ -172,6 +172,15 @@ contains
uCEFResourceReadCallback in '..\source\uCEFResourceReadCallback.pas',
uCEFSentinel in '..\source\uCEFSentinel.pas',
uCEFApplicationCore in '..\source\uCEFApplicationCore.pas',
uCEFOAuth2Helper in '..\source\uCEFOAuth2Helper.pas';
uCEFOAuth2Helper in '..\source\uCEFOAuth2Helper.pas',
uCEFMediaSource in '..\source\uCEFMediaSource.pas',
uCEFMediaSink in '..\source\uCEFMediaSink.pas',
uCEFMediaRouteCreateCallback in '..\source\uCEFMediaRouteCreateCallback.pas',
uCEFMediaRoute in '..\source\uCEFMediaRoute.pas',
uCEFMediaObserver in '..\source\uCEFMediaObserver.pas',
uCEFMediaRouter in '..\source\uCEFMediaRouter.pas',
uCEFRegistration in '..\source\uCEFRegistration.pas',
uCEFMediaObserverComponent in '..\source\uCEFMediaObserverComponent.pas',
uCEFMediaObserverEvents in '..\source\uCEFMediaObserverEvents.pas';
end.

View File

@@ -50,13 +50,14 @@ implementation
uses
Classes,
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFBufferPanel, uCEFWorkScheduler,
uCEFServerComponent, uCEFLinkedWindowParent, uCEFUrlRequestClientComponent, uCEFSentinel;
uCEFServerComponent, uCEFLinkedWindowParent, uCEFUrlRequestClientComponent, uCEFSentinel,
uCEFMediaObserverComponent;
procedure Register;
begin
RegisterComponents('Chromium', [TChromium, TCEFWindowParent, TChromiumWindow, TBufferPanel,
TCEFWorkScheduler, TCEFServerComponent, TCEFLinkedWindowParent,
TCEFUrlRequestClientComponent, TCEFSentinel]);
TCEFUrlRequestClientComponent, TCEFSentinel, TCEFMediaObserverComponent]);
end;
end.

View File

@@ -180,7 +180,16 @@ contains
uCEFResourceReadCallback in '..\source\uCEFResourceReadCallback.pas',
uCEFSentinel in '..\source\uCEFSentinel.pas',
uCEFApplicationCore in '..\source\uCEFApplicationCore.pas',
uCEFOAuth2Helper in '..\source\uCEFOAuth2Helper.pas';
uCEFOAuth2Helper in '..\source\uCEFOAuth2Helper.pas',
uCEFMediaSource in '..\source\uCEFMediaSource.pas',
uCEFMediaSink in '..\source\uCEFMediaSink.pas',
uCEFMediaRouteCreateCallback in '..\source\uCEFMediaRouteCreateCallback.pas',
uCEFMediaRoute in '..\source\uCEFMediaRoute.pas',
uCEFMediaObserver in '..\source\uCEFMediaObserver.pas',
uCEFMediaRouter in '..\source\uCEFMediaRouter.pas',
uCEFRegistration in '..\source\uCEFRegistration.pas',
uCEFMediaObserverComponent in '..\source\uCEFMediaObserverComponent.pas',
uCEFMediaObserverEvents in '..\source\uCEFMediaObserverEvents.pas';
end.

View File

@@ -296,6 +296,15 @@
<DCCReference Include="..\source\uCEFSentinel.pas"/>
<DCCReference Include="..\source\uCEFApplicationCore.pas"/>
<DCCReference Include="..\source\uCEFOAuth2Helper.pas"/>
<DCCReference Include="..\source\uCEFMediaSource.pas"/>
<DCCReference Include="..\source\uCEFMediaSink.pas"/>
<DCCReference Include="..\source\uCEFMediaRouteCreateCallback.pas"/>
<DCCReference Include="..\source\uCEFMediaRoute.pas"/>
<DCCReference Include="..\source\uCEFMediaObserver.pas"/>
<DCCReference Include="..\source\uCEFMediaRouter.pas"/>
<DCCReference Include="..\source\uCEFRegistration.pas"/>
<DCCReference Include="..\source\uCEFMediaObserverComponent.pas"/>
<DCCReference Include="..\source\uCEFMediaObserverEvents.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>

View File

@@ -52,7 +52,7 @@ uses
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFBufferPanel,
uCEFWorkScheduler, uCEFFMXBufferPanel, uCEFFMXChromium, uCEFFMXWorkScheduler,
uCEFServerComponent, uCEFLinkedWindowParent, uCEFUrlRequestClientComponent,
uCEFSentinel;
uCEFSentinel, uCEFMediaObserverComponent;
procedure Register;
begin
@@ -61,7 +61,7 @@ begin
TFMXWorkScheduler, TCEFWorkScheduler,
TCEFServerComponent, TCEFLinkedWindowParent,
TCEFUrlRequestClientComponent,
TCEFSentinel]);
TCEFSentinel, TCEFMediaObserverComponent]);
end;
end.

View File

@@ -53,14 +53,17 @@ uses
{$ELSE}
Classes,
{$ENDIF}
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFBufferPanel, uCEFWorkScheduler,
uCEFServerComponent, uCEFLinkedWindowParent, uCEFUrlRequestClientComponent, uCEFSentinel;
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFBufferPanel,
uCEFWorkScheduler, uCEFServerComponent, uCEFLinkedWindowParent,
uCEFUrlRequestClientComponent, uCEFSentinel, uCEFMediaObserverComponent;
procedure Register;
begin
RegisterComponents('Chromium', [TChromium, TCEFWindowParent, TChromiumWindow, TBufferPanel,
TCEFWorkScheduler, TCEFServerComponent, TCEFLinkedWindowParent,
TCEFUrlRequestClientComponent, TCEFSentinel]);
RegisterComponents('Chromium', [TChromium, TCEFWindowParent, TChromiumWindow,
TBufferPanel, TCEFWorkScheduler,
TCEFServerComponent, TCEFLinkedWindowParent,
TCEFUrlRequestClientComponent, TCEFSentinel,
TCEFMediaObserverComponent]);
end;
end.

View File

@@ -21,8 +21,8 @@
</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="80" Release="8"/>
<Files Count="147">
<Version Major="80" Minor="1" Release="2"/>
<Files Count="156">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
<UnitName Value="uCEFAccessibilityHandler"/>
@@ -620,6 +620,43 @@
<Filename Value="..\source\uCEFOAuth2Helper.pas"/>
<UnitName Value="uCEFOAuth2Helper"/>
</Item147>
<Item148>
<Filename Value="..\source\uCEFMediaObserver.pas"/>
<UnitName Value="uCEFMediaObserver"/>
</Item148>
<Item149>
<Filename Value="..\source\uCEFMediaObserverComponent.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="uCEFMediaObserverComponent"/>
</Item149>
<Item150>
<Filename Value="..\source\uCEFMediaObserverEvents.pas"/>
<UnitName Value="uCEFMediaObserverEvents"/>
</Item150>
<Item151>
<Filename Value="..\source\uCEFMediaRoute.pas"/>
<UnitName Value="uCEFMediaRoute"/>
</Item151>
<Item152>
<Filename Value="..\source\uCEFMediaRouteCreateCallback.pas"/>
<UnitName Value="uCEFMediaRouteCreateCallback"/>
</Item152>
<Item153>
<Filename Value="..\source\uCEFMediaRouter.pas"/>
<UnitName Value="uCEFMediaRouter"/>
</Item153>
<Item154>
<Filename Value="..\source\uCEFMediaSink.pas"/>
<UnitName Value="uCEFMediaSink"/>
</Item154>
<Item155>
<Filename Value="..\source\uCEFMediaSource.pas"/>
<UnitName Value="uCEFMediaSource"/>
</Item155>
<Item156>
<Filename Value="..\source\uCEFRegistration.pas"/>
<UnitName Value="uCEFRegistration"/>
</Item156>
</Files>
<RequiredPkgs Count="4">
<Item1>

View File

@@ -50,7 +50,10 @@ uses
uCEFUrlRequestClientComponent, uCEFOSRIMEHandler, uCEFCookieAccessFilter,
uCEFResourceReadCallback, uCEFResourceRequestHandler,
uCEFResourceSkipCallback, uCEFSentinel, uCEFApplicationCore,
uCEFOAuth2Helper, LazarusPackageIntf;
uCEFOAuth2Helper, uCEFMediaObserver, uCEFMediaObserverComponent,
uCEFMediaObserverEvents, uCEFMediaRoute, uCEFMediaRouteCreateCallback,
uCEFMediaRouter, uCEFMediaSink, uCEFMediaSource, uCEFRegistration,
LazarusPackageIntf;
implementation
@@ -66,6 +69,8 @@ begin
RegisterUnit('uCEFUrlRequestClientComponent',
@uCEFUrlRequestClientComponent.Register);
RegisterUnit('uCEFSentinel', @uCEFSentinel.Register);
RegisterUnit('uCEFMediaObserverComponent',
@uCEFMediaObserverComponent.Register);
end;
initialization

View File

@@ -6,4 +6,5 @@ c:\lazarus\tools\lazres.exe ..\..\source\res\tcefworkscheduler.lrs tcefworksched
c:\lazarus\tools\lazres.exe ..\..\source\res\tchromium.lrs tchromium.png
c:\lazarus\tools\lazres.exe ..\..\source\res\tchromiumwindow.lrs tchromiumwindow.png
c:\lazarus\tools\lazres.exe ..\..\source\res\tcefurlrequestclientcomponent.lrs tcefurlrequestclientcomponent.png
c:\lazarus\tools\lazres.exe ..\..\source\res\tcefmediaobservercomponent.lrs tcefmediaobservercomponent.png
pause

Binary file not shown.

View File

@@ -10,3 +10,4 @@ TFMXWorkScheduler BITMAP "workscheduler.bmp"
TCEFServerComponent BITMAP "server.bmp"
TCEFUrlRequestClientComponent BITMAP "tcefurlrequestclientcomponent.bmp"
TCEFSentinel BITMAP "tcefsentinel.bmp"
TCEFMediaObserverComponent BITMAP "tcefmediaobservercomponent.bmp"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 B

View File

@@ -0,0 +1,41 @@
LazarusResources.Add('tcefmediaobservercomponent','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#3'NIDATx'#218#236#149
+';H'#155'Q'#20#199'O'#222#205#163'&1'#26'c(D'#173#17#137#165'>'#161'T'#176
+#226#11'\'#138' 8'#22#29#186'uq'#176'K'#199#14'.A'#7'7'#7'A('#182#179#184'd'
+#136'C'#16#130#214#7'!'#193#162#245#17#18'k'#242'Uc'#30#26#147'*1'#233#255'D'
+'#)H;'#20'7'#15#252#248#174#247#158#251'?'#247#156'{r'#21#229'r9'#186'O'#19
+#211'='#219'C'#128#127#154'H,'#190#142'Q'#184#236#162'K/'#1#173#160#19#212#0
+#19#208#222#172'%'#128#0#246#129#11#172#131#211#188#160'HD'#127'|'#239#8'P'
+#138#207#27#240#26#232','#22#139#162#186#186#250'Q:'#157#150#135#195'a)'#251
+'TVVf'#148'J'#229#165#223#239#255#21#8#4'.0'#21#7#11#224#19#132#163#127#11
+#208#14#222#235#245'z'#243#192#192'@E'#127#127#127#153#201'dR'#207#206#206
+#210#198#198#198#237'&'#246'mii'#161#145#145#17#18#4#225#220#225'pD'#230#231
+#231#127#198'b'#177#16#150#237#192']'#240#149#20#6#176'W`'#172#167#167#167'j'
+'rr'#178'app'#176#172#174#174'N'#238'Xt'#147'L]NJ'#149#138#162#17#129'$'#18#9
+'I'#165'R'#138'D"'#148'H$hxxX'#222#222#222#174#235#234#234'2 '#195#12#178'z'
+#6#157#16't'#3#249#0'7'#25'Tbb'#172#179#179#243#137#221'noill'#148#235't:r'
+#185'\'#228#255#17#163#143#31#222#145'g3@'#129#189'-'#4#144#146'X,'#197'WL'
+#161'P'#136#170#170#170#168#169#169#137#204'f'#179#20'Y'#149'mooG'#131#193
+#160#5#154'_'#161#153#228#0#229#248#227'-'#196'_'#142#142#142#214#183#181#181
+'i8h6'#155#165#233#233'i'#138''''#146#228#219#22'h'#127'g'#147#190#249'<'#148
+'L'#158#147'F'#163#165#146#18'='#182'e'#233#236#236#148#186#187#187#243#229
+'+--'#21'WTT'#168'Q6'#17#238'F'#131#185'-'#190'4;j'#174'@'#205#155'a2'#22'f'
+#216#14#14#14#232#234'JB'#201'X'#130#188#222'5'#156'\r'#221'B('#141#197'b'
+#133#184'$'#239#147#201'dn'#219#18#26':'#214#242'z'#189#129'x<n'#231#250#140
+'a'#176#182#176#176#176'|||'#156'`'#231#2'|*'#149'J'#141#147#153'H'#169'T'
+#147'B'#161#204#195'c'#158#227'5'#246')'#222#195#26#172#197#154#172#205#1'"'
+#220'^n'#183'{}ff'#198'S'#236#140#246'D'#6#151#164#213#150#227'd'#29#164#215
+#27#243#160#9#242's'#188#198'>'#197'{X'#131#181'X'#147#181#11#151'|'#142#178
+'D<'#30'O'#153#193'`'#144#217'l63ZQ'#164'B'#231#172#174#174#144'L&'#163#154
+#154#231'd'#179#181'R}}3'#5#131#17#180#231'w'#138#199#5#26#26#26'"'#163#209
+#136'`W'#185#185#185#185#181#137#137#137'e'#140#191'@s'#183#184#139'8'#213'0'
+'D'#15#23#23#23#165'h'#183'S'#180#168#193'j'#181#170#225'L>'#223':'#234'.'
+#208#197'E'#10#223'#'#212#221'G'#209#232'!'#245#245#245'QGG'#7#223#195#241
+#248#248#184'sjj'#202#5#141#207#144#243#222'>'#21#220#215#197#191'<'#216'c~'
+#30'p'#250#23#216'l'#237#237#237#181#226#16#166#221#221']'#237#201#201#137
+#146#29#144'e'#186#182#182'6'#129#172#5#167#211#185#179#180#180#180#147'J'
+#165'Vn'#158#141#179#226#151#225#174#0#5'c'#177#167#160#1#24#1#247#165#234'f'
+'-'#5'b'#224#8'l'#130'='#144'.'#222'|'#27#224#225'?'#218'C'#128#255#182#223#2
+#12#0'+'#130#148'=gv'#220#198#0#0#0#0'IEND'#174'B`'#130
]);

View File

@@ -61,14 +61,14 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 80;
CEF_SUPPORTED_VERSION_MINOR = 0;
CEF_SUPPORTED_VERSION_RELEASE = 8;
CEF_SUPPORTED_VERSION_MINOR = 1;
CEF_SUPPORTED_VERSION_RELEASE = 2;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 80;
CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 3987;
CEF_CHROMEELF_VERSION_BUILD = 132;
CEF_CHROMEELF_VERSION_BUILD = 149;
{$IFDEF MSWINDOWS}
LIBCEF_DLL = 'libcef.dll';
@@ -244,7 +244,7 @@ type
function GetMustCreateLoadHandler : boolean; virtual;
function GetGlobalContextInitialized : boolean;
function GetChildProcessesCount : integer;
function GetUsedMemory : cardinal;
function GetUsedMemory : uint64;
function GetTotalSystemMemory : uint64;
function GetAvailableSystemMemory : uint64;
function GetSystemMemoryLoad : cardinal;
@@ -259,6 +259,7 @@ type
function Load_cef_file_util_capi_h : boolean;
function Load_cef_image_capi_h : boolean;
function Load_cef_menu_model_capi_h : boolean;
function Load_cef_media_router_capi_h : boolean;
function Load_cef_origin_whitelist_capi_h : boolean;
function Load_cef_parser_capi_h : boolean;
function Load_cef_path_util_capi_h : boolean;
@@ -476,7 +477,7 @@ type
property WidevinePath : ustring read FWidevinePath write FWidevinePath;
property MustFreeLibrary : boolean read FMustFreeLibrary write FMustFreeLibrary;
property ChildProcessesCount : integer read GetChildProcessesCount;
property UsedMemory : cardinal read GetUsedMemory;
property UsedMemory : uint64 read GetUsedMemory;
property TotalSystemMemory : uint64 read GetTotalSystemMemory;
property AvailableSystemMemory : uint64 read GetAvailableSystemMemory;
property SystemMemoryLoad : cardinal read GetSystemMemoryLoad;
@@ -815,7 +816,7 @@ begin
try
if CheckCEFLibrary and LoadCEFlibrary then
begin
if ProcessType <> ptBrowser then BeforeInitSubProcess;
if (FProcessType <> ptBrowser) then BeforeInitSubProcess;
TempApp := TCustomCefApp.Create(self);
Result := (ExecuteProcess(TempApp) < 0) and InitializeLibrary(TempApp);
end;
@@ -1896,7 +1897,7 @@ begin
{$ENDIF}
end;
function TCefApplicationCore.GetUsedMemory : cardinal;
function TCefApplicationCore.GetUsedMemory : uint64;
{$IFDEF MSWINDOWS}
var
TempHandle : THandle;
@@ -2047,6 +2048,7 @@ begin
Load_cef_file_util_capi_h and
Load_cef_image_capi_h and
Load_cef_menu_model_capi_h and
Load_cef_media_router_capi_h and
Load_cef_origin_whitelist_capi_h and
Load_cef_parser_capi_h and
Load_cef_path_util_capi_h and
@@ -2206,6 +2208,13 @@ begin
Result := assigned(cef_menu_model_create);
end;
function TCefApplicationCore.Load_cef_media_router_capi_h : boolean;
begin
{$IFDEF FPC}Pointer({$ENDIF}cef_media_router_get_global{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_media_router_get_global');
Result := assigned(cef_media_router_get_global);
end;
function TCefApplicationCore.Load_cef_origin_whitelist_capi_h : boolean;
begin
{$IFDEF FPC}Pointer({$ENDIF}cef_add_cross_origin_whitelist_entry{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_add_cross_origin_whitelist_entry');

View File

@@ -75,7 +75,6 @@ type
FScanlineSize : integer;
FTransparent : boolean;
FOnPaintParentBkg : TNotifyEvent;
FOnWrongSize : TNotifyEvent;
{$IFDEF MSWINDOWS}
FIMEHandler : TCEFOSRIMEHandler;
FOnIMECancelComposition : TNotifyEvent;
@@ -151,7 +150,6 @@ type
property OnPointerUpdate : TOnHandledMessageEvent read FOnPointerUpdate write FOnPointerUpdate;
{$ENDIF}
property OnPaintParentBkg : TNotifyEvent read FOnPaintParentBkg write FOnPaintParentBkg;
property OnWrongSize : TNotifyEvent read FOnWrongSize write FOnWrongSize;
property Transparent : boolean read FTransparent write SetTransparent default False;
@@ -262,7 +260,6 @@ begin
FBuffer := nil;
FTransparent := False;
FOnPaintParentBkg := nil;
FOnWrongSize := nil;
{$IFDEF MSWINDOWS}
FIMEHandler := nil;
@@ -399,10 +396,8 @@ var
{$IFDEF MSWINDOWS}
TempFunction : TBlendFunction;
{$ENDIF}
TempWrongSize : boolean;
begin
Result := False;
TempWrongSize := False;
{$IFDEF MSWINDOWS}
if BeginBufferDraw then
@@ -430,15 +425,11 @@ begin
Result := BitBlt(Canvas.Handle, 0, 0, Width, Height,
FBuffer.Canvas.Handle, 0, 0,
SrcCopy);
TempWrongSize := (Width <> FBuffer.Width) or (Height <> FBuffer.Height);
end;
finally
EndBufferDraw;
end;
{$ENDIF}
if TempWrongSize and assigned(FOnWrongSize) then FOnWrongSize(self);
end;
procedure TBufferPanel.Paint;

View File

@@ -384,7 +384,7 @@ type
{$IFDEF MSWINDOWS}
procedure PrefsAvailableMsg(aResultOK : boolean);
function SendCompMessage(aMsg : cardinal; wParam : cardinal = 0; lParam : integer = 0) : boolean;
function SendCompMessage(aMsg : cardinal; aWParam : WPARAM = 0; aLParam : LPARAM = 0) : boolean;
procedure ToMouseEvent(grfKeyState : Longint; pt : TPoint; var aMouseEvent : TCefMouseEvent);
procedure WndProc(var aMessage: TMessage);
procedure CreateStub(const aMethod : TWndMethod; var aStub : Pointer);
@@ -4143,9 +4143,9 @@ begin
if assigned(FOnPrefsAvailable) then FOnPrefsAvailable(self, aResultOK);
end;
function TChromiumCore.SendCompMessage(aMsg : cardinal; wParam : cardinal; lParam : integer) : boolean;
function TChromiumCore.SendCompMessage(aMsg : cardinal; aWParam : WPARAM; aLParam : LPARAM) : boolean;
begin
Result := (FCompHandle <> 0) and PostMessage(FCompHandle, aMsg, wParam, lParam);
Result := (FCompHandle <> 0) and PostMessage(FCompHandle, aMsg, aWParam, aLParam);
end;
{$ENDIF}

View File

@@ -526,6 +526,18 @@ const
DUPLEX_MODE_LONG_EDGE = 1;
DUPLEX_MODE_SHORT_EDGE = 2;
// /include/internal/cef_types.h (cef_media_route_create_result_t)
CEF_MRCR_UNKNOWN_ERROR = 0;
CEF_MRCR_OK = 1;
CEF_MRCR_TIMED_OUT = 2;
CEF_MRCR_ROUTE_NOT_FOUND = 3;
CEF_MRCR_SINK_NOT_FOUND = 4;
CEF_MRCR_INVALID_ORIGIN = 5;
CEF_MRCR_NO_SUPPORTED_PROVIDER = 7;
CEF_MRCR_CANCELLED = 8;
CEF_MRCR_ROUTE_ALREADY_EXISTS = 9;
CEF_MRCR_TOTAL_COUNT = 11;
//******************************************************
//****************** OTHER CONSTANTS *******************

View File

@@ -70,7 +70,6 @@ type
FColor : TAlphaColor;
FHighSpeedDrawing : boolean;
FOnDialogKey : TDialogKeyEvent;
FOnWrongSize : TNotifyEvent;
procedure CreateSyncObj;
@@ -153,7 +152,6 @@ type
property OnKeyUp;
property OnKeyDown;
property OnDialogKey : TDialogKeyEvent read FOnDialogKey write FOnDialogKey;
property OnWrongSize : TNotifyEvent read FOnWrongSize write FOnWrongSize;
end;
implementation
@@ -176,7 +174,6 @@ begin
FScanlineSize := 0;
FColor := claWhite;
FOnDialogKey := nil;
FOnWrongSize := nil;
FHighSpeedDrawing := True;
end;
@@ -286,11 +283,9 @@ function TFMXBufferPanel.CopyBuffer : boolean;
var
TempSrc, TempDst, TempClip : TRectF;
TempState : TCanvasSaveState;
TempWrongSize : boolean;
TempScale : single;
begin
Result := False;
TempWrongSize := False;
if Canvas.BeginScene then
try
@@ -311,9 +306,6 @@ begin
finally
Canvas.RestoreState(TempState);
end;
TempWrongSize := (abs(Width - TempDst.Width) > 1) or
(abs(Height - TempDst.Height) > 1);
end;
finally
EndBufferDraw;
@@ -321,8 +313,6 @@ begin
finally
Canvas.EndScene;
end;
if TempWrongSize and assigned(FOnWrongSize) then FOnWrongSize(self);
end;
procedure TFMXBufferPanel.DialogKey(var Key: Word; Shift: TShiftState);

View File

@@ -143,12 +143,21 @@ type
ICefMenuButton = interface;
ICefUrlRequest = interface;
ICefPostDataElement = interface;
ICefRegistration = interface;
ICefMediaRouter = interface;
ICefMediaObserver = interface;
ICefMediaRoute = interface;
ICefMediaRouteCreateCallback = interface;
ICefMediaSink = interface;
ICefMediaSource = interface;
TCefv8ValueArray = array of ICefv8Value;
TCefX509CertificateArray = array of ICefX509Certificate;
TCefBinaryValueArray = array of ICefBinaryValue;
TCefFrameIdentifierArray = array of int64;
TCefPostDataElementArray = array of ICefPostDataElement;
TCefMediaRouteArray = array of ICefMediaRoute;
TCefMediaSinkArray = array of ICefMediaSink;
@@ -1230,6 +1239,91 @@ type
property CommandLineString : ustring read GetCommandLineString;
end;
// TCefRegistration
// /include/capi/cef_registration_capi.h (cef_registration_t)
ICefRegistration = interface(ICefBaseRefCounted)
['{9226018F-7A56-4F2E-AF01-43268E33EE6B}']
end;
// TCefMediaRouter
// /include/capi/cef_media_router_capi.h (cef_media_router_t)
ICefMediaRouter = interface(ICefBaseRefCounted)
['{F18C3880-CB8D-48F9-9D74-DCFF4B9E88DF}']
function AddObserver(const observer: ICefMediaObserver): ICefRegistration;
function GetSource(const urn: ustring): ICefMediaSource;
procedure NotifyCurrentSinks;
procedure CreateRoute(const source: ICefMediaSource; const sink: ICefMediaSink; const callback: ICefMediaRouteCreateCallback);
procedure NotifyCurrentRoutes;
end;
// TCefMediaObserver
// /include/capi/cef_media_router_capi.h (cef_media_observer_t)
ICefMediaObserver = interface(ICefBaseRefCounted)
['{0B27C8D1-63E3-4F69-939F-DCAD518654A3}']
procedure OnSinks(const sinks: TCefMediaSinkArray);
procedure OnRoutes(const routes: TCefMediaRouteArray);
procedure OnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState);
procedure OnRouteMessageReceived(const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt);
end;
ICefMediaObserverEvents = interface
['{267D5287-08DB-49D6-AF6E-B27C66C6E5D4}']
procedure doOnSinks(const sinks: TCefMediaSinkArray);
procedure doOnRoutes(const routes: TCefMediaRouteArray);
procedure doOnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState);
procedure doOnRouteMessageReceived(const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt);
end;
// TCefMediaRoute
// /include/capi/cef_media_router_capi.h (cef_media_observer_t)
ICefMediaRoute = interface(ICefBaseRefCounted)
['{D8959122-DD19-4933-B4D9-DF829062A0D3}']
function GetId: ustring;
function GetSource: ICefMediaSource;
function GetSink: ICefMediaSink;
procedure SendRouteMessage(const message_: Pointer; message_size: NativeUInt);
procedure Terminate;
property ID : ustring read GetId;
end;
// TCefMediaRouteCreateCallback
// /include/capi/cef_media_router_capi.h (cef_media_route_create_callback_t)
ICefMediaRouteCreateCallback = interface(ICefBaseRefCounted)
['{8848CBFE-36AC-4AC8-BC10-386B69FB27BE}']
procedure OnMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
end;
// TCefMediaSink
// /include/capi/cef_media_router_capi.h (cef_media_sink_t)
ICefMediaSink = interface(ICefBaseRefCounted)
['{EDA1A4B2-2A4C-42DD-A7DF-901BF93D908D}']
function GetId: ustring;
function IsValid: boolean;
function GetName: ustring;
function GetDescription: ustring;
function IsCastSink: boolean;
function IsDialSink: boolean;
function IsCompatibleWith(const source: ICefMediaSource): boolean;
property ID : ustring read GetId;
property Name : ustring read GetName;
property Description : ustring read GetDescription;
end;
// TCefMediaSource
// /include/capi/cef_media_router_capi.h (cef_media_source_t)
ICefMediaSource = interface(ICefBaseRefCounted)
['{734ED6E4-6498-43ED-AAA4-6B993EDC30BE}']
function GetId : ustring;
function IsValid : boolean;
function IsCastSource : boolean;
function IsDialSource : boolean;
property ID : ustring read GetId;
end;
// TCefResourceBundleHandler
// /include/capi/cef_resource_bundle_handler_capi.h (cef_resource_bundle_handler_t)
ICefResourceBundleHandler = interface(ICefBaseRefCounted)
@@ -2027,6 +2121,7 @@ type
function HasExtension(const extension_id: ustring): boolean;
function GetExtensions(const extension_ids: TStringList): boolean;
function GetExtension(const extension_id: ustring): ICefExtension;
function GetMediaRouter: ICefMediaRouter;
property CachePath : ustring read GetCachePath;
property IsGlobalContext : boolean read IsGlobal;
@@ -2256,6 +2351,8 @@ type
end;
// *********************************
// ************* Views *************
// *********************************

View File

@@ -98,6 +98,9 @@ var
// /include/capi/cef_image_capi.h
cef_image_create : function : PCefImage; cdecl;
// /include/capi/cef_media_router_capi.h
cef_media_router_get_global : function : PCefMediaRouter; cdecl;
// /include/capi/cef_menu_model_capi.h
cef_menu_model_create : function(delegate: PCefMenuModelDelegate): PCefMenuModel; cdecl;

View File

@@ -0,0 +1,302 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaObserver;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefMediaObserverOwn = class(TCefBaseRefCountedOwn, ICefMediaObserver)
protected
procedure OnSinks(const sinks: TCefMediaSinkArray); virtual;
procedure OnRoutes(const routes: TCefMediaRouteArray); virtual;
procedure OnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState); virtual;
procedure OnRouteMessageReceived(const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt); virtual;
public
constructor Create; virtual;
end;
TCustomMediaObserver = class(TCefMediaObserverOwn)
protected
FEvents : Pointer;
procedure OnSinks(const sinks: TCefMediaSinkArray); override;
procedure OnRoutes(const routes: TCefMediaRouteArray); override;
procedure OnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState); override;
procedure OnRouteMessageReceived(const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt); override;
public
constructor Create(const events: ICefMediaObserverEvents); reintroduce;
destructor Destroy; override;
end;
implementation
uses
{$IFDEF DELPHI16_UP}
System.SysUtils,
{$ELSE}
SysUtils,
{$ENDIF}
uCEFMiscFunctions, uCEFLibFunctions, uCEFMediaSource, uCEFMediaSink,
uCEFMediaRoute;
// **************************************************
// ************** TCefMediaObserverOwn **************
// **************************************************
procedure cef_media_observer_on_sinks( self : PCefMediaObserver;
sinksCount : NativeUInt;
const sinks : PPCefMediaSink); stdcall;
var
TempObject : TObject;
TempArray : TCefMediaSinkArray;
i : NativeUInt;
TempItem : PCefMediaSink;
begin
TempArray := nil;
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefMediaObserverOwn) then
try
SetLength(TempArray, sinksCount);
TempItem := PCefMediaSink(sinks^);
i := 0;
while (i < sinksCount) do
begin
TempArray[i] := TCefMediaSinkRef.UnWrap(TempItem);
inc(TempItem);
inc(i);
end;
TCefMediaObserverOwn(TempObject).OnSinks(TempArray);
finally
if (TempArray <> nil) then
begin
i := 0;
while (i < sinksCount) do
begin
TempArray[i] := nil;
inc(i);
end;
Finalize(TempArray);
TempArray := nil;
end;
end;
end;
procedure cef_media_observer_on_routes( self : PCefMediaObserver;
routesCount : NativeUInt;
const routes : PPCefMediaRoute); stdcall;
var
TempObject : TObject;
TempArray : TCefMediaRouteArray;
i : NativeUInt;
TempItem : PCefMediaRoute;
begin
TempArray := nil;
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefMediaObserverOwn) then
try
SetLength(TempArray, routesCount);
TempItem := PCefMediaRoute(routes^);
i := 0;
while (i < routesCount) do
begin
TempArray[i] := TCefMediaRouteRef.UnWrap(TempItem);
inc(TempItem);
inc(i);
end;
TCefMediaObserverOwn(TempObject).OnRoutes(TempArray);
finally
if (TempArray <> nil) then
begin
i := 0;
while (i < routesCount) do
begin
TempArray[i] := nil;
inc(i);
end;
Finalize(TempArray);
TempArray := nil;
end;
end;
end;
procedure cef_media_observer_on_route_state_changed(self : PCefMediaObserver;
route : PCefMediaRoute;
state : TCefMediaRouteConnectionState); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefMediaObserverOwn) then
TCefMediaObserverOwn(TempObject).OnRouteStateChanged(TCefMediaRouteRef.UnWrap(route), state);
end;
procedure cef_media_observer_on_route_message_received( self : PCefMediaObserver;
route : PCefMediaRoute;
const message_ : Pointer;
message_size : NativeUInt); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefMediaObserverOwn) then
TCefMediaObserverOwn(TempObject).OnRouteMessageReceived(TCefMediaRouteRef.UnWrap(route),
message_,
message_size);
end;
constructor TCefMediaObserverOwn.Create;
begin
inherited CreateData(SizeOf(TCefMediaObserver));
with PCefMediaObserver(FData)^ do
begin
on_sinks := {$IFDEF FPC}@{$ENDIF}cef_media_observer_on_sinks;
on_routes := {$IFDEF FPC}@{$ENDIF}cef_media_observer_on_routes;
on_route_state_changed := {$IFDEF FPC}@{$ENDIF}cef_media_observer_on_route_state_changed;
on_route_message_received := {$IFDEF FPC}@{$ENDIF}cef_media_observer_on_route_message_received;
end;
end;
procedure TCefMediaObserverOwn.OnSinks(const sinks: TCefMediaSinkArray);
begin
//
end;
procedure TCefMediaObserverOwn.OnRoutes(const routes: TCefMediaRouteArray);
begin
//
end;
procedure TCefMediaObserverOwn.OnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState);
begin
//
end;
procedure TCefMediaObserverOwn.OnRouteMessageReceived(const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt);
begin
//
end;
// **************************************************
// ************** TCustomMediaObserver **************
// **************************************************
constructor TCustomMediaObserver.Create(const events: ICefMediaObserverEvents);
begin
inherited Create;
FEvents := Pointer(events);
end;
destructor TCustomMediaObserver.Destroy;
begin
FEvents := nil;
inherited Destroy;
end;
procedure TCustomMediaObserver.OnSinks(const sinks: TCefMediaSinkArray);
begin
try
if (FEvents <> nil) then
ICefMediaObserverEvents(FEvents).doOnSinks(sinks);
except
on e : exception do
if CustomExceptionHandler('TCustomMediaObserver.OnSinks', e) then raise;
end;
end;
procedure TCustomMediaObserver.OnRoutes(const routes: TCefMediaRouteArray);
begin
try
if (FEvents <> nil) then
ICefMediaObserverEvents(FEvents).doOnRoutes(routes);
except
on e : exception do
if CustomExceptionHandler('TCustomMediaObserver.OnRoutes', e) then raise;
end;
end;
procedure TCustomMediaObserver.OnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState);
begin
try
if (FEvents <> nil) then
ICefMediaObserverEvents(FEvents).doOnRouteStateChanged(route, state);
except
on e : exception do
if CustomExceptionHandler('TCustomMediaObserver.OnRouteStateChanged', e) then raise;
end;
end;
procedure TCustomMediaObserver.OnRouteMessageReceived(const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt);
begin
try
if (FEvents <> nil) then
ICefMediaObserverEvents(FEvents).doOnRouteMessageReceived(route, message_, message_size);
except
on e : exception do
if CustomExceptionHandler('TCustomMediaObserver.OnRouteMessageReceived', e) then raise;
end;
end;
end.

View File

@@ -0,0 +1,188 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaObserverComponent;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
{$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages, WinApi.ActiveX,{$ENDIF}
System.Classes, System.Math,
{$ELSE}
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} Classes, Math,
{$IFDEF FPC}
LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase,
{$ELSE}
Messages,
{$ENDIF}
{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFMediaObserver, uCEFMediaObserverEvents;
type
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF}
TCEFMediaObserverComponent = class(TComponent, ICefMediaObserverEvents)
protected
FMediaObserver : ICefMediaObserver;
FOnSinks : TOnSinksEvent;
FOnRoutes : TOnRoutesEvent;
FOnRouteStateChanged : TOnRouteStateChangedEvent;
FOnRouteMessageReceived : TOnRouteMessageReceivedEvent;
// ICefMediaObserverEvents
procedure doOnSinks(const sinks: TCefMediaSinkArray); virtual;
procedure doOnRoutes(const routes: TCefMediaRouteArray); virtual;
procedure doOnRouteStateChanged(const route: ICefMediaRoute; state: TCefMediaRouteConnectionState); virtual;
procedure doOnRouteMessageReceived(const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AfterConstruction; override;
property MediaObserver : ICefMediaObserver read FMediaObserver;
published
property OnSinks : TOnSinksEvent read FOnSinks write FOnSinks;
property OnRoutes : TOnRoutesEvent read FOnRoutes write FOnRoutes;
property OnRouteStateChanged : TOnRouteStateChangedEvent read FOnRouteStateChanged write FOnRouteStateChanged;
property OnRouteMessageReceived : TOnRouteMessageReceivedEvent read FOnRouteMessageReceived write FOnRouteMessageReceived;
end;
{$IFDEF FPC}
procedure Register;
{$ENDIF}
implementation
// *********************************************************
// ********************** ATTENTION ! **********************
// *********************************************************
// ** **
// ** MANY OF THE EVENTS IN CEF4DELPHI COMPONENTS LIKE **
// ** TCHROMIUM, TFMXCHROMIUM OR TCEFAPPLICATION ARE **
// ** EXECUTED IN A CEF THREAD BY DEFAULT. **
// ** **
// ** WINDOWS CONTROLS MUST BE CREATED AND DESTROYED IN **
// ** THE SAME THREAD TO AVOID ERRORS. **
// ** SOME OF THEM RECREATE THE HANDLERS IF THEY ARE **
// ** MODIFIED AND CAN CAUSE THE SAME ERRORS. **
// ** **
// ** DON'T CREATE, MODIFY OR DESTROY WINDOWS CONTROLS **
// ** INSIDE THE CEF4DELPHI EVENTS AND USE **
// ** SYNCHRONIZATION OBJECTS TO PROTECT VARIABLES AND **
// ** FIELDS IF THEY ARE ALSO USED IN THE MAIN THREAD. **
// ** **
// ** READ THIS FOR MORE INFORMATION : **
// ** https://www.briskbard.com/index.php?pageid=cef **
// ** **
// ** USE OUR FORUMS FOR MORE QUESTIONS : **
// ** https://www.briskbard.com/forum/ **
// ** **
// *********************************************************
// *********************************************************
constructor TCEFMediaObserverComponent.Create(AOwner: TComponent);
begin
inherited Create(aOwner);
FMediaObserver := nil;
FOnSinks := nil;
FOnRoutes := nil;
FOnRouteStateChanged := nil;
FOnRouteMessageReceived := nil;
end;
destructor TCEFMediaObserverComponent.Destroy;
begin
FMediaObserver := nil;
inherited Destroy;
end;
procedure TCEFMediaObserverComponent.AfterConstruction;
begin
inherited AfterConstruction;
FMediaObserver := TCustomMediaObserver.Create(self);
end;
procedure TCEFMediaObserverComponent.doOnSinks(const sinks: TCefMediaSinkArray);
begin
if assigned(FOnSinks) then
FOnSinks(self, sinks);
end;
procedure TCEFMediaObserverComponent.doOnRoutes(const routes: TCefMediaRouteArray);
begin
if assigned(FOnRoutes) then
FOnRoutes(self, routes);
end;
procedure TCEFMediaObserverComponent.doOnRouteStateChanged(const route : ICefMediaRoute;
state : TCefMediaRouteConnectionState);
begin
if assigned(FOnRouteStateChanged) then
FOnRouteStateChanged(self, route, state);
end;
procedure TCEFMediaObserverComponent.doOnRouteMessageReceived(const route : ICefMediaRoute;
const message_ : Pointer;
message_size : NativeUInt);
begin
if assigned(FOnRouteMessageReceived) then
FOnRouteMessageReceived(self, route, message_, message_size);
end;
{$IFDEF FPC}
procedure Register;
begin
{$I res/tcefmediaobservercomponent.lrs}
RegisterComponents('Chromium', [TCEFMediaObserverComponent]);
end;
{$ENDIF}
end.

View File

@@ -0,0 +1,67 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaObserverEvents;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes,
{$ELSE}
Classes,
{$ENDIF}
uCEFTypes, uCEFInterfaces;
type
TOnSinksEvent = procedure(Sender: TObject; const sinks: TCefMediaSinkArray) of object;
TOnRoutesEvent = procedure(Sender: TObject; const routes: TCefMediaRouteArray) of object;
TOnRouteStateChangedEvent = procedure(Sender: TObject; const route: ICefMediaRoute; state: TCefMediaRouteConnectionState) of object;
TOnRouteMessageReceivedEvent = procedure(Sender: TObject; const route: ICefMediaRoute; const message_: Pointer; message_size: NativeUInt) of object;
implementation
end.

104
source/uCEFMediaRoute.pas Normal file
View File

@@ -0,0 +1,104 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaRoute;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefMediaRouteRef = class(TCefBaseRefCountedRef, ICefMediaRoute)
protected
function GetId: ustring;
function GetSource: ICefMediaSource;
function GetSink: ICefMediaSink;
procedure SendRouteMessage(const message_: Pointer; message_size: NativeUInt);
procedure Terminate;
public
class function UnWrap(data: Pointer): ICefMediaRoute;
end;
implementation
uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFMediaSource, uCEFMediaSink;
function TCefMediaRouteRef.GetId: ustring;
begin
Result := CefStringFreeAndGet(PCefMediaRoute(FData)^.get_id(PCefMediaRoute(FData)));
end;
function TCefMediaRouteRef.GetSource: ICefMediaSource;
begin
Result := TCefMediaSourceRef.UnWrap(PCefMediaRoute(FData)^.get_source(PCefMediaRoute(FData)));
end;
function TCefMediaRouteRef.GetSink: ICefMediaSink;
begin
Result := TCefMediaSinkRef.UnWrap(PCefMediaRoute(FData)^.get_sink(PCefMediaRoute(FData)));
end;
procedure TCefMediaRouteRef.SendRouteMessage(const message_: Pointer; message_size: NativeUInt);
begin
PCefMediaRoute(FData)^.send_route_message(PCefMediaRoute(FData), message_, message_size);
end;
procedure TCefMediaRouteRef.Terminate;
begin
PCefMediaRoute(FData)^.terminate(PCefMediaRoute(FData));
end;
class function TCefMediaRouteRef.UnWrap(data: Pointer): ICefMediaRoute;
begin
if (data <> nil) then
Result := Create(data) as ICefMediaRoute
else
Result := nil;
end;
end.

View File

@@ -0,0 +1,88 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaRouteCreateCallback;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefMediaRouteCreateCallbackRef = class(TCefBaseRefCountedRef, ICefMediaRouteCreateCallback)
protected
procedure OnMediaRouteCreateFinished(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
public
class function UnWrap(data: Pointer): ICefMediaRouteCreateCallback;
end;
implementation
uses
uCEFMiscFunctions, uCEFLibFunctions;
procedure TCefMediaRouteCreateCallbackRef.OnMediaRouteCreateFinished( result : TCefMediaRouterCreateResult;
const error : ustring;
const route : ICefMediaRoute);
var
TempError : TCefString;
begin
TempError := CefString(error);
PCefMediaRouteCreateCallback(FData)^.on_media_route_create_finished(PCefMediaRouteCreateCallback(FData),
result,
@TempError,
CefGetData(route));
end;
class function TCefMediaRouteCreateCallbackRef.UnWrap(data: Pointer): ICefMediaRouteCreateCallback;
begin
if (data <> nil) then
Result := Create(data) as ICefMediaRouteCreateCallback
else
Result := nil;
end;
end.

121
source/uCEFMediaRouter.pas Normal file
View File

@@ -0,0 +1,121 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaRouter;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefMediaRouterRef = class(TCefBaseRefCountedRef, ICefMediaRouter)
protected
function AddObserver(const observer: ICefMediaObserver): ICefRegistration;
function GetSource(const urn: ustring): ICefMediaSource;
procedure NotifyCurrentSinks;
procedure CreateRoute(const source: ICefMediaSource; const sink: ICefMediaSink; const callback: ICefMediaRouteCreateCallback);
procedure NotifyCurrentRoutes;
public
class function UnWrap(data: Pointer): ICefMediaRouter;
class function Global: ICefMediaRouter;
end;
implementation
uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFMediaSource, uCEFRegistration,
uCEFMediaRouteCreateCallback;
function TCefMediaRouterRef.AddObserver(const observer: ICefMediaObserver): ICefRegistration;
begin
Result := TCefRegistrationRef.UnWrap(PCefMediaRouter(FData)^.add_observer(PCefMediaRouter(FData),
CefGetData(observer)));
end;
function TCefMediaRouterRef.GetSource(const urn: ustring): ICefMediaSource;
var
TempURN : TCefString;
begin
TempURN := CefString(urn);
Result := TCefMediaSourceRef.UnWrap(PCefMediaRouter(FData)^.get_source(PCefMediaRouter(FData),
@TempURN));
end;
procedure TCefMediaRouterRef.NotifyCurrentSinks;
begin
PCefMediaRouter(FData)^.notify_current_sinks(PCefMediaRouter(FData));
end;
procedure TCefMediaRouterRef.CreateRoute(const source : ICefMediaSource;
const sink : ICefMediaSink;
const callback : ICefMediaRouteCreateCallback);
begin
PCefMediaRouter(FData)^.create_route(PCefMediaRouter(FData),
CefGetData(source),
CefGetData(sink),
CefGetData(callback));
end;
procedure TCefMediaRouterRef.NotifyCurrentRoutes;
begin
PCefMediaRouter(FData)^.notify_current_routes(PCefMediaRouter(FData));
end;
class function TCefMediaRouterRef.UnWrap(data: Pointer): ICefMediaRouter;
begin
if (data <> nil) then
Result := Create(data) as ICefMediaRouter
else
Result := nil;
end;
class function TCefMediaRouterRef.Global: ICefMediaRouter;
begin
Result := UnWrap(cef_media_router_get_global());
end;
end.

116
source/uCEFMediaSink.pas Normal file
View File

@@ -0,0 +1,116 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaSink;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefMediaSinkRef = class(TCefBaseRefCountedRef, ICefMediaSink)
protected
function GetId: ustring;
function IsValid: boolean;
function GetName: ustring;
function GetDescription: ustring;
function IsCastSink: boolean;
function IsDialSink: boolean;
function IsCompatibleWith(const source: ICefMediaSource): boolean;
public
class function UnWrap(data: Pointer): ICefMediaSink;
end;
implementation
uses
uCEFMiscFunctions, uCEFLibFunctions;
function TCefMediaSinkRef.GetId: ustring;
begin
Result := CefStringFreeAndGet(PCefMediaSink(FData)^.get_id(PCefMediaSink(FData)));
end;
function TCefMediaSinkRef.IsValid: Boolean;
begin
Result := PCefMediaSink(FData)^.is_valid(PCefMediaSink(FData)) <> 0;
end;
function TCefMediaSinkRef.GetName: ustring;
begin
Result := CefStringFreeAndGet(PCefMediaSink(FData)^.get_name(PCefMediaSink(FData)));
end;
function TCefMediaSinkRef.GetDescription: ustring;
begin
Result := CefStringFreeAndGet(PCefMediaSink(FData)^.get_description(PCefMediaSink(FData)));
end;
function TCefMediaSinkRef.IsCastSink: Boolean;
begin
Result := PCefMediaSink(FData)^.is_cast_sink(PCefMediaSink(FData)) <> 0;
end;
function TCefMediaSinkRef.IsDialSink: Boolean;
begin
Result := PCefMediaSink(FData)^.is_dial_sink(PCefMediaSink(FData)) <> 0;
end;
function TCefMediaSinkRef.IsCompatibleWith(const source: ICefMediaSource): boolean;
begin
Result := PCefMediaSink(FData)^.is_compatible_with(PCefMediaSink(FData), CefGetData(source)) <> 0;
end;
class function TCefMediaSinkRef.UnWrap(data: Pointer): ICefMediaSink;
begin
if (data <> nil) then
Result := Create(data) as ICefMediaSink
else
Result := nil;
end;
end.

View File

@@ -0,0 +1,98 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFMediaSource;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefMediaSourceRef = class(TCefBaseRefCountedRef, ICefMediaSource)
protected
function GetId : ustring;
function IsValid : boolean;
function IsCastSource : boolean;
function IsDialSource : boolean;
public
class function UnWrap(data: Pointer): ICefMediaSource;
end;
implementation
uses
uCEFMiscFunctions, uCEFLibFunctions;
function TCefMediaSourceRef.GetId: ustring;
begin
Result := CefStringFreeAndGet(PCefMediaSource(FData)^.get_id(PCefMediaSource(FData)));
end;
function TCefMediaSourceRef.IsValid: Boolean;
begin
Result := PCefMediaSource(FData)^.is_valid(PCefMediaSource(FData)) <> 0;
end;
function TCefMediaSourceRef.IsCastSource: Boolean;
begin
Result := PCefMediaSource(FData)^.is_cast_source(PCefMediaSource(FData)) <> 0;
end;
function TCefMediaSourceRef.IsDialSource: Boolean;
begin
Result := PCefMediaSource(FData)^.is_dial_source(PCefMediaSource(FData)) <> 0;
end;
class function TCefMediaSourceRef.UnWrap(data: Pointer): ICefMediaSource;
begin
if (data <> nil) then
Result := Create(data) as ICefMediaSource
else
Result := nil;
end;
end.

View File

@@ -0,0 +1,70 @@
// ************************************************************************
// ***************************** CEF4Delphi *******************************
// ************************************************************************
//
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
// browser in Delphi applications.
//
// The original license of DCEF3 still applies to CEF4Delphi.
//
// For more information about CEF4Delphi visit :
// https://www.briskbard.com/index.php?lang=en&pageid=cef
//
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
//
// ************************************************************************
// ************ vvvv Original license and comments below vvvv *************
// ************************************************************************
(*
* Delphi Chromium Embedded 3
*
* Usage allowed under the restrictions of the Lesser GNU General Public License
* or alternatively the restrictions of the Mozilla Public License 1.1
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
*)
unit uCEFRegistration;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefRegistrationRef = class(TCefBaseRefCountedRef, ICefRegistration)
public
class function UnWrap(data: Pointer): ICefRegistration;
end;
implementation
class function TCefRegistrationRef.UnWrap(data: Pointer): ICefRegistration;
begin
if (data <> nil) then
Result := Create(data) as ICefRegistration
else
Result := nil;
end;
end.

View File

@@ -83,6 +83,7 @@ type
function HasExtension(const extension_id: ustring): boolean;
function GetExtensions(const extension_ids: TStringList): boolean;
function GetExtension(const extension_id: ustring): ICefExtension;
function GetMediaRouter: ICefMediaRouter;
public
class function UnWrap(data: Pointer): ICefRequestContext;
@@ -111,7 +112,7 @@ implementation
uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, uCEFCookieManager,
uCEFRequestContextHandler, uCEFExtension, uCEFStringList;
uCEFRequestContextHandler, uCEFExtension, uCEFStringList, uCEFMediaRouter;
function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean;
begin
@@ -307,6 +308,11 @@ begin
Result := TCefExtensionRef.UnWrap(PCefRequestContext(FData)^.get_extension(PCefRequestContext(FData), @TempID));
end;
function TCefRequestContextRef.GetMediaRouter: ICefMediaRouter;
begin
Result := TCefMediaRouterRef.UnWrap(PCefRequestContext(FData)^.get_media_router(PCefRequestContext(FData)));
end;
function TCefRequestContextRef.RegisterSchemeHandlerFactory(const schemeName : ustring;
const domainName : ustring;
const factory : ICefSchemeHandlerFactory): Boolean;

View File

@@ -69,7 +69,7 @@ type
TCustomServerHandler = class(TCEFServerHandlerOwn)
protected
FEvents : IServerEvents;
FEvents : Pointer;
procedure OnServerCreated(const server: ICefServer); override;
procedure OnServerDestroyed(const server: ICefServer); override;
@@ -278,7 +278,7 @@ constructor TCustomServerHandler.Create(const events: IServerEvents);
begin
inherited Create;
FEvents := events;
FEvents := Pointer(events);
end;
destructor TCustomServerHandler.Destroy;
@@ -291,7 +291,8 @@ end;
procedure TCustomServerHandler.OnServerCreated(const server: ICefServer);
begin
try
if (FEvents <> nil) then FEvents.doOnServerCreated(server);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnServerCreated(server);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnServerCreated', e) then raise;
@@ -301,7 +302,8 @@ end;
procedure TCustomServerHandler.OnServerDestroyed(const server: ICefServer);
begin
try
if (FEvents <> nil) then FEvents.doOnServerDestroyed(server);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnServerDestroyed(server);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnServerDestroyed', e) then raise;
@@ -311,7 +313,8 @@ end;
procedure TCustomServerHandler.OnClientConnected(const server: ICefServer; connection_id: Integer);
begin
try
if (FEvents <> nil) then FEvents.doOnClientConnected(server, connection_id);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnClientConnected(server, connection_id);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnClientConnected', e) then raise;
@@ -321,7 +324,8 @@ end;
procedure TCustomServerHandler.OnClientDisconnected(const server: ICefServer; connection_id: Integer);
begin
try
if (FEvents <> nil) then FEvents.doOnClientDisconnected(server, connection_id);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnClientDisconnected(server, connection_id);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnClientDisconnected', e) then raise;
@@ -331,7 +335,8 @@ end;
procedure TCustomServerHandler.OnHttpRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest);
begin
try
if (FEvents <> nil) then FEvents.doOnHttpRequest(server, connection_id, client_address, request);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnHttpRequest(server, connection_id, client_address, request);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnHttpRequest', e) then raise;
@@ -341,7 +346,8 @@ end;
procedure TCustomServerHandler.OnWebSocketRequest(const server: ICefServer; connection_id: Integer; const client_address: ustring; const request: ICefRequest; const callback: ICefCallback);
begin
try
if (FEvents <> nil) then FEvents.doOnWebSocketRequest(server, connection_id, client_address, request, callback);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnWebSocketRequest(server, connection_id, client_address, request, callback);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnWebSocketRequest', e) then raise;
@@ -351,7 +357,8 @@ end;
procedure TCustomServerHandler.OnWebSocketConnected(const server: ICefServer; connection_id: Integer);
begin
try
if (FEvents <> nil) then FEvents.doOnWebSocketConnected(server, connection_id);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnWebSocketConnected(server, connection_id);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnWebSocketConnected', e) then raise;
@@ -361,7 +368,8 @@ end;
procedure TCustomServerHandler.OnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt);
begin
try
if (FEvents <> nil) then FEvents.doOnWebSocketMessage(server, connection_id, data, data_size);
if (FEvents <> nil) then
IServerEvents(FEvents).doOnWebSocketMessage(server, connection_id, data, data_size);
except
on e : exception do
if CustomExceptionHandler('TCustomServerHandler.OnWebSocketMessage', e) then raise;

View File

@@ -234,6 +234,15 @@ type
PCefWindow = ^TCefWindow;
PCefWindowDelegate = ^TCefWindowDelegate;
PCefBoxLayoutSettings = ^TCefBoxLayoutSettings;
PCefRegistration = ^TCefRegistration;
PCefMediaRouter = ^TCefMediaRouter;
PCefMediaRoute = ^TCefMediaRoute;
PPCefMediaRoute = ^PCefMediaRoute;
PCefMediaRouteCreateCallback = ^TCefMediaRouteCreateCallback;
PCefMediaObserver = ^TCefMediaObserver;
PCefMediaSink = ^TCefMediaSink;
PPCefMediaSink = ^PCefMediaSink;
PCefMediaSource = ^TCefMediaSource;
{$IFDEF LINUX}
PXEvent = Pointer;
@@ -286,6 +295,7 @@ type
TCefFileDialogMode = Cardinal; // /include/internal/cef_types.h (cef_file_dialog_mode_t)
TCefDuplexMode = Integer; // /include/internal/cef_types.h (cef_duplex_mode_t)
TCefSchemeOptions = Integer; // /include/internal/cef_types.h (cef_scheme_options_t)
TCefMediaRouterCreateResult = Integer; // /include/internal/cef_types.h (cef_media_route_create_result_t)
{$IFDEF FPC}
@@ -541,6 +551,15 @@ type
VTYPE_LIST
);
// /include/internal/cef_types.h (cef_media_route_connection_state_t)
TCefMediaRouteConnectionState = (
CEF_MRCS_UNKNOWN,
CEF_MRCS_CONNECTING,
CEF_MRCS_CONNECTED,
CEF_MRCS_CLOSED,
CEF_MRCS_TERMINATED
);
// /include/internal/cef_types.h (cef_referrer_policy_t)
TCefReferrerPolicy = (
REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, // same value as REFERRER_POLICY_DEFAULT
@@ -1452,6 +1471,67 @@ type
on_before_close : procedure(self: PCefLifeSpanHandler; browser: PCefBrowser); stdcall;
end;
// /include/capi/cef_registration_capi.h (cef_registration_t)
TCefRegistration = record
base : TCefBaseRefCounted;
end;
// /include/capi/cef_media_router_capi.h (cef_media_router_t)
TCefMediaRouter = record
base : TCefBaseRefCounted;
add_observer : function(self: PCefMediaRouter; observer: PCefMediaObserver): PCefRegistration; stdcall;
get_source : function(self: PCefMediaRouter; const urn: PCefString): PCefMediaSource; stdcall;
notify_current_sinks : procedure(self: PCefMediaRouter); stdcall;
create_route : procedure(self: PCefMediaRouter; source: PCefMediaSource; sink: PCefMediaSink; callback: PCefMediaRouteCreateCallback); stdcall;
notify_current_routes : procedure(self: PCefMediaRouter); stdcall;
end;
// /include/capi/cef_media_router_capi.h (cef_media_observer_t)
TCefMediaObserver = record
base : TCefBaseRefCounted;
on_sinks : procedure(self: PCefMediaObserver; sinksCount: NativeUInt; const sinks: PPCefMediaSink); stdcall;
on_routes : procedure(self: PCefMediaObserver; routesCount: NativeUInt; const routes: PPCefMediaRoute); stdcall;
on_route_state_changed : procedure(self: PCefMediaObserver; route: PCefMediaRoute; state: TCefMediaRouteConnectionState); stdcall;
on_route_message_received : procedure(self: PCefMediaObserver; route: PCefMediaRoute; const message_: Pointer; message_size: NativeUInt); stdcall;
end;
// /include/capi/cef_media_router_capi.h (cef_media_route_t)
TCefMediaRoute = record
base : TCefBaseRefCounted;
get_id : function(self: PCefMediaRoute): PCefStringUserFree; stdcall;
get_source : function(self: PCefMediaRoute): PCefMediaSource; stdcall;
get_sink : function(self: PCefMediaRoute): PCefMediaSink; stdcall;
send_route_message : procedure(self: PCefMediaRoute; const message_: Pointer; message_size: NativeUInt); stdcall;
terminate : procedure(self: PCefMediaRoute); stdcall;
end;
// /include/capi/cef_media_router_capi.h (cef_media_route_create_callback_t)
TCefMediaRouteCreateCallback = record
base : TCefBaseRefCounted;
on_media_route_create_finished : procedure(self: PCefMediaRouteCreateCallback; result: TCefMediaRouterCreateResult; const error: PCefString; route: PCefMediaRoute); stdcall;
end;
// /include/capi/cef_media_router_capi.h (cef_media_sink_t)
TCefMediaSink = record
base : TCefBaseRefCounted;
get_id : function(self: PCefMediaSink): PCefStringUserFree; stdcall;
is_valid : function(self: PCefMediaSink): Integer; stdcall;
get_name : function(self: PCefMediaSink): PCefStringUserFree; stdcall;
get_description : function(self: PCefMediaSink): PCefStringUserFree; stdcall;
is_cast_sink : function(self: PCefMediaSink): Integer; stdcall;
is_dial_sink : function(self: PCefMediaSink): Integer; stdcall;
is_compatible_with : function(self: PCefMediaSink; source: PCefMediaSource): Integer; stdcall;
end;
// /include/capi/cef_media_router_capi.h (cef_media_source_t)
TCefMediaSource = record
base : TCefBaseRefCounted;
get_id : function(self: PCefMediaSource): PCefStringUserFree; stdcall;
is_valid : function(self: PCefMediaSource): Integer; stdcall;
is_cast_source : function(self: PCefMediaSource): Integer; stdcall;
is_dial_source : function(self: PCefMediaSource): Integer; stdcall;
end;
// /include/capi/cef_extension_handler_capi.h (cef_get_extension_resource_callback_t)
TCefGetExtensionResourceCallback = record
base : TCefBaseRefCounted;
@@ -1873,6 +1953,7 @@ type
has_extension : function(self: PCefRequestContext; const extension_id: PCefString): Integer; stdcall;
get_extensions : function(self: PCefRequestContext; extension_ids: TCefStringList): Integer; stdcall;
get_extension : function(self: PCefRequestContext; const extension_id: PCefString): PCefExtension; stdcall;
get_media_router : function(self: PCefRequestContext): PCefMediaRouter; stdcall;
end;
// /include/capi/cef_request_context_handler_capi.h (cef_request_context_handler_t)

View File

@@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 109,
"InternalVersion" : 110,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "80.0.8.0"
"Version" : "80.1.2.0"
}
],
"UpdatePackageData" : {