You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Update to CEF 117.1.4
This commit is contained in:
@@ -24,18 +24,22 @@ uses
|
||||
|
||||
type
|
||||
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pfidWindows or pfidOSX or pfidLinux)]{$ENDIF}{$ENDIF}
|
||||
/// <summary>
|
||||
/// Component hosting a ICefBrowserView instance. Used in Chrome runtime mode only.
|
||||
/// </summary>
|
||||
TCEFBrowserViewComponent = class(TCEFViewComponent, ICefBrowserViewDelegateEvents)
|
||||
protected
|
||||
FBrowserView : ICefBrowserView;
|
||||
FBrowserViewDlg : ICefBrowserViewDelegate;
|
||||
FBrowserView : ICefBrowserView;
|
||||
FBrowserViewDlg : ICefBrowserViewDelegate;
|
||||
|
||||
// ICefBrowserViewDelegateEvents
|
||||
FOnBrowserCreated : TOnBrowserCreatedEvent;
|
||||
FOnBrowserDestroyed : TOnBrowserDestroyedEvent;
|
||||
FOnGetDelegateForPopupBrowserView : TOnGetDelegateForPopupBrowserViewEvent;
|
||||
FOnPopupBrowserViewCreated : TOnPopupBrowserViewCreatedEvent;
|
||||
FOnGetChromeToolbarType : TOnGetChromeToolbarTypeEvent;
|
||||
FOnGestureCommand : TOnGestureCommandEvent;
|
||||
FOnBrowserCreated : TOnBrowserCreatedEvent;
|
||||
FOnBrowserDestroyed : TOnBrowserDestroyedEvent;
|
||||
FOnGetDelegateForPopupBrowserView : TOnGetDelegateForPopupBrowserViewEvent;
|
||||
FOnPopupBrowserViewCreated : TOnPopupBrowserViewCreatedEvent;
|
||||
FOnGetChromeToolbarType : TOnGetChromeToolbarTypeEvent;
|
||||
FOnUseFramelessWindowForPictureInPicture : TOnUseFramelessWindowForPictureInPicture;
|
||||
FOnGestureCommand : TOnGestureCommandEvent;
|
||||
|
||||
procedure DestroyView; override;
|
||||
procedure Initialize; override;
|
||||
@@ -51,23 +55,95 @@ type
|
||||
procedure doOnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
|
||||
procedure doOnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
|
||||
procedure doOnGetChromeToolbarType(var aChromeToolbarType: TCefChromeToolbarType);
|
||||
procedure doOnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
|
||||
procedure doOnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
|
||||
|
||||
public
|
||||
/// <summary>
|
||||
/// Create a new ICefBrowserView. The underlying ICefBrowser will not be created
|
||||
/// until this view is added to the views hierarchy. The optional |extra_info|
|
||||
/// parameter provides an opportunity to specify extra information specific to
|
||||
/// the created browser that will be passed to
|
||||
/// ICefRenderProcessHandler.OnBrowserCreated in the render process.
|
||||
/// </summary>
|
||||
function CreateBrowserView(const client: ICefClient; const url: ustring; const settings: TCefBrowserSettings; const extra_info: ICefDictionaryValue; const request_context: ICefRequestContext): boolean;
|
||||
/// <summary>
|
||||
/// Updates the internal ICefBrowserView with the ICefBrowserView associated with |browser|.
|
||||
/// </summary>
|
||||
function GetForBrowser(const browser: ICefBrowser): boolean;
|
||||
/// <summary>
|
||||
/// Sets whether accelerators registered with ICefWindow.SetAccelerator are
|
||||
/// triggered before or after the event is sent to the ICefBrowser. If
|
||||
/// |prefer_accelerators| is true (1) then the matching accelerator will be
|
||||
/// triggered immediately and the event will not be sent to the ICefBrowser.
|
||||
/// If |prefer_accelerators| is false (0) then the matching accelerator will
|
||||
/// only be triggered if the event is not handled by web content or by
|
||||
/// ICefKeyboardHandler. The default value is false (0).
|
||||
/// </summary>
|
||||
procedure SetPreferAccelerators(prefer_accelerators: boolean);
|
||||
|
||||
property Browser : ICefBrowser read GetBrowser;
|
||||
property BrowserView : ICefBrowserView read FBrowserView;
|
||||
/// <summary>
|
||||
/// Returns the ICefBrowser hosted by this BrowserView. Will return NULL if
|
||||
/// the browser has not yet been created or has already been destroyed.
|
||||
/// </summary>
|
||||
property Browser : ICefBrowser read GetBrowser;
|
||||
/// <summary>
|
||||
/// ICefBrowserView assiciated to this component.
|
||||
/// </summary>
|
||||
property BrowserView : ICefBrowserView read FBrowserView;
|
||||
|
||||
published
|
||||
property OnBrowserCreated : TOnBrowserCreatedEvent read FOnBrowserCreated write FOnBrowserCreated;
|
||||
property OnBrowserDestroyed : TOnBrowserDestroyedEvent read FOnBrowserDestroyed write FOnBrowserDestroyed;
|
||||
property OnGetDelegateForPopupBrowserView : TOnGetDelegateForPopupBrowserViewEvent read FOnGetDelegateForPopupBrowserView write FOnGetDelegateForPopupBrowserView;
|
||||
property OnPopupBrowserViewCreated : TOnPopupBrowserViewCreatedEvent read FOnPopupBrowserViewCreated write FOnPopupBrowserViewCreated;
|
||||
property OnGetChromeToolbarType : TOnGetChromeToolbarTypeEvent read FOnGetChromeToolbarType write FOnGetChromeToolbarType;
|
||||
property OnGestureCommand : TOnGestureCommandEvent read FOnGestureCommand write FOnGestureCommand;
|
||||
/// <summary>
|
||||
/// Called when |browser| associated with |browser_view| is created. This
|
||||
/// function will be called after ICefLifeSpanHandler.OnAfterCreated()
|
||||
/// is called for |browser| and before OnPopupBrowserViewCreated() is
|
||||
/// called for |browser|'s parent delegate if |browser| is a popup.
|
||||
/// </summary>
|
||||
property OnBrowserCreated : TOnBrowserCreatedEvent read FOnBrowserCreated write FOnBrowserCreated;
|
||||
/// <summary>
|
||||
/// Called when |browser| associated with |browser_view| is destroyed. Release
|
||||
/// all references to |browser| and do not attempt to execute any functions on
|
||||
/// |browser| after this callback returns. This function will be called before
|
||||
/// ICefLifeSpanHandler.OnBeforeClose() is called for |browser|.
|
||||
/// </summary>
|
||||
property OnBrowserDestroyed : TOnBrowserDestroyedEvent read FOnBrowserDestroyed write FOnBrowserDestroyed;
|
||||
/// <summary>
|
||||
/// Called before a new popup BrowserView is created. The popup originated
|
||||
/// from |browser_view|. |settings| and |client| are the values returned from
|
||||
/// ICefLifeSpanHandler.OnBeforePopup(). |is_devtools| will be true (1)
|
||||
/// if the popup will be a DevTools browser. Return the delegate that will be
|
||||
/// used for the new popup BrowserView.
|
||||
/// </summary>
|
||||
property OnGetDelegateForPopupBrowserView : TOnGetDelegateForPopupBrowserViewEvent read FOnGetDelegateForPopupBrowserView write FOnGetDelegateForPopupBrowserView;
|
||||
/// <summary>
|
||||
/// Called after |popup_browser_view| is created. This function will be called
|
||||
/// after ICefLifeSpanHandler.OnAfterCreated() and OnBrowserCreated()
|
||||
/// are called for the new popup browser. The popup originated from
|
||||
/// |browser_view|. |is_devtools| will be true (1) if the popup is a DevTools
|
||||
/// browser. Optionally add |popup_browser_view| to the views hierarchy
|
||||
/// yourself and return true (1). Otherwise return false (0) and a default
|
||||
/// ICefWindow will be created for the popup.
|
||||
/// </summary>
|
||||
property OnPopupBrowserViewCreated : TOnPopupBrowserViewCreatedEvent read FOnPopupBrowserViewCreated write FOnPopupBrowserViewCreated;
|
||||
/// <summary>
|
||||
/// Returns the Chrome toolbar type that will be available via
|
||||
/// ICefBrowserView.GetChromeToolbar(). See that function for related
|
||||
/// documentation.
|
||||
/// </summary>
|
||||
property OnGetChromeToolbarType : TOnGetChromeToolbarTypeEvent read FOnGetChromeToolbarType write FOnGetChromeToolbarType;
|
||||
/// <summary>
|
||||
/// Return true (1) to create frameless windows for Document picture-in-
|
||||
/// picture popups. Content in frameless windows should specify draggable
|
||||
/// regions using "-webkit-app-region: drag" CSS.
|
||||
/// </summary>
|
||||
property OnUseFramelessWindowForPictureInPicture : TOnUseFramelessWindowForPictureInPicture read FOnUseFramelessWindowForPictureInPicture write FOnUseFramelessWindowForPictureInPicture;
|
||||
/// <summary>
|
||||
/// Called when |browser_view| receives a gesture command. Return true (1) to
|
||||
/// handle (or disable) a |gesture_command| or false (0) to propagate the
|
||||
/// gesture to the browser for default handling. With the Chrome runtime these
|
||||
/// commands can also be handled via cef_command_handler_t::OnChromeCommand.
|
||||
/// </summary>
|
||||
property OnGestureCommand : TOnGestureCommandEvent read FOnGestureCommand write FOnGestureCommand;
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
@@ -110,14 +186,15 @@ procedure TCEFBrowserViewComponent.Initialize;
|
||||
begin
|
||||
inherited Initialize;
|
||||
|
||||
FBrowserView := nil;
|
||||
FBrowserViewDlg := nil;
|
||||
FOnBrowserCreated := nil;
|
||||
FOnBrowserDestroyed := nil;
|
||||
FOnGetDelegateForPopupBrowserView := nil;
|
||||
FOnPopupBrowserViewCreated := nil;
|
||||
FOnGetChromeToolbarType := nil;
|
||||
FOnGestureCommand := nil;
|
||||
FBrowserView := nil;
|
||||
FBrowserViewDlg := nil;
|
||||
FOnBrowserCreated := nil;
|
||||
FOnBrowserDestroyed := nil;
|
||||
FOnGetDelegateForPopupBrowserView := nil;
|
||||
FOnPopupBrowserViewCreated := nil;
|
||||
FOnGetChromeToolbarType := nil;
|
||||
FOnUseFramelessWindowForPictureInPicture := nil;
|
||||
FOnGestureCommand := nil;
|
||||
end;
|
||||
|
||||
procedure TCEFBrowserViewComponent.DestroyView;
|
||||
@@ -227,12 +304,19 @@ begin
|
||||
FOnGetChromeToolbarType(self, aChromeToolbarType);
|
||||
end;
|
||||
|
||||
procedure TCEFBrowserViewComponent.doOnUseFramelessWindowForPictureInPicture(const browser_view : ICefBrowserView;
|
||||
var aResult : boolean);
|
||||
begin
|
||||
if assigned(FOnUseFramelessWindowForPictureInPicture) then
|
||||
FOnUseFramelessWindowForPictureInPicture(self, browser_view, aResult);
|
||||
end;
|
||||
|
||||
procedure TCEFBrowserViewComponent.doOnGestureCommand(const browser_view : ICefBrowserView;
|
||||
gesture_command : TCefGestureCommand;
|
||||
var aResult : boolean);
|
||||
begin
|
||||
if assigned(FOnGestureCommand) then
|
||||
FOnGestureCommand(self, browser_view, aResult);
|
||||
FOnGestureCommand(self, browser_view, gesture_command, aResult);
|
||||
end;
|
||||
|
||||
{$IFDEF FPC}
|
||||
|
||||
Reference in New Issue
Block a user