You've already forked CEF4Delphi
							
							
				mirror of
				https://github.com/salvadordf/CEF4Delphi.git
				synced 2025-10-30 23:07:52 +02:00 
			
		
		
		
	Update to CEF 3.3683.1920.g9f41a27
This commit is contained in:
		| @@ -52,7 +52,6 @@ object Form1: TForm1 | ||||
|     Visible = False | ||||
|   end | ||||
|   object chrmosr: TChromium | ||||
|     OnProcessMessageReceived = chrmosrProcessMessageReceived | ||||
|     OnBeforeContextMenu = chrmosrBeforeContextMenu | ||||
|     OnContextMenuCommand = chrmosrContextMenuCommand | ||||
|     OnTooltip = chrmosrTooltip | ||||
| @@ -66,6 +65,7 @@ object Form1: TForm1 | ||||
|     OnPopupSize = chrmosrPopupSize | ||||
|     OnPaint = chrmosrPaint | ||||
|     OnCursorChange = chrmosrCursorChange | ||||
|     OnVirtualKeyboardRequested = chrmosrVirtualKeyboardRequested | ||||
|     Left = 24 | ||||
|     Top = 56 | ||||
|   end | ||||
|   | ||||
| @@ -103,11 +103,11 @@ type | ||||
|     procedure chrmosrBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean); | ||||
|     procedure chrmosrClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); | ||||
|     procedure chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); | ||||
|     procedure chrmosrProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean); | ||||
|     procedure chrmosrBeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel); | ||||
|     procedure chrmosrContextMenuCommand(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: Cardinal; out Result: Boolean); | ||||
|     procedure chrmosrVirtualKeyboardRequested(Sender: TObject; const browser: ICefBrowser; input_mode: TCefTextInpuMode); | ||||
|  | ||||
|     protected | ||||
|   protected | ||||
|     FPopUpBitmap     : TBitmap; | ||||
|     FPopUpRect       : TRect; | ||||
|     FShowPopUp       : boolean; | ||||
| @@ -170,68 +170,11 @@ uses | ||||
| // 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed. | ||||
| //    Now we set FCanClose to True and send WM_CLOSE to the form. | ||||
|  | ||||
| function NodeIsTextArea(const aNode : ICefDomNode) : boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} | ||||
| begin | ||||
|   Result := (CompareText(aNode.ElementTagName, 'textarea') = 0); | ||||
| end; | ||||
|  | ||||
| function NodeIsInput(const aNode : ICefDomNode) : boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} | ||||
| begin | ||||
|   Result := (CompareText(aNode.ElementTagName, 'input') = 0); | ||||
| end; | ||||
|  | ||||
| function InputNeedsKeyboard(const aNode : ICefDomNode) : boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} | ||||
| var | ||||
|   TempType : string; | ||||
| begin | ||||
|   if not(aNode.HasElementAttribute('type')) then | ||||
|     Result := True | ||||
|    else | ||||
|     begin | ||||
|       TempType := aNode.GetElementAttribute('type'); | ||||
|       Result   := (CompareText(TempType, 'date')           = 0) or | ||||
|                   (CompareText(TempType, 'datetime-local') = 0) or | ||||
|                   (CompareText(TempType, 'email')          = 0) or | ||||
|                   (CompareText(TempType, 'month')          = 0) or | ||||
|                   (CompareText(TempType, 'number')         = 0) or | ||||
|                   (CompareText(TempType, 'password')       = 0) or | ||||
|                   (CompareText(TempType, 'search')         = 0) or | ||||
|                   (CompareText(TempType, 'tel')            = 0) or | ||||
|                   (CompareText(TempType, 'text')           = 0) or | ||||
|                   (CompareText(TempType, 'time')           = 0) or | ||||
|                   (CompareText(TempType, 'url')            = 0) or | ||||
|                   (CompareText(TempType, 'week')           = 0); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| function NodeNeedsKeyboard(const aNode : ICefDomNode) : boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} | ||||
| begin | ||||
|   Result := NodeIsTextArea(aNode) or | ||||
|             (NodeIsInput(aNode) and InputNeedsKeyboard(aNode)); | ||||
| end; | ||||
|  | ||||
| procedure GlobalCEFApp_OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode); | ||||
| var | ||||
|   TempMsg : ICefProcessMessage; | ||||
| begin | ||||
|   // This procedure is called in the Render process and checks if the focused node is an | ||||
|   // INPUT or TEXTAREA to show or hide the virtual keyboard. | ||||
|   // It sends a process message to the browser process to handle the virtual keyboard. | ||||
|  | ||||
|   if (node <> nil) and NodeNeedsKeyboard(node) then | ||||
|     TempMsg := TCefProcessMessageRef.New(SHOWKEYBOARD_PROCMSG) | ||||
|    else | ||||
|     TempMsg := TCefProcessMessageRef.New(HIDEKEYBOARD_PROCMSG); | ||||
|  | ||||
|   browser.SendProcessMessage(PID_BROWSER, TempMsg); | ||||
| end; | ||||
|  | ||||
| procedure CreateGlobalCEFApp; | ||||
| begin | ||||
|   GlobalCEFApp                            := TCefApplication.Create; | ||||
|   GlobalCEFApp.WindowlessRenderingEnabled := True; | ||||
|   GlobalCEFApp.EnableHighDPISupport       := True; | ||||
|   GlobalCEFApp.OnFocusedNodeChanged       := GlobalCEFApp_OnFocusedNodeChanged; | ||||
| end; | ||||
|  | ||||
| procedure TForm1.AppEventsMessage(var Msg: tagMSG; var Handled: Boolean); | ||||
| @@ -630,29 +573,6 @@ begin | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TForm1.chrmosrProcessMessageReceived(      Sender        : TObject; | ||||
|                                                const browser       : ICefBrowser; | ||||
|                                                      sourceProcess : TCefProcessId; | ||||
|                                                const message       : ICefProcessMessage; | ||||
|                                                out   Result        : Boolean); | ||||
| begin | ||||
|   // This function receives the process message from the render process to show or hide the virtual keyboard. | ||||
|   // This event is not executed in the main thread so it has to send a custom windows message to the form | ||||
|   // to handle the keyboard in the main thread. | ||||
|  | ||||
|   if (message.Name = SHOWKEYBOARD_PROCMSG) then | ||||
|     begin | ||||
|       PostMessage(Handle, CEF_SHOWKEYBOARD, 0 ,0); | ||||
|       Result := True; | ||||
|     end | ||||
|    else | ||||
|     if (message.Name = HIDEKEYBOARD_PROCMSG) then | ||||
|       begin | ||||
|         PostMessage(Handle, CEF_HIDEKEYBOARD, 0 ,0); | ||||
|         Result := True; | ||||
|       end; | ||||
| end; | ||||
|  | ||||
| procedure TForm1.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean); | ||||
| begin | ||||
|   Panel1.hint     := text; | ||||
| @@ -660,6 +580,16 @@ begin | ||||
|   Result          := True; | ||||
| end; | ||||
|  | ||||
| procedure TForm1.chrmosrVirtualKeyboardRequested(      Sender     : TObject; | ||||
|                                                  const browser    : ICefBrowser; | ||||
|                                                        input_mode : TCefTextInpuMode); | ||||
| begin | ||||
|   if (input_mode = CEF_TEXT_INPUT_MODE_NONE) then | ||||
|     PostMessage(Handle, CEF_HIDEKEYBOARD, 0, 0) | ||||
|    else | ||||
|     PostMessage(Handle, CEF_SHOWKEYBOARD, 0, 0); | ||||
| end; | ||||
|  | ||||
| function TForm1.getModifiers(Shift: TShiftState): TCefEventFlags; | ||||
| begin | ||||
|   Result := EVENTFLAG_NONE; | ||||
|   | ||||
| @@ -127,7 +127,7 @@ uses | ||||
|  | ||||
| procedure GlobalCEFApp_OnRegCustomSchemes(const registrar: TCefSchemeRegistrarRef); | ||||
| begin | ||||
|   registrar.AddCustomScheme('hello', True, True, False, False, False, False); | ||||
|   registrar.AddCustomScheme('hello', CEF_SCHEME_OPTION_STANDARD or CEF_SCHEME_OPTION_LOCAL); | ||||
| end; | ||||
|  | ||||
| procedure CreateGlobalCEFApp; | ||||
|   | ||||
| @@ -6,7 +6,7 @@ | ||||
|         <MainSource>SimpleBrowser2.dpr</MainSource> | ||||
|         <Base>True</Base> | ||||
|         <Config Condition="'$(Config)'==''">Debug</Config> | ||||
|         <Platform Condition="'$(Platform)'==''">Win64</Platform> | ||||
|         <Platform Condition="'$(Platform)'==''">Win32</Platform> | ||||
|         <TargetedPlatforms>3</TargetedPlatforms> | ||||
|         <AppType>Application</AppType> | ||||
|     </PropertyGroup> | ||||
|   | ||||
| @@ -167,7 +167,8 @@ contains | ||||
|   uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', | ||||
|   uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', | ||||
|   uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas', | ||||
|   uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas'; | ||||
|   uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas', | ||||
|   uCEFAudioHandler in '..\source\uCEFAudioHandler.pas'; | ||||
|  | ||||
| end. | ||||
|  | ||||
|   | ||||
| @@ -164,6 +164,7 @@ contains | ||||
|   uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', | ||||
|   uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', | ||||
|   uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas', | ||||
|   uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas'; | ||||
|   uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas', | ||||
|   uCEFAudioHandler in '..\source\uCEFAudioHandler.pas'; | ||||
|  | ||||
| end. | ||||
|   | ||||
| @@ -9,13 +9,13 @@ package CEF4Delphi_FMX; | ||||
| {$EXTENDEDSYNTAX ON} | ||||
| {$IMPORTEDDATA ON} | ||||
| {$IOCHECKS ON} | ||||
| {$LOCALSYMBOLS ON} | ||||
| {$LOCALSYMBOLS OFF} | ||||
| {$LONGSTRINGS ON} | ||||
| {$OPENSTRINGS ON} | ||||
| {$OPTIMIZATION ON} | ||||
| {$OVERFLOWCHECKS ON} | ||||
| {$RANGECHECKS ON} | ||||
| {$REFERENCEINFO ON} | ||||
| {$OVERFLOWCHECKS OFF} | ||||
| {$RANGECHECKS OFF} | ||||
| {$REFERENCEINFO OFF} | ||||
| {$SAFEDIVIDE OFF} | ||||
| {$STACKFRAMES OFF} | ||||
| {$TYPEDADDRESS OFF} | ||||
| @@ -23,8 +23,8 @@ package CEF4Delphi_FMX; | ||||
| {$WRITEABLECONST OFF} | ||||
| {$MINENUMSIZE 1} | ||||
| {$IMAGEBASE $400000} | ||||
| {$DEFINE RELEASE} | ||||
| {$ENDIF IMPLICITBUILDING} | ||||
| {$DESCRIPTION 'CEF4Delphi'} | ||||
| {$IMPLICITBUILD OFF} | ||||
|  | ||||
| requires | ||||
| @@ -171,7 +171,8 @@ contains | ||||
|   uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', | ||||
|   uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', | ||||
|   uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas', | ||||
|   uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas'; | ||||
|   uCEFOSRIMEHandler in '..\source\uCEFOSRIMEHandler.pas', | ||||
|   uCEFAudioHandler in '..\source\uCEFAudioHandler.pas'; | ||||
|  | ||||
| end. | ||||
|  | ||||
|   | ||||
| @@ -273,6 +273,7 @@ | ||||
|         <DCCReference Include="..\source\uCEFUrlRequestClientEvents.pas"/> | ||||
|         <DCCReference Include="..\source\uCEFUrlRequestClientComponent.pas"/> | ||||
|         <DCCReference Include="..\source\uCEFOSRIMEHandler.pas"/> | ||||
|         <DCCReference Include="..\source\uCEFAudioHandler.pas"/> | ||||
|         <BuildConfiguration Include="Base"> | ||||
|             <Key>Base</Key> | ||||
|         </BuildConfiguration> | ||||
|   | ||||
| @@ -21,7 +21,7 @@ | ||||
|     </CompilerOptions> | ||||
|     <Description Value="CEF4Delphi"/> | ||||
|     <Version Major="1"/> | ||||
|     <Files Count="138"> | ||||
|     <Files Count="139"> | ||||
|       <Item1> | ||||
|         <Filename Value="..\source\uCEFAccessibilityHandler.pas"/> | ||||
|         <UnitName Value="uCEFAccessibilityHandler"/> | ||||
| @@ -582,6 +582,10 @@ | ||||
|         <Filename Value="..\source\uCEFOSRIMEHandler.pas"/> | ||||
|         <UnitName Value="uCEFOSRIMEHandler"/> | ||||
|       </Item138> | ||||
|       <Item139> | ||||
|         <Filename Value="..\source\uCEFAudioHandler.pas"/> | ||||
|         <UnitName Value="uCEFAudioHandler"/> | ||||
|       </Item139> | ||||
|     </Files> | ||||
|     <RequiredPkgs Count="3"> | ||||
|       <Item1> | ||||
|   | ||||
| @@ -47,7 +47,7 @@ uses | ||||
|   uCEFZipReader, uCEFChromium, uBufferPanel, uCEFServer, uCEFServerComponent,  | ||||
|   uCEFServerEvents, uCEFServerHandler, uCEFWinControl, uCEFLinkedWindowParent,  | ||||
|   uCEFUrlRequestClientEvents, uCEFUrlRequestClientComponent,  | ||||
|   uCEFOSRIMEHandler, LazarusPackageIntf; | ||||
|   uCEFOSRIMEHandler, uCEFAudioHandler, LazarusPackageIntf; | ||||
|  | ||||
| implementation | ||||
|  | ||||
|   | ||||
| @@ -58,14 +58,14 @@ uses | ||||
|  | ||||
| const | ||||
|   CEF_SUPPORTED_VERSION_MAJOR   = 3; | ||||
|   CEF_SUPPORTED_VERSION_MINOR   = 3626; | ||||
|   CEF_SUPPORTED_VERSION_RELEASE = 1895; | ||||
|   CEF_SUPPORTED_VERSION_MINOR   = 3683; | ||||
|   CEF_SUPPORTED_VERSION_RELEASE = 1920; | ||||
|   CEF_SUPPORTED_VERSION_BUILD   = 0; | ||||
|  | ||||
|   CEF_CHROMEELF_VERSION_MAJOR   = 72; | ||||
|   CEF_CHROMEELF_VERSION_MAJOR   = 73; | ||||
|   CEF_CHROMEELF_VERSION_MINOR   = 0; | ||||
|   CEF_CHROMEELF_VERSION_RELEASE = 3626; | ||||
|   CEF_CHROMEELF_VERSION_BUILD   = 121; | ||||
|   CEF_CHROMEELF_VERSION_RELEASE = 3683; | ||||
|   CEF_CHROMEELF_VERSION_BUILD   = 75; | ||||
|  | ||||
|   {$IFDEF MSWINDOWS} | ||||
|   LIBCEF_DLL                    = 'libcef.dll'; | ||||
|   | ||||
							
								
								
									
										247
									
								
								source/uCEFAudioHandler.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										247
									
								
								source/uCEFAudioHandler.pas
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,247 @@ | ||||
| // ************************************************************************ | ||||
| // ***************************** CEF4Delphi ******************************* | ||||
| // ************************************************************************ | ||||
| // | ||||
| // CEF4Delphi is based on DCEF3 which uses CEF3 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 � 2019 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 uCEFAudioHandler; | ||||
|  | ||||
| {$IFDEF FPC} | ||||
|   {$MODE OBJFPC}{$H+} | ||||
| {$ENDIF} | ||||
|  | ||||
| {$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF} | ||||
| {$MINENUMSIZE 4} | ||||
|  | ||||
| {$I cef.inc} | ||||
|  | ||||
| interface | ||||
|  | ||||
| uses | ||||
|   uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; | ||||
|  | ||||
| type | ||||
|   TCefAudioHandlerOwn = class(TCefBaseRefCountedOwn, ICefAudioHandler) | ||||
|     protected | ||||
|       procedure OnAudioStreamStarted(const browser: ICefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer); virtual; | ||||
|       procedure OnAudioStreamPacket(const browser: ICefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64); virtual; | ||||
|       procedure OnAudioStreamStopped(const browser: ICefBrowser; audio_stream_id: integer); virtual; | ||||
|  | ||||
|       procedure RemoveReferences; virtual; | ||||
|  | ||||
|     public | ||||
|       constructor Create; virtual; | ||||
|   end; | ||||
|  | ||||
|   TCustomAudioHandler = class(TCefAudioHandlerOwn) | ||||
|     protected | ||||
|       FEvents : Pointer; | ||||
|  | ||||
|       procedure OnAudioStreamStarted(const browser: ICefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer); override; | ||||
|       procedure OnAudioStreamPacket(const browser: ICefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64); override; | ||||
|       procedure OnAudioStreamStopped(const browser: ICefBrowser; audio_stream_id: integer); override; | ||||
|  | ||||
|       procedure RemoveReferences; override; | ||||
|  | ||||
|     public | ||||
|       constructor Create(const events: Pointer); reintroduce; virtual; | ||||
|       destructor  Destroy; override; | ||||
|   end; | ||||
|  | ||||
| implementation | ||||
|  | ||||
| uses | ||||
|   {$IFDEF DELPHI16_UP} | ||||
|   System.SysUtils, | ||||
|   {$ELSE} | ||||
|   SysUtils, | ||||
|   {$ENDIF} | ||||
|   uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser; | ||||
|  | ||||
| procedure cef_audio_handler_on_audio_stream_started(self              : PCefAudioHandler; | ||||
|                                                     browser           : PCefBrowser; | ||||
|                                                     audio_stream_id   : integer; | ||||
|                                                     channels          : integer; | ||||
|                                                     channel_layout    : TCefChannelLayout; | ||||
|                                                     sample_rate       : integer; | ||||
|                                                     frames_per_buffer : integer); stdcall; | ||||
| var | ||||
|   TempObject : TObject; | ||||
| begin | ||||
|   TempObject := CefGetObject(self); | ||||
|  | ||||
|   if (TempObject <> nil) and (TempObject is TCefAudioHandlerOwn) then | ||||
|     TCefAudioHandlerOwn(TempObject).OnAudioStreamStarted(TCefBrowserRef.UnWrap(browser), | ||||
|                                                          audio_stream_id, | ||||
|                                                          channels, | ||||
|                                                          channel_layout, | ||||
|                                                          sample_rate, | ||||
|                                                          frames_per_buffer); | ||||
| end; | ||||
|  | ||||
| procedure cef_audio_handler_on_audio_stream_packet(      self            : PCefAudioHandler; | ||||
|                                                          browser         : PCefBrowser; | ||||
|                                                          audio_stream_id : integer; | ||||
|                                                    const data            : PPSingle; | ||||
|                                                          frames          : integer; | ||||
|                                                          pts             : int64); stdcall; | ||||
| var | ||||
|   TempObject : TObject; | ||||
| begin | ||||
|   TempObject := CefGetObject(self); | ||||
|  | ||||
|   if (TempObject <> nil) and (TempObject is TCefAudioHandlerOwn) then | ||||
|     TCefAudioHandlerOwn(TempObject).OnAudioStreamPacket(TCefBrowserRef.UnWrap(browser), | ||||
|                                                         audio_stream_id, | ||||
|                                                         data, | ||||
|                                                         frames, | ||||
|                                                         pts); | ||||
| end; | ||||
|  | ||||
| procedure cef_audio_handler_on_audio_stream_stopped(self            : PCefAudioHandler; | ||||
|                                                     browser         : PCefBrowser; | ||||
|                                                     audio_stream_id : integer); stdcall; | ||||
| var | ||||
|   TempObject : TObject; | ||||
| begin | ||||
|   TempObject := CefGetObject(self); | ||||
|  | ||||
|   if (TempObject <> nil) and (TempObject is TCefAudioHandlerOwn) then | ||||
|     TCefAudioHandlerOwn(TempObject).OnAudioStreamStopped(TCefBrowserRef.UnWrap(browser), | ||||
|                                                          audio_stream_id); | ||||
| end; | ||||
|  | ||||
| constructor TCefAudioHandlerOwn.Create; | ||||
| begin | ||||
|   inherited CreateData(SizeOf(TCefAudioHandler)); | ||||
|  | ||||
|   with PCefAudioHandler(FData)^ do | ||||
|     begin | ||||
|       on_audio_stream_started := {$IFDEF FPC}@{$ENDIF}cef_audio_handler_on_audio_stream_started; | ||||
|       on_audio_stream_packet  := {$IFDEF FPC}@{$ENDIF}cef_audio_handler_on_audio_stream_packet; | ||||
|       on_audio_stream_stopped := {$IFDEF FPC}@{$ENDIF}cef_audio_handler_on_audio_stream_stopped; | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TCefAudioHandlerOwn.OnAudioStreamStarted(const browser           : ICefBrowser; | ||||
|                                                          audio_stream_id   : integer; | ||||
|                                                          channels          : integer; | ||||
|                                                          channel_layout    : TCefChannelLayout; | ||||
|                                                          sample_rate       : integer; | ||||
|                                                          frames_per_buffer : integer); | ||||
| begin | ||||
|   // | ||||
| end; | ||||
|  | ||||
| procedure TCefAudioHandlerOwn.OnAudioStreamPacket(const browser         : ICefBrowser; | ||||
|                                                         audio_stream_id : integer; | ||||
|                                                   const data            : PPSingle; | ||||
|                                                         frames          : integer; | ||||
|                                                         pts             : int64); | ||||
| begin | ||||
|   // | ||||
| end; | ||||
|  | ||||
| procedure TCefAudioHandlerOwn.OnAudioStreamStopped(const browser         : ICefBrowser; | ||||
|                                                          audio_stream_id : integer); | ||||
| begin | ||||
|   // | ||||
| end; | ||||
|  | ||||
| procedure TCefAudioHandlerOwn.RemoveReferences; | ||||
| begin | ||||
|   // | ||||
| end; | ||||
|  | ||||
|  | ||||
| // TCustomAudioHandler | ||||
|  | ||||
| constructor TCustomAudioHandler.Create(const events: Pointer); | ||||
| begin | ||||
|   inherited Create; | ||||
|  | ||||
|   FEvents := events; | ||||
| end; | ||||
|  | ||||
| destructor TCustomAudioHandler.Destroy; | ||||
| begin | ||||
|   RemoveReferences; | ||||
|  | ||||
|   inherited Destroy; | ||||
| end; | ||||
|  | ||||
| procedure TCustomAudioHandler.RemoveReferences; | ||||
| begin | ||||
|   FEvents := nil; | ||||
| end; | ||||
|  | ||||
| procedure TCustomAudioHandler.OnAudioStreamStarted(const browser           : ICefBrowser; | ||||
|                                                          audio_stream_id   : integer; | ||||
|                                                          channels          : integer; | ||||
|                                                          channel_layout    : TCefChannelLayout; | ||||
|                                                          sample_rate       : integer; | ||||
|                                                          frames_per_buffer : integer); | ||||
| begin | ||||
|   if (FEvents <> nil) then | ||||
|     IChromiumEvents(FEvents).doOnAudioStreamStarted(browser, | ||||
|                                                     audio_stream_id, | ||||
|                                                     channels, | ||||
|                                                     channel_layout, | ||||
|                                                     sample_rate, | ||||
|                                                     frames_per_buffer); | ||||
| end; | ||||
|  | ||||
| procedure TCustomAudioHandler.OnAudioStreamPacket(const browser         : ICefBrowser; | ||||
|                                                         audio_stream_id : integer; | ||||
|                                                   const data            : PPSingle; | ||||
|                                                         frames          : integer; | ||||
|                                                         pts             : int64); | ||||
| begin | ||||
|   if (FEvents <> nil) then | ||||
|     IChromiumEvents(FEvents).doOnAudioStreamPacket(browser, | ||||
|                                                    audio_stream_id, | ||||
|                                                    data, | ||||
|                                                    frames, | ||||
|                                                    pts); | ||||
| end; | ||||
|  | ||||
| procedure TCustomAudioHandler.OnAudioStreamStopped(const browser         : ICefBrowser; | ||||
|                                                          audio_stream_id : integer); | ||||
| begin | ||||
|   if (FEvents <> nil) then | ||||
|     IChromiumEvents(FEvents).doOnAudioStreamStopped(browser, | ||||
|                                                     audio_stream_id); | ||||
| end; | ||||
|  | ||||
| end. | ||||
| @@ -126,6 +126,7 @@ type | ||||
|       procedure SendMouseClickEvent(const event: PCefMouseEvent; kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer); | ||||
|       procedure SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean); | ||||
|       procedure SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer); | ||||
|       procedure SendTouchEvent(const event: PCefTouchEvent); | ||||
|       procedure SendFocusEvent(aSetFocus: Boolean); | ||||
|       procedure SendCaptureLostEvent; | ||||
|       procedure NotifyMoveOrResizeStarted; | ||||
| @@ -146,6 +147,8 @@ type | ||||
|       procedure SetAutoResizeEnabled(enabled: boolean; const min_size, max_size: PCefSize); | ||||
|       function  GetExtension : ICefExtension; | ||||
|       function  IsBackgroundHost : boolean; | ||||
|       procedure SetAudioMuted(mute: boolean); | ||||
|       function  IsAudioMuted : boolean; | ||||
|  | ||||
|     public | ||||
|       class function UnWrap(data: Pointer): ICefBrowserHost; | ||||
| @@ -378,6 +381,16 @@ begin | ||||
|   Result := PCefBrowserHost(FData)^.is_background_host(PCefBrowserHost(FData)) <> 0; | ||||
| end; | ||||
|  | ||||
| procedure TCefBrowserHostRef.SetAudioMuted(mute: boolean); | ||||
| begin | ||||
|   PCefBrowserHost(FData)^.set_audio_muted(PCefBrowserHost(FData), Ord(mute)); | ||||
| end; | ||||
|  | ||||
| function TCefBrowserHostRef.IsAudioMuted : boolean; | ||||
| begin | ||||
|   Result := PCefBrowserHost(FData)^.is_audio_muted(PCefBrowserHost(FData)) <> 0; | ||||
| end; | ||||
|  | ||||
| procedure TCefBrowserHostRef.DragTargetDragEnter(const dragData: ICefDragData; const event: PCefMouseEvent; allowedOps: TCefDragOperations); | ||||
| begin | ||||
|   PCefBrowserHost(FData)^.drag_target_drag_enter(PCefBrowserHost(FData), CefGetData(dragData), event, allowedOps); | ||||
| @@ -526,6 +539,11 @@ begin | ||||
|   PCefBrowserHost(FData)^.send_mouse_wheel_event(PCefBrowserHost(FData), event, deltaX, deltaY); | ||||
| end; | ||||
|  | ||||
| procedure TCefBrowserHostRef.SendTouchEvent(const event: PCefTouchEvent); | ||||
| begin | ||||
|   PCefBrowserHost(FData)^.send_touch_event(PCefBrowserHost(FData), event); | ||||
| end; | ||||
|  | ||||
| procedure TCefBrowserHostRef.SetFocus(focus: Boolean); | ||||
| begin | ||||
|   PCefBrowserHost(FData)^.set_focus(PCefBrowserHost(FData), Ord(focus)); | ||||
|   | ||||
| @@ -219,6 +219,7 @@ type | ||||
|       FOnScrollOffsetChanged          : TOnScrollOffsetChanged; | ||||
|       FOnIMECompositionRangeChanged   : TOnIMECompositionRangeChanged; | ||||
|       FOnTextSelectionChanged         : TOnTextSelectionChanged; | ||||
|       FOnVirtualKeyboardRequested     : TOnVirtualKeyboardRequested; | ||||
|  | ||||
|       // ICefDragHandler | ||||
|       FOnDragEnter                    : TOnDragEnter; | ||||
| @@ -227,6 +228,11 @@ type | ||||
|       // ICefFindHandler | ||||
|       FOnFindResult                   : TOnFindResult; | ||||
|  | ||||
|       // ICefAudioHandler | ||||
|       FOnAudioStreamStarted           : TOnAudioStreamStarted; | ||||
|       FOnAudioStreamPacket            : TOnAudioStreamPacket; | ||||
|       FOnAudioStreamStopped           : TOnAudioStreamStopped; | ||||
|  | ||||
|       // Custom | ||||
|       FOnTextResultAvailable              : TOnTextResultAvailableEvent; | ||||
|       FOnPdfPrintFinished                 : TOnPdfPrintFinishedEvent; | ||||
| @@ -262,6 +268,7 @@ type | ||||
|       function  GetFrameCount : NativeUInt; | ||||
|       function  GetRequestContextCache : ustring; | ||||
|       function  GetRequestContextIsGlobal : boolean; | ||||
|       function  GetAudioMuted : boolean; | ||||
|  | ||||
|       procedure SetDoNotTrack(aValue : boolean); | ||||
|       procedure SetSendReferrer(aValue : boolean); | ||||
| @@ -290,6 +297,7 @@ type | ||||
|       procedure SetZoomPct(const aValue : double); | ||||
|       procedure SetZoomStep(aValue : byte); | ||||
|       procedure SetWindowlessFrameRate(aValue : integer); | ||||
|       procedure SetAudioMuted(aValue : boolean); | ||||
|  | ||||
|  | ||||
|       function  CreateBrowserHost(aWindowInfo : PCefWindowInfo; const aURL : ustring; const aSettings : PCefBrowserSettings; const aContext : ICefRequestContext): boolean; | ||||
| @@ -332,6 +340,8 @@ type | ||||
|       function  MustCreateJsDialogHandler : boolean; virtual; | ||||
|       function  MustCreateDragHandler : boolean; virtual; | ||||
|       function  MustCreateFindHandler : boolean; virtual; | ||||
|       function  MustCreateAudioHandler : boolean; virtual; | ||||
|  | ||||
|       {$IFDEF MSWINDOWS} | ||||
|       procedure PrefsAvailableMsg(var aMessage : TMessage); | ||||
|       {$ENDIF} | ||||
| @@ -453,6 +463,7 @@ type | ||||
|       procedure doOnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); virtual; | ||||
|       procedure doOnIMECompositionRangeChanged(const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); virtual; | ||||
|       procedure doOnTextSelectionChanged(const browser: ICefBrowser; const selected_text: ustring; const selected_range: PCefRange); virtual; | ||||
|       procedure doOnVirtualKeyboardRequested(const browser: ICefBrowser; input_mode: TCefTextInpuMode); virtual; | ||||
|  | ||||
|       // ICefDragHandler | ||||
|       function  doOnDragEnter(const browser: ICefBrowser; const dragData: ICefDragData; mask: TCefDragOperations): Boolean; virtual; | ||||
| @@ -461,6 +472,11 @@ type | ||||
|       // ICefFindHandler | ||||
|       procedure doOnFindResult(const browser: ICefBrowser; identifier, count: Integer; const selectionRect: PCefRect; activeMatchOrdinal: Integer; finalUpdate: Boolean); virtual; | ||||
|  | ||||
|       // ICefAudioHandler | ||||
|       procedure doOnAudioStreamStarted(const browser: ICefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer); | ||||
|       procedure doOnAudioStreamPacket(const browser: ICefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64); | ||||
|       procedure doOnAudioStreamStopped(const browser: ICefBrowser; audio_stream_id: integer); | ||||
|  | ||||
|       // Custom | ||||
|       procedure doCookiesDeleted(numDeleted : integer); virtual; | ||||
|       procedure doPdfPrintFinished(aResultOK : boolean); virtual; | ||||
| @@ -557,6 +573,7 @@ type | ||||
|       procedure   SendMouseClickEvent(const event: PCefMouseEvent; kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer); | ||||
|       procedure   SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean); | ||||
|       procedure   SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer); | ||||
|       procedure   SendTouchEvent(const event: PCefTouchEvent); | ||||
|       procedure   SendFocusEvent(setFocus: Boolean); | ||||
|       procedure   SendCaptureLostEvent; | ||||
|       function    SendProcessMessage(targetProcess: TCefProcessId; const ProcMessage: ICefProcessMessage): Boolean; | ||||
| @@ -624,6 +641,7 @@ type | ||||
|       property  HasValidMainFrame       : boolean                      read GetHasValidMainFrame; | ||||
|       property  FrameCount              : NativeUInt                   read GetFrameCount; | ||||
|       property  DragOperations          : TCefDragOperations           read FDragOperations           write FDragOperations; | ||||
|       property  AudioMuted              : boolean                      read GetAudioMuted             write SetAudioMuted; | ||||
|  | ||||
|       property  WebRTCIPHandlingPolicy  : TCefWebRTCHandlingPolicy     read FWebRTCIPHandlingPolicy   write SetWebRTCIPHandlingPolicy; | ||||
|       property  WebRTCMultipleRoutes    : TCefState                    read FWebRTCMultipleRoutes     write SetWebRTCMultipleRoutes; | ||||
| @@ -741,6 +759,7 @@ type | ||||
|       property OnScrollOffsetChanged            : TOnScrollOffsetChanged            read FOnScrollOffsetChanged            write FOnScrollOffsetChanged; | ||||
|       property OnIMECompositionRangeChanged     : TOnIMECompositionRangeChanged     read FOnIMECompositionRangeChanged     write FOnIMECompositionRangeChanged; | ||||
|       property OnTextSelectionChanged           : TOnTextSelectionChanged           read FOnTextSelectionChanged           write FOnTextSelectionChanged; | ||||
|       property OnVirtualKeyboardRequested       : TOnVirtualKeyboardRequested       read FOnVirtualKeyboardRequested       write FOnVirtualKeyboardRequested; | ||||
|  | ||||
|       // ICefDragHandler | ||||
|       property OnDragEnter                      : TOnDragEnter                      read FOnDragEnter                      write FOnDragEnter; | ||||
| @@ -749,6 +768,11 @@ type | ||||
|       // ICefFindHandler | ||||
|       property OnFindResult                     : TOnFindResult                     read FOnFindResult                     write FOnFindResult; | ||||
|  | ||||
|       // ICefAudioHandler | ||||
|       property OnAudioStreamStarted             : TOnAudioStreamStarted             read FOnAudioStreamStarted             write FOnAudioStreamStarted; | ||||
|       property OnAudioStreamPacket              : TOnAudioStreamPacket              read FOnAudioStreamPacket              write FOnAudioStreamPacket; | ||||
|       property OnAudioStreamStopped             : TOnAudioStreamStopped             read FOnAudioStreamStopped             write FOnAudioStreamStopped; | ||||
|  | ||||
|   end; | ||||
|  | ||||
| {$IFDEF FPC} | ||||
| @@ -985,7 +1009,8 @@ begin | ||||
|                                                 FIsOSR, // Create the Render Handler in OSR mode only | ||||
|                                                 True, | ||||
|                                                 MustCreateDragHandler, | ||||
|                                                 MustCreateFindHandler); | ||||
|                                                 MustCreateFindHandler, | ||||
|                                                 MustCreateAudioHandler); | ||||
|  | ||||
|         Result   := True; | ||||
|       end; | ||||
| @@ -1098,6 +1123,7 @@ begin | ||||
|   FOnScrollOffsetChanged          := nil; | ||||
|   FOnIMECompositionRangeChanged   := nil; | ||||
|   FOnTextSelectionChanged         := nil; | ||||
|   FOnVirtualKeyboardRequested     := nil; | ||||
|  | ||||
|   // ICefDragHandler | ||||
|   FOnDragEnter                    := nil; | ||||
| @@ -1106,6 +1132,11 @@ begin | ||||
|   // ICefFindHandler | ||||
|   FOnFindResult                   := nil; | ||||
|  | ||||
|   // ICefAudioHandler | ||||
|   FOnAudioStreamStarted           := nil; | ||||
|   FOnAudioStreamPacket            := nil; | ||||
|   FOnAudioStreamStopped           := nil; | ||||
|  | ||||
|   // Custom | ||||
|   FOnTextResultAvailable              := nil; | ||||
|   FOnPdfPrintFinished                 := nil; | ||||
| @@ -1789,6 +1820,16 @@ begin | ||||
|   Result := Initialized and FBrowser.host.RequestContext.IsGlobal; | ||||
| end; | ||||
|  | ||||
| function TChromium.GetAudioMuted : boolean; | ||||
| begin | ||||
|   Result := Initialized and FBrowser.host.IsAudioMuted; | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SetAudioMuted(aValue : boolean); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SetAudioMuted(aValue); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SetWindowlessFrameRate(aValue : integer); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SetWindowlessFrameRate(aValue); | ||||
| @@ -2981,6 +3022,13 @@ begin | ||||
|   Result := assigned(FOnFindResult); | ||||
| end; | ||||
|  | ||||
| function TChromium.MustCreateAudioHandler : boolean; | ||||
| begin | ||||
|   Result := assigned(FOnAudioStreamStarted) or | ||||
|             assigned(FOnAudioStreamPacket)  or | ||||
|             assigned(FOnAudioStreamStopped); | ||||
| end; | ||||
|  | ||||
| {$IFDEF MSWINDOWS} | ||||
| procedure TChromium.PrefsAvailableMsg(var aMessage : TMessage); | ||||
| begin | ||||
| @@ -3456,6 +3504,34 @@ begin | ||||
|     FOnFindResult(Self, browser, identifier, count, selectionRect, activeMatchOrdinal, finalUpdate); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.doOnAudioStreamStarted(const browser           : ICefBrowser; | ||||
|                                                  audio_stream_id   : integer; | ||||
|                                                  channels          : integer; | ||||
|                                                  channel_layout    : TCefChannelLayout; | ||||
|                                                  sample_rate       : integer; | ||||
|                                                  frames_per_buffer : integer); | ||||
| begin | ||||
|   if Assigned(FOnAudioStreamStarted) then | ||||
|     FOnAudioStreamStarted(Self, browser, audio_stream_id, channels, channel_layout, sample_rate, frames_per_buffer); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.doOnAudioStreamPacket(const browser         : ICefBrowser; | ||||
|                                                 audio_stream_id : integer; | ||||
|                                           const data            : PPSingle; | ||||
|                                                 frames          : integer; | ||||
|                                                 pts             : int64); | ||||
| begin | ||||
|   if Assigned(FOnAudioStreamPacket) then | ||||
|     FOnAudioStreamPacket(Self, browser, audio_stream_id, data, frames, pts); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.doOnAudioStreamStopped(const browser         : ICefBrowser; | ||||
|                                                  audio_stream_id : integer); | ||||
| begin | ||||
|   if Assigned(FOnAudioStreamStopped) then | ||||
|     FOnAudioStreamStopped(Self, browser, audio_stream_id); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.doOnFullScreenModeChange(const browser: ICefBrowser; fullscreen: Boolean); | ||||
| begin | ||||
|   if Assigned(FOnFullScreenModeChange) then FOnFullScreenModeChange(Self, browser, fullscreen); | ||||
| @@ -3821,6 +3897,13 @@ begin | ||||
|     FOnTextSelectionChanged(self, browser, selected_text, selected_range); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.doOnVirtualKeyboardRequested(const browser    : ICefBrowser; | ||||
|                                                        input_mode : TCefTextInpuMode); | ||||
| begin | ||||
|   if assigned(FOnVirtualKeyboardRequested) then | ||||
|     FOnVirtualKeyboardRequested(self, browser, input_mode); | ||||
| end; | ||||
|  | ||||
| function TChromium.doOnSetFocus(const browser: ICefBrowser; source: TCefFocusSource): Boolean; | ||||
| begin | ||||
|   Result := False; | ||||
| @@ -4063,6 +4146,11 @@ begin | ||||
|   if Initialized then FBrowser.Host.SendMouseWheelEvent(event, deltaX, deltaY); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SendTouchEvent(const event: PCefTouchEvent); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SendTouchEvent(event); | ||||
| end; | ||||
|  | ||||
| procedure TChromium.SendFocusEvent(setFocus: Boolean); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SendFocusEvent(setFocus); | ||||
|   | ||||
| @@ -147,6 +147,7 @@ type | ||||
|   TOnScrollOffsetChanged          = procedure(Sender: TObject; const browser: ICefBrowser; x, y: Double) of Object; | ||||
|   TOnIMECompositionRangeChanged   = procedure(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect) of Object; | ||||
|   TOnTextSelectionChanged         = procedure(Sender: TObject; const browser: ICefBrowser; const selected_text: ustring; const selected_range: PCefRange) of Object; | ||||
|   TOnVirtualKeyboardRequested     = procedure(Sender: TObject; const browser: ICefBrowser; input_mode: TCefTextInpuMode) of Object; | ||||
|  | ||||
|   // ICefDragHandler | ||||
|   TOnDragEnter                    = procedure(Sender: TObject; const browser: ICefBrowser; const dragData: ICefDragData; mask: TCefDragOperations; out Result: Boolean) of Object; | ||||
| @@ -155,6 +156,11 @@ type | ||||
|   // ICefFindHandler | ||||
|   TOnFindResult                   = procedure(Sender: TObject; const browser: ICefBrowser; identifier, count: Integer; const selectionRect: PCefRect; activeMatchOrdinal: Integer; finalUpdate: Boolean) of Object; | ||||
|  | ||||
|   // ICefAudioHandler | ||||
|   TOnAudioStreamStarted           = procedure(Sender: TObject; const browser: ICefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer) of Object; | ||||
|   TOnAudioStreamPacket            = procedure(Sender: TObject; const browser: ICefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64) of Object; | ||||
|   TOnAudioStreamStopped           = procedure(Sender: TObject; const browser: ICefBrowser; audio_stream_id: integer) of Object; | ||||
|  | ||||
|   // Custom | ||||
|   TOnTextResultAvailableEvent              = procedure(Sender: TObject; const aText : ustring) of object; | ||||
|   TOnPdfPrintFinishedEvent                 = procedure(Sender: TObject; aResultOK : boolean) of object; | ||||
|   | ||||
| @@ -54,6 +54,7 @@ uses | ||||
| type | ||||
|   TCefClientRef = class(TCefBaseRefCountedRef, ICefClient) | ||||
|     protected | ||||
|       procedure GetAudioHandler(var aHandler : ICefAudioHandler); virtual; | ||||
|       procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); virtual; | ||||
|       procedure GetDialogHandler(var aHandler : ICefDialogHandler); virtual; | ||||
|       procedure GetDisplayHandler(var aHandler : ICefDisplayHandler); virtual; | ||||
| @@ -77,6 +78,7 @@ type | ||||
|  | ||||
|   TCefClientOwn = class(TCefBaseRefCountedOwn, ICefClient) | ||||
|     protected | ||||
|       procedure GetAudioHandler(var aHandler : ICefAudioHandler); virtual; | ||||
|       procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); virtual; | ||||
|       procedure GetDialogHandler(var aHandler : ICefDialogHandler); virtual; | ||||
|       procedure GetDisplayHandler(var aHandler : ICefDisplayHandler); virtual; | ||||
| @@ -114,7 +116,9 @@ type | ||||
|       FRequestHandler     : ICefRequestHandler; | ||||
|       FDragHandler        : ICefDragHandler; | ||||
|       FFindHandler        : ICefFindHandler; | ||||
|       FAudioHandler       : ICefAudioHandler; | ||||
|  | ||||
|       procedure GetAudioHandler(var aHandler : ICefAudioHandler); override; | ||||
|       procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); override; | ||||
|       procedure GetDialogHandler(var aHandler : ICefDialogHandler); override; | ||||
|       procedure GetDisplayHandler(var aHandler : ICefDisplayHandler); override; | ||||
| @@ -137,7 +141,7 @@ type | ||||
|                          aCreateLoadHandler, aCreateFocusHandler, aCreateContextMenuHandler, aCreateDialogHandler, | ||||
|                          aCreateKeyboardHandler, aCreateDisplayHandler, aCreateDownloadHandler, aCreateJsDialogHandler, | ||||
|                          aCreateLifeSpanHandler, aCreateRenderHandler, aCreateRequestHandler, aCreateDragHandler, | ||||
|                          aCreateFindHandler : boolean); reintroduce; virtual; | ||||
|                          aCreateFindHandler, aCreateAudioHandler : boolean); reintroduce; virtual; | ||||
|       procedure   BeforeDestruction; override; | ||||
|       procedure   RemoveReferences; override; | ||||
|   end; | ||||
| @@ -154,7 +158,7 @@ uses | ||||
|   uCEFFocusHandler, uCEFContextMenuHandler, uCEFDialogHandler, uCEFKeyboardHandler, | ||||
|   uCEFDisplayHandler, uCEFDownloadHandler, uCEFJsDialogHandler, | ||||
|   uCEFLifeSpanHandler, uCEFRequestHandler, uCEFRenderHandler, uCEFDragHandler, | ||||
|   uCEFFindHandler, uCEFConstants, uCEFApplication; | ||||
|   uCEFFindHandler, uCEFAudioHandler, uCEFConstants, uCEFApplication; | ||||
|  | ||||
|  | ||||
| // ****************************************************** | ||||
| @@ -169,6 +173,11 @@ begin | ||||
|     Result := nil; | ||||
| end; | ||||
|  | ||||
| procedure TCefClientRef.GetAudioHandler(var aHandler : ICefAudioHandler); | ||||
| begin | ||||
|   aHandler := nil; | ||||
| end; | ||||
|  | ||||
| procedure TCefClientRef.GetContextMenuHandler(var aHandler : ICefContextMenuHandler); | ||||
| begin | ||||
|   aHandler := nil; | ||||
| @@ -250,6 +259,23 @@ end; | ||||
| // ****************************************************** | ||||
|  | ||||
|  | ||||
| function cef_client_own_get_audio_handler(self: PCefClient): PCefAudioHandler; stdcall; | ||||
| var | ||||
|   TempObject  : TObject; | ||||
|   TempHandler : ICefAudioHandler; | ||||
| begin | ||||
|   Result      := nil; | ||||
|   TempObject  := CefGetObject(self); | ||||
|  | ||||
|   if (TempObject <> nil) and (TempObject is TCefClientOwn) then | ||||
|     try | ||||
|       TCefClientOwn(TempObject).GetAudioHandler(TempHandler); | ||||
|       if (TempHandler <> nil) then Result := TempHandler.Wrap; | ||||
|     finally | ||||
|       TempHandler := nil; | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| function cef_client_own_get_context_menu_handler(self: PCefClient): PCefContextMenuHandler; stdcall; | ||||
| var | ||||
|   TempObject  : TObject; | ||||
| @@ -493,6 +519,7 @@ begin | ||||
|  | ||||
|   with PCefClient(FData)^ do | ||||
|     begin | ||||
|       get_audio_handler           := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_audio_handler; | ||||
|       get_context_menu_handler    := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_context_menu_handler; | ||||
|       get_dialog_handler          := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_dialog_handler; | ||||
|       get_display_handler         := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_display_handler; | ||||
| @@ -510,6 +537,11 @@ begin | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TCefClientOwn.GetAudioHandler(var aHandler : ICefAudioHandler); | ||||
| begin | ||||
|   aHandler := nil; | ||||
| end; | ||||
|  | ||||
| procedure TCefClientOwn.GetContextMenuHandler(var aHandler : ICefContextMenuHandler); | ||||
| begin | ||||
|   aHandler := nil; | ||||
| @@ -606,7 +638,8 @@ constructor TCustomClientHandler.Create(const events                     : IChro | ||||
|                                               aCreateRenderHandler       : boolean; | ||||
|                                               aCreateRequestHandler      : boolean; | ||||
|                                               aCreateDragHandler         : boolean; | ||||
|                                               aCreateFindHandler         : boolean); | ||||
|                                               aCreateFindHandler         : boolean; | ||||
|                                               aCreateAudioHandler        : boolean); | ||||
| begin | ||||
|   inherited Create; | ||||
|  | ||||
| @@ -629,6 +662,7 @@ begin | ||||
|       if aCreateRequestHandler     then FRequestHandler     := TCustomRequestHandler.Create(FEvents); | ||||
|       if aCreateDragHandler        then FDragHandler        := TCustomDragHandler.Create(FEvents); | ||||
|       if aCreateFindHandler        then FFindHandler        := TCustomFindHandler.Create(FEvents); | ||||
|       if aCreateAudioHandler       then FAudioHandler       := TCustomAudioHandler.Create(self); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| @@ -656,6 +690,7 @@ begin | ||||
|   if (FRenderHandler      <> nil) then FRenderHandler.RemoveReferences; | ||||
|   if (FDragHandler        <> nil) then FDragHandler.RemoveReferences; | ||||
|   if (FFindHandler        <> nil) then FFindHandler.RemoveReferences; | ||||
|   if (FAudioHandler       <> nil) then FAudioHandler.RemoveReferences; | ||||
| end; | ||||
|  | ||||
| procedure TCustomClientHandler.InitializeVars; | ||||
| @@ -673,9 +708,18 @@ begin | ||||
|   FRenderHandler      := nil; | ||||
|   FDragHandler        := nil; | ||||
|   FFindHandler        := nil; | ||||
|   FAudioHandler       := nil; | ||||
|   FEvents             := nil; | ||||
| end; | ||||
|  | ||||
| procedure TCustomClientHandler.GetAudioHandler(var aHandler : ICefAudioHandler); | ||||
| begin | ||||
|   if (FAudioHandler <> nil) then | ||||
|     aHandler := FAudioHandler | ||||
|    else | ||||
|     aHandler := nil; | ||||
| end; | ||||
|  | ||||
| procedure TCustomClientHandler.GetContextMenuHandler(var aHandler : ICefContextMenuHandler); | ||||
| begin | ||||
|   if (FContextMenuHandler <> nil) then | ||||
|   | ||||
| @@ -169,11 +169,22 @@ const | ||||
|   UR_FLAG_NONE                     = 0; | ||||
|   UR_FLAG_SKIP_CACHE               = 1 shl 0; | ||||
|   UR_FLAG_ONLY_FROM_CACHE          = 1 shl 1; | ||||
|   UR_FLAG_ALLOW_STORED_CREDENTIALS = 1 shl 2; | ||||
|   UR_FLAG_REPORT_UPLOAD_PROGRESS   = 1 shl 3; | ||||
|   UR_FLAG_NO_DOWNLOAD_DATA         = 1 shl 4; | ||||
|   UR_FLAG_NO_RETRY_ON_5XX          = 1 shl 5; | ||||
|   UR_FLAG_STOP_ON_REDIRECT         = 1 shl 6; | ||||
|   UR_FLAG_DISABLE_CACHE            = 1 shl 2; | ||||
|   UR_FLAG_ALLOW_STORED_CREDENTIALS = 1 shl 3; | ||||
|   UR_FLAG_REPORT_UPLOAD_PROGRESS   = 1 shl 4; | ||||
|   UR_FLAG_NO_DOWNLOAD_DATA         = 1 shl 5; | ||||
|   UR_FLAG_NO_RETRY_ON_5XX          = 1 shl 6; | ||||
|   UR_FLAG_STOP_ON_REDIRECT         = 1 shl 7; | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_scheme_options_t) | ||||
|   CEF_SCHEME_OPTION_NONE             = 0; | ||||
|   CEF_SCHEME_OPTION_STANDARD         = 1 shl 0; | ||||
|   CEF_SCHEME_OPTION_LOCAL            = 1 shl 1; | ||||
|   CEF_SCHEME_OPTION_DISPLAY_ISOLATED = 1 shl 2; | ||||
|   CEF_SCHEME_OPTION_SECURE           = 1 shl 3; | ||||
|   CEF_SCHEME_OPTION_CORS_ENABLED     = 1 shl 4; | ||||
|   CEF_SCHEME_OPTION_CSP_BYPASSING    = 1 shl 5; | ||||
|   CEF_SCHEME_OPTION_FETCH_ENABLED    = 1 shl 6; | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_dom_event_category_t) | ||||
|   DOM_EVENT_CATEGORY_UNKNOWN                 = 0; | ||||
|   | ||||
| @@ -138,6 +138,7 @@ type | ||||
|   ICefLabelButton = interface; | ||||
|   ICefMenuButton = interface; | ||||
|   ICefUrlRequest = interface; | ||||
|   ICefAudioHandler = interface; | ||||
|  | ||||
|   TCefv8ValueArray         = array of ICefv8Value; | ||||
|   TCefX509CertificateArray = array of ICefX509Certificate; | ||||
| @@ -355,6 +356,7 @@ type | ||||
|     procedure doOnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); | ||||
|     procedure doOnIMECompositionRangeChanged(const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); | ||||
|     procedure doOnTextSelectionChanged(const browser: ICefBrowser; const selected_text: ustring; const selected_range: PCefRange); | ||||
|     procedure doOnVirtualKeyboardRequested(const browser: ICefBrowser; input_mode: TCefTextInpuMode); | ||||
|  | ||||
|     // ICefDragHandler | ||||
|     function  doOnDragEnter(const browser: ICefBrowser; const dragData: ICefDragData; mask: TCefDragOperations): Boolean; | ||||
| @@ -363,6 +365,11 @@ type | ||||
|     // ICefFindHandler | ||||
|     procedure doOnFindResult(const browser: ICefBrowser; identifier, count: Integer; const selectionRect: PCefRect; activeMatchOrdinal: Integer; finalUpdate: Boolean); | ||||
|  | ||||
|     // ICefAudioHandler | ||||
|     procedure doOnAudioStreamStarted(const browser: ICefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer); | ||||
|     procedure doOnAudioStreamPacket(const browser: ICefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64); | ||||
|     procedure doOnAudioStreamStopped(const browser: ICefBrowser; audio_stream_id: integer); | ||||
|  | ||||
|     // Custom | ||||
|     procedure doCookiesDeleted(numDeleted : integer); | ||||
|     procedure doPdfPrintFinished(aResultOK : boolean); | ||||
| @@ -485,6 +492,7 @@ type | ||||
|     procedure SendMouseClickEvent(const event: PCefMouseEvent; kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer); | ||||
|     procedure SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean); | ||||
|     procedure SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer); | ||||
|     procedure SendTouchEvent(const event: PCefTouchEvent); | ||||
|     procedure SendFocusEvent(aSetFocus: Boolean); | ||||
|     procedure SendCaptureLostEvent; | ||||
|     procedure NotifyMoveOrResizeStarted; | ||||
| @@ -505,6 +513,8 @@ type | ||||
|     procedure SetAutoResizeEnabled(enabled: boolean; const min_size, max_size: PCefSize); | ||||
|     function  GetExtension : ICefExtension; | ||||
|     function  IsBackgroundHost : boolean; | ||||
|     procedure SetAudioMuted(mute: boolean); | ||||
|     function  IsAudioMuted : boolean; | ||||
|  | ||||
|     property Browser                : ICefBrowser              read GetBrowser; | ||||
|     property WindowHandle           : TCefWindowHandle         read GetWindowHandle; | ||||
| @@ -1693,6 +1703,17 @@ type | ||||
|     procedure RemoveReferences; // custom procedure to clear all references | ||||
|   end; | ||||
|  | ||||
|   // TCefAudioHandler | ||||
|   // /include/capi/cef_audio_handler_capi.h (cef_audio_handler_t) | ||||
|   ICefAudioHandler = interface(ICefBaseRefCounted) | ||||
|     ['{8963271A-0B94-4279-82C8-FB2EA7B3CDEC}'] | ||||
|     procedure OnAudioStreamStarted(const browser: ICefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer); | ||||
|     procedure OnAudioStreamPacket(const browser: ICefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64); | ||||
|     procedure OnAudioStreamStopped(const browser: ICefBrowser; audio_stream_id: integer); | ||||
|  | ||||
|     procedure RemoveReferences; // custom procedure to clear all references | ||||
|   end; | ||||
|  | ||||
|   // TCefRunContextMenuCallback | ||||
|   // /include/capi/cef_context_menu_handler_capi.h (cef_run_context_menu_callback_t) | ||||
|   ICefRunContextMenuCallback = interface(ICefBaseRefCounted) | ||||
| @@ -1749,6 +1770,7 @@ type | ||||
|     procedure OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); | ||||
|     procedure OnIMECompositionRangeChanged(const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); | ||||
|     procedure OnTextSelectionChanged(const browser: ICefBrowser; const selected_text: ustring; const selected_range: PCefRange); | ||||
|     procedure OnVirtualKeyboardRequested(const browser: ICefBrowser; input_mode: TCefTextInpuMode); | ||||
|  | ||||
|     procedure RemoveReferences; // custom procedure to clear all references | ||||
|   end; | ||||
| @@ -1757,6 +1779,7 @@ type | ||||
|   // /include/capi/cef_client_capi.h (cef_client_t) | ||||
|   ICefClient = interface(ICefBaseRefCounted) | ||||
|     ['{1D502075-2FF0-4E13-A112-9E541CD811F4}'] | ||||
|     procedure GetAudioHandler(var aHandler : ICefAudioHandler); | ||||
|     procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); | ||||
|     procedure GetDialogHandler(var aHandler : ICefDialogHandler); | ||||
|     procedure GetDisplayHandler(var aHandler : ICefDisplayHandler); | ||||
|   | ||||
| @@ -65,7 +65,7 @@ type | ||||
|   {$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pidWin32 or pidWin64)]{$ENDIF}{$ENDIF} | ||||
|   TCEFLinkedWindowParent = class(TCEFWinControl) | ||||
|     protected | ||||
|       FChromium : TChromium; | ||||
|       FChromium               : TChromium; | ||||
|  | ||||
|       procedure SetChromium(aValue : TChromium); | ||||
|  | ||||
| @@ -79,7 +79,7 @@ type | ||||
|       constructor Create(AOwner : TComponent); override; | ||||
|  | ||||
|     published | ||||
|       property Chromium : TChromium    read FChromium     write SetChromium; | ||||
|       property Chromium   : TChromium    read FChromium   write SetChromium; | ||||
|   end; | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -114,9 +114,9 @@ procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCe | ||||
| {$ENDIF} | ||||
|  | ||||
| {$IFDEF LINUX} | ||||
| procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; aRect : TRect); | ||||
| procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle); | ||||
| procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle); | ||||
| procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; aRect : TRect; const aWindowName : ustring = ''); | ||||
| procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; const aWindowName : ustring = ''); | ||||
| procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; const aWindowName : ustring = ''); | ||||
| {$ENDIF} | ||||
|  | ||||
| {$IFDEF MSWINDOWS} | ||||
| @@ -635,8 +635,9 @@ end; | ||||
| {$ENDIF} | ||||
|  | ||||
| {$IFDEF LINUX} | ||||
| procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; aRect : TRect); | ||||
| procedure WindowInfoAsChild(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; aRect : TRect; const aWindowName : ustring = ''); | ||||
| begin | ||||
|   aWindowInfo.window_name                  := aWindowName; | ||||
|   aWindowInfo.x                            := aRect.left; | ||||
|   aWindowInfo.y                            := aRect.top; | ||||
|   aWindowInfo.width                        := aRect.right  - aRect.left; | ||||
| @@ -648,8 +649,9 @@ begin | ||||
|   aWindowInfo.window                       := 0; | ||||
| end; | ||||
|  | ||||
| procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle); | ||||
| procedure WindowInfoAsPopUp(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; const aWindowName : ustring = ''); | ||||
| begin | ||||
|   aWindowInfo.window_name                  := aWindowName; | ||||
|   aWindowInfo.x                            := 0; | ||||
|   aWindowInfo.y                            := 0; | ||||
|   aWindowInfo.width                        := 0; | ||||
| @@ -661,8 +663,9 @@ begin | ||||
|   aWindowInfo.window                       := 0; | ||||
| end; | ||||
|  | ||||
| procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle); | ||||
| procedure WindowInfoAsWindowless(var aWindowInfo : TCefWindowInfo; aParent : TCefWindowHandle; const aWindowName : ustring = ''); | ||||
| begin | ||||
|   aWindowInfo.window_name                  := aWindowName; | ||||
|   aWindowInfo.x                            := 0; | ||||
|   aWindowInfo.y                            := 0; | ||||
|   aWindowInfo.width                        := 0; | ||||
|   | ||||
| @@ -69,6 +69,7 @@ type | ||||
|       procedure OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); virtual; | ||||
|       procedure OnIMECompositionRangeChanged(const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); virtual; | ||||
|       procedure OnTextSelectionChanged(const browser: ICefBrowser; const selected_text: ustring; const selected_range: PCefRange); virtual; | ||||
|       procedure OnVirtualKeyboardRequested(const browser: ICefBrowser; input_mode: TCefTextInpuMode); virtual; | ||||
|  | ||||
|       procedure RemoveReferences; virtual; | ||||
|  | ||||
| @@ -95,6 +96,7 @@ type | ||||
|       procedure OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); override; | ||||
|       procedure OnIMECompositionRangeChanged(const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); override; | ||||
|       procedure OnTextSelectionChanged(const browser: ICefBrowser; const selected_text: ustring; const selected_range: PCefRange); override; | ||||
|       procedure OnVirtualKeyboardRequested(const browser: ICefBrowser; input_mode: TCefTextInpuMode); override; | ||||
|  | ||||
|       procedure RemoveReferences; override; | ||||
|  | ||||
| @@ -358,6 +360,19 @@ begin | ||||
|                                                             selected_range); | ||||
| end; | ||||
|  | ||||
| procedure cef_render_handler_on_virtual_keyboard_requested(self       : PCefRenderHandler; | ||||
|                                                            browser    : PCefBrowser; | ||||
|                                                            input_mode : TCefTextInpuMode); stdcall; | ||||
| var | ||||
|   TempObject : TObject; | ||||
| begin | ||||
|   TempObject := CefGetObject(self); | ||||
|  | ||||
|   if (TempObject <> nil) and (TempObject is TCefRenderHandlerOwn) then | ||||
|     TCefRenderHandlerOwn(TempObject).OnVirtualKeyboardRequested(TCefBrowserRef.UnWrap(browser), | ||||
|                                                                 input_mode); | ||||
| end; | ||||
|  | ||||
| constructor TCefRenderHandlerOwn.Create; | ||||
| begin | ||||
|   inherited CreateData(SizeOf(TCefRenderHandler)); | ||||
| @@ -379,6 +394,7 @@ begin | ||||
|       on_scroll_offset_changed         := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_scroll_offset_changed; | ||||
|       on_ime_composition_range_changed := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_ime_composition_range_changed; | ||||
|       on_text_selection_changed        := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_text_selection_changed; | ||||
|       on_virtual_keyboard_requested    := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_virtual_keyboard_requested; | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| @@ -452,6 +468,12 @@ begin | ||||
|   // | ||||
| end; | ||||
|  | ||||
| procedure TCefRenderHandlerOwn.OnVirtualKeyboardRequested(const browser    : ICefBrowser; | ||||
|                                                                 input_mode : TCefTextInpuMode); | ||||
| begin | ||||
|   // | ||||
| end; | ||||
|  | ||||
| function TCefRenderHandlerOwn.OnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean; | ||||
| begin | ||||
|   Result := False; | ||||
| @@ -583,6 +605,12 @@ begin | ||||
|   if (FEvents <> nil) then IChromiumEvents(FEvents).doOnTextSelectionChanged(browser, selected_text, selected_range); | ||||
| end; | ||||
|  | ||||
| procedure TCustomRenderHandler.OnVirtualKeyboardRequested(const browser    : ICefBrowser; | ||||
|                                                                 input_mode : TCefTextInpuMode); | ||||
| begin | ||||
|   if (FEvents <> nil) then IChromiumEvents(FEvents).doOnVirtualKeyboardRequested(browser, input_mode); | ||||
| end; | ||||
|  | ||||
| function TCustomRenderHandler.OnStartDragging(const browser    : ICefBrowser; | ||||
|                                               const dragData   : ICefDragData; | ||||
|                                                     allowedOps : TCefDragOperations; | ||||
|   | ||||
| @@ -54,7 +54,7 @@ uses | ||||
| type | ||||
|   TCefSchemeRegistrarRef = class(TCEFBaseScopedWrapperRef) | ||||
|     public | ||||
|       function AddCustomScheme(const schemeName: ustring; IsStandard, IsLocal, IsDisplayIsolated, IsSecure, IsCorsEnabled, IsCSPBypassing: Boolean): Boolean; | ||||
|       function AddCustomScheme(const schemeName: ustring; options : TCefSchemeOptions): Boolean; | ||||
|   end; | ||||
|  | ||||
| implementation | ||||
| @@ -62,25 +62,15 @@ implementation | ||||
| uses | ||||
|   uCEFMiscFunctions; | ||||
|  | ||||
| function TCefSchemeRegistrarRef.AddCustomScheme(const schemeName        : ustring; | ||||
|                                                       IsStandard        : Boolean; | ||||
|                                                       IsLocal           : Boolean; | ||||
|                                                       IsDisplayIsolated : Boolean; | ||||
|                                                       IsSecure          : Boolean; | ||||
|                                                       IsCorsEnabled     : Boolean; | ||||
|                                                       IsCSPBypassing    : Boolean): Boolean; | ||||
| function TCefSchemeRegistrarRef.AddCustomScheme(const schemeName : ustring; | ||||
|                                                       options    : TCefSchemeOptions): Boolean; | ||||
| var | ||||
|   TempName : TCefString; | ||||
| begin | ||||
|   TempName := CefString(schemeName); | ||||
|   Result   := PCefSchemeRegistrar(FData)^.add_custom_scheme(PCefSchemeRegistrar(FData), | ||||
|                                                             @TempName, | ||||
|                                                             Ord(IsStandard), | ||||
|                                                             Ord(IsLocal), | ||||
|                                                             Ord(IsDisplayIsolated), | ||||
|                                                             Ord(isSecure), | ||||
|                                                             Ord(IsCorsEnabled), | ||||
|                                                             Ord(IsCSPBypassing)) <> 0; | ||||
|                                                             options) <> 0; | ||||
| end; | ||||
|  | ||||
| end. | ||||
|   | ||||
| @@ -134,6 +134,7 @@ type | ||||
|   PCefLifeSpanHandler = ^TCefLifeSpanHandler; | ||||
|   PCefGetExtensionResourceCallback = ^TCefGetExtensionResourceCallback; | ||||
|   PCefExtensionHandler = ^TCefExtensionHandler; | ||||
|   PCefAudioHandler = ^TCefAudioHandler; | ||||
|   PCefExtension = ^TCefExtension; | ||||
|   PCefPopupFeatures = ^TCefPopupFeatures; | ||||
|   PCefBrowserSettings = ^TCefBrowserSettings; | ||||
| @@ -177,6 +178,7 @@ type | ||||
|   PCefNavigationEntryVisitor = ^TCefNavigationEntryVisitor; | ||||
|   PCefNavigationEntry = ^TCefNavigationEntry; | ||||
|   PCefMouseEvent = ^TCefMouseEvent; | ||||
|   PCefTouchEvent = ^TCefTouchEvent; | ||||
|   PCefPrintSettings = ^TCefPrintSettings; | ||||
|   PCefPrintDialogCallback = ^TCefPrintDialogCallback; | ||||
|   PCefPrintJobCallback = ^TCefPrintJobCallback; | ||||
| @@ -276,6 +278,7 @@ type | ||||
|   TCefLogSeverity                  = Cardinal;    // /include/internal/cef_types.h (cef_log_severity_t) | ||||
|   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) | ||||
|  | ||||
|  | ||||
| {$IFDEF FPC} | ||||
| @@ -303,6 +306,8 @@ type | ||||
|   {$ENDIF} | ||||
| {$ENDIF} | ||||
|  | ||||
|   PPSingle = ^PSingle; | ||||
|  | ||||
|   Char16  = WideChar; | ||||
|   PChar16 = PWideChar; | ||||
|  | ||||
| @@ -510,8 +515,7 @@ type | ||||
|     REFERRER_POLICY_ORIGIN, | ||||
|     REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_CROSS_ORIGIN, | ||||
|     REFERRER_POLICY_ORIGIN_CLEAR_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | ||||
|     REFERRER_POLICY_NO_REFERRER, | ||||
|     REFERRER_POLICY_LAST_VALUE | ||||
|     REFERRER_POLICY_NO_REFERRER // REFERRER_POLICY_LAST_VALUE = REFERRER_POLICY_NO_REFERRER | ||||
|   ); | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_postdataelement_type_t) | ||||
| @@ -620,6 +624,73 @@ type | ||||
|     WOD_IGNORE_ACTION | ||||
|   ); | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_text_input_mode_t) | ||||
|   TCefTextInpuMode = ( | ||||
|     CEF_TEXT_INPUT_MODE_DEFAULT, | ||||
|     CEF_TEXT_INPUT_MODE_NONE, | ||||
|     CEF_TEXT_INPUT_MODE_TEXT, | ||||
|     CEF_TEXT_INPUT_MODE_TEL, | ||||
|     CEF_TEXT_INPUT_MODE_URL, | ||||
|     CEF_TEXT_INPUT_MODE_EMAIL, | ||||
|     CEF_TEXT_INPUT_MODE_NUMERIC, | ||||
|     CEF_TEXT_INPUT_MODE_DECIMAL, | ||||
|     CEF_TEXT_INPUT_MODE_SEARCH    // CEF_TEXT_INPUT_MODE_MAX = CEF_TEXT_INPUT_MODE_SEARCH | ||||
|   ); | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_touch_event_type_t) | ||||
|   TCefTouchEeventType = ( | ||||
|     CEF_TET_RELEASED = 0, | ||||
|     CEF_TET_PRESSED, | ||||
|     CEF_TET_MOVED, | ||||
|     CEF_TET_CANCELLED | ||||
|   ); | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_pointer_type_t) | ||||
|   TCefPointerType = ( | ||||
|     CEF_POINTER_TYPE_TOUCH = 0, | ||||
|     CEF_POINTER_TYPE_MOUSE, | ||||
|     CEF_POINTER_TYPE_PEN, | ||||
|     CEF_POINTER_TYPE_ERASER, | ||||
|     CEF_POINTER_TYPE_UNKNOWN | ||||
|   ); | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_channel_layout_t) | ||||
|   TCefChannelLayout = ( | ||||
|     CEF_CHANNEL_LAYOUT_NONE = 0, | ||||
|     CEF_CHANNEL_LAYOUT_UNSUPPORTED, | ||||
|     CEF_CHANNEL_LAYOUT_MONO, | ||||
|     CEF_CHANNEL_LAYOUT_STEREO, | ||||
|     CEF_CHANNEL_LAYOUT_2_1, | ||||
|     CEF_CHANNEL_LAYOUT_SURROUND, | ||||
|     CEF_CHANNEL_LAYOUT_4_0, | ||||
|     CEF_CHANNEL_LAYOUT_2_2, | ||||
|     CEF_CHANNEL_LAYOUT_QUAD, | ||||
|     CEF_CHANNEL_LAYOUT_5_0, | ||||
|     CEF_CHANNEL_LAYOUT_5_1, | ||||
|     CEF_CHANNEL_LAYOUT_5_0_BACK, | ||||
|     CEF_CHANNEL_LAYOUT_5_1_BACK, | ||||
|     CEF_CHANNEL_LAYOUT_7_0, | ||||
|     CEF_CHANNEL_LAYOUT_7_1, | ||||
|     CEF_CHANNEL_LAYOUT_7_1_WIDE, | ||||
|     CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX, | ||||
|     CEF_CHANNEL_LAYOUT_2POINT1, | ||||
|     CEF_CHANNEL_LAYOUT_3_1, | ||||
|     CEF_CHANNEL_LAYOUT_4_1, | ||||
|     CEF_CHANNEL_LAYOUT_6_0, | ||||
|     CEF_CHANNEL_LAYOUT_6_0_FRONT, | ||||
|     CEF_CHANNEL_LAYOUT_HEXAGONAL, | ||||
|     CEF_CHANNEL_LAYOUT_6_1, | ||||
|     CEF_CHANNEL_LAYOUT_6_1_BACK, | ||||
|     CEF_CHANNEL_LAYOUT_6_1_FRONT, | ||||
|     CEF_CHANNEL_LAYOUT_7_0_FRONT, | ||||
|     CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK, | ||||
|     CEF_CHANNEL_LAYOUT_OCTAGONAL, | ||||
|     CEF_CHANNEL_LAYOUT_DISCRETE, | ||||
|     CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC, | ||||
|     CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE, | ||||
|     CEF_CHANNEL_LAYOUT_BITSTREAM  // CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_BITSTREAM | ||||
|   ); | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_paint_element_type_t) | ||||
|   TCefPaintElementType = ( | ||||
|     PET_VIEW, | ||||
| @@ -1033,6 +1104,7 @@ type | ||||
|     view                          : TCefWindowHandle; | ||||
|     {$ENDIF} | ||||
|     {$IFDEF LINUX} | ||||
|     window_name                   : TCefString; | ||||
|     x                             : uint32; | ||||
|     y                             : uint32; | ||||
|     width                         : uint32; | ||||
| @@ -1190,6 +1262,20 @@ type | ||||
|     modifiers : TCefEventFlags; | ||||
|   end; | ||||
|  | ||||
|   // /include/internal/cef_types.h (cef_touch_event_t) | ||||
|   TCefTouchEvent = record | ||||
|     id             : integer; | ||||
|     x              : single; | ||||
|     y              : single; | ||||
|     radius_x       : single; | ||||
|     radius_y       : single; | ||||
|     rotation_angle : single; | ||||
|     pressure       : single; | ||||
|     type_          : TCefTouchEeventType; | ||||
|     modifiers      : TCefEventFlags; | ||||
|     pointer_type   : TCefPointerType; | ||||
|   end; | ||||
|  | ||||
|   // /include/capi/cef_base_capi.h (cef_base_ref_counted_t) | ||||
|   TCefBaseRefCounted = record | ||||
|     size                 : NativeUInt; | ||||
| @@ -1380,6 +1466,14 @@ type | ||||
|     get_extension_resource        : function(self: PCefExtensionHandler; extension: PCefExtension; browser: PCefBrowser; const file_: PCefString; callback: PCefGetExtensionResourceCallback): Integer; stdcall; | ||||
|   end; | ||||
|  | ||||
|   // /include/capi/cef_audio_handler_capi.h (cef_audio_handler_t) | ||||
|   TCefAudioHandler = record | ||||
|     base                          : TCefBaseRefCounted; | ||||
|     on_audio_stream_started       : procedure(self: PCefAudioHandler; browser: PCefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer); stdcall; | ||||
|     on_audio_stream_packet        : procedure(self: PCefAudioHandler; browser: PCefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64); stdcall; | ||||
|     on_audio_stream_stopped       : procedure(self: PCefAudioHandler; browser: PCefBrowser; audio_stream_id: integer); stdcall; | ||||
|   end; | ||||
|  | ||||
|   // /include/capi/cef_extension_capi.h (cef_extension_t) | ||||
|   TCefExtension = record | ||||
|     base                : TCefBaseRefCounted; | ||||
| @@ -1420,6 +1514,7 @@ type | ||||
|     on_scroll_offset_changed          : procedure(self: PCefRenderHandler; browser: PCefBrowser; x, y: Double); stdcall; | ||||
|     on_ime_composition_range_changed  : procedure(self: PCefRenderHandler; browser: PCefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); stdcall; | ||||
|     on_text_selection_changed         : procedure(self: PCefRenderHandler; browser: PCefBrowser; const selected_text: PCefString; const selected_range: PCefRange); stdcall; | ||||
|     on_virtual_keyboard_requested     : procedure(self: PCefRenderHandler; browser: PCefBrowser; input_mode: TCefTextInpuMode); stdcall; | ||||
|   end; | ||||
|  | ||||
|   // /include/capi/cef_v8_capi.h (cef_v8stack_trace_t) | ||||
| @@ -1986,7 +2081,7 @@ type | ||||
|   // /include/capi/cef_scheme_capi.h (cef_scheme_registrar_t) | ||||
|   TCefSchemeRegistrar = record | ||||
|     base              : TCefBaseScoped; | ||||
|     add_custom_scheme : function(self: PCefSchemeRegistrar; const scheme_name: PCefString; is_standard, is_local, is_display_isolated, is_secure, is_cors_enabled, is_csp_bypassing: Integer): Integer; stdcall; | ||||
|     add_custom_scheme : function(self: PCefSchemeRegistrar; const scheme_name: PCefString; options : TCefSchemeOptions): Integer; stdcall; | ||||
|   end; | ||||
|  | ||||
|   // /include/capi/cef_values_capi.h (cef_binary_value_t) | ||||
| @@ -2495,6 +2590,7 @@ type | ||||
|   // /include/capi/cef_client_capi.h (cef_client_t) | ||||
|   TCefClient = record | ||||
|     base                        : TCefBaseRefCounted; | ||||
|     get_audio_handler           : function(self: PCefClient): PCefAudioHandler; stdcall; | ||||
|     get_context_menu_handler    : function(self: PCefClient): PCefContextMenuHandler; stdcall; | ||||
|     get_dialog_handler          : function(self: PCefClient): PCefDialogHandler; stdcall; | ||||
|     get_display_handler         : function(self: PCefClient): PCefDisplayHandler; stdcall; | ||||
| @@ -2550,6 +2646,7 @@ type | ||||
|     send_mouse_click_event            : procedure(self: PCefBrowserHost; const event: PCefMouseEvent; kind: TCefMouseButtonType; mouseUp, clickCount: Integer); stdcall; | ||||
|     send_mouse_move_event             : procedure(self: PCefBrowserHost; const event: PCefMouseEvent; mouseLeave: Integer); stdcall; | ||||
|     send_mouse_wheel_event            : procedure(self: PCefBrowserHost; const event: PCefMouseEvent; deltaX, deltaY: Integer); stdcall; | ||||
|     send_touch_event                  : procedure(self: PCefBrowserHost; const event: PCefTouchEvent); stdcall; | ||||
|     send_focus_event                  : procedure(self: PCefBrowserHost; setFocus: Integer); stdcall; | ||||
|     send_capture_lost_event           : procedure(self: PCefBrowserHost); stdcall; | ||||
|     notify_move_or_resize_started     : procedure(self: PCefBrowserHost); stdcall; | ||||
| @@ -2570,6 +2667,8 @@ type | ||||
|     set_auto_resize_enabled           : procedure(self: PCefBrowserHost; enabled: integer; const min_size, max_size: PCefSize); stdcall; | ||||
|     get_extension                     : function(self: PCefBrowserHost): PCefExtension; stdcall; | ||||
|     is_background_host                : function(self: PCefBrowserHost): integer; stdcall; | ||||
|     set_audio_muted                   : procedure(self: PCefBrowserHost; mute: integer); stdcall; | ||||
|     is_audio_muted                    : function(self: PCefBrowserHost): integer; stdcall; | ||||
|   end; | ||||
|  | ||||
|   // /include/capi/cef_browser_capi.h (cef_browser_t) | ||||
|   | ||||
| @@ -66,13 +66,13 @@ type | ||||
|       procedure Resize; override; | ||||
|  | ||||
|     public | ||||
|       function  TakeSnapshot(var aBitmap : TBitmap) : boolean; | ||||
|       function  DestroyChildWindow : boolean; | ||||
|       procedure CreateHandle; override; | ||||
|       procedure InvalidateChildren; | ||||
|       procedure UpdateSize; | ||||
|       function    TakeSnapshot(var aBitmap : TBitmap) : boolean; | ||||
|       function    DestroyChildWindow : boolean; | ||||
|       procedure   CreateHandle; override; | ||||
|       procedure   InvalidateChildren; | ||||
|       procedure   UpdateSize; | ||||
|  | ||||
|       property  ChildWindowHandle : THandle   read GetChildWindowHandle; | ||||
|       property  ChildWindowHandle : THandle  read GetChildWindowHandle; | ||||
|  | ||||
|     published | ||||
|       property  Align; | ||||
|   | ||||
| @@ -203,6 +203,7 @@ type | ||||
|       FOnScrollOffsetChanged          : TOnScrollOffsetChanged; | ||||
|       FOnIMECompositionRangeChanged   : TOnIMECompositionRangeChanged; | ||||
|       FOnTextSelectionChanged         : TOnTextSelectionChanged; | ||||
|       FOnVirtualKeyboardRequested     : TOnVirtualKeyboardRequested; | ||||
|  | ||||
|       // ICefDragHandler | ||||
|       FOnDragEnter                    : TOnDragEnter; | ||||
| @@ -211,6 +212,11 @@ type | ||||
|       // ICefFindHandler | ||||
|       FOnFindResult                   : TOnFindResult; | ||||
|  | ||||
|       // ICefAudioHandler | ||||
|       FOnAudioStreamStarted           : TOnAudioStreamStarted; | ||||
|       FOnAudioStreamPacket            : TOnAudioStreamPacket; | ||||
|       FOnAudioStreamStopped           : TOnAudioStreamStopped; | ||||
|  | ||||
|       // Custom | ||||
|       FOnTextResultAvailable              : TOnTextResultAvailableEvent; | ||||
|       FOnPdfPrintFinished                 : TOnPdfPrintFinishedEvent; | ||||
| @@ -245,6 +251,7 @@ type | ||||
|       function  GetFrameCount : NativeUInt; | ||||
|       function  GetRequestContextCache : ustring; | ||||
|       function  GetRequestContextIsGlobal : boolean; | ||||
|       function  GetAudioMuted : boolean; | ||||
|  | ||||
|       procedure SetDoNotTrack(aValue : boolean); | ||||
|       procedure SetSendReferrer(aValue : boolean); | ||||
| @@ -273,6 +280,7 @@ type | ||||
|       procedure SetZoomPct(const aValue : double); | ||||
|       procedure SetZoomStep(aValue : byte); | ||||
|       procedure SetWindowlessFrameRate(aValue : integer); | ||||
|       procedure SetAudioMuted(aValue : boolean); | ||||
|  | ||||
|  | ||||
|       function  CreateBrowserHost(aWindowInfo : PCefWindowInfo; const aURL : ustring; const aSettings : PCefBrowserSettings; const aContext : ICefRequestContext): boolean; | ||||
| @@ -315,6 +323,7 @@ type | ||||
|       function  MustCreateJsDialogHandler : boolean; virtual; | ||||
|       function  MustCreateDragHandler : boolean; virtual; | ||||
|       function  MustCreateFindHandler : boolean; virtual; | ||||
|       function  MustCreateAudioHandler : boolean; virtual; | ||||
|  | ||||
|       procedure ApplyZoomStep; | ||||
|       function  GetParentForm : TCustomForm; | ||||
| @@ -421,6 +430,7 @@ type | ||||
|       procedure doOnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); virtual; | ||||
|       procedure doOnIMECompositionRangeChanged(const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); virtual; | ||||
|       procedure doOnTextSelectionChanged(const browser: ICefBrowser; const selected_text: ustring; const selected_range: PCefRange); virtual; | ||||
|       procedure doOnVirtualKeyboardRequested(const browser: ICefBrowser; input_mode: TCefTextInpuMode); virtual; | ||||
|  | ||||
|       // ICefDragHandler | ||||
|       function  doOnDragEnter(const browser: ICefBrowser; const dragData: ICefDragData; mask: TCefDragOperations): Boolean; virtual; | ||||
| @@ -429,6 +439,11 @@ type | ||||
|       // ICefFindHandler | ||||
|       procedure doOnFindResult(const browser: ICefBrowser; identifier, count: Integer; const selectionRect: PCefRect; activeMatchOrdinal: Integer; finalUpdate: Boolean); virtual; | ||||
|  | ||||
|       // ICefAudioHandler | ||||
|       procedure doOnAudioStreamStarted(const browser: ICefBrowser; audio_stream_id, channels: integer; channel_layout: TCefChannelLayout; sample_rate, frames_per_buffer: integer); | ||||
|       procedure doOnAudioStreamPacket(const browser: ICefBrowser; audio_stream_id: integer; const data : PPSingle; frames: integer; pts: int64); | ||||
|       procedure doOnAudioStreamStopped(const browser: ICefBrowser; audio_stream_id: integer); | ||||
|  | ||||
|       // Custom | ||||
|       procedure doCookiesDeleted(numDeleted : integer); virtual; | ||||
|       procedure doPdfPrintFinished(aResultOK : boolean); virtual; | ||||
| @@ -520,6 +535,7 @@ type | ||||
|       procedure   SendMouseClickEvent(const event: PCefMouseEvent; kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer); | ||||
|       procedure   SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean); | ||||
|       procedure   SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer); | ||||
|       procedure   SendTouchEvent(const event: PCefTouchEvent); | ||||
|       procedure   SendFocusEvent(setFocus: Boolean); | ||||
|       procedure   SendCaptureLostEvent; | ||||
|       function    SendProcessMessage(targetProcess: TCefProcessId; const ProcMessage: ICefProcessMessage): Boolean; | ||||
| @@ -582,6 +598,7 @@ type | ||||
|       property  HasValidMainFrame       : boolean                      read GetHasValidMainFrame; | ||||
|       property  FrameCount              : NativeUInt                   read GetFrameCount; | ||||
|       property  DragOperations          : TCefDragOperations           read FDragOperations           write FDragOperations; | ||||
|       property  AudioMuted              : boolean                      read GetAudioMuted             write SetAudioMuted; | ||||
|  | ||||
|       property  WebRTCIPHandlingPolicy  : TCefWebRTCHandlingPolicy     read FWebRTCIPHandlingPolicy   write SetWebRTCIPHandlingPolicy; | ||||
|       property  WebRTCMultipleRoutes    : TCefState                    read FWebRTCMultipleRoutes     write SetWebRTCMultipleRoutes; | ||||
| @@ -696,6 +713,7 @@ type | ||||
|       property OnScrollOffsetChanged            : TOnScrollOffsetChanged            read FOnScrollOffsetChanged            write FOnScrollOffsetChanged; | ||||
|       property OnIMECompositionRangeChanged     : TOnIMECompositionRangeChanged     read FOnIMECompositionRangeChanged     write FOnIMECompositionRangeChanged; | ||||
|       property OnTextSelectionChanged           : TOnTextSelectionChanged           read FOnTextSelectionChanged           write FOnTextSelectionChanged; | ||||
|       property OnVirtualKeyboardRequested       : TOnVirtualKeyboardRequested       read FOnVirtualKeyboardRequested       write FOnVirtualKeyboardRequested; | ||||
|  | ||||
|       // ICefDragHandler | ||||
|       property OnDragEnter                      : TOnDragEnter                      read FOnDragEnter                      write FOnDragEnter; | ||||
| @@ -704,6 +722,11 @@ type | ||||
|       // ICefFindHandler | ||||
|       property OnFindResult                     : TOnFindResult                     read FOnFindResult                     write FOnFindResult; | ||||
|  | ||||
|       // ICefAudioHandler | ||||
|       property OnAudioStreamStarted             : TOnAudioStreamStarted             read FOnAudioStreamStarted             write FOnAudioStreamStarted; | ||||
|       property OnAudioStreamPacket              : TOnAudioStreamPacket              read FOnAudioStreamPacket              write FOnAudioStreamPacket; | ||||
|       property OnAudioStreamStopped             : TOnAudioStreamStopped             read FOnAudioStreamStopped             write FOnAudioStreamStopped; | ||||
|  | ||||
|   end; | ||||
|  | ||||
| implementation | ||||
| @@ -890,7 +913,8 @@ begin | ||||
|                                                 FIsOSR, | ||||
|                                                 True, | ||||
|                                                 MustCreateDragHandler, | ||||
|                                                 MustCreateFindHandler); | ||||
|                                                 MustCreateFindHandler, | ||||
|                                                 MustCreateAudioHandler); | ||||
|  | ||||
|         Result   := True; | ||||
|       end; | ||||
| @@ -1001,6 +1025,7 @@ begin | ||||
|   FOnScrollOffsetChanged          := nil; | ||||
|   FOnIMECompositionRangeChanged   := nil; | ||||
|   FOnTextSelectionChanged         := nil; | ||||
|   FOnVirtualKeyboardRequested     := nil; | ||||
|  | ||||
|   // ICefDragHandler | ||||
|   FOnDragEnter                    := nil; | ||||
| @@ -1009,6 +1034,11 @@ begin | ||||
|   // ICefFindHandler | ||||
|   FOnFindResult                   := nil; | ||||
|  | ||||
|   // ICefAudioHandler | ||||
|   FOnAudioStreamStarted           := nil; | ||||
|   FOnAudioStreamPacket            := nil; | ||||
|   FOnAudioStreamStopped           := nil; | ||||
|  | ||||
|   // Custom | ||||
|   FOnTextResultAvailable              := nil; | ||||
|   FOnPdfPrintFinished                 := nil; | ||||
| @@ -1575,6 +1605,16 @@ begin | ||||
|   Result := Initialized and FBrowser.host.RequestContext.IsGlobal; | ||||
| end; | ||||
|  | ||||
| function TFMXChromium.GetAudioMuted : boolean; | ||||
| begin | ||||
|   Result := Initialized and FBrowser.host.IsAudioMuted; | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.SetAudioMuted(aValue : boolean); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SetAudioMuted(aValue); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.SetWindowlessFrameRate(aValue : integer); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SetWindowlessFrameRate(aValue); | ||||
| @@ -2713,6 +2753,13 @@ begin | ||||
|   Result := assigned(FOnFindResult); | ||||
| end; | ||||
|  | ||||
| function TFMXChromium.MustCreateAudioHandler : boolean; | ||||
| begin | ||||
|   Result := assigned(FOnAudioStreamStarted) or | ||||
|             assigned(FOnAudioStreamPacket)  or | ||||
|             assigned(FOnAudioStreamStopped); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.doTextResultAvailable(const aText : ustring); | ||||
| begin | ||||
|   if assigned(FOnTextResultAvailable) then FOnTextResultAvailable(self, aText); | ||||
| @@ -3035,6 +3082,34 @@ begin | ||||
|     FOnFindResult(Self, browser, identifier, count, selectionRect, activeMatchOrdinal, finalUpdate); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.doOnAudioStreamStarted(const browser           : ICefBrowser; | ||||
|                                                     audio_stream_id   : integer; | ||||
|                                                     channels          : integer; | ||||
|                                                     channel_layout    : TCefChannelLayout; | ||||
|                                                     sample_rate       : integer; | ||||
|                                                     frames_per_buffer : integer); | ||||
| begin | ||||
|   if Assigned(FOnAudioStreamStarted) then | ||||
|     FOnAudioStreamStarted(Self, browser, audio_stream_id, channels, channel_layout, sample_rate, frames_per_buffer); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.doOnAudioStreamPacket(const browser         : ICefBrowser; | ||||
|                                                    audio_stream_id : integer; | ||||
|                                              const data            : PPSingle; | ||||
|                                                    frames          : integer; | ||||
|                                                    pts             : int64); | ||||
| begin | ||||
|   if Assigned(FOnAudioStreamPacket) then | ||||
|     FOnAudioStreamPacket(Self, browser, audio_stream_id, data, frames, pts); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.doOnAudioStreamStopped(const browser         : ICefBrowser; | ||||
|                                                     audio_stream_id : integer); | ||||
| begin | ||||
|   if Assigned(FOnAudioStreamStopped) then | ||||
|     FOnAudioStreamStopped(Self, browser, audio_stream_id); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.doOnFullScreenModeChange(const browser: ICefBrowser; fullscreen: Boolean); | ||||
| begin | ||||
|   if Assigned(FOnFullScreenModeChange) then FOnFullScreenModeChange(Self, browser, fullscreen); | ||||
| @@ -3400,6 +3475,13 @@ begin | ||||
|     FOnTextSelectionChanged(self, browser, selected_text, selected_range); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.doOnVirtualKeyboardRequested(const browser    : ICefBrowser; | ||||
|                                                           input_mode : TCefTextInpuMode); | ||||
| begin | ||||
|   if assigned(FOnVirtualKeyboardRequested) then | ||||
|     FOnVirtualKeyboardRequested(self, browser, input_mode); | ||||
| end; | ||||
|  | ||||
| function TFMXChromium.doOnSetFocus(const browser: ICefBrowser; source: TCefFocusSource): Boolean; | ||||
| begin | ||||
|   Result := False; | ||||
| @@ -3714,6 +3796,11 @@ begin | ||||
|   if Initialized then FBrowser.Host.SendMouseWheelEvent(event, deltaX, deltaY); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.SendTouchEvent(const event: PCefTouchEvent); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SendTouchEvent(event); | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.SendFocusEvent(setFocus: Boolean); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.SendFocusEvent(setFocus); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user