1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2024-11-24 08:02:15 +02:00

Update to CEF 117.1.4

This commit is contained in:
salvadordf 2023-09-24 11:21:05 +02:00
parent 1e5d96f16e
commit 8979dc8078
32 changed files with 1324 additions and 341 deletions

View File

@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the LICENSE.md file.
CEF4Delphi uses CEF 116.0.27 which includes Chromium 116.0.5845.190.
CEF4Delphi uses CEF 117.1.4 which includes Chromium 117.0.5938.92.
The CEF binaries used by CEF4Delphi are available for download at Spotify :
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_116.0.27%2Bgd8c85ac%2Bchromium-116.0.5845.190_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_116.0.27%2Bgd8c85ac%2Bchromium-116.0.5845.190_windows64.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_116.0.27%2Bgd8c85ac%2Bchromium-116.0.5845.190_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_116.0.27%2Bgd8c85ac%2Bchromium-116.0.5845.190_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_116.0.27%2Bgd8c85ac%2Bchromium-116.0.5845.190_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_116.0.27%2Bgd8c85ac%2Bchromium-116.0.5845.190_macosx64.tar.bz2)
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_windows64.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_117.1.4%2Bga26f38b%2Bchromium-117.0.5938.92_macosx64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 11.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.6/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

Binary file not shown.

View File

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

View File

@ -78,6 +78,7 @@ type
FLocale : ustring;
FLogFile : ustring;
FLogSeverity : TCefLogSeverity;
FLogItems : TCefLogItems;
FJavaScriptFlags : ustring;
FResourcesDirPath : ustring;
FLocalesDirPath : ustring;
@ -600,6 +601,13 @@ type
/// </summary>
property LogSeverity : TCefLogSeverity read FLogSeverity write FLogSeverity;
/// <summary>
/// The log items prepended to each log line. If not set the default log items
/// will be used. Also configurable using the "log-items" command-line switch
/// with a value of "none" for no log items, or a comma-delimited list of
/// values "pid", "tid", "timestamp" or "tickcount" for custom log items.
/// </summary>
property LogItems : TCefLogItems read FLogItems write FLogItems;
/// <summary>
/// Custom flags that will be used when initializing the V8 JavaScript engine.
/// The consequences of using custom flags may not be well tested. Also
/// configurable using the "js-flags" command-line switch.
@ -1707,6 +1715,7 @@ begin
FLocale := '';
FLogFile := '';
FLogSeverity := LOGSEVERITY_DISABLE;
FLogItems := LOG_ITEMS_DEFAULT;
FJavaScriptFlags := '';
FResourcesDirPath := '';
FLocalesDirPath := '';
@ -2654,6 +2663,7 @@ begin
aSettings.locale := CefString(FLocale);
aSettings.log_file := CefString(FLogFile);
aSettings.log_severity := FLogSeverity;
aSettings.log_items := FLogItems;
aSettings.javascript_flags := CefString(FJavaScriptFlags);
aSettings.resources_dir_path := CefString(ResourcesDirPath);
aSettings.locales_dir_path := CefString(LocalesDirPath);

View File

@ -19,6 +19,9 @@ uses
{$ENDIF}
type
/// <summary>
/// Class that stores a copy of the raw bitmap buffer sent by CEF in the TChromiumCore.OnPaint event.
/// </summary>
TCEFBitmapBitBuffer = class
protected
FBuffer : pointer;
@ -39,15 +42,41 @@ type
public
constructor Create(aWidth, aHeight : integer);
destructor Destroy; override;
/// <summary>
/// Updates the image size.
/// </summary>
procedure UpdateSize(aWidth, aHeight : integer);
/// <summary>
/// Image width.
/// </summary>
property Width : integer read FImageWidth;
/// <summary>
/// Image height.
/// </summary>
property Height : integer read FImageHeight;
/// <summary>
/// Buffer length.
/// </summary>
property BufferLength : integer read GetBufferLength;
/// <summary>
/// Returns true if the buffer is empty.
/// </summary>
property Empty : boolean read GetEmpty;
/// <summary>
/// Returns a pointer to the first byte in of the Y scnaline.
/// </summary>
property Scanline[y : integer] : PByte read GetScanline;
property ScanlineSize : integer read GetScanlineSize;
/// <summary>
/// Returns the scanline size.
/// </summary>
property ScanlineSize : integer read GetScanlineSize;
/// <summary>
/// Returns the real buffer scanline size.
/// </summary>
property BufferScanlineSize : integer read GetBufferScanlineSize;
/// <summary>
/// Returns a pointer to the buffer that stores the image.
/// </summary>
property BufferBits : pointer read FBuffer;
end;

View File

@ -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}

View File

@ -26,7 +26,8 @@ type
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
function GetChromeToolbarType: TCefChromeToolbarType;
procedure OnGetChromeToolbarType(var aResult: TCefChromeToolbarType);
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
public
@ -39,7 +40,8 @@ type
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual;
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); virtual;
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); virtual;
function GetChromeToolbarType: TCefChromeToolbarType; virtual;
procedure OnGetChromeToolbarType(var aResult: TCefChromeToolbarType); virtual;
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean); virtual;
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); virtual;
procedure InitializeCEFMethods; override;
@ -69,7 +71,8 @@ type
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); override;
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); override;
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); override;
function GetChromeToolbarType: TCefChromeToolbarType; override;
procedure OnGetChromeToolbarType(var aResult: TCefChromeToolbarType); override;
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean); override;
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); override;
public
@ -126,9 +129,15 @@ begin
ord(is_devtools)) <> 0);
end;
function TCefBrowserViewDelegateRef.GetChromeToolbarType: TCefChromeToolbarType;
procedure TCefBrowserViewDelegateRef.OnGetChromeToolbarType(var aResult : TCefChromeToolbarType);
begin
Result := PCefBrowserViewDelegate(FData)^.get_chrome_toolbar_type(PCefBrowserViewDelegate(FData));
aResult := PCefBrowserViewDelegate(FData)^.get_chrome_toolbar_type(PCefBrowserViewDelegate(FData));
end;
procedure TCefBrowserViewDelegateRef.OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
begin
aResult := (PCefBrowserViewDelegate(FData)^.use_frameless_window_for_picture_in_picture(PCefBrowserViewDelegate(FData),
CefGetData(browser_view)) <> 0);
end;
procedure TCefBrowserViewDelegateRef.OnGestureCommand(const browser_view : ICefBrowserView;
@ -229,7 +238,23 @@ begin
Result := CEF_CTT_NONE;
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
Result := TCefBrowserViewDelegateOwn(TempObject).GetChromeToolbarType();
TCefBrowserViewDelegateOwn(TempObject).OnGetChromeToolbarType(Result);
end;
function cef_browserview_delegate_use_frameless_window_for_picture_in_picture(self : PCefBrowserViewDelegate;
browser_view : PCefBrowserView): integer; stdcall;
var
TempObject : TObject;
TempResult : boolean;
begin
TempObject := CefGetObject(self);
TempResult := False;
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
TCefBrowserViewDelegateOwn(TempObject).OnUseFramelessWindowForPictureInPicture(TCefBrowserViewRef.UnWrap(browser_view),
TempResult);
Result := ord(TempResult);
end;
function cef_browserview_delegate_on_gesture_command(self : PCefBrowserViewDelegate;
@ -263,12 +288,13 @@ begin
with PCefBrowserViewDelegate(FData)^ do
begin
on_browser_created := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_browser_created;
on_browser_destroyed := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_browser_destroyed;
get_delegate_for_popup_browser_view := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_delegate_for_popup_browser_view;
on_popup_browser_view_created := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_popup_browser_view_created;
get_chrome_toolbar_type := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_chrome_toolbar_type;
on_gesture_command := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_gesture_command;
on_browser_created := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_browser_created;
on_browser_destroyed := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_browser_destroyed;
get_delegate_for_popup_browser_view := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_delegate_for_popup_browser_view;
on_popup_browser_view_created := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_popup_browser_view_created;
get_chrome_toolbar_type := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_chrome_toolbar_type;
use_frameless_window_for_picture_in_picture := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_use_frameless_window_for_picture_in_picture;
on_gesture_command := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_gesture_command;
end;
end;
@ -284,22 +310,27 @@ end;
procedure TCefBrowserViewDelegateOwn.OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
begin
//
aResult := nil;
end;
procedure TCefBrowserViewDelegateOwn.OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
begin
//
aResult := False;
end;
function TCefBrowserViewDelegateOwn.GetChromeToolbarType: TCefChromeToolbarType;
procedure TCefBrowserViewDelegateOwn.OnGetChromeToolbarType(var aResult: TCefChromeToolbarType);
begin
Result := CEF_CTT_NONE;
aResult := CEF_CTT_NONE;
end;
procedure TCefBrowserViewDelegateOwn.OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
begin
aResult := False;
end;
procedure TCefBrowserViewDelegateOwn.OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
begin
//
aResult := False;
end;
@ -316,6 +347,8 @@ end;
procedure TCustomBrowserViewDelegate.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetPreferredSize(view, aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGetPreferredSize(view, aResult);
@ -327,6 +360,8 @@ end;
procedure TCustomBrowserViewDelegate.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMinimumSize(view, aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGetMinimumSize(view, aResult);
@ -338,6 +373,8 @@ end;
procedure TCustomBrowserViewDelegate.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMaximumSize(view, aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGetMaximumSize(view, aResult);
@ -349,6 +386,8 @@ end;
procedure TCustomBrowserViewDelegate.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
inherited OnGetHeightForWidth(view, width, aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGetHeightForWidth(view, width, aResult);
@ -448,6 +487,8 @@ end;
procedure TCustomBrowserViewDelegate.OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
begin
inherited OnGetDelegateForPopupBrowserView(browser_view, settings, client, is_devtools, aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGetDelegateForPopupBrowserView(browser_view, settings, client, is_devtools, aResult);
@ -459,6 +500,8 @@ end;
procedure TCustomBrowserViewDelegate.OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
begin
inherited OnPopupBrowserViewCreated(browser_view, popup_browser_view, is_devtools, aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnPopupBrowserViewCreated(browser_view, popup_browser_view, is_devtools, aResult);
@ -468,16 +511,29 @@ begin
end;
end;
function TCustomBrowserViewDelegate.GetChromeToolbarType: TCefChromeToolbarType;
procedure TCustomBrowserViewDelegate.OnGetChromeToolbarType(var aResult: TCefChromeToolbarType);
begin
Result := inherited GetChromeToolbarType();
inherited OnGetChromeToolbarType(aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGetChromeToolbarType(Result);
ICefBrowserViewDelegateEvents(FEvents).doOnGetChromeToolbarType(aResult);
except
on e : exception do
if CustomExceptionHandler('TCustomBrowserViewDelegate.GetChromeToolbarType', e) then raise;
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGetChromeToolbarType', e) then raise;
end;
end;
procedure TCustomBrowserViewDelegate.OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
begin
inherited OnUseFramelessWindowForPictureInPicture(browser_view, aResult);
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnUseFramelessWindowForPictureInPicture(browser_view, aResult);
except
on e : exception do
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnUseFramelessWindowForPictureInPicture', e) then raise;
end;
end;

View File

@ -111,41 +111,141 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AfterConstruction; override;
/// <summary>
/// Save the visible web contents as a bitmap file.
/// </summary>
function SaveToFile(const aFilename : string) : boolean;
/// <summary>
/// Invalidate this panel.
/// </summary>
function InvalidatePanel : boolean;
/// <summary>
/// Acquires the synchronization object before drawing into the background bitmap.
/// </summary>
function BeginBufferDraw : boolean;
/// <summary>
/// Releases the synchronization object after drawing into the background bitmap.
/// </summary>
procedure EndBufferDraw;
/// <summary>
/// Draws aBitmap into the background bitmap buffer at the specified coordinates.
/// </summary>
/// <param name="x">x coordinate where the bitmap will be drawn.</param>
/// <param name="y">y coordinate where the bitmap will be drawn.</param>
/// <param name="aBitmap">Bitmap that will be drawn into the background bitmap.</param>
procedure BufferDraw(x, y : integer; const aBitmap : TBitmap); overload;
/// <summary>
/// Draws a part of aBitmap into the background bitmap buffer at the specified rectangle.
/// </summary>
/// <param name="aBitmap">Bitmap that will be drawn into the background bitmap.</param>
/// <param name="aSrcRect">Rectangle that defines the area of aBitmap that will be drawn into the background bitmap.</param>
/// <param name="aDstRect">Rectangle that defines the area of the background bitmap where aBitmap will be drawn.</param>
procedure BufferDraw(const aBitmap : TBitmap; const aSrcRect, aDstRect : TRect); overload;
function UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;
/// <summary>
/// Update the background bitmap size.
/// </summary>
function UpdateBufferDimensions(aWidth, aHeight : integer) : boolean;
/// <summary>
/// Update the image size of the original buffer copy.
/// </summary>
function UpdateOrigBufferDimensions(aWidth, aHeight : integer) : boolean;
/// <summary>
/// Update the popup image size of the original buffer copy.
/// </summary>
function UpdateOrigPopupBufferDimensions(aWidth, aHeight : integer) : boolean;
/// <summary>
/// Update the FDeviceScaleFactor value with the current scale.
/// </summary>
procedure UpdateDeviceScaleFactor;
/// <summary>
/// Check if the background image buffers have the same dimensions as this panel. Returns true if they have the same size.
/// </summary>
function BufferIsResized(aUseMutex : boolean = True) : boolean;
/// <summary>
/// Creates the IME handler.
/// </summary>
procedure CreateIMEHandler;
/// <summary>
/// Calls ChangeCompositionRange in the IME handler.
/// </summary>
procedure ChangeCompositionRange(const selection_range : TCefRange; const character_bounds : TCefRectDynArray);
/// <summary>
/// Copy the contents from the original popup buffer copy to the main buffer copy.
/// </summary>
procedure DrawOrigPopupBuffer(const aSrcRect, aDstRect : TRect);
/// <summary>
/// Returns the scanline size.
/// </summary>
property ScanlineSize : integer read FScanlineSize;
/// <summary>
/// Image width.
/// </summary>
property BufferWidth : integer read GetBufferWidth;
/// <summary>
/// Image height.
/// </summary>
property BufferHeight : integer read GetBufferHeight;
/// <summary>
/// Returns a pointer to the buffer that stores the image.
/// </summary>
property BufferBits : pointer read GetBufferBits;
/// <summary>
/// Returns the screen scale.
/// </summary>
property ScreenScale : single read GetScreenScale;
/// <summary>
/// Screen scale value used instead of the real one.
/// </summary>
property ForcedDeviceScaleFactor : single read FForcedDeviceScaleFactor write FForcedDeviceScaleFactor;
/// <summary>
/// Clear the background image before copying the original buffer contents.
/// </summary>
property MustInitBuffer : boolean read FMustInitBuffer write FMustInitBuffer;
/// <summary>
/// Background bitmap.
/// </summary>
property Buffer : TBitmap read FBuffer;
/// <summary>
/// Copy of the raw main bitmap buffer sent by CEF in the TChromiumCore.OnPaint event.
/// </summary>
property OrigBuffer : TCEFBitmapBitBuffer read FOrigBuffer;
/// <summary>
/// Image width of the raw main bitmap buffer copy.
/// </summary>
property OrigBufferWidth : integer read GetOrigBufferWidth;
/// <summary>
/// Image height of the raw main bitmap buffer copy.
/// </summary>
property OrigBufferHeight : integer read GetOrigBufferHeight;
/// <summary>
/// Copy of the raw popup bitmap buffer sent by CEF in the TChromiumCore.OnPaint event.
/// </summary>
property OrigPopupBuffer : TCEFBitmapBitBuffer read FOrigPopupBuffer;
/// <summary>
/// Image width of the raw popup bitmap buffer copy.
/// </summary>
property OrigPopupBufferWidth : integer read GetOrigPopupBufferWidth;
/// <summary>
/// Image height of the raw popup bitmap buffer copy.
/// </summary>
property OrigPopupBufferHeight : integer read GetOrigPopupBufferHeight;
/// <summary>
/// Returns a pointer to the raw popup bitmap buffer copye.
/// </summary>
property OrigPopupBufferBits : pointer read GetOrigPopupBufferBits;
/// <summary>
/// Returns the scanline size of the raw popup bitmap buffer copy.
/// </summary>
property OrigPopupScanlineSize : integer read FOrigPopupScanlineSize;
{$IFDEF MSWINDOWS}
/// <summary>
/// Returns the handle of the parent form.
/// </summary>
property ParentFormHandle : TCefWindowHandle read GetParentFormHandle;
/// <summary>
/// Returns the parent form.
/// </summary>
property ParentForm : TCustomForm read GetParentForm;
{$ENDIF}

View File

@ -159,6 +159,8 @@ end;
procedure TCustomButtonDelegate.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetPreferredSize(view, aResult);
try
if (FEvents <> nil) then
ICefButtonDelegateEvents(FEvents).doOnGetPreferredSize(view, aResult);
@ -170,6 +172,8 @@ end;
procedure TCustomButtonDelegate.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMinimumSize(view, aResult);
try
if (FEvents <> nil) then
ICefButtonDelegateEvents(FEvents).doOnGetMinimumSize(view, aResult);
@ -181,6 +185,8 @@ end;
procedure TCustomButtonDelegate.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMaximumSize(view, aResult);
try
if (FEvents <> nil) then
ICefButtonDelegateEvents(FEvents).doOnGetMaximumSize(view, aResult);
@ -192,6 +198,8 @@ end;
procedure TCustomButtonDelegate.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
inherited OnGetHeightForWidth(view, width, aResult);
try
if (FEvents <> nil) then
ICefButtonDelegateEvents(FEvents).doOnGetHeightForWidth(view, width, aResult);

View File

@ -782,42 +782,72 @@ type
function SetNewBrowserParent(aNewParentHwnd : HWND) : boolean;
{$ENDIF MSWINDOWS}
/// <summary>
/// Used to create the browser after the global request context has been
/// <para>Used to create the browser after the global request context has been
/// initialized. You need to set all properties and events before calling
/// this function because it will only create the internal handlers needed
/// for those events and the property values will be used in the browser
/// initialization.
/// The browser will be fully initialized when the TChromiumCore.OnAfterCreated
/// event is triggered.
/// initialization.</para>
/// <para>The browser will be fully initialized when the TChromiumCore.OnAfterCreated
/// event is triggered.</para>
/// </summary>
function CreateBrowser(aParentHandle : TCefWindowHandle; aParentRect : TRect; const aWindowName : ustring = ''; const aContext : ICefRequestContext = nil; const aExtraInfo : ICefDictionaryValue = nil; aForceAsPopup : boolean = False) : boolean; overload; virtual;
/// <summary>
/// <para>Used to create the browser after the global request context has been
/// initialized. You need to set all properties and events before calling
/// this function because it will only create the internal handlers needed
/// for those events and the property values will be used in the browser
/// initialization.</para>
/// <para>The browser will be fully initialized when the TChromiumCore.OnAfterCreated
/// event is triggered.</para>
/// </summary>
function CreateBrowser(const aURL : ustring; const aBrowserViewComp : TCEFBrowserViewComponent; const aContext : ICefRequestContext = nil; const aExtraInfo : ICefDictionaryValue = nil) : boolean; overload; virtual;
/// <summary>
/// Used to navigate to a URL in the specified frame or the main frame.
/// </summary>
procedure LoadURL(const aURL : ustring; const aFrameName : ustring = ''); overload;
/// <summary>
/// Used to navigate to a URL in the specified frame or the main frame.
/// </summary>
procedure LoadURL(const aURL : ustring; const aFrame : ICefFrame); overload;
/// <summary>
/// Used to navigate to a URL in the specified frame or the main frame.
/// </summary>
procedure LoadURL(const aURL : ustring; const aFrameIdentifier : int64); overload;
/// <summary>
/// Used to load a DATA URI with the HTML string contents in the specified frame or the main frame.
/// </summary>
procedure LoadString(const aHTML : ustring; const aFrameName : ustring = ''); overload;
/// <summary>
/// Used to load a DATA URI with the HTML string contents in the specified frame or the main frame.
/// </summary>
procedure LoadString(const aHTML : ustring; const aFrame : ICefFrame); overload;
/// <summary>
/// Used to load a DATA URI with the HTML string contents in the specified frame or the main frame.
/// </summary>
procedure LoadString(const aHTML : ustring; const aFrameIdentifier : int64); overload;
/// <summary>
/// Used to load a DATA URI with the stream contents in the specified frame or the main frame.
/// The DATA URI will be configured with the mime type and charset specified in the parameters.
/// </summary>
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameName : ustring = ''); overload;
/// <summary>
/// Used to load a DATA URI with the stream contents in the specified frame or the main frame.
/// The DATA URI will be configured with the mime type and charset specified in the parameters.
/// </summary>
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrame : ICefFrame); overload;
/// <summary>
/// Used to load a DATA URI with the stream contents in the specified frame or the main frame.
/// The DATA URI will be configured with the mime type and charset specified in the parameters.
/// </summary>
procedure LoadResource(const aStream : TCustomMemoryStream; const aMimeType, aCharset : string; const aFrameIdentifier : int64); overload;
/// <summary>
/// Load the request represented by the aRequest object.
///
/// </summary>
/// <remarks>
/// WARNING: This function will fail with bad IPC message reason
/// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
/// origin using some other mechanism (LoadURL, link click, etc).
/// </summary>
/// </remarks>
procedure LoadRequest(const aRequest: ICefRequest);
/// <summary>
/// Navigate backwards.
@ -854,20 +884,20 @@ type
/// </summary>
procedure SimulateMouseWheel(aDeltaX, aDeltaY : integer);
/// <summary>
/// Clears all certificate exceptions that were added as part of handling
/// <para>Clears all certificate exceptions that were added as part of handling
/// OnCertificateError. If you call this it is recommended that you also call
/// CloseAllConnections() or you risk not being prompted again for server
/// certificates if you reconnect quickly.
/// If aClearImmediately is false then OnCertificateExceptionsCleared is
/// triggered when the exceptions are cleared.
/// certificates if you reconnect quickly.</para>
/// <para>If aClearImmediately is false then OnCertificateExceptionsCleared is
/// triggered when the exceptions are cleared.</para>
/// </summary>
function ClearCertificateExceptions(aClearImmediately : boolean = True) : boolean;
/// <summary>
/// Clears all HTTP authentication credentials that were added as part of
/// <para>Clears all HTTP authentication credentials that were added as part of
/// handling GetAuthCredentials. If |callback| is non-NULL it will be executed
/// on the UI thread after completion.
/// If aClearImmediately is false then OnHttpAuthCredentialsCleared is triggered
/// when the credeintials are cleared.
/// on the UI thread after completion.</para>
/// <para>If aClearImmediately is false then OnHttpAuthCredentialsCleared is triggered
/// when the credeintials are cleared.</para>
/// </summary>
function ClearHttpAuthCredentials(aClearImmediately : boolean = True) : boolean;
/// <summary>
@ -877,17 +907,17 @@ type
/// </summary>
function CloseAllConnections(aCloseImmediately : boolean = True) : boolean;
/// <summary>
/// Retrieve all the HTML content from the specified frame or the main frame.
/// Leave aFrameName empty to get the HTML source from the main frame.
/// It uses a CefStringVisitor to get the HTML content asynchronously and the
/// result will be received in the TChromiumCore.OnTextResultAvailable event.
/// <para>Retrieve all the HTML content from the specified frame or the main frame.
/// Leave aFrameName empty to get the HTML source from the main frame.</para>
/// <para>It uses a CefStringVisitor to get the HTML content asynchronously and the
/// result will be received in the TChromiumCore.OnTextResultAvailable event.</para>
/// </summary>
procedure RetrieveHTML(const aFrameName : ustring = ''); overload;
/// <summary>
/// Retrieve all the HTML content from the specified frame or the main frame.
/// Set aFrame to nil to get the HTML source from the main frame.
/// It uses a CefStringVisitor to get the HTML content asynchronously and the
/// result will be received in the TChromiumCore.OnTextResultAvailable event.
/// <para>Retrieve all the HTML content from the specified frame or the main frame.
/// Set aFrame to nil to get the HTML source from the main frame.</para>
/// <para>It uses a CefStringVisitor to get the HTML content asynchronously and the
/// result will be received in the TChromiumCore.OnTextResultAvailable event.</para>
/// </summary>
procedure RetrieveHTML(const aFrame : ICefFrame); overload;
/// <summary>
@ -933,14 +963,28 @@ type
/// </summary>
function GetFrameIdentifiers(var aFrameCount : NativeUInt; var aFrameIdentifierArray : TCefFrameIdentifierArray) : boolean;
/// <summary>
/// Execute a string of JavaScript code in this frame. The |aScriptURL|
/// parameter is the URL where the script in question can be found, if any.
/// The renderer may request this URL to show the developer the source of the
/// error. The |aStartLine| parameter is the base line number to use for
/// error reporting.
/// Execute a string of JavaScript code in this frame.
/// </summary>
/// <param name="aCode">JavaScript code.</param>
/// <param name="aScriptURL">The URL where the script in question can be found, if any. The renderer may request this URL to show the developer the source of the error.</param>
/// <param name="aFrameName">Name of the frame where the JavaScript code will be executed. This name is generated automatically by Chromium. See ICefBrowser.GetFrameNames.</param>
/// <param name="aStartLine">The base line number to use for error reporting.</param>
procedure ExecuteJavaScript(const aCode, aScriptURL : ustring; const aFrameName : ustring = ''; aStartLine : integer = 0); overload;
/// <summary>
/// Execute a string of JavaScript code in this frame.
/// </summary>
/// <param name="aCode">JavaScript code.</param>
/// <param name="aScriptURL">The URL where the script in question can be found, if any. The renderer may request this URL to show the developer the source of the error.</param>
/// <param name="aFrame">Frame where the JavaScript code will be executed.</param>
/// <param name="aStartLine">The base line number to use for error reporting.</param>
procedure ExecuteJavaScript(const aCode, aScriptURL : ustring; const aFrame : ICefFrame; aStartLine : integer = 0); overload;
/// <summary>
/// Execute a string of JavaScript code in this frame.
/// </summary>
/// <param name="aCode">JavaScript code.</param>
/// <param name="aScriptURL">The URL where the script in question can be found, if any. The renderer may request this URL to show the developer the source of the error.</param>
/// <param name="aFrameIdentifier">Frame where the JavaScript code will be executed.</param>
/// <param name="aStartLine">The base line number to use for error reporting.</param>
procedure ExecuteJavaScript(const aCode, aScriptURL : ustring; const aFrameIdentifier : int64; aStartLine : integer = 0); overload;
/// <summary>
/// Used to update the browser preferences using the TChromiumCore property values asynchronously.
@ -989,21 +1033,21 @@ type
/// </summary>
function DeleteCookies(const url : ustring = ''; const cookieName : ustring = ''; aDeleteImmediately : boolean = False) : boolean;
/// <summary>
/// TChromiumCore.VisitAllCookies triggers the TChromiumCore.OnCookiesVisited event for each cookie
/// <para>TChromiumCore.VisitAllCookies triggers the TChromiumCore.OnCookiesVisited event for each cookie
/// aID is an optional parameter to identify which VisitAllCookies call has triggered the
/// OnCookiesVisited event.
/// TChromiumCore.OnCookiesVisited may not be triggered if the cookie store is empty but the
/// OnCookiesVisited event.</para>
/// <para>TChromiumCore.OnCookiesVisited may not be triggered if the cookie store is empty but the
/// TChromium.OnCookieVisitorDestroyed event will always be triggered to signal when the browser
/// when the visit is over.
/// when the visit is over.</para>
/// </summary>
function VisitAllCookies(aID : integer = 0) : boolean;
/// <summary>
/// TChromiumCore.VisitURLCookies triggers the TChromiumCore.OnCookiesVisited event for each cookie
/// <para>TChromiumCore.VisitURLCookies triggers the TChromiumCore.OnCookiesVisited event for each cookie
/// aID is an optional parameter to identify which VisitURLCookies call has triggered the
/// OnCookiesVisited event.
/// TChromiumCore.OnCookiesVisited may not be triggered if the cookie store is empty but the
/// OnCookiesVisited event.</para>
/// <para>TChromiumCore.OnCookiesVisited may not be triggered if the cookie store is empty but the
/// TChromium.OnCookieVisitorDestroyed event will always be triggered to signal when the browser
/// when the visit is over.
/// when the visit is over.</para>
/// </summary>
function VisitURLCookies(const url : ustring; includeHttpOnly : boolean = False; aID : integer = 0) : boolean;
/// <summary>
@ -1033,7 +1077,7 @@ type
/// </summary>
procedure CloseDevTools(const aDevToolsWnd : TCefWindowHandle); overload;
/// <summary>
/// Send a function call message over the DevTools protocol. |message_| must be
/// <para>Send a function call message over the DevTools protocol. |message_| must be
/// a UTF8-encoded JSON dictionary that contains "id" (int), "function"
/// (string) and "params" (dictionary, optional) values. See the DevTools
/// protocol documentation at https://chromedevtools.github.io/devtools-
@ -1044,40 +1088,37 @@ type
/// will be applied asynchronously and any messages that fail due to
/// formatting errors or missing parameters may be discarded without
/// notification. Prefer ExecuteDevToolsMethod if a more structured approach
/// to message formatting is desired.
///
/// Every valid function call will result in an asynchronous function result
/// to message formatting is desired.</para>
/// <para>Every valid function call will result in an asynchronous function result
/// or error message that references the sent message "id". Event messages are
/// received while notifications are enabled (for example, between function
/// calls for "Page.enable" and "Page.disable"). All received messages will be
/// delivered to the observer(s) registered with AddDevToolsMessageObserver.
/// See ICefDevToolsMessageObserver.OnDevToolsMessage documentation for
/// details of received message contents.
///
/// Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
/// details of received message contents.</para>
/// <para>Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
/// AddDevToolsMessageObserver functions does not require an active DevTools
/// front-end or remote-debugging session. Other active DevTools sessions will
/// continue to function independently. However, any modification of global
/// browser state by one session may not be reflected in the UI of other
/// sessions.
///
/// Communication with the DevTools front-end (when displayed) can be logged
/// sessions.</para>
/// <para>Communication with the DevTools front-end (when displayed) can be logged
/// for development purposes by passing the `--devtools-protocol-log-
/// file=<path>` command-line flag.
/// file=<path>` command-line flag.</para>
/// </summary>
function SendDevToolsMessage(const message_: ustring): boolean;
/// <summary>
/// Execute a function call over the DevTools protocol. This is a more
/// <para>Execute a function call over the DevTools protocol. This is a more
/// structured version of SendDevToolsMessage. |message_id| is an incremental
/// number that uniquely identifies the message (pass 0 to have the next
/// number assigned automatically based on previous values). |function| is the
/// function name. |params| are the function parameters, which may be NULL.
/// See the DevTools protocol documentation (linked above) for details of
/// function name. |params| are the function parameters, which may be NULL.</para>
/// <para>See the DevTools protocol documentation (linked above) for details of
/// supported functions and the expected |params| dictionary contents. This
/// function will return the assigned message ID if called on the UI thread
/// and the message was successfully submitted for validation, otherwise 0.
/// See the SendDevToolsMessage documentation for additional usage
/// information.
/// and the message was successfully submitted for validation, otherwise 0.</para>
/// <para>See the SendDevToolsMessage documentation for additional usage
/// information.</para>
/// </summary>
function ExecuteDevToolsMethod(message_id: integer; const method: ustring; const params: ICefDictionaryValue): Integer;
/// <summary>
@ -1088,12 +1129,12 @@ type
/// </summary>
function AddDevToolsMessageObserver(const observer: ICefDevToolsMessageObserver): ICefRegistration;
/// <summary>
/// Search for |searchText|. |forward| indicates whether to search forward or
/// <para>Search for |searchText|. |forward| indicates whether to search forward or
/// backward within the page. |matchCase| indicates whether the search should
/// be case-sensitive. |findNext| indicates whether this is the first request
/// or a follow-up. The search will be restarted if |searchText| or
/// |matchCase| change. The search will be stopped if |searchText| is NULL.
/// OnFindResult will be triggered to report find results.
/// |matchCase| change. The search will be stopped if |searchText| is NULL.</para>
/// <para>OnFindResult will be triggered to report find results.</para>
/// </summary>
procedure Find(const aSearchText : ustring; aForward, aMatchCase, aFindNext : Boolean);
/// <summary>
@ -1105,12 +1146,12 @@ type
/// </summary>
procedure Print;
/// <summary>
/// Print the current browser contents to the PDF file specified by |path| and
/// <para>Print the current browser contents to the PDF file specified by |path| and
/// execute |callback| on completion. The caller is responsible for deleting
/// |path| when done. For PDF printing to work on Linux you must implement the
/// ICefPrintHandler.GetPdfPaperSize function.
/// The TChromiumCore.OnPdfPrintFinished event will be triggered when the PDF
/// file is created.
/// ICefPrintHandler.GetPdfPaperSize function.</para>
/// <para>The TChromiumCore.OnPdfPrintFinished event will be triggered when the PDF
/// file is created.</para>
/// </summary>
procedure PrintToPDF(const aFilePath : ustring);
/// <summary>
@ -1270,51 +1311,54 @@ type
/// </summary>
procedure SendProcessMessage(targetProcess: TCefProcessId; const ProcMessage: ICefProcessMessage; const aFrameIdentifier : int64); overload;
/// <summary>
/// Create a new URL request that will be treated as originating from this
/// <para>Create a new URL request that will be treated as originating from this
/// frame and the associated browser. Use TCustomCefUrlrequestClient.Create instead if
/// you do not want the request to have this association, in which case it may
/// be handled differently (see documentation on that function). A request
/// created with this function may only originate from the browser process,
/// and will behave as follows:
/// and will behave as follows:</para>
/// </code>
/// - It may be intercepted by the client via CefResourceRequestHandler or
/// CefSchemeHandlerFactory.
/// - POST data may only contain a single element of type PDE_TYPE_FILE or
/// PDE_TYPE_BYTES.
///
/// The |request| object will be marked as read-only after calling this
/// function.
/// </code>
/// <para>The |request| object will be marked as read-only after calling this
/// function.</para>
/// </summary>
function CreateUrlRequest(const request: ICefRequest; const client: ICefUrlrequestClient; const aFrameName : ustring = ''): ICefUrlRequest; overload;
/// <summary>
/// Create a new URL request that will be treated as originating from this
/// <para>Create a new URL request that will be treated as originating from this
/// frame and the associated browser. Use TCustomCefUrlrequestClient.Create instead if
/// you do not want the request to have this association, in which case it may
/// be handled differently (see documentation on that function). A request
/// created with this function may only originate from the browser process,
/// and will behave as follows:
/// and will behave as follows:</para>
/// <code>
/// - It may be intercepted by the client via CefResourceRequestHandler or
/// CefSchemeHandlerFactory.
/// - POST data may only contain a single element of type PDE_TYPE_FILE or
/// PDE_TYPE_BYTES.
///
/// The |request| object will be marked as read-only after calling this
/// function.
/// </code>
/// <para>The |request| object will be marked as read-only after calling this
/// function.</para>
/// </summary>
function CreateUrlRequest(const request: ICefRequest; const client: ICefUrlrequestClient; const aFrame : ICefFrame): ICefUrlRequest; overload;
/// <summary>
/// Create a new URL request that will be treated as originating from this
/// <para>Create a new URL request that will be treated as originating from this
/// frame and the associated browser. Use TCustomCefUrlrequestClient.Create instead if
/// you do not want the request to have this association, in which case it may
/// be handled differently (see documentation on that function). A request
/// created with this function may only originate from the browser process,
/// and will behave as follows:
/// and will behave as follows:</para>
/// <code>
/// - It may be intercepted by the client via CefResourceRequestHandler or
/// CefSchemeHandlerFactory.
/// - POST data may only contain a single element of type PDE_TYPE_FILE or
/// PDE_TYPE_BYTES.
///
/// The |request| object will be marked as read-only after calling this
/// function.
/// </code>
/// <para>The |request| object will be marked as read-only after calling this
/// function.</para>
/// </summary>
function CreateUrlRequest(const request: ICefRequest; const client: ICefUrlrequestClient; const aFrameIdentifier : int64): ICefUrlRequest; overload;
/// <summary>
@ -1322,29 +1366,27 @@ type
/// </summary>
procedure SetFocus(focus: Boolean);
/// <summary>
/// Set accessibility state for all frames. |accessibility_state| may be
/// <para>Set accessibility state for all frames. |accessibility_state| may be
/// default, enabled or disabled. If |accessibility_state| is STATE_DEFAULT
/// then accessibility will be disabled by default and the state may be
/// further controlled with the "force-renderer-accessibility" and "disable-
/// renderer-accessibility" command-line switches. If |accessibility_state| is
/// STATE_ENABLED then accessibility will be enabled. If |accessibility_state|
/// is STATE_DISABLED then accessibility will be completely disabled.
///
/// For windowed browsers accessibility will be enabled in Complete mode
/// is STATE_DISABLED then accessibility will be completely disabled.</para>
/// <para>For windowed browsers accessibility will be enabled in Complete mode
/// (which corresponds to kAccessibilityModeComplete in Chromium). In this
/// mode all platform accessibility objects will be created and managed by
/// Chromium's internal implementation. The client needs only to detect the
/// screen reader and call this function appropriately. For example, on macOS
/// the client can handle the @"AXEnhancedUserStructure" accessibility
/// attribute to detect VoiceOver state changes and on Windows the client can
/// handle WM_GETOBJECT with OBJID_CLIENT to detect accessibility readers.
///
/// For windowless browsers accessibility will be enabled in TreeOnly mode
/// handle WM_GETOBJECT with OBJID_CLIENT to detect accessibility readers.</para>
/// <para>For windowless browsers accessibility will be enabled in TreeOnly mode
/// (which corresponds to kAccessibilityModeWebContentsOnly in Chromium). In
/// this mode renderer accessibility is enabled, the full tree is computed,
/// and events are passed to CefAccessibiltyHandler, but platform
/// accessibility objects are not created. The client may implement platform
/// accessibility objects using CefAccessibiltyHandler callbacks if desired.
/// accessibility objects using CefAccessibiltyHandler callbacks if desired.</para>
/// </summary>
procedure SetAccessibilityState(accessibilityState: TCefState);
/// <summary>
@ -1398,29 +1440,28 @@ type
/// </summary>
procedure DragSourceSystemDragEnded;
/// <summary>
/// Begins a new composition or updates the existing composition. Blink has a
/// <para>Begins a new composition or updates the existing composition. Blink has a
/// special node (a composition node) that allows the input function to change
/// text without affecting other DOM nodes. |text| is the optional text that
/// will be inserted into the composition node. |underlines| is an optional
/// set of ranges that will be underlined in the resulting text.
/// |replacement_range| is an optional range of the existing text that will be
/// set of ranges that will be underlined in the resulting text.</para>
/// <para>|replacement_range| is an optional range of the existing text that will be
/// replaced. |selection_range| is an optional range of the resulting text
/// that will be selected after insertion or replacement. The
/// |replacement_range| value is only used on OS X.
///
/// This function may be called multiple times as the composition changes.
/// |replacement_range| value is only used on OS X.</para>
/// <para>This function may be called multiple times as the composition changes.
/// When the client is done making changes the composition should either be
/// canceled or completed. To cancel the composition call
/// ImeCancelComposition. To complete the composition call either
/// ImeCommitText or ImeFinishComposingText. Completion is usually signaled
/// when:
///
/// when:</para>
/// <code>
/// 1. The client receives a WM_IME_COMPOSITION message with a GCS_RESULTSTR
/// flag (on Windows), or;
/// 2. The client receives a "commit" signal of GtkIMContext (on Linux), or;
/// 3. insertText of NSTextInput is called (on Mac).
///
/// This function is only used when window rendering is disabled.
/// </code>
/// <para>This function is only used when window rendering is disabled.</para>
/// </summary>
procedure IMESetComposition(const text: ustring; const underlines : TCefCompositionUnderlineDynArray; const replacement_range, selection_range : PCefRange);
/// <summary>
@ -1487,25 +1528,24 @@ type
/// </summary>
procedure NotifyCurrentRoutes;
/// <summary>
/// Create a new route between |source| and |sink|. Source and sink must be
/// <para>Create a new route between |source| and |sink|. Source and sink must be
/// valid, compatible (as reported by ICefMediaSink.IsCompatibleWith), and
/// a route between them must not already exist. |callback| will be executed
/// on success or failure. If route creation succeeds it will also trigger an
/// asynchronous call to ICefMediaObserver.OnRoutes on all registered
/// observers.
/// This procedure is asynchronous and the result, ICefMediaRoute and the error
/// message will be available in the TChromium.OnMediaRouteCreateFinished event.
/// observers.</para>
/// <para>This procedure is asynchronous and the result, ICefMediaRoute and the error
/// message will be available in the TChromium.OnMediaRouteCreateFinished event.</para>
/// </summary>
procedure CreateRoute(const source: ICefMediaSource; const sink: ICefMediaSink);
/// <summary>
/// Asynchronously retrieves device info.
/// This procedure will trigger OnMediaSinkDeviceInfo with the device info.
/// <para>Asynchronously retrieves device info.</para>
/// <para>This procedure will trigger OnMediaSinkDeviceInfo with the device info.</para>
/// </summary>
procedure GetDeviceInfo(const aMediaSink: ICefMediaSink);
/// <summary>
/// Load an extension.
///
/// If extension resources will be read from disk using the default load
/// <para>Load an extension.</para>
/// <para>If extension resources will be read from disk using the default load
/// implementation then |root_directory| should be the absolute path to the
/// extension resources directory and |manifest| should be NULL. If extension
/// resources will be provided by the client (e.g. via cef_request_handler_t
@ -1513,32 +1553,28 @@ type
/// component unique to the extension (if not absolute this will be internally
/// prefixed with the PK_DIR_RESOURCES path) and |manifest| should contain the
/// contents that would otherwise be read from the "manifest.json" file on
/// disk.
///
/// The loaded extension will be accessible in all contexts sharing the same
/// disk.</para>
/// <para>The loaded extension will be accessible in all contexts sharing the same
/// storage (HasExtension returns true (1)). However, only the context on
/// which this function was called is considered the loader (DidLoadExtension
/// returns true (1)) and only the loader will receive
/// cef_request_context_handler_t callbacks for the extension.
///
/// cef_extension_handler_t::OnExtensionLoaded will be called on load success
/// or cef_extension_handler_t::OnExtensionLoadFailed will be called on load
/// failure.
///
/// If the extension specifies a background script via the "background"
/// manifest key then cef_extension_handler_t::OnBeforeBackgroundBrowser will
/// TCustomRequestContextHandler callbacks for the extension.</para>
/// <para>TCustomExtensionHandler.OnExtensionLoaded will be called on load success
/// or TCustomExtensionHandler.OnExtensionLoadFailed will be called on load
/// failure.</para>
/// <para>If the extension specifies a background script via the "background"
/// manifest key then TCustomExtensionHandler.OnBeforeBackgroundBrowser will
/// be called to create the background browser. See that function for
/// additional information about background scripts.
///
/// For visible extension views the client application should evaluate the
/// additional information about background scripts.</para>
/// <para>For visible extension views the client application should evaluate the
/// manifest to determine the correct extension URL to load and then pass that
/// URL to the cef_browser_host_t::CreateBrowser* function after the extension
/// URL to the ICefBrowserHost.CreateBrowser* function after the extension
/// has loaded. For example, the client can look for the "browser_action"
/// manifest key as documented at
/// https://developer.chrome.com/extensions/browserAction. Extension URLs take
/// the form "chrome-extension://<extension_id>/<path>".
///
/// Browsers that host extensions differ from normal browsers as follows:
/// the form "chrome-extension://<extension_id>/<path>".</para>
/// <para>Browsers that host extensions differ from normal browsers as follows:</para>
/// <code>
/// - Can access chrome.* JavaScript APIs if allowed by the manifest. Visit
/// chrome://extensions-support for the list of extension APIs currently
/// supported by CEF.
@ -1546,9 +1582,9 @@ type
/// - Pinch-zooming is disabled.
/// - CefBrowserHost::GetExtension returns the hosted extension.
/// - CefBrowserHost::IsBackgroundHost returns true for background hosts.
///
/// See https://developer.chrome.com/extensions for extension implementation
/// and usage documentation.
/// </code>
/// <para>See https://developer.chrome.com/extensions for extension implementation
/// and usage documentation.</para>
/// </summary>
function LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue = nil; const handler: ICefExtensionHandler = nil; const requestContext : ICefRequestContext = nil) : boolean;
/// <summary>
@ -1586,18 +1622,17 @@ type
/// </summary>
function GetWebsiteSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes): ICefValue;
/// <summary>
/// Sets the current value for |content_type| for the specified URLs in the
/// <para>Sets the current value for |content_type| for the specified URLs in the
/// default scope. If both URLs are NULL, and the context is not incognito,
/// the default value will be set. Pass nullptr for |value| to remove the
/// default value for this content type.
///
/// WARNING: Incorrect usage of this function may cause instability or
/// default value for this content type.</para>
/// <para>WARNING: Incorrect usage of this function may cause instability or
/// security issues in Chromium. Make sure that you first understand the
/// potential impact of any changes to |content_type| by reviewing the related
/// source code in Chromium. For example, if you plan to modify
/// CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of
/// ContentSettingsType::POPUPS in Chromium:
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS</para>
/// </summary>
procedure SetWebsiteSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes; const value: ICefValue);
/// <summary>
@ -1608,22 +1643,21 @@ type
/// </summary>
function GetContentSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes): TCefContentSettingValues;
/// <summary>
/// Sets the current value for |content_type| for the specified URLs in the
/// <para>Sets the current value for |content_type| for the specified URLs in the
/// default scope. If both URLs are NULL, and the context is not incognito,
/// the default value will be set. Pass CEF_CONTENT_SETTING_VALUE_DEFAULT for
/// |value| to use the default value for this content type.
///
/// WARNING: Incorrect usage of this function may cause instability or
/// |value| to use the default value for this content type.</para>
/// <para>WARNING: Incorrect usage of this function may cause instability or
/// security issues in Chromium. Make sure that you first understand the
/// potential impact of any changes to |content_type| by reviewing the related
/// source code in Chromium. For example, if you plan to modify
/// CEF_CONTENT_SETTING_TYPE_POPUPS, first review and understand the usage of
/// ContentSettingsType::POPUPS in Chromium:
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS
/// https://source.chromium.org/search?q=ContentSettingsType::POPUPS</para>
/// </summary>
procedure SetContentSetting(const requesting_url, top_level_url: ustring; content_type: TCefContentSettingTypes; value: TCefContentSettingValues);
/// <summary>
/// First URL loaded by the browser after its creation.
/// First URL loaded by the browser after its creation.
/// </summary>
property DefaultUrl : ustring read FDefaultUrl write SetDefaultUrl;
/// <summary>
@ -1635,7 +1669,7 @@ type
/// </summary>
property FontOptions : TChromiumFontOptions read FFontOptions write FFontOptions;
/// <summary>
/// Properties used to fill the TCefPdfPrintSettings record which is used in the TChromiumCore.PrintToPDF call.
/// Properties used to fill the TCefPdfPrintSettings record which is used in the TChromiumCore.PrintToPDF call.
/// </summary>
property PDFPrintOptions : TPDFPrintOptions read FPDFPrintOptions write FPDFPrintOptions;
/// <summary>
@ -2538,47 +2572,47 @@ type
/// </remarks>
property OnBeforeClose : TOnBeforeClose read FOnBeforeClose write FOnBeforeClose;
/// <summary>
/// Called when a browser has recieved a request to close. This may result
/// <para>Called when a browser has recieved a request to close. This may result
/// directly from a call to ICefBrowserHost.*CloseBrowser or indirectly
/// if the browser is parented to a top-level window created by CEF and the
/// user attempts to close that window (by clicking the 'X', for example). The
/// OnClose function will be called after the JavaScript 'onunload' event
/// has been fired.
/// has been fired.</para>
///
/// An application should handle top-level owner window close notifications by
/// <para>An application should handle top-level owner window close notifications by
/// calling ICefBrowserHost.TryCloseBrowser or
/// ICefBrowserHost.CloseBrowser(false) instead of allowing the window
/// to close immediately (see the examples below). This gives CEF an
/// opportunity to process the 'onbeforeunload' event and optionally cancel
/// the close before OnClose is called.
/// the close before OnClose is called.</para>
///
/// When windowed rendering is enabled CEF will internally create a window or
/// <para>When windowed rendering is enabled CEF will internally create a window or
/// view to host the browser. In that case returning false (0) from OnClose()
/// will send the standard close notification to the browser's top-level owner
/// window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on
/// Linux or ICefWindowDelegate.CanClose callback from Views). If the
/// browser's host window/view has already been destroyed (via view hierarchy
/// tear-down, for example) then OnClose() will not be called for that
/// browser since is no longer possible to cancel the close.
/// browser since is no longer possible to cancel the close.</para>
///
/// When windowed rendering is disabled returning false (0) from OnClose()
/// will cause the browser object to be destroyed immediately.
/// <para>When windowed rendering is disabled returning false (0) from OnClose()
/// will cause the browser object to be destroyed immediately.</para>
///
/// If the browser's top-level owner window requires a non-standard close
/// notification then send that notification from OnClose() and return true
/// (1).
/// <para>If the browser's top-level owner window requires a non-standard close
/// notification then send that notification from OnClose() and return true.</para>
///
/// The ICefLifeSpanHandler.OnBeforeClose function will be called
/// <para>The ICefLifeSpanHandler.OnBeforeClose function will be called
/// after OnClose() (if OnClose() is called) and immediately before the
/// browser object is destroyed. The application should only exit after
/// OnBeforeClose() has been called for all existing browsers.
/// OnBeforeClose() has been called for all existing browsers.</para>
///
/// The below examples describe what should happen during window close when
/// the browser is parented to an application-provided top-level window.
/// <para>The below examples describe what should happen during window close when
/// the browser is parented to an application-provided top-level window.</para>
///
/// Example 1: Using ICefBrowserHost.TryCloseBrowser(). This is
/// <para>Example 1: Using ICefBrowserHost.TryCloseBrowser(). This is
/// recommended for clients using standard close handling and windows created
/// on the browser process UI thread.
/// on the browser process UI thread.</para>
/// <code>
/// 1. User clicks the window close button which sends a close notification
/// to the application's top-level window.
/// 2. Application's top-level window receives the close notification and
@ -2598,11 +2632,12 @@ type
/// 8. Application's top-level window is destroyed.
/// 9. Application's OnBeforeClose() handler is called and the browser object is destroyed.
/// 10. Application exits by calling cef_quit_message_loop() if no other browsers exist.
///
/// Example 2: Using ICefBrowserHost::CloseBrowser(false) and
/// </code>
/// <para>Example 2: Using ICefBrowserHost::CloseBrowser(false) and
/// implementing the OnClose() callback. This is recommended for clients
/// using non-standard close handling or windows that were not created on the
/// browser process UI thread.
/// browser process UI thread.</para>
/// <code>
/// 1. User clicks the window close button which sends a close notification
/// to the application's top-level window.
/// 2. Application's top-level window receives the close notification and:
@ -2622,6 +2657,7 @@ type
/// 9. Application's top-level window is destroyed.
/// 10. Application's OnBeforeClose() handler is called and the browser object is destroyed.
/// 11. Application exits by calling cef_quit_message_loop() if no other browsers exist.
/// </code>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -2629,17 +2665,17 @@ type
/// </remarks>
property OnClose : TOnClose read FOnClose write FOnClose;
/// <summary>
/// Called on the UI thread before browser navigation. Return true (1) to
/// <para>Called on the UI thread before browser navigation. Return true (1) to
/// cancel the navigation or false (0) to allow the navigation to proceed. The
/// |request| object cannot be modified in this callback.
/// ICefLoadHandler.OnLoadingStateChange will be called twice in all
/// |request| object cannot be modified in this callback.</para>
/// <para>ICefLoadHandler.OnLoadingStateChange will be called twice in all
/// cases. If the navigation is allowed ICefLoadHandler.OnLoadStart and
/// ICefLoadHandler.OnLoadEnd will be called. If the navigation is
/// canceled ICefLoadHandler.OnLoadError will be called with an
/// |errorCode| value of ERR_ABORTED. The |user_gesture| value will be true
/// (1) if the browser navigated via explicit user gesture (e.g. clicking a
/// link) or false (0) if it navigated automatically (e.g. via the
/// DomContentLoaded event).
/// DomContentLoaded event).</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -2809,7 +2845,7 @@ type
/// </remarks>
property OnResourceRedirect : TOnResourceRedirect read FOnResourceRedirect write FOnResourceRedirect;
/// <summary>
/// Called on the IO thread when a resource response is received. The
/// <para>Called on the IO thread when a resource response is received. The
/// |browser| and |frame| values represent the source of the request, and may
/// be NULL for requests originating from service workers or ICefUrlRequest.
/// To allow the resource load to proceed without modification return false
@ -2817,10 +2853,9 @@ type
/// and return true (1). Modification of the request URL will be treated as a
/// redirect. Requests handled using the default network loader cannot be
/// redirected in this callback. The |response| object cannot be modified in
/// this callback.
///
/// WARNING: Redirecting using this function is deprecated. Use
/// OnBeforeResourceLoad or GetResourceHandler to perform redirects.
/// this callback.</para>
/// <para>WARNING: Redirecting using this function is deprecated. Use
/// OnBeforeResourceLoad or GetResourceHandler to perform redirects.</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF IO thread.</para>
@ -3038,18 +3073,16 @@ type
/// </remarks>
property OnTouchHandleStateChanged : TOnTouchHandleStateChanged read FOnTouchHandleStateChanged write FOnTouchHandleStateChanged;
/// <summary>
/// Called when the user starts dragging content in the web view. Contextual
/// <para>Called when the user starts dragging content in the web view. Contextual
/// information about the dragged content is supplied by |drag_data|. (|x|,
/// |y|) is the drag start location in screen coordinates. OS APIs that run a
/// system message loop may be used within the StartDragging call.
///
/// Return false (0) to abort the drag operation. Don't call any of
/// ICefBrowserHost.DragSource*Ended* functions after returning false (0).
///
/// Return true (1) to handle the drag operation. Call
/// system message loop may be used within the StartDragging call.</para>
/// <para>Return false (0) to abort the drag operation. Don't call any of
/// ICefBrowserHost.DragSource*Ended* functions after returning false (0).</para>
/// <para>Return true (1) to handle the drag operation. Call
/// ICefBrowserHost.DragSourceEndedAt and DragSourceSystemDragEnded either
/// synchronously or asynchronously to inform the web view that the drag
/// operation has ended.
/// operation has ended.</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -3270,15 +3303,14 @@ type
/// </remarks>
property OnAudioStreamError : TOnAudioStreamErrorEvent read FOnAudioStreamError write FOnAudioStreamError;
/// <summary>
/// Method that will be called on receipt of a DevTools protocol message.
/// <para>Method that will be called on receipt of a DevTools protocol message.
/// |browser| is the originating browser instance. |message| is a UTF8-encoded
/// JSON dictionary representing either a function result or an event.
/// |message| is only valid for the scope of this callback and should be
/// JSON dictionary representing either a function result or an event.</para>
/// <para>|message| is only valid for the scope of this callback and should be
/// copied if necessary. Return true (1) if the message was handled or false
/// (0) if the message should be further processed and passed to the
/// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.
///
/// Method result dictionaries include an "id" (int) value that identifies the
/// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.</para>
/// <para>Method result dictionaries include an "id" (int) value that identifies the
/// orginating function call sent from
/// ICefBrowserHost.SendDevToolsMessage, and optionally either a "result"
/// (dictionary) or "error" (dictionary) value. The "error" dictionary will
@ -3289,7 +3321,7 @@ type
/// supported function calls and the expected "result" or "params" dictionary
/// contents. JSON dictionaries can be parsed using the CefParseJSON function
/// if desired, however be aware of performance considerations when parsing
/// large messages (some of which may exceed 1MB in size).
/// large messages (some of which may exceed 1MB in size).</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -3297,15 +3329,14 @@ type
/// </remarks>
property OnDevToolsMessage : TOnDevToolsMessageEvent read FOnDevToolsMessage write FOnDevToolsMessage;
/// <summary>
/// Method that will be called on receipt of a DevTools protocol message.
/// <para>Method that will be called on receipt of a DevTools protocol message.
/// |browser| is the originating browser instance. |message| is a UTF8-encoded
/// JSON dictionary representing either a function result or an event.
/// |message| is only valid for the scope of this callback and should be
/// JSON dictionary representing either a function result or an event.</para>
/// <para>|message| is only valid for the scope of this callback and should be
/// copied if necessary. Return true (1) if the message was handled or false
/// (0) if the message should be further processed and passed to the
/// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.
///
/// Method result dictionaries include an "id" (int) value that identifies the
/// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.</para>
/// <para>Method result dictionaries include an "id" (int) value that identifies the
/// orginating function call sent from
/// ICefBrowserHost.SendDevToolsMessage, and optionally either a "result"
/// (dictionary) or "error" (dictionary) value. The "error" dictionary will
@ -3316,7 +3347,7 @@ type
/// supported function calls and the expected "result" or "params" dictionary
/// contents. JSON dictionaries can be parsed using the CefParseJSON function
/// if desired, however be aware of performance considerations when parsing
/// large messages (some of which may exceed 1MB in size).
/// large messages (some of which may exceed 1MB in size).</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -3324,16 +3355,16 @@ type
/// </remarks>
property OnDevToolsRawMessage : TOnDevToolsRawMessageEvent read FOnDevToolsRawMessage write FOnDevToolsRawMessage;
/// <summary>
/// Method that will be called after attempted execution of a DevTools
/// protocol function. |browser| is the originating browser instance.
/// |message_id| is the "id" value that identifies the originating function
/// <para>Method that will be called after attempted execution of a DevTools
/// protocol function. |browser| is the originating browser instance.</para>
/// <para>|message_id| is the "id" value that identifies the originating function
/// call message. If the function succeeded |success| will be true (1) and
/// |result| will be the UTF8-encoded JSON "result" dictionary value (which
/// may be NULL). If the function failed |success| will be false (0) and
/// |result| will be the UTF8-encoded JSON "error" dictionary value. |result|
/// is only valid for the scope of this callback and should be copied if
/// necessary. See the OnDevToolsMessage documentation for additional details
/// on |result| contents.
/// on |result| contents.</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -3341,16 +3372,16 @@ type
/// </remarks>
property OnDevToolsMethodResult : TOnDevToolsMethodResultEvent read FOnDevToolsMethodResult write FOnDevToolsMethodResult;
/// <summary>
/// Method that will be called after attempted execution of a DevTools
/// protocol function. |browser| is the originating browser instance.
/// |message_id| is the "id" value that identifies the originating function
/// <para>Method that will be called after attempted execution of a DevTools
/// protocol function. |browser| is the originating browser instance.</para>
/// <para>|message_id| is the "id" value that identifies the originating function
/// call message. If the function succeeded |success| will be true (1) and
/// |result| will be the UTF8-encoded JSON "result" dictionary value (which
/// may be NULL). If the function failed |success| will be false (0) and
/// |result| will be the UTF8-encoded JSON "error" dictionary value. |result|
/// is only valid for the scope of this callback and should be copied if
/// necessary. See the OnDevToolsMessage documentation for additional details
/// on |result| contents.
/// on |result| contents.</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -3404,7 +3435,6 @@ type
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_devtools_message_observer_capi.h">CEF source file: /include/capi/cef_devtools_message_observer_capi.h (cef_dev_tools_message_observer_t)</see></para>
/// </remarks>
property OnDevToolsAgentDetached : TOnDevToolsAgentDetachedEvent read FOnDevToolsAgentDetached write FOnDevToolsAgentDetached;
/// <summary>
/// Called if the ICefRequestContext.LoadExtension request fails. |result|
/// will be the error code.
@ -3687,17 +3717,17 @@ type
/// </remarks>
property OnIsChromeToolbarButtonVisible : TOnIsChromeToolbarButtonVisibleEvent read FOnIsChromeToolbarButtonVisible write FOnIsChromeToolbarButtonVisible;
/// <summary>
/// Called when a page requests permission to access media.
/// |requesting_origin| is the URL origin requesting permission.
/// |requested_permissions| is a combination of values from
/// <para>Called when a page requests permission to access media.
/// |requesting_origin| is the URL origin requesting permission.</para>
/// <para>|requested_permissions| is a combination of values from
/// TCefMediaAccessPermissionTypes that represent the requested
/// permissions. Return true (1) and call ICefMediaAccessCallback
/// functions either in this function or at a later time to continue or cancel
/// the request. Return false (0) to proceed with default handling. With the
/// Chrome runtime, default handling will display the permission request UI.
/// With the Alloy runtime, default handling will deny the request. This
/// Chrome runtime, default handling will display the permission request UI.</para>
/// <para>With the Alloy runtime, default handling will deny the request. This
/// function will not be called if the "--enable-media-stream" command-line
/// switch is used to grant all permissions.
/// switch is used to grant all permissions.</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
@ -3705,15 +3735,15 @@ type
/// </remarks>
property OnRequestMediaAccessPermission : TOnRequestMediaAccessPermissionEvent read FOnRequestMediaAccessPermission write FOnRequestMediaAccessPermission;
/// <summary>
/// Called when a page should show a permission prompt. |prompt_id| uniquely
/// <para>Called when a page should show a permission prompt. |prompt_id| uniquely
/// identifies the prompt. |requesting_origin| is the URL origin requesting
/// permission. |requested_permissions| is a combination of values from
/// TCefPermissionRequestTypes that represent the requested permissions.
/// Return true (1) and call ICefPermissionPromptCallback.Continue either
/// in this function or at a later time to continue or cancel the request.
/// Return false (0) to proceed with default handling. With the Chrome
/// TCefPermissionRequestTypes that represent the requested permissions.</para>
/// <para>Return true (1) and call ICefPermissionPromptCallback.Continue either
/// in this function or at a later time to continue or cancel the request.</para>
/// <para>Return false (0) to proceed with default handling. With the Chrome
/// runtime, default handling will display the permission prompt UI. With the
/// Alloy runtime, default handling is CEF_PERMISSION_RESULT_IGNORE.
/// Alloy runtime, default handling is CEF_PERMISSION_RESULT_IGNORE.</para>
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>

View File

@ -20,6 +20,9 @@ uses
uCEFTypes;
type
/// <summary>
/// The TChromiumFontOptions properties are used to fill the TCefBrowserSettings record which is used during the browser creation.
/// </summary>
TChromiumFontOptions = class(TPersistent)
protected
FStandardFontFamily : ustring;
@ -35,19 +38,56 @@ type
FMinimumFontSize : Integer;
public
/// <summary>
/// Constructor of TChromiumFontOptions
/// </summary>
constructor Create; virtual;
published
/// <summary>
/// Standard font family name.
/// </summary>
property StandardFontFamily : ustring read FStandardFontFamily write FStandardFontFamily;
/// <summary>
/// Fixed font family name.
/// </summary>
property FixedFontFamily : ustring read FFixedFontFamily write FFixedFontFamily;
/// <summary>
/// Serif font family name.
/// </summary>
property SerifFontFamily : ustring read FSerifFontFamily write FSerifFontFamily;
/// <summary>
/// SansSerif font family name.
/// </summary>
property SansSerifFontFamily : ustring read FSansSerifFontFamily write FSansSerifFontFamily;
/// <summary>
/// Cursive font family name.
/// </summary>
property CursiveFontFamily : ustring read FCursiveFontFamily write FCursiveFontFamily;
/// <summary>
/// Fantasy font family name.
/// </summary>
property FantasyFontFamily : ustring read FFantasyFontFamily write FFantasyFontFamily;
/// <summary>
/// Default font size.
/// </summary>
property DefaultFontSize : Integer read FDefaultFontSize write FDefaultFontSize default 0;
/// <summary>
/// Default fixed font size.
/// </summary>
property DefaultFixedFontSize : Integer read FDefaultFixedFontSize write FDefaultFixedFontSize default 0;
/// <summary>
/// Minimum font size.
/// </summary>
property MinimumFontSize : Integer read FMinimumFontSize write FMinimumFontSize default 0;
/// <summary>
/// Minimum logical font size.
/// </summary>
property MinimumLogicalFontSize : Integer read FMinimumLogicalFontSize write FMinimumLogicalFontSize default 0;
/// <summary>
/// Controls the loading of fonts from remote sources. Also configurable using
/// the "disable-remote-fonts" command-line switch.
/// </summary>
property RemoteFonts : TCefState read FRemoteFontsDisabled write FRemoteFontsDisabled default STATE_DEFAULT;
end;

View File

@ -20,6 +20,9 @@ uses
uCEFTypes, uCEFConstants;
type
/// <summary>
/// The TChromiumOptions properties used to fill the TCefBrowserSettings record which is used during the browser creation.
/// </summary>
TChromiumOptions = class(TPersistent)
protected
FWindowlessFrameRate : Integer;
@ -39,23 +42,110 @@ type
FChromeStatusBubble : TCefState;
public
/// <summary>
/// Constructor of TChromiumOptions
/// </summary>
constructor Create; virtual;
published
/// <summary>
/// Controls whether JavaScript can be executed. Also configurable using the
/// "disable-javascript" command-line switch.
/// </summary>
property Javascript : TCefState read FJavascript write FJavascript default STATE_DEFAULT;
/// <summary>
/// Controls whether JavaScript can be used to close windows that were not
/// opened via JavaScript. JavaScript can still be used to close windows that
/// were opened via JavaScript or that have no back/forward history. Also
/// configurable using the "disable-javascript-close-windows" command-line
/// switch.
/// </summary>
property JavascriptCloseWindows : TCefState read FJavascriptCloseWindows write FJavascriptCloseWindows default STATE_DEFAULT;
/// <summary>
/// Controls whether JavaScript can access the clipboard. Also configurable
/// using the "disable-javascript-access-clipboard" command-line switch.
/// </summary>
property JavascriptAccessClipboard : TCefState read FJavascriptAccessClipboard write FJavascriptAccessClipboard default STATE_DEFAULT;
/// <summary>
/// Controls whether DOM pasting is supported in the editor via
/// execCommand("paste"). The |javascript_access_clipboard| setting must also
/// be enabled. Also configurable using the "disable-javascript-dom-paste"
/// command-line switch.
/// </summary>
property JavascriptDomPaste : TCefState read FJavascriptDomPaste write FJavascriptDomPaste default STATE_DEFAULT;
/// <summary>
/// Controls whether image URLs will be loaded from the network. A cached
/// image will still be rendered if requested. Also configurable using the
/// "disable-image-loading" command-line switch.
/// </summary>
property ImageLoading : TCefState read FImageLoading write FImageLoading default STATE_DEFAULT;
/// <summary>
/// Controls whether standalone images will be shrunk to fit the page. Also
/// configurable using the "image-shrink-standalone-to-fit" command-line
/// switch.
/// </summary>
property ImageShrinkStandaloneToFit : TCefState read FImageShrinkStandaloneToFit write FImageShrinkStandaloneToFit default STATE_DEFAULT;
/// <summary>
/// Controls whether text areas can be resized. Also configurable using the
/// "disable-text-area-resize" command-line switch.
/// </summary>
property TextAreaResize : TCefState read FTextAreaResize write FTextAreaResize default STATE_DEFAULT;
/// <summary>
/// Controls whether the tab key can advance focus to links. Also configurable
/// using the "disable-tab-to-links" command-line switch.
/// </summary>
property TabToLinks : TCefState read FTabToLinks write FTabToLinks default STATE_DEFAULT;
/// <summary>
/// Controls whether local storage can be used. Also configurable using the
/// "disable-local-storage" command-line switch.
/// </summary>
property LocalStorage : TCefState read FLocalStorage write FLocalStorage default STATE_DEFAULT;
/// <summary>
/// Controls whether databases can be used. Also configurable using the
/// "disable-databases" command-line switch.
/// </summary>
property Databases : TCefState read FDatabases write FDatabases default STATE_DEFAULT;
/// <summary>
/// Controls whether WebGL can be used. Note that WebGL requires hardware
/// support and may not work on all systems even when enabled. Also
/// configurable using the "disable-webgl" command-line switch.
/// </summary>
property Webgl : TCefState read FWebgl write FWebgl default STATE_DEFAULT;
/// <summary>
/// Background color used for the browser before a document is loaded and when
/// no document color is specified. The alpha component must be either fully
/// opaque (0xFF) or fully transparent (0x00). If the alpha component is fully
/// opaque then the RGB components will be used as the background color. If
/// the alpha component is fully transparent for a windowed browser then the
/// TCefSettings.background_color value will be used. If the alpha component is
/// fully transparent for a windowless (off-screen) browser then transparent
/// painting will be enabled.
/// </summary>
property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor default 0;
/// <summary>
/// Comma delimited ordered list of language codes without any whitespace that
/// will be used in the "Accept-Language" HTTP header. May be set globally
/// using the TCefSettings.accept_language_list value. If both values are
/// empty then "en-US,en" will be used.
/// </summary>
property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList;
/// <summary>
/// The maximum rate in frames per second (fps) that ICefRenderHandler.OnPaint
/// will be called for a windowless browser. The actual fps may be lower if
/// the browser cannot generate frames at the requested rate. The minimum
/// value is 1 and the maximum value is 60 (default 30). This value can also
/// be changed dynamically via ICefBrowserHost.SetWindowlessFrameRate.
/// </summary>
/// <remarks>
/// <para>Use CEF_OSR_SHARED_TEXTURES_FRAMERATE_DEFAULT as default value if the shared textures are enabled.</para>
/// <para>Use CEF_OSR_FRAMERATE_DEFAULT as default value if the shared textures are disabled.</para>
/// </remarks>
property WindowlessFrameRate : Integer read FWindowlessFrameRate write FWindowlessFrameRate default CEF_OSR_FRAMERATE_DEFAULT;
/// <summary>
/// Controls whether the Chrome status bubble will be used. Only supported
/// with the Chrome runtime. For details about the status bubble see
/// https://www.chromium.org/user-experience/status-bubble/
/// </summary>
property ChromeStatusBubble : TCefState read FChromeStatusBubble write FChromeStatusBubble default STATE_DEFAULT;
end;
@ -63,7 +153,7 @@ implementation
constructor TChromiumOptions.Create;
begin
FWindowlessFrameRate := CEF_OSR_FRAMERATE_DEFAULT; // Use CEF_OSR_SHARED_TEXTURES_FRAMERATE_DEFAULT if the shared textures are enabled.
FWindowlessFrameRate := CEF_OSR_FRAMERATE_DEFAULT;
FJavascript := STATE_DEFAULT;
FJavascriptCloseWindows := STATE_DEFAULT;
FJavascriptAccessClipboard := STATE_DEFAULT;

View File

@ -27,19 +27,21 @@ uses
type
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pfidWindows)]{$ENDIF}{$ENDIF}
{ TChromiumWindow }
/// <summary>
/// <para>This component puts together a TChromium and a TCEFWindowParent to embbed a
/// web browser with only one component.</para>
/// <para>This component should only be used in extremely simple applications with simple browsers.
/// In other cases it's recomended using a TChromium with a TCEFWindowParent as shown in the
/// SimpleBrowser2 demo.</para>
/// </summary>
TChromiumWindow = class(TCEFLinkedWinControlBase)
protected
FChromium : TChromium;
FOnClose : TNotifyEvent;
FOnBeforeClose : TNotifyEvent;
FOnAfterCreated : TNotifyEvent;
FUseSetFocus : boolean;
function GetChromium: TChromium; override;
function GetUseSetFocus: Boolean; override;
function GetBrowserInitialized : boolean;
{$IFDEF MSWINDOWS}
procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE;
@ -60,18 +62,166 @@ type
public
constructor Create(AOwner: TComponent); override;
procedure AfterConstruction; override;
/// <summary>
/// <para>Used to create the browser after the global request context has been
/// initialized. You need to set all properties and events before calling
/// this function because it will only create the internal handlers needed
/// for those events and the property values will be used in the browser
/// initialization.</para>
/// <para>The browser will be fully initialized when the TChromiumWindow.OnAfterCreated
/// event is triggered.</para>
/// </summary>
function CreateBrowser : boolean;
/// <summary>
/// Request that the browser close. The JavaScript 'onbeforeunload' event will
/// be fired. If |aForceClose| is false (0) the event handler, if any, will be
/// allowed to prompt the user and the user can optionally cancel the close.
/// If |aForceClose| is true (1) the prompt will not be displayed and the
/// close will proceed. Results in a call to
/// ICefLifeSpanHandler.DoClose() if the event handler allows the close
/// or if |aForceClose| is true (1). See ICefLifeSpanHandler.DoClose()
/// documentation for additional usage information.
/// </summary>
procedure CloseBrowser(aForceClose : boolean);
/// <summary>
/// Used to navigate to a URL.
/// </summary>
procedure LoadURL(const aURL : ustring);
/// <summary>
/// Notify the browser that the window hosting it is about to be moved or
/// resized. This function is only used on Windows and Linux.
/// </summary>
procedure NotifyMoveOrResizeStarted;
/// <summary>
/// TChromium instance used by this component.
/// </summary>
property ChromiumBrowser : TChromium read GetChromium;
/// <summary>
/// Returns true when the browser is fully initialized and it's not being closed.
/// </summary>
property Initialized : boolean read GetBrowserInitialized;
published
property UseSetFocus : boolean read FUseSetFocus write FUseSetFocus default True;
/// <summary>
/// <para>Called when a browser has recieved a request to close. This may result
/// directly from a call to ICefBrowserHost.*CloseBrowser or indirectly
/// if the browser is parented to a top-level window created by CEF and the
/// user attempts to close that window (by clicking the 'X', for example). The
/// OnClose function will be called after the JavaScript 'onunload' event
/// has been fired.</para>
///
/// <para>An application should handle top-level owner window close notifications by
/// calling ICefBrowserHost.TryCloseBrowser or
/// ICefBrowserHost.CloseBrowser(false) instead of allowing the window
/// to close immediately (see the examples below). This gives CEF an
/// opportunity to process the 'onbeforeunload' event and optionally cancel
/// the close before OnClose is called.</para>
///
/// <para>When windowed rendering is enabled CEF will internally create a window or
/// view to host the browser. In that case returning false (0) from OnClose()
/// will send the standard close notification to the browser's top-level owner
/// window (e.g. WM_CLOSE on Windows, performClose: on OS X, "delete_event" on
/// Linux or ICefWindowDelegate.CanClose callback from Views). If the
/// browser's host window/view has already been destroyed (via view hierarchy
/// tear-down, for example) then OnClose() will not be called for that
/// browser since is no longer possible to cancel the close.</para>
///
/// <para>When windowed rendering is disabled returning false (0) from OnClose()
/// will cause the browser object to be destroyed immediately.</para>
///
/// <para>If the browser's top-level owner window requires a non-standard close
/// notification then send that notification from OnClose() and return true.</para>
///
/// <para>The ICefLifeSpanHandler.OnBeforeClose function will be called
/// after OnClose() (if OnClose() is called) and immediately before the
/// browser object is destroyed. The application should only exit after
/// OnBeforeClose() has been called for all existing browsers.</para>
///
/// <para>The below examples describe what should happen during window close when
/// the browser is parented to an application-provided top-level window.</para>
///
/// <para>Example 1: Using ICefBrowserHost.TryCloseBrowser(). This is
/// recommended for clients using standard close handling and windows created
/// on the browser process UI thread.</para>
/// <code>
/// 1. User clicks the window close button which sends a close notification
/// to the application's top-level window.
/// 2. Application's top-level window receives the close notification and
/// calls TryCloseBrowser() (which internally calls CloseBrowser(false)).
/// TryCloseBrowser() returns false so the client cancels the window
/// close.
/// 3. JavaScript 'onbeforeunload' handler executes and shows the close
/// confirmation dialog (which can be overridden via
/// ICefJSDialogHandler.OnBeforeUnloadDialog()).
/// 4. User approves the close.
/// 5. JavaScript 'onunload' handler executes.
/// 6. CEF sends a close notification to the application's top-level window
/// (because OnClose() returned false by default).
/// 7. Application's top-level window receives the close notification and
/// calls TryCloseBrowser(). TryCloseBrowser() returns true so the client
/// allows the window close.
/// 8. Application's top-level window is destroyed.
/// 9. Application's OnBeforeClose() handler is called and the browser object is destroyed.
/// 10. Application exits by calling cef_quit_message_loop() if no other browsers exist.
/// </code>
/// <para>Example 2: Using ICefBrowserHost::CloseBrowser(false) and
/// implementing the OnClose() callback. This is recommended for clients
/// using non-standard close handling or windows that were not created on the
/// browser process UI thread.</para>
/// <code>
/// 1. User clicks the window close button which sends a close notification
/// to the application's top-level window.
/// 2. Application's top-level window receives the close notification and:
/// A. Calls ICefBrowserHost.CloseBrowser(false).
/// B. Cancels the window close.
/// 3. JavaScript 'onbeforeunload' handler executes and shows the close
/// confirmation dialog (which can be overridden via
/// ICefJSDialogHandler.OnBeforeUnloadDialog()).
/// 4. User approves the close.
/// 5. JavaScript 'onunload' handler executes.
/// 6. Application's OnClose() handler is called. Application will:
/// A. Set a flag to indicate that the next close attempt will be allowed.
/// B. Return false.
/// 7. CEF sends an close notification to the application's top-level window.
/// 8. Application's top-level window receives the close notification and
/// allows the window to close based on the flag from #6B.
/// 9. Application's top-level window is destroyed.
/// 10. Application's OnBeforeClose() handler is called and the browser object is destroyed.
/// 11. Application exits by calling cef_quit_message_loop() if no other browsers exist.
/// </code>
/// </summary>
/// <remarks>
/// <para>This event will be called on the main application thread.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_life_span_handler_capi.h">CEF source file: /include/capi/cef_life_span_handler_capi.h (cef_life_span_handler_t)</see></para>
/// </remarks>
property OnClose : TNotifyEvent read FOnClose write FOnClose;
/// <summary>
/// Called just before a browser is destroyed. Release all references to the
/// browser object and do not attempt to execute any functions on the browser
/// object (other than IsValid, GetIdentifier or IsSame) after this callback
/// returns. ICefFrameHandler callbacks related to final main frame
/// destruction will arrive after this callback and ICefBrowser.IsValid
/// will return false (0) at that time. Any in-progress network requests
/// associated with |browser| will be aborted when the browser is destroyed,
/// and ICefResourceRequestHandler callbacks related to those requests may
/// still arrive on the IO thread after this callback. See ICefFrameHandler
/// and OnClose() documentation for additional usage information.
/// </summary>
/// <remarks>
/// <para>This event will be called on the browser process CEF UI thread.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_life_span_handler_capi.h">CEF source file: /include/capi/cef_life_span_handler_capi.h (cef_life_span_handler_t)</see></para>
/// </remarks>
property OnBeforeClose : TNotifyEvent read FOnBeforeClose write FOnBeforeClose;
/// <summary>
/// Called after a new browser is created. It is now safe to begin performing
/// actions with |browser|. ICefFrameHandler callbacks related to initial
/// main frame creation will arrive before this callback. See
/// ICefFrameHandler documentation for additional usage information.
/// </summary>
/// <remarks>
/// <para>This event will be called on the main application thread.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_life_span_handler_capi.h">CEF source file: /include/capi/cef_life_span_handler_capi.h (cef_life_span_handler_t)</see></para>
/// </remarks>
property OnAfterCreated : TNotifyEvent read FOnAfterCreated write FOnAfterCreated;
end;
@ -106,9 +256,6 @@ procedure Register;
// *********************************************************
// *********************************************************
// This component should *ONLY* be used in emtremely simple applications with simple browsers.
// In other cases it's recomended using a TChromium with a TCEFWindowParent as shown in the
// SimpleBrowser2 demo.
implementation
@ -127,7 +274,6 @@ begin
FOnClose := nil;
FOnBeforeClose := nil;
FOnAfterCreated := nil;
FUseSetFocus := True;
end;
procedure TChromiumWindow.AfterConstruction;
@ -249,11 +395,6 @@ begin
result := FChromium;
end;
function TChromiumWindow.GetUseSetFocus: Boolean;
begin
Result := FUseSetFocus;
end;
// This is a workaround for the CEF issue #2026
// https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on
// We use ChromiumWindow1.OnEnter, ChromiumWindow1.OnExit and

View File

@ -2064,11 +2064,9 @@ const
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 shl 14;
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 shl 15;
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 shl 16;
CEF_PERMISSION_TYPE_SECURITY_ATTESTATION = 1 shl 17;
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 shl 18;
CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 shl 19;
CEF_PERMISSION_TYPE_VR_SESSION = 1 shl 20;
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 shl 21;
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 shl 17;
CEF_PERMISSION_TYPE_VR_SESSION = 1 shl 18;
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 shl 19;
/// <summary>
/// Platform API hash.
@ -2350,6 +2348,59 @@ const
/// </remarks>
CEF_DOWNLOAD_INTERRUPT_REASON_CRASH = 50;
/// <summary>
/// Prepend the default list of items.
/// </summary>
/// <remarks>
/// <para>TCefLogItems value.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h">CEF source file: /include/internal/cef_types.h (cef_log_items_t)</see></para>
/// </remarks>
LOG_ITEMS_DEFAULT = 0;
/// <summary>
/// Prepend no items.
/// </summary>
/// <remarks>
/// <para>TCefLogItems value.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h">CEF source file: /include/internal/cef_types.h (cef_log_items_t)</see></para>
/// </remarks>
LOG_ITEMS_NONE = 1 shl 0;
/// <summary>
/// Prepend the process ID.
/// </summary>
/// <remarks>
/// <para>TCefLogItems value.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h">CEF source file: /include/internal/cef_types.h (cef_log_items_t)</see></para>
/// </remarks>
LOG_ITEMS_FLAG_PROCESS_ID = 1 shl 1;
/// <summary>
/// Prepend the thread ID.
/// </summary>
/// <remarks>
/// <para>TCefLogItems value.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h">CEF source file: /include/internal/cef_types.h (cef_log_items_t)</see></para>
/// </remarks>
LOG_ITEMS_FLAG_THREAD_ID = 1 shl 2;
/// <summary>
/// Prepend the timestamp.
/// </summary>
/// <remarks>
/// <para>TCefLogItems value.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h">CEF source file: /include/internal/cef_types.h (cef_log_items_t)</see></para>
/// </remarks>
LOG_ITEMS_FLAG_TIME_STAMP = 1 shl 3;
/// <summary>
/// Prepend the tickcount.
/// </summary>
/// <remarks>
/// <para>TCefLogItems value.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h">CEF source file: /include/internal/cef_types.h (cef_log_items_t)</see></para>
/// </remarks>
LOG_ITEMS_FLAG_TICK_COUNT = 1 shl 4;
{*

View File

@ -29,9 +29,21 @@ type
{$ENDIF}
public
{$IFDEF MSWINDOWS}
/// <summary>
/// Set a new parent for this control.
/// </summary>
procedure Reparent(const aNewParentHandle : {$IFDEF DELPHI18_UP}TWindowHandle{$ELSE}TFmxHandle{$ENDIF});
/// <summary>
/// Updates the size of the child windows created by the browser.
/// </summary>
procedure UpdateSize;
/// <summary>
/// Handle of the first child window created by the browser.
/// </summary>
property ChildWindowHandle : HWND read GetChildWindowHandle;
/// <summary>
/// TChromium instance used by this component.
/// </summary>
property Chromium : TFMXChromium read FChromium write FChromium;
{$ENDIF}
{$IFNDEF DELPHI17_UP}

View File

@ -14,6 +14,10 @@ uses
type
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pfidWindows or pfidOSX or pfidLinux)]{$ENDIF}{$ENDIF}
/// <summary>
/// <para>Implementation of an external message pump for FMX.</para>
/// <para>Read the GlobalCEFApp.OnScheduleMessagePumpWork documentation for all the details.</para>
/// </summary>
TFMXWorkScheduler = class(TComponent)
protected
FThread : TCEFWorkSchedulerThread;
@ -50,24 +54,65 @@ type
procedure Thread_OnPulse(Sender : TObject);
public
/// <summary>
/// Full constructor of TFMXWorkScheduler. This constructor also creates the internal threads.
/// </summary>
constructor Create(AOwner: TComponent); override;
/// <summary>
/// Partial constructor of TFMXWorkScheduler. This constructor doesn't create any threads.
/// Call TFMXWorkScheduler.CreateThread when necessary.
/// </summary>
constructor CreateDelayed;
/// <summary>
/// TFMXWorkScheduler destructor.
/// </summary>
destructor Destroy; override;
/// <summary>
/// Called from GlobalCEFApp.OnScheduleMessagePumpWork to schedule
/// a GlobalCEFApp.DoMessageLoopWork call asynchronously to perform a single
/// iteration of CEF message loop processing.
/// </summary>
/// <param name="delay_ms">Requested delay in milliseconds.</param>
procedure ScheduleMessagePumpWork(const delay_ms : int64);
/// <summary>
/// Stop the scheduler. This function must be called after the destruction of all the forms in the application.
/// </summary>
procedure StopScheduler;
/// <summary>
/// Schedule a GlobalCEFApp.DoMessageLoopWork call synchronously to perform a single
/// iteration of CEF message loop processing.
/// </summary>
procedure ScheduleWork(const delay_ms : int64);
/// <summary>
/// Creates all the internal threads used by TCEFWorkScheduler.
/// </summary>
procedure CreateThread;
published
{$IFDEF MSWINDOWS}
{$WARN SYMBOL_PLATFORM OFF}
/// <summary>
/// Priority of TCEFWorkSchedulerThread in Windows.
/// </summary>
property Priority : TThreadPriority read FPriority write SetPriority default tpNormal;
{$WARN SYMBOL_PLATFORM ON}
{$ENDIF}
/// <summary>
/// Default interval in milliseconds to do the next GlobalCEFApp.DoMessageLoopWork call.
/// </summary>
property DefaultInterval : integer read FDefaultInterval write SetDefaultInterval default CEF_TIMER_MAXDELAY;
/// <summary>
/// Number of cycles used to deplete the remaining messages in the work loop.
/// </summary>
property DepleteWorkCycles : cardinal read FDepleteWorkCycles write FDepleteWorkCycles default CEF_TIMER_DEPLETEWORK_CYCLES;
/// <summary>
/// Delay in milliseconds between the cycles used to deplete the remaining messages in the work loop.
/// </summary>
property DepleteWorkDelay : cardinal read FDepleteWorkDelay write FDepleteWorkDelay default CEF_TIMER_DEPLETEWORK_DELAY;
/// <summary>
/// Use a custom queue thread instead of Windows messages or any other way to schedule the next pump work.
/// </summary>
property UseQueueThread : boolean read FUseQueueThread write FUseQueueThread default False;
end;

View File

@ -609,6 +609,7 @@ 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);
end;
@ -10301,7 +10302,7 @@ type
function GetBrowser : ICefBrowser;
/// <summary>
/// Returns the Chrome toolbar associated with this BrowserView. Only
/// supported when using the Chrome runtime. The ICefBrowserViewDelegate.get_chrome_toolbar_type()
/// supported when using the Chrome runtime. The ICefBrowserViewDelegate.GetChromeToolbarType
/// function must return a value other than
/// CEF_CTT_NONE and the toolbar will not be available until after this
/// BrowserView is added to a ICefWindow and
@ -10368,7 +10369,13 @@ type
/// ICefBrowserView.GetChromeToolbar(). See that function for related
/// documentation.
/// </summary>
function GetChromeToolbarType: TCefChromeToolbarType;
procedure OnGetChromeToolbarType(var aResult : TCefChromeToolbarType);
/// <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>
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
/// <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
@ -10376,12 +10383,6 @@ type
/// commands can also be handled via cef_command_handler_t::OnChromeCommand.
/// </summary>
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
/// <summary>
/// Returns the Chrome toolbar type that will be available via
/// ICefBrowserView.GetChromeToolbar(). See that function for related
/// documentation.
/// </summary>
property ChromeToolbarType: TCefChromeToolbarType read GetChromeToolbarType;
end;
/// <summary>

View File

@ -24,14 +24,21 @@ uses
uCEFTypes, uCEFInterfaces, uCEFWinControl, uCEFChromium;
type
{ TCEFLinkedWinControlBase }
/// <summary>
/// TCEFLinkedWinControlBase is a custom TWinControl to host the child controls created by the web browser
/// to show the web contents and it's linked to the TChromium instance that handles that web browser.
/// TCEFLinkedWinControlBase is the parent class of TChromiumWindow, TBrowserWindow and TCEFLinkedWindowParent.
/// </summary>
TCEFLinkedWinControlBase = class(TCEFWinControl)
protected
{$IFDEF MSWINDOWS}
FUseSetFocus : boolean;
{$ENDIF}
function GetChromium: TChromium; virtual; abstract;
function GetUseSetFocus: Boolean; virtual;
procedure SetUseSetFocus(aValue : boolean); virtual;
{$IFDEF FPC}
procedure SetVisible(Value: Boolean); override;
{$ENDIF}
@ -39,19 +46,42 @@ type
{$IFDEF MSWINDOWS}
procedure WndProc(var aMessage: TMessage); override;
{$ENDIF}
/// <summary>
/// TChromium instance used by this component.
/// </summary>
property Chromium : TChromium read GetChromium;
public
constructor Create(AOwner: TComponent); override;
procedure UpdateSize; override;
published
{$IFDEF MSWINDOWS}
/// <summary>
/// Use TChromium.SetFocus when the component receives a WM_SETFOCUS message in Windows.
/// </summary>
property UseSetFocus : boolean read GetUseSetFocus write SetUseSetFocus default True;
{$ENDIF}
end;
implementation
{ TCEFLinkedWinControlBase }
constructor TCEFLinkedWinControlBase.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF MSWINDOWS}
FUseSetFocus := True;
{$ENDIF}
end;
function TCEFLinkedWinControlBase.GetUseSetFocus: Boolean;
begin
Result := True;
Result := FUseSetFocus;
end;
procedure TCEFLinkedWinControlBase.SetUseSetFocus(aValue : boolean);
begin
FUseSetFocus := aValue;
end;
{$IFDEF FPC}
@ -94,7 +124,7 @@ begin
case aMessage.Msg of
WM_SETFOCUS:
begin
if GetUseSetFocus and (Chromium <> nil) then
if UseSetFocus and (Chromium <> nil) then
Chromium.SetFocus(True)
else
begin

View File

@ -51,6 +51,9 @@ type
constructor Create(AOwner : TComponent); override;
published
/// <summary>
/// TChromium instance used by this component.
/// </summary>
property Chromium : TChromium read FChromium write SetChromium;
end;

View File

@ -20,6 +20,9 @@ uses
uCEFTypes;
type
/// <summary>
/// The TPDFPrintOptions properties are used to fill the TCefPdfPrintSettings record which is used in the TChromiumCore.PrintToPDF call.
/// </summary>
TPDFPrintOptions = class
protected
FLandscape : boolean;
@ -37,6 +40,7 @@ type
FDisplayHeaderFooter : boolean;
FHeaderTemplate : ustring;
FFooterTemplate : ustring;
FGenerateTaggedPDF : boolean;
function GetScalePct: double;
function GetPaperWidthMM: double;
@ -58,33 +62,136 @@ type
function MMToInches(const aMM: double): double;
public
/// <summary>
/// Constructor of TPDFPrintOptions
/// </summary>
constructor Create; virtual;
/// <summary>
/// Copy the fields of this class to the TCefPdfPrintSettings parameter.
/// </summary>
procedure CopyToSettings(var aSettings : TCefPdfPrintSettings);
/// <summary>
/// Set to true for landscape mode or false for portrait mode.
/// </summary>
property Landscape : boolean read FLandscape write FLandscape;
/// <summary>
/// Set to true to print background graphics.
/// </summary>
property PrintBackground : boolean read FPrintBackground write FPrintBackground;
/// <summary>
/// Set to true to prefer page size as defined by css. Defaults to false,
/// in which case the content will be scaled to fit the paper size.
/// </summary>
property PreferCSSPageSize : boolean read FPreferCSSPageSize write FPreferCSSPageSize;
/// <summary>
/// <para>Paper ranges to print, one based, e.g., '1-5, 8, 11-13'. Pages are printed
/// in the document order, not in the order specified, and no more than once.
/// Defaults to empty string, which implies the entire document is printed.</para>
/// <para>The page numbers are quietly capped to actual page count of the document,
/// and ranges beyond the end of the document are ignored. If this results in
/// no pages to print, an error is reported. It is an error to specify a range
/// with start greater than end.</para>
/// </summary>
property PageRanges : ustring read FPageRanges write FPageRanges;
/// <summary>
/// Set to true to display the header and/or footer. Modify
/// HeaderTemplate and/or FooterTemplate to customize the display.
/// </summary>
property DisplayHeaderFooter : boolean read FDisplayHeaderFooter write FDisplayHeaderFooter;
/// <summary>
/// <para>HTML template for the print header. Only displayed if
/// DisplayHeaderFooter is true. Should be valid HTML markup with
/// the following classes used to inject printing values into them:</para>
/// <code>
/// - date: formatted print date
/// - title: document title
/// - url: document location
/// - pageNumber: current page number
/// - totalPages: total pages in the document
/// </code>
/// <para>For example, "<span class=title></span>" would generate a span containing
/// the title.</para>
/// </summary>
property HeaderTemplate : ustring read FHeaderTemplate write FHeaderTemplate;
/// <summary>
/// HTML template for the print footer. Only displayed if
/// DisplayHeaderFooter is true. Uses the same format as
/// HeaderTemplate.
/// </summary>
property FooterTemplate : ustring read FFooterTemplate write FFooterTemplate;
/// <summary>
/// Set to true to generate tagged (accessible) PDF.
/// </summary>
property GenerateTaggedPDF : boolean read FGenerateTaggedPDF write FGenerateTaggedPDF;
/// <summary>
/// The percentage to scale the PDF by before printing (e.g. .5 is 50%).
/// If this value is less than or equal to zero the default value of 1.0
/// will be used.
/// </summary>
property Scale : double read FScale write FScale;
/// <summary>
/// The percentage value to scale the PDF by before printing (e.g. 50 is 50%).
/// </summary>
property ScalePct : double read GetScalePct write SetScalePct;
/// <summary>
/// Output paper width in inches. If either of these values is less than or
/// equal to zero then the default paper size (letter, 8.5 x 11 inches) will
/// be used.
/// </summary>
property PaperWidthInch : double read FPaperWidth write FPaperWidth;
/// <summary>
/// Output paper height in inches. If either of these values is less than or
/// equal to zero then the default paper size (letter, 8.5 x 11 inches) will
/// be used.
/// </summary>
property PaperHeightInch : double read FPaperHeight write FPaperHeight;
/// <summary>
/// Output paper width in mm.
/// </summary>
property PaperWidthMM : double read GetPaperWidthMM write SetPaperWidthMM;
/// <summary>
/// Output paper height in mm.
/// </summary>
property PaperHeightMM : double read GetPaperHeightMM write SetPaperHeightMM;
/// <summary>
/// Margin type.
/// </summary>
property MarginType : TCefPdfPrintMarginType read FMarginType write FMarginType;
/// <summary>
/// Top margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginTopInch : double read FMarginTop write FMarginTop;
/// <summary>
/// Right margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginRightInch : double read FMarginRight write FMarginRight;
/// <summary>
/// Bottom margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginBottomInch : double read FMarginBottom write FMarginBottom;
/// <summary>
/// Left margin in inches. Only used if MarginType is set to
/// PDF_PRINT_MARGIN_CUSTOM.
/// </summary>
property MarginLeftInch : double read FMarginLeft write FMarginLeft;
/// <summary>
/// Top margin in mm.
/// </summary>
property MarginTopMM : double read GetMarginTopMM write SetMarginTopMM;
/// <summary>
/// Right margin in mm.
/// </summary>
property MarginRightMM : double read GetMarginRightMM write SetMarginRightMM;
/// <summary>
/// Bottom margin in mm.
/// </summary>
property MarginBottomMM : double read GetMarginBottomMM write SetMarginBottomMM;
/// <summary>
/// Left margin in mm.
/// </summary>
property MarginLeftMM : double read GetMarginLeftMM write SetMarginLeftMM;
end;
@ -113,6 +220,7 @@ begin
FDisplayHeaderFooter := False;
FHeaderTemplate := '';
FFooterTemplate := '';
FGenerateTaggedPDF := False;
end;
function TPDFPrintOptions.InchesToMM(const aInches: double): double;
@ -236,6 +344,7 @@ begin
aSettings.display_header_footer := Ord(FDisplayHeaderFooter);
aSettings.header_template := CefString(FHeaderTemplate);
aSettings.footer_template := CefString(FFooterTemplate);
aSettings.generate_tagged_pdf := Ord(FGenerateTaggedPDF);
end;
end.

View File

@ -91,6 +91,8 @@ end;
procedure TCustomPanelDelegate.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetPreferredSize(view, aResult);
try
if (FEvents <> nil) then
ICefPanelDelegateEvents(FEvents).doOnGetPreferredSize(view, aResult);
@ -102,6 +104,8 @@ end;
procedure TCustomPanelDelegate.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMinimumSize(view, aResult);
try
if (FEvents <> nil) then
ICefPanelDelegateEvents(FEvents).doOnGetMinimumSize(view, aResult);
@ -113,6 +117,8 @@ end;
procedure TCustomPanelDelegate.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMaximumSize(view, aResult);
try
if (FEvents <> nil) then
ICefPanelDelegateEvents(FEvents).doOnGetMaximumSize(view, aResult);
@ -124,6 +130,8 @@ end;
procedure TCustomPanelDelegate.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
inherited OnGetHeightForWidth(view, width, aResult);
try
if (FEvents <> nil) then
ICefPanelDelegateEvents(FEvents).doOnGetHeightForWidth(view, width, aResult);

View File

@ -206,7 +206,7 @@ type
/// Returns the extension matching |extension_id| or NULL if no matching
/// extension is accessible in this context (see HasExtension). This function
/// must be called on the browser process UI thread.
///
/// </summary>
function GetExtension(const extension_id: ustring): ICefExtension;
/// <summary>

View File

@ -76,18 +76,43 @@ type
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure AfterConstruction; override;
/// <summary>
/// Start checking all the CEF subprocesses.
/// </summary>
procedure Start; virtual;
/// <summary>
/// Status of this component.
/// </summary>
property Status : TSentinelStatus read GetStatus;
/// <summary>
/// Number of CEF subprocesses.
/// </summary>
property ChildProcCount : integer read GetChildProcCount;
published
/// <summary>
/// Delay per subprocess in milliseconds. This delay is used to calculate how much time to wait until this component checks the CEF subprocesses again.
/// </summary>
property DelayPerProcMs : cardinal read FDelayPerProcMs write FDelayPerProcMs default CEFSENTINEL_DEFAULT_DELAYPERPROCMS;
/// <summary>
/// Minimum initial delay in milliseconds. This is the minimum time to wait until this component checks the CEF subprocesses again.
/// </summary>
property MinInitDelayMs : cardinal read FMinInitDelayMs write FMinInitDelayMs default CEFSENTINEL_DEFAULT_MININITDELAYMS;
/// <summary>
/// Final delay in milliseconds. This is an extra delay to wait after enough CEF subprocesses are closed.
/// </summary>
property FinalDelayMs : cardinal read FFinalDelayMs write FFinalDelayMs default CEFSENTINEL_DEFAULT_FINALDELAYMS;
/// <summary>
/// Minimum number of CEF subprocesses. When ChildProcCount reaches this value it's considered safe to trigger OnClose.
/// </summary>
property MinChildProcs : integer read FMinChildProcs write FMinChildProcs default CEFSENTINEL_DEFAULT_MINCHILDPROCS;
/// <summary>
/// Maximum number of times this component will check the CEF subprocesses.
/// </summary>
property MaxCheckCount : integer read FMaxCheckCount write FMaxCheckCount default CEFSENTINEL_DEFAULT_MAXCHECKCOUNTS;
/// <summary>
/// Event triggered when enought CEF subprocesses are closed.
/// </summary>
property OnClose : TNotifyEvent read FOnClose write FOnClose;
end;
@ -175,7 +200,7 @@ procedure TCEFSentinel.doStartMsg({$IFDEF MSWINDOWS}var aMessage : TMessage{$ELS
begin
if (FTimer <> nil) then
begin
FTimer.Interval := max(ChildProcCount * CEFSENTINEL_DEFAULT_DELAYPERPROCMS, FMinInitDelayMs);
FTimer.Interval := max(cardinal(ChildProcCount) * FDelayPerProcMs, FMinInitDelayMs);
FTimer.Enabled := True;
end;
end;

View File

@ -168,6 +168,8 @@ end;
procedure TCustomTextfieldDelegate.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetPreferredSize(view, aResult);
try
if (FEvents <> nil) then
ICefTextfieldDelegateEvents(FEvents).doOnGetPreferredSize(view, aResult);
@ -179,6 +181,8 @@ end;
procedure TCustomTextfieldDelegate.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMinimumSize(view, aResult);
try
if (FEvents <> nil) then
ICefTextfieldDelegateEvents(FEvents).doOnGetMinimumSize(view, aResult);
@ -190,6 +194,8 @@ end;
procedure TCustomTextfieldDelegate.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMaximumSize(view, aResult);
try
if (FEvents <> nil) then
ICefTextfieldDelegateEvents(FEvents).doOnGetMaximumSize(view, aResult);
@ -201,6 +207,8 @@ end;
procedure TCustomTextfieldDelegate.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
inherited OnGetHeightForWidth(view, width, aResult);
try
if (FEvents <> nil) then
ICefTextfieldDelegateEvents(FEvents).doOnGetHeightForWidth(view, width, aResult);

View File

@ -371,6 +371,7 @@ type
/// <summary>
/// Supported error code values.
/// <code>
/// Ranges:
/// 0- 99 System related errors
/// 100-199 Connection related errors
@ -381,6 +382,7 @@ type
/// 600-699 FTP errors
/// 700-799 Certificate manager errors
/// 800-899 DNS resolver errors
/// </code>
/// </summary>
/// <remarks>
/// <para>See the uCEFConstants unit for all possible values.</para>
@ -701,6 +703,15 @@ type
/// </remarks>
TCefMenuId = type Integer;
/// <summary>
/// Log items prepended to each log line.
/// </summary>
/// <remarks>
/// <para>See the uCEFConstants unit for all possible values.</para>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/internal/cef_types.h">CEF source file: /include/internal/cef_types.h (cef_log_items_t)</see></para>
/// </remarks>
TCefLogItems = type Cardinal;
{$IFDEF FPC}
NativeInt = PtrInt;
NativeUInt = PtrUInt;
@ -3049,6 +3060,13 @@ type
/// </summary>
log_severity : TCefLogSeverity;
/// <summary>
/// The log items prepended to each log line. If not set the default log items
/// will be used. Also configurable using the "log-items" command-line switch
/// with a value of "none" for no log items, or a comma-delimited list of
/// values "pid", "tid", "timestamp" or "tickcount" for custom log items.
/// </summary>
log_items : TCefLogItems;
/// <summary>
/// Custom flags that will be used when initializing the V8 JavaScript engine.
/// The consequences of using custom flags may not be well tested. Also
/// configurable using the "js-flags" command-line switch.
@ -3770,6 +3788,10 @@ type
/// |header_template|.
/// </summary>
footer_template : TCefString;
/// <summary>
/// Set to true (1) to generate tagged (accessible) PDF.
/// </summary>
generate_tagged_pdf : integer;
end;
/// <summary>
@ -4253,7 +4275,14 @@ type
/// Used to indicate whether HTTPS-First Mode is enabled on the hostname.
/// </summary>
CEF_CONTENT_SETTING_TYPE_HTTPS_ENFORCED,
/// <summary>
/// Stores per origin metadata for cookie controls.
/// </summary>
CEF_CONTENT_SETTING_TYPE_COOKIE_CONTROLS_METADATA,
/// <summary>
/// Setting for supporting 3PCD.
/// </summary>
CEF_CONTENT_SETTING_TYPE_TPCD_SUPPORT,
CEF_CONTENT_SETTING_TYPE_NUM_TYPES
);
@ -7365,13 +7394,14 @@ type
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/views/cef_browser_view_delegate_capi.h">CEF source file: /include/capi/views/cef_browser_view_delegate_capi.h (cef_browser_view_delegate_t)</see></para>
/// </remarks>
TCefBrowserViewDelegate = record
base : TCefViewDelegate;
on_browser_created : procedure(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; browser: PCefBrowser); stdcall;
on_browser_destroyed : procedure(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; browser: PCefBrowser); stdcall;
get_delegate_for_popup_browser_view : function(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; const settings: PCefBrowserSettings; client: PCefClient; is_devtools: Integer): PCefBrowserViewDelegate; stdcall;
on_popup_browser_view_created : function(self: PCefBrowserViewDelegate; browser_view, popup_browser_view: PCefBrowserView; is_devtools: Integer): Integer; stdcall;
get_chrome_toolbar_type : function(self: PCefBrowserViewDelegate): TCefChromeToolbarType; stdcall;
on_gesture_command : function(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; gesture_command: TCefGestureCommand): Integer; stdcall;
base : TCefViewDelegate;
on_browser_created : procedure(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; browser: PCefBrowser); stdcall;
on_browser_destroyed : procedure(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; browser: PCefBrowser); stdcall;
get_delegate_for_popup_browser_view : function(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; const settings: PCefBrowserSettings; client: PCefClient; is_devtools: Integer): PCefBrowserViewDelegate; stdcall;
on_popup_browser_view_created : function(self: PCefBrowserViewDelegate; browser_view, popup_browser_view: PCefBrowserView; is_devtools: Integer): Integer; stdcall;
get_chrome_toolbar_type : function(self: PCefBrowserViewDelegate): TCefChromeToolbarType; stdcall;
use_frameless_window_for_picture_in_picture : function(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView): integer; stdcall;
on_gesture_command : function(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; gesture_command: TCefGestureCommand): Integer; stdcall;
end;
/// <summary>

View File

@ -1,9 +1,9 @@
CEF_SUPPORTED_VERSION_MAJOR = 116;
CEF_SUPPORTED_VERSION_MINOR = 0;
CEF_SUPPORTED_VERSION_RELEASE = 27;
CEF_SUPPORTED_VERSION_MAJOR = 117;
CEF_SUPPORTED_VERSION_MINOR = 1;
CEF_SUPPORTED_VERSION_RELEASE = 4;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR;
CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 5845;
CEF_CHROMEELF_VERSION_BUILD = 190;
CEF_CHROMEELF_VERSION_RELEASE = 5938;
CEF_CHROMEELF_VERSION_BUILD = 92;

View File

@ -332,22 +332,25 @@ end;
procedure TCefViewDelegateOwn.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
//
aResult.width := 0;
aResult.height := 0;
end;
procedure TCefViewDelegateOwn.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
//
aResult.width := 0;
aResult.height := 0;
end;
procedure TCefViewDelegateOwn.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
//
aResult.width := 0;
aResult.height := 0;
end;
procedure TCefViewDelegateOwn.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
//
aResult := 0;
end;
procedure TCefViewDelegateOwn.OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
@ -401,6 +404,8 @@ end;
procedure TCustomViewDelegate.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetPreferredSize(view, aResult);
try
if (FEvents <> nil) then
ICefViewDelegateEvents(FEvents).doOnGetPreferredSize(view, aResult);
@ -412,6 +417,8 @@ end;
procedure TCustomViewDelegate.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMinimumSize(view, aResult);
try
if (FEvents <> nil) then
ICefViewDelegateEvents(FEvents).doOnGetMinimumSize(view, aResult);
@ -423,6 +430,8 @@ end;
procedure TCustomViewDelegate.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
inherited OnGetMaximumSize(view, aResult);
try
if (FEvents <> nil) then
ICefViewDelegateEvents(FEvents).doOnGetMaximumSize(view, aResult);
@ -434,6 +443,8 @@ end;
procedure TCustomViewDelegate.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
inherited OnGetHeightForWidth(view, width, aResult);
try
if (FEvents <> nil) then
ICefViewDelegateEvents(FEvents).doOnGetHeightForWidth(view, width, aResult);

View File

@ -39,12 +39,13 @@ type
// ICefPanelDelegate
// ICefBrowserViewDelegate
TOnBrowserCreatedEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const browser: ICefBrowser) of object;
TOnBrowserDestroyedEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const browser: ICefBrowser) of object;
TOnGetDelegateForPopupBrowserViewEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate) of object;
TOnPopupBrowserViewCreatedEvent = procedure(const Sender: TObject; const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean) of object;
TOnGetChromeToolbarTypeEvent = procedure(const Sender: TObject; var aChromeToolbarType: TCefChromeToolbarType) of object;
TOnGestureCommandEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; var aResult : boolean) of object;
TOnBrowserCreatedEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const browser: ICefBrowser) of object;
TOnBrowserDestroyedEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const browser: ICefBrowser) of object;
TOnGetDelegateForPopupBrowserViewEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate) of object;
TOnPopupBrowserViewCreatedEvent = procedure(const Sender: TObject; const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean) of object;
TOnGetChromeToolbarTypeEvent = procedure(const Sender: TObject; var aChromeToolbarType: TCefChromeToolbarType) of object;
TOnUseFramelessWindowForPictureInPicture = procedure(const Sender: TObject; const browser_view: ICefBrowserView; var aResult : boolean) of object;
TOnGestureCommandEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean) of object;
// ICefButtonDelegate
TOnButtonPressedEvent = procedure(const Sender: TObject; const button: ICefButton) of object;

View File

@ -29,18 +29,38 @@ uses
uCEFTypes, uCEFInterfaces;
type
/// <summary>
/// Custom TWinControl used by CEF browsers.
/// </summary>
TCEFWinControl = class(TWinControl)
protected
function GetChildWindowHandle : {$IFNDEF MSWINDOWS}{$IFDEF FPC}LclType.{$ENDIF}{$ENDIF}THandle; virtual;
procedure Resize; override;
public
/// <summary>
/// Take a snapshot of the browser contents into aBitmap. This function only works in Windows without hardware acceleration.
/// </summary>
function TakeSnapshot(var aBitmap : TBitmap) : boolean;
/// <summary>
/// Destroy the child windows created by the browser.
/// </summary>
function DestroyChildWindow : boolean;
/// <summary>
/// Exposes the CreateHandle procedure to create the Handle at any time.
/// </summary>
procedure CreateHandle; override;
/// <summary>
/// Invalidate the child windows created by the browser.
/// </summary>
procedure InvalidateChildren;
/// <summary>
/// Updates the size of the child windows created by the browser.
/// </summary>
procedure UpdateSize; virtual;
/// <summary>
/// Handle of the first child window created by the browser.
/// </summary>
property ChildWindowHandle : THandle read GetChildWindowHandle;
published

View File

@ -27,6 +27,10 @@ uses
type
{$IFNDEF FPC}{$IFDEF DELPHI16_UP}[ComponentPlatformsAttribute(pfidWindows)]{$ENDIF}{$ENDIF}
/// <summary>
/// <para>Implementation of an external message pump for VCL and LCL.</para>
/// <para>Read the GlobalCEFApp.OnScheduleMessagePumpWork documentation for all the details.</para>
/// </summary>
TCEFWorkScheduler = class(TComponent)
protected
FThread : TCEFWorkSchedulerThread;
@ -73,22 +77,59 @@ type
procedure Thread_OnPulse(Sender : TObject);
public
/// <summary>
/// Full constructor of TCEFWorkScheduler. This constructor also creates the internal threads.
/// </summary>
constructor Create(AOwner: TComponent); override;
/// <summary>
/// Partial constructor of TCEFWorkScheduler. This constructor doesn't create any threads.
/// Call TCEFWorkScheduler.CreateThread when necessary.
/// </summary>
constructor CreateDelayed;
/// <summary>
/// TCEFWorkScheduler destructor.
/// </summary>
destructor Destroy; override;
/// <summary>
/// Called from GlobalCEFApp.OnScheduleMessagePumpWork to schedule
/// a GlobalCEFApp.DoMessageLoopWork call asynchronously to perform a single
/// iteration of CEF message loop processing.
/// </summary>
/// <param name="delay_ms">Requested delay in milliseconds.</param>
procedure ScheduleMessagePumpWork(const delay_ms : int64);
/// <summary>
/// Stop the scheduler. This function must be called after the destruction of all the forms in the application.
/// </summary>
procedure StopScheduler;
/// <summary>
/// Creates all the internal threads used by TCEFWorkScheduler.
/// </summary>
procedure CreateThread;
published
{$IFDEF MSWINDOWS}
{$WARN SYMBOL_PLATFORM OFF}
/// <summary>
/// Priority of TCEFWorkSchedulerThread in Windows.
/// </summary>
property Priority : TThreadPriority read FPriority write SetPriority default tpNormal;
{$WARN SYMBOL_PLATFORM ON}
{$ENDIF}
/// <summary>
/// Default interval in milliseconds to do the next GlobalCEFApp.DoMessageLoopWork call.
/// </summary>
property DefaultInterval : integer read FDefaultInterval write SetDefaultInterval default CEF_TIMER_MAXDELAY;
/// <summary>
/// Number of cycles used to deplete the remaining messages in the work loop.
/// </summary>
property DepleteWorkCycles : cardinal read FDepleteWorkCycles write FDepleteWorkCycles default CEF_TIMER_DEPLETEWORK_CYCLES;
/// <summary>
/// Delay in milliseconds between the cycles used to deplete the remaining messages in the work loop.
/// </summary>
property DepleteWorkDelay : cardinal read FDepleteWorkDelay write FDepleteWorkDelay default CEF_TIMER_DEPLETEWORK_DELAY;
/// <summary>
/// Use a custom queue thread instead of Windows messages or any other way to schedule the next pump work.
/// </summary>
property UseQueueThread : boolean read FUseQueueThread write FUseQueueThread default False;
end;

View File

@ -119,7 +119,7 @@ begin
Result := 0;
if Lock then
begin
try
TempLen := length(FValues);
if (TempLen > 0) then
@ -137,7 +137,7 @@ begin
Finalize(TempNewValues);
end;
end;
finally
Unlock;
end;
end;
@ -147,13 +147,13 @@ begin
Result := False;
if Lock then
begin
try
if not(Terminated) and not(FStop) then
begin
FWaiting := False;
Result := (Length(FValues) > 0);
end;
finally
Unlock;
end;
end;
@ -161,7 +161,7 @@ end;
procedure TCEFWorkSchedulerQueueThread.StopThread;
begin
if Lock then
begin
try
FStop := True;
if FWaiting then
@ -169,7 +169,7 @@ begin
FWaiting := False;
FEvent.SetEvent;
end;
finally
Unlock;
end;
end;

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 517,
"InternalVersion" : 518,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "116.0.27"
"Version" : "117.1.4"
}
],
"UpdatePackageData" : {