Update to CEF 3.3202.1674.g2a991c4

This commit is contained in:
Salvador Díaz Fau 2017-10-26 13:23:13 +02:00
parent 87d11774bd
commit 26f286cae7
11 changed files with 393 additions and 172 deletions

View File

@ -56,14 +56,14 @@ uses
const const
CEF_SUPPORTED_VERSION_MAJOR = 3; CEF_SUPPORTED_VERSION_MAJOR = 3;
CEF_SUPPORTED_VERSION_MINOR = 3163; CEF_SUPPORTED_VERSION_MINOR = 3202;
CEF_SUPPORTED_VERSION_RELEASE = 1671; CEF_SUPPORTED_VERSION_RELEASE = 1674;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 61; CEF_CHROMEELF_VERSION_MAJOR = 62;
CEF_CHROMEELF_VERSION_MINOR = 0; CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 3163; CEF_CHROMEELF_VERSION_RELEASE = 3202;
CEF_CHROMEELF_VERSION_BUILD = 91; CEF_CHROMEELF_VERSION_BUILD = 62;
LIBCEF_DLL = 'libcef.dll'; LIBCEF_DLL = 'libcef.dll';
CHROMEELF_DLL = 'chrome_elf.dll'; CHROMEELF_DLL = 'chrome_elf.dll';

View File

@ -140,6 +140,9 @@ type
procedure DragSourceSystemDragEnded; procedure DragSourceSystemDragEnded;
function GetVisibleNavigationEntry : ICefNavigationEntry; function GetVisibleNavigationEntry : ICefNavigationEntry;
procedure SetAccessibilityState(accessibilityState: TCefState); procedure SetAccessibilityState(accessibilityState: TCefState);
procedure SetAutoResizeEnabled(enabled: boolean; const min_size, max_size: PCefSize);
function GetExtension : ICefExtension;
function IsBackgroundHost : boolean;
public public
class function UnWrap(data: Pointer): ICefBrowserHost; class function UnWrap(data: Pointer): ICefBrowserHost;
@ -149,7 +152,8 @@ implementation
uses uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFDownloadImageCallBack, uCEFFrame, uCEFPDFPrintCallback, uCEFMiscFunctions, uCEFLibFunctions, uCEFDownloadImageCallBack, uCEFFrame, uCEFPDFPrintCallback,
uCEFRunFileDialogCallback, uCEFRequestContext, uCEFNavigationEntryVisitor, uCEFNavigationEntry; uCEFRunFileDialogCallback, uCEFRequestContext, uCEFNavigationEntryVisitor, uCEFNavigationEntry,
uCEFExtension;
function TCefBrowserRef.GetHost: ICefBrowserHost; function TCefBrowserRef.GetHost: ICefBrowserHost;
begin begin
@ -369,6 +373,21 @@ begin
PCefBrowserHost(FData).set_accessibility_state(FData, accessibilityState); PCefBrowserHost(FData).set_accessibility_state(FData, accessibilityState);
end; end;
procedure TCefBrowserHostRef.SetAutoResizeEnabled(enabled: boolean; const min_size, max_size: PCefSize);
begin
PCefBrowserHost(FData).set_auto_resize_enabled(FData, Ord(enabled), min_size, max_size);
end;
function TCefBrowserHostRef.GetExtension : ICefExtension;
begin
Result := TCefExtensionRef.UnWrap(PCefBrowserHost(FData).get_extension(FData));
end;
function TCefBrowserHostRef.IsBackgroundHost : boolean;
begin
Result := PCefBrowserHost(FData).is_background_host(FData) <> 0;
end;
procedure TCefBrowserHostRef.DragTargetDragEnter(const dragData: ICefDragData; procedure TCefBrowserHostRef.DragTargetDragEnter(const dragData: ICefDragData;
const event: PCefMouseEvent; allowedOps: TCefDragOperations); const event: PCefMouseEvent; allowedOps: TCefDragOperations);
begin begin

View File

@ -136,6 +136,7 @@ type
FOnTooltip : TOnTooltip; FOnTooltip : TOnTooltip;
FOnStatusMessage : TOnStatusMessage; FOnStatusMessage : TOnStatusMessage;
FOnConsoleMessage : TOnConsoleMessage; FOnConsoleMessage : TOnConsoleMessage;
FOnAutoResize : TOnAutoResize;
// ICefDownloadHandler // ICefDownloadHandler
FOnBeforeDownload : TOnBeforeDownload; FOnBeforeDownload : TOnBeforeDownload;
@ -319,6 +320,7 @@ type
function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; virtual; function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; virtual;
procedure doOnStatusMessage(const browser: ICefBrowser; const value: ustring); virtual; procedure doOnStatusMessage(const browser: ICefBrowser; const value: ustring); virtual;
function doOnConsoleMessage(const browser: ICefBrowser; const aMessage, source: ustring; line: Integer): Boolean; virtual; function doOnConsoleMessage(const browser: ICefBrowser; const aMessage, source: ustring; line: Integer): Boolean; virtual;
function doOnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; virtual;
// ICefDownloadHandler // ICefDownloadHandler
procedure doOnBeforeDownload(const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); virtual; procedure doOnBeforeDownload(const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); virtual;
@ -570,6 +572,7 @@ type
property OnTooltip : TOnTooltip read FOnTooltip write FOnTooltip; property OnTooltip : TOnTooltip read FOnTooltip write FOnTooltip;
property OnStatusMessage : TOnStatusMessage read FOnStatusMessage write FOnStatusMessage; property OnStatusMessage : TOnStatusMessage read FOnStatusMessage write FOnStatusMessage;
property OnConsoleMessage : TOnConsoleMessage read FOnConsoleMessage write FOnConsoleMessage; property OnConsoleMessage : TOnConsoleMessage read FOnConsoleMessage write FOnConsoleMessage;
property OnAutoResize : TOnAutoResize read FOnAutoResize write FOnAutoResize;
// ICefDownloadHandler // ICefDownloadHandler
property OnBeforeDownload : TOnBeforeDownload read FOnBeforeDownload write FOnBeforeDownload; property OnBeforeDownload : TOnBeforeDownload read FOnBeforeDownload write FOnBeforeDownload;
@ -813,6 +816,7 @@ begin
FOnTooltip := nil; FOnTooltip := nil;
FOnStatusMessage := nil; FOnStatusMessage := nil;
FOnConsoleMessage := nil; FOnConsoleMessage := nil;
FOnAutoResize := nil;
// ICefDownloadHandler // ICefDownloadHandler
FOnBeforeDownload := nil; FOnBeforeDownload := nil;
@ -2567,6 +2571,14 @@ begin
if Assigned(FOnConsoleMessage) then FOnConsoleMessage(Self, browser, aMessage, source, line, Result); if Assigned(FOnConsoleMessage) then FOnConsoleMessage(Self, browser, aMessage, source, line, Result);
end; end;
function TChromium.doOnAutoResize(const browser : ICefBrowser;
const new_size : PCefSize): Boolean;
begin
Result := False;
if Assigned(FOnAutoResize) then FOnAutoResize(Self, browser, new_size, Result);
end;
function TChromium.doOnContextMenuCommand(const browser : ICefBrowser; function TChromium.doOnContextMenuCommand(const browser : ICefBrowser;
const frame : ICefFrame; const frame : ICefFrame;
const params : ICefContextMenuParams; const params : ICefContextMenuParams;

View File

@ -80,6 +80,7 @@ type
TOnTooltip = procedure(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean) of object; TOnTooltip = procedure(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean) of object;
TOnStatusMessage = procedure(Sender: TObject; const browser: ICefBrowser; const value: ustring) of object; TOnStatusMessage = procedure(Sender: TObject; const browser: ICefBrowser; const value: ustring) of object;
TOnConsoleMessage = procedure(Sender: TObject; const browser: ICefBrowser; const message, source: ustring; line: Integer; out Result: Boolean) of object; TOnConsoleMessage = procedure(Sender: TObject; const browser: ICefBrowser; const message, source: ustring; line: Integer; out Result: Boolean) of object;
TOnAutoResize = procedure(Sender: TObject; const browser: ICefBrowser; const new_size: PCefSize; out Result: Boolean) of object;
TOnBeforeDownload = procedure(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const suggestedName: ustring; const callback: ICefBeforeDownloadCallback) of object; TOnBeforeDownload = procedure(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const suggestedName: ustring; const callback: ICefBeforeDownloadCallback) of object;
TOnDownloadUpdated = procedure(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const callback: ICefDownloadItemCallback) of object; TOnDownloadUpdated = procedure(Sender: TObject; const browser: ICefBrowser; const downloadItem: ICefDownloadItem; const callback: ICefDownloadItemCallback) of object;
TOnRequestGeolocationPermission = procedure(Sender: TObject; const browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback; out Result: Boolean) of object; TOnRequestGeolocationPermission = procedure(Sender: TObject; const browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback; out Result: Boolean) of object;

View File

@ -64,6 +64,8 @@ type
function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; virtual; function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; virtual;
procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring); virtual; procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring); virtual;
function OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean; virtual; function OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean; virtual;
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; virtual;
public public
constructor Create; virtual; constructor Create; virtual;
end; end;
@ -79,6 +81,7 @@ type
function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; override; function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; override;
procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring); override; procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring); override;
function OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean; override; function OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean; override;
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; override;
public public
constructor Create(const events: IChromiumEvents); reintroduce; virtual; constructor Create(const events: IChromiumEvents); reintroduce; virtual;
@ -165,30 +168,40 @@ begin
CefString(message), CefString(source), line)); CefString(message), CefString(source), line));
end; end;
function cef_display_handler_on_auto_resize(self: PCefDisplayHandler; browser: PCefBrowser; const new_size: PCefSize): Integer; stdcall;
begin
Result := Ord(TCefDisplayHandlerOwn(CefGetObject(self)).OnAutoResize(TCefBrowserRef.UnWrap(browser), new_size));
end;
constructor TCefDisplayHandlerOwn.Create; constructor TCefDisplayHandlerOwn.Create;
begin begin
inherited CreateData(SizeOf(TCefDisplayHandler)); inherited CreateData(SizeOf(TCefDisplayHandler));
with PCefDisplayHandler(FData)^ do with PCefDisplayHandler(FData)^ do
begin begin
on_address_change := cef_display_handler_on_address_change; on_address_change := cef_display_handler_on_address_change;
on_title_change := cef_display_handler_on_title_change; on_title_change := cef_display_handler_on_title_change;
on_favicon_urlchange := cef_display_handler_on_favicon_urlchange; on_favicon_urlchange := cef_display_handler_on_favicon_urlchange;
on_fullscreen_mode_change := cef_display_handler_on_fullscreen_mode_change; on_fullscreen_mode_change := cef_display_handler_on_fullscreen_mode_change;
on_tooltip := cef_display_handler_on_tooltip; on_tooltip := cef_display_handler_on_tooltip;
on_status_message := cef_display_handler_on_status_message; on_status_message := cef_display_handler_on_status_message;
on_console_message := cef_display_handler_on_console_message; on_console_message := cef_display_handler_on_console_message;
end; on_auto_resize := cef_display_handler_on_auto_resize;
end;
end; end;
procedure TCefDisplayHandlerOwn.OnAddressChange(const browser: ICefBrowser; procedure TCefDisplayHandlerOwn.OnAddressChange(const browser: ICefBrowser; const frame: ICefFrame; const url: ustring);
const frame: ICefFrame; const url: ustring);
begin begin
end; end;
function TCefDisplayHandlerOwn.OnConsoleMessage(const browser: ICefBrowser; function TCefDisplayHandlerOwn.OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean;
const message, source: ustring; line: Integer): Boolean; begin
Result := False;
end;
function TCefDisplayHandlerOwn.OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
begin begin
Result := False; Result := False;
end; end;
@ -199,26 +212,22 @@ begin
end; end;
procedure TCefDisplayHandlerOwn.OnFullScreenModeChange( procedure TCefDisplayHandlerOwn.OnFullScreenModeChange(const browser: ICefBrowser; fullscreen: Boolean);
const browser: ICefBrowser; fullscreen: Boolean);
begin begin
end; end;
procedure TCefDisplayHandlerOwn.OnStatusMessage(const browser: ICefBrowser; procedure TCefDisplayHandlerOwn.OnStatusMessage(const browser: ICefBrowser; const value: ustring);
const value: ustring);
begin begin
end; end;
procedure TCefDisplayHandlerOwn.OnTitleChange(const browser: ICefBrowser; procedure TCefDisplayHandlerOwn.OnTitleChange(const browser: ICefBrowser; const title: ustring);
const title: ustring);
begin begin
end; end;
function TCefDisplayHandlerOwn.OnTooltip(const browser: ICefBrowser; function TCefDisplayHandlerOwn.OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean;
var text: ustring): Boolean;
begin begin
Result := False; Result := False;
end; end;
@ -257,6 +266,14 @@ begin
Result := inherited OnConsoleMessage(browser, message, source, line); Result := inherited OnConsoleMessage(browser, message, source, line);
end; end;
function TCustomDisplayHandler.OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
begin
if (FEvent <> nil) then
Result := FEvent.doOnAutoResize(browser, new_size)
else
Result := inherited OnAutoResize(browser, new_size);
end;
procedure TCustomDisplayHandler.OnFaviconUrlChange(const browser: ICefBrowser; iconUrls: TStrings); procedure TCustomDisplayHandler.OnFaviconUrlChange(const browser: ICefBrowser; iconUrls: TStrings);
begin begin
if (FEvent <> nil) then FEvent.doOnFaviconUrlChange(browser, iconUrls); if (FEvent <> nil) then FEvent.doOnFaviconUrlChange(browser, iconUrls);

View File

@ -52,13 +52,13 @@ uses
type type
TCefExtensionRef = class(TCefBaseRefCountedRef, ICefExtension) TCefExtensionRef = class(TCefBaseRefCountedRef, ICefExtension)
protected protected
function GetIdentifier : ustring; function GetIdentifier : ustring;
function GetPath : ustring; function GetPath : ustring;
function GetManifest : ICefDictionaryValue; function GetManifest : ICefDictionaryValue;
function IsSame(const that : ICefExtension) : boolean; function IsSame(const that : ICefExtension) : boolean;
function GetHandler : ICefExtensionHandler; function GetHandler : ICefExtensionHandler;
function GetLoaderContext: ICefRequestContext; function GetLoaderContext: ICefRequestContext;
function IsLoaded : boolean; function IsLoaded : boolean;
procedure unload; procedure unload;
public public

View File

@ -55,10 +55,11 @@ type
procedure OnExtensionLoadFailed(result: TCefErrorcode); procedure OnExtensionLoadFailed(result: TCefErrorcode);
procedure OnExtensionLoaded(const extension: ICefExtension); procedure OnExtensionLoaded(const extension: ICefExtension);
procedure OnExtensionUnloaded(const extension: ICefExtension); procedure OnExtensionUnloaded(const extension: ICefExtension);
function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser;
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean;
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean;
public public
class function UnWrap(data: Pointer): ICefExtensionHandler; class function UnWrap(data: Pointer): ICefExtensionHandler;
@ -69,10 +70,11 @@ type
procedure OnExtensionLoadFailed(result: TCefErrorcode); virtual; procedure OnExtensionLoadFailed(result: TCefErrorcode); virtual;
procedure OnExtensionLoaded(const extension: ICefExtension); virtual; procedure OnExtensionLoaded(const extension: ICefExtension); virtual;
procedure OnExtensionUnloaded(const extension: ICefExtension); virtual; procedure OnExtensionUnloaded(const extension: ICefExtension); virtual;
function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; virtual; function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; virtual;
function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; virtual; function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; virtual; function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; virtual;
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; virtual; function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; virtual;
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; virtual;
public public
constructor Create; virtual; constructor Create; virtual;
@ -111,6 +113,19 @@ begin
Result := False; Result := False;
end; end;
function TCefExtensionHandlerRef.OnBeforeBrowser(const extension : ICefExtension;
const browser : ICefBrowser;
const active_browser : ICefBrowser;
index : Integer;
const url : ustring;
active : boolean;
var windowInfo : TCefWindowInfo;
var client : ICefClient;
var settings : TCefBrowserSettings) : boolean;
begin
Result := True;
end;
function TCefExtensionHandlerRef.GetActiveBrowser(const extension : ICefExtension; function TCefExtensionHandlerRef.GetActiveBrowser(const extension : ICefExtension;
const browser : ICefBrowser; const browser : ICefBrowser;
include_incognito : boolean): ICefBrowser; include_incognito : boolean): ICefBrowser;
@ -203,6 +218,40 @@ begin
client := CefGetData(TempClient); client := CefGetData(TempClient);
end; end;
function cef_extension_handler_on_before_browser(self : PCefExtensionHandler;
extension : PCefExtension;
browser : PCefBrowser;
active_browser : PCefBrowser;
index : Integer;
const url : PCefString;
active : Integer;
windowInfo : PCefWindowInfo;
var client : PCefClient;
settings : PCefBrowserSettings) : Integer; stdcall;
var
TempClient : ICefClient;
TempOldCli : pointer;
begin
TempClient := TCefClientRef.UnWrap(client);
TempOldCli := pointer(TempClient);
Result := Ord(TCefExtensionHandlerOwn(CefGetObject(self)).OnBeforeBrowser(TCefExtensionRef.UnWrap(extension),
TCefBrowserRef.UnWrap(browser),
TCefBrowserRef.UnWrap(active_browser),
index,
CefString(url),
active <> 0,
windowInfo^,
TempClient,
settings^));
if (TempClient = nil) then
client := nil
else
if (TempOldCli <> pointer(TempClient)) then
client := CefGetData(TempClient);
end;
function cef_extension_handler_get_active_browser(self : PCefExtensionHandler; function cef_extension_handler_get_active_browser(self : PCefExtensionHandler;
extension : PCefExtension; extension : PCefExtension;
browser : PCefBrowser; browser : PCefBrowser;
@ -247,6 +296,7 @@ begin
on_extension_loaded := cef_extension_handler_on_extension_loaded; on_extension_loaded := cef_extension_handler_on_extension_loaded;
on_extension_unloaded := cef_extension_handler_on_extension_unloaded; on_extension_unloaded := cef_extension_handler_on_extension_unloaded;
on_before_background_browser := cef_extension_handler_on_before_background_browser; on_before_background_browser := cef_extension_handler_on_before_background_browser;
on_before_browser := cef_extension_handler_on_before_browser;
get_active_browser := cef_extension_handler_get_active_browser; get_active_browser := cef_extension_handler_get_active_browser;
can_access_browser := cef_extension_handler_can_access_browser; can_access_browser := cef_extension_handler_can_access_browser;
get_extension_resource := cef_extension_handler_get_extension_resource; get_extension_resource := cef_extension_handler_get_extension_resource;
@ -276,6 +326,19 @@ begin
Result := True; Result := True;
end; end;
function TCefExtensionHandlerOwn.OnBeforeBrowser(const extension : ICefExtension;
const browser : ICefBrowser;
const active_browser : ICefBrowser;
index : Integer;
const url : ustring;
active : boolean;
var windowInfo : TCefWindowInfo;
var client : ICefClient;
var settings : TCefBrowserSettings) : boolean;
begin
Result := True;
end;
function TCefExtensionHandlerOwn.GetActiveBrowser(const extension : ICefExtension; function TCefExtensionHandlerOwn.GetActiveBrowser(const extension : ICefExtension;
const browser : ICefBrowser; const browser : ICefBrowser;
include_incognito : boolean): ICefBrowser; include_incognito : boolean): ICefBrowser;

View File

@ -221,6 +221,9 @@ type
procedure DragSourceSystemDragEnded; procedure DragSourceSystemDragEnded;
function GetVisibleNavigationEntry : ICefNavigationEntry; function GetVisibleNavigationEntry : ICefNavigationEntry;
procedure SetAccessibilityState(accessibilityState: TCefState); procedure SetAccessibilityState(accessibilityState: TCefState);
procedure SetAutoResizeEnabled(enabled: boolean; const min_size, max_size: PCefSize);
function GetExtension : ICefExtension;
function IsBackgroundHost : boolean;
property Browser: ICefBrowser read GetBrowser; property Browser: ICefBrowser read GetBrowser;
property WindowHandle: TCefWindowHandle read GetWindowHandle; property WindowHandle: TCefWindowHandle read GetWindowHandle;
@ -1209,27 +1212,28 @@ type
procedure OnExtensionLoadFailed(result: TCefErrorcode); procedure OnExtensionLoadFailed(result: TCefErrorcode);
procedure OnExtensionLoaded(const extension: ICefExtension); procedure OnExtensionLoaded(const extension: ICefExtension);
procedure OnExtensionUnloaded(const extension: ICefExtension); procedure OnExtensionUnloaded(const extension: ICefExtension);
function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean;
function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser;
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean;
function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean;
end; end;
ICefExtension = interface(ICefBaseRefCounted) ICefExtension = interface(ICefBaseRefCounted)
['{D30D1C64-A26F-49C0-AEB7-C55EC68951CA}'] ['{D30D1C64-A26F-49C0-AEB7-C55EC68951CA}']
function GetIdentifier : ustring; function GetIdentifier : ustring;
function GetPath : ustring; function GetPath : ustring;
function GetManifest : ICefDictionaryValue; function GetManifest : ICefDictionaryValue;
function IsSame(const that : ICefExtension) : boolean; function IsSame(const that : ICefExtension) : boolean;
function GetHandler : ICefExtensionHandler; function GetHandler : ICefExtensionHandler;
function GetLoaderContext: ICefRequestContext; function GetLoaderContext : ICefRequestContext;
function IsLoaded : boolean; function IsLoaded : boolean;
procedure unload; procedure unload;
property Identifier : ustring read GetIdentifier; property Identifier : ustring read GetIdentifier;
property Path : ustring read GetPath; property Path : ustring read GetPath;
property Manifest : ICefDictionaryValue read GetManifest; property Manifest : ICefDictionaryValue read GetManifest;
property Handler : ICefExtensionHandler read GetHandler; property Handler : ICefExtensionHandler read GetHandler;
property LoaderContext : ICefRequestContext read GetLoaderContext; property LoaderContext : ICefRequestContext read GetLoaderContext;
end; end;
@ -1238,8 +1242,7 @@ type
procedure OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); procedure OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
procedure OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType); procedure OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType);
procedure OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); procedure OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
procedure OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; procedure OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring);
const errorText, failedUrl: ustring);
end; end;
ICefRequestCallback = interface(ICefBaseRefCounted) ICefRequestCallback = interface(ICefBaseRefCounted)
@ -1280,9 +1283,10 @@ type
procedure OnTitleChange(const browser: ICefBrowser; const title: ustring); procedure OnTitleChange(const browser: ICefBrowser; const title: ustring);
procedure OnFaviconUrlChange(const browser: ICefBrowser; icon_urls: TStrings); procedure OnFaviconUrlChange(const browser: ICefBrowser; icon_urls: TStrings);
procedure OnFullScreenModeChange(const browser: ICefBrowser; fullscreen: Boolean); procedure OnFullScreenModeChange(const browser: ICefBrowser; fullscreen: Boolean);
function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean;
procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring); procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring);
function OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean; function OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean;
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
end; end;
ICefFocusHandler = interface(ICefBaseRefCounted) ICefFocusHandler = interface(ICefBaseRefCounted)
@ -1485,6 +1489,7 @@ type
ICefRequestContextHandler = interface(ICefBaseRefCounted) ICefRequestContextHandler = interface(ICefBaseRefCounted)
['{76EB1FA7-78DF-4FD5-ABB3-1CDD3E73A140}'] ['{76EB1FA7-78DF-4FD5-ABB3-1CDD3E73A140}']
procedure OnRequestContextInitialized(const request_context: ICefRequestContext);
function GetCookieManager: ICefCookieManager; function GetCookieManager: ICefCookieManager;
function OnBeforePluginLoad(const mimeType, pluginUrl:ustring; isMainFrame : boolean; const topOriginUrl: ustring; function OnBeforePluginLoad(const mimeType, pluginUrl:ustring; isMainFrame : boolean; const topOriginUrl: ustring;
const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean;
@ -1497,28 +1502,33 @@ type
ICefRequestContext = interface(ICefBaseRefCounted) ICefRequestContext = interface(ICefBaseRefCounted)
['{5830847A-2971-4BD5-ABE6-21451F8923F7}'] ['{5830847A-2971-4BD5-ABE6-21451F8923F7}']
function IsSame(const other: ICefRequestContext): Boolean; function IsSame(const other: ICefRequestContext): Boolean;
function IsSharingWith(const other: ICefRequestContext): Boolean; function IsSharingWith(const other: ICefRequestContext): Boolean;
function IsGlobal: Boolean; function IsGlobal: Boolean;
function GetHandler: ICefRequestContextHandler; function GetHandler: ICefRequestContextHandler;
function GetCachePath: ustring; function GetCachePath: ustring;
function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager; function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager;
function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;
function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean;
const factory: ICefSchemeHandlerFactory): Boolean; function ClearSchemeHandlerFactories: Boolean;
function ClearSchemeHandlerFactories: Boolean;
procedure PurgePluginListCache(reloadPages: Boolean); procedure PurgePluginListCache(reloadPages: Boolean);
function HasPreference(const name: ustring): Boolean; function HasPreference(const name: ustring): Boolean;
function GetPreference(const name: ustring): ICefValue; function GetPreference(const name: ustring): ICefValue;
function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue;
function CanSetPreference(const name: ustring): Boolean; function CanSetPreference(const name: ustring): Boolean;
function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean;
procedure ClearCertificateExceptions(const callback: ICefCompletionCallback); procedure ClearCertificateExceptions(const callback: ICefCompletionCallback);
procedure CloseAllConnections(const callback: ICefCompletionCallback); procedure CloseAllConnections(const callback: ICefCompletionCallback);
procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback); procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback);
function ResolveHostCached(const origin: ustring; resolvedIps: TStrings): TCefErrorCode; function ResolveHostCached(const origin: ustring; const resolvedIps: TStrings): TCefErrorCode;
property CachePath: ustring read GetCachePath; procedure LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue; const handler: ICefExtensionHandler);
property IsGlobalContext: boolean read IsGlobal; function DidLoadExtension(const extension_id: ustring): boolean;
function HasExtension(const extension_id: ustring): boolean;
function GetExtensions(const extension_ids: TStringList): boolean;
function GetExtension(const extension_id: ustring): ICefExtension;
property CachePath : ustring read GetCachePath;
property IsGlobalContext : boolean read IsGlobal;
end; end;
ICefPrintSettings = Interface(ICefBaseRefCounted) ICefPrintSettings = Interface(ICefBaseRefCounted)
@ -1732,6 +1742,7 @@ type
function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean;
procedure doOnStatusMessage(const browser: ICefBrowser; const value: ustring); procedure doOnStatusMessage(const browser: ICefBrowser; const value: ustring);
function doOnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean; function doOnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean;
function doOnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
function doOnRequestGeolocationPermission(const browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback): Boolean; function doOnRequestGeolocationPermission(const browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback): Boolean;
procedure doOnCancelGeolocationPermission(const browser: ICefBrowser; requestId: Integer); procedure doOnCancelGeolocationPermission(const browser: ICefBrowser; requestId: Integer);

View File

@ -57,25 +57,30 @@ uses
type type
TCefRequestContextRef = class(TCefBaseRefCountedRef, ICefRequestContext) TCefRequestContextRef = class(TCefBaseRefCountedRef, ICefRequestContext)
protected protected
function IsSame(const other: ICefRequestContext): Boolean; function IsSame(const other: ICefRequestContext): Boolean;
function IsSharingWith(const other: ICefRequestContext): Boolean; function IsSharingWith(const other: ICefRequestContext): Boolean;
function IsGlobal: Boolean; function IsGlobal: Boolean;
function GetHandler: ICefRequestContextHandler; function GetHandler: ICefRequestContextHandler;
function GetCachePath: ustring; function GetCachePath: ustring;
function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager; function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager;
function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;
function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean;
function ClearSchemeHandlerFactories: Boolean; function ClearSchemeHandlerFactories: Boolean;
procedure PurgePluginListCache(reloadPages: Boolean); procedure PurgePluginListCache(reloadPages: Boolean);
function HasPreference(const name: ustring): Boolean; function HasPreference(const name: ustring): Boolean;
function GetPreference(const name: ustring): ICefValue; function GetPreference(const name: ustring): ICefValue;
function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue;
function CanSetPreference(const name: ustring): Boolean; function CanSetPreference(const name: ustring): Boolean;
function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean;
procedure ClearCertificateExceptions(const callback: ICefCompletionCallback); procedure ClearCertificateExceptions(const callback: ICefCompletionCallback);
procedure CloseAllConnections(const callback: ICefCompletionCallback); procedure CloseAllConnections(const callback: ICefCompletionCallback);
procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback); procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback);
function ResolveHostCached(const origin: ustring; resolvedIps: TStrings): TCefErrorCode; function ResolveHostCached(const origin: ustring; const resolvedIps: TStrings): TCefErrorCode;
procedure LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue; const handler: ICefExtensionHandler);
function DidLoadExtension(const extension_id: ustring): boolean;
function HasExtension(const extension_id: ustring): boolean;
function GetExtensions(const extension_ids: TStringList): boolean;
function GetExtension(const extension_id: ustring): ICefExtension;
public public
class function UnWrap(data: Pointer): ICefRequestContext; class function UnWrap(data: Pointer): ICefRequestContext;
@ -89,7 +94,7 @@ implementation
uses uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, uCEFCookieManager, uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, uCEFCookieManager,
uCEFCompletionCallback, uCEFRequestContextHandler; uCEFCompletionCallback, uCEFRequestContextHandler, uCEFExtension;
function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean; function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean;
begin begin
@ -101,16 +106,12 @@ begin
Result := CefStringFreeAndGet(PCefRequestContext(FData).get_cache_path(FData)); Result := CefStringFreeAndGet(PCefRequestContext(FData).get_cache_path(FData));
end; end;
function TCefRequestContextRef.GetDefaultCookieManager( function TCefRequestContextRef.GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager;
const callback: ICefCompletionCallback): ICefCookieManager;
begin begin
Result := TCefCookieManagerRef.UnWrap( Result := TCefCookieManagerRef.UnWrap(PCefRequestContext(FData).get_default_cookie_manager(FData, CefGetData(callback)));
PCefRequestContext(FData).get_default_cookie_manager(
FData, CefGetData(callback)));
end; end;
function TCefRequestContextRef.GetDefaultCookieManagerProc( function TCefRequestContextRef.GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;
const callback: TCefCompletionCallbackProc): ICefCookieManager;
begin begin
Result := GetDefaultCookieManager(TCefFastCompletionCallback.Create(callback)); Result := GetDefaultCookieManager(TCefFastCompletionCallback.Create(callback));
end; end;
@ -122,23 +123,22 @@ end;
class function TCefRequestContextRef.Global: ICefRequestContext; class function TCefRequestContextRef.Global: ICefRequestContext;
begin begin
Result:= UnWrap(cef_request_context_get_global_context()); Result := UnWrap(cef_request_context_get_global_context());
end; end;
function TCefRequestContextRef.IsGlobal: Boolean; function TCefRequestContextRef.IsGlobal: Boolean;
begin begin
Result:= PCefRequestContext(FData).is_global(FData) <> 0; Result := PCefRequestContext(FData).is_global(FData) <> 0;
end; end;
function TCefRequestContextRef.IsSame(const other: ICefRequestContext): Boolean; function TCefRequestContextRef.IsSame(const other: ICefRequestContext): Boolean;
begin begin
Result:= PCefRequestContext(FData).is_same(FData, CefGetData(other)) <> 0; Result := PCefRequestContext(FData).is_same(FData, CefGetData(other)) <> 0;
end; end;
function TCefRequestContextRef.IsSharingWith( function TCefRequestContextRef.IsSharingWith(const other: ICefRequestContext): Boolean;
const other: ICefRequestContext): Boolean;
begin begin
Result:= PCefRequestContext(FData).is_sharing_with(FData, CefGetData(other)) <> 0; Result := PCefRequestContext(FData).is_sharing_with(FData, CefGetData(other)) <> 0;
end; end;
class function TCefRequestContextRef.New(const settings: PCefRequestContextSettings; class function TCefRequestContextRef.New(const settings: PCefRequestContextSettings;
@ -175,17 +175,17 @@ end;
function TCefRequestContextRef.HasPreference(const name: ustring): Boolean; function TCefRequestContextRef.HasPreference(const name: ustring): Boolean;
var var
n: TCefString; n : TCefString;
begin begin
n := CefString(name); n := CefString(name);
Result := PCefRequestContext(FData).has_preference(FData, @n) <> 0; Result := PCefRequestContext(FData).has_preference(FData, @n) <> 0;
end; end;
function TCefRequestContextRef.GetPreference(const name: ustring): ICefValue; function TCefRequestContextRef.GetPreference(const name: ustring): ICefValue;
var var
n: TCefString; n : TCefString;
begin begin
n := CefString(name); n := CefString(name);
Result := TCefValueRef.UnWrap(PCefRequestContext(FData).get_preference(FData, @n)); Result := TCefValueRef.UnWrap(PCefRequestContext(FData).get_preference(FData, @n));
end; end;
@ -198,18 +198,20 @@ function TCefRequestContextRef.CanSetPreference(const name: ustring): Boolean;
var var
n: TCefString; n: TCefString;
begin begin
n := CefString(name); n := CefString(name);
Result := PCefRequestContext(FData).can_set_preference(FData, @n) <> 0; Result := PCefRequestContext(FData).can_set_preference(FData, @n) <> 0;
end; end;
function TCefRequestContextRef.SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; function TCefRequestContextRef.SetPreference(const name : ustring;
const value : ICefValue;
out error : ustring): Boolean;
var var
n, e: TCefString; n, e: TCefString;
begin begin
n := CefString(name); n := CefString(name);
FillChar(e, SizeOf(e), 0); FillChar(e, SizeOf(e), 0);
Result := PCefRequestContext(FData).set_preference(FData, @n, CefGetData(value), @e) <> 0; Result := PCefRequestContext(FData).set_preference(FData, @n, CefGetData(value), @e) <> 0;
error := CefString(@e); error := CefString(@e);
end; end;
procedure TCefRequestContextRef.ClearCertificateExceptions(const callback: ICefCompletionCallback); procedure TCefRequestContextRef.ClearCertificateExceptions(const callback: ICefCompletionCallback);
@ -222,8 +224,8 @@ begin
PCefRequestContext(FData).close_all_connections(FData, CefGetData(callback)); PCefRequestContext(FData).close_all_connections(FData, CefGetData(callback));
end; end;
procedure TCefRequestContextRef.ResolveHost(const origin: ustring; procedure TCefRequestContextRef.ResolveHost(const origin : ustring;
const callback: ICefResolveCallback); const callback : ICefResolveCallback);
var var
o: TCefString; o: TCefString;
begin begin
@ -231,49 +233,114 @@ begin
PCefRequestContext(FData).resolve_host(FData, @o, CefGetData(callback)); PCefRequestContext(FData).resolve_host(FData, @o, CefGetData(callback));
end; end;
function TCefRequestContextRef.ResolveHostCached(const origin: ustring; function TCefRequestContextRef.ResolveHostCached(const origin : ustring;
resolvedIps: TStrings): TCefErrorCode; const resolvedIps : TStrings): TCefErrorCode;
var var
ips: TCefStringList; ips : TCefStringList;
o, str: TCefString; o, str : TCefString;
i: Integer; i : Integer;
begin begin
ips := cef_string_list_alloc; ips := cef_string_list_alloc;
try try
o := CefString(origin); o := CefString(origin);
Result := PCefRequestContext(FData).resolve_host_cached(FData, @o, ips); Result := PCefRequestContext(FData).resolve_host_cached(FData, @o, ips);
if Assigned(ips) then if Assigned(ips) then
for i := 0 to cef_string_list_size(ips) - 1 do for i := 0 to cef_string_list_size(ips) - 1 do
begin begin
FillChar(str, SizeOf(str), 0); FillChar(str, SizeOf(str), 0);
cef_string_list_value(ips, i, @str); cef_string_list_value(ips, i, @str);
resolvedIps.Add(CefStringClearAndGet(str)); resolvedIps.Add(CefStringClearAndGet(str));
end; end;
finally finally
cef_string_list_free(ips); cef_string_list_free(ips);
end; end;
end; end;
function TCefRequestContextRef.RegisterSchemeHandlerFactory(const schemeName, procedure TCefRequestContextRef.LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue; const handler: ICefExtensionHandler);
domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; var
TempDir : TCefString;
begin
TempDir := CefString(root_directory);
PCefRequestContext(FData).load_extension(FData, @TempDir, CefGetData(manifest), CefGetData(handler));
end;
function TCefRequestContextRef.DidLoadExtension(const extension_id: ustring): boolean;
var
TempID : TCefString;
begin
TempID := CefString(extension_id);
Result := PCefRequestContext(FData).did_load_extension(FData, @TempID) <> 0;
end;
function TCefRequestContextRef.HasExtension(const extension_id: ustring): boolean;
var
TempID : TCefString;
begin
TempID := CefString(extension_id);
Result := PCefRequestContext(FData).has_extension(FData, @TempID) <> 0;
end;
function TCefRequestContextRef.GetExtensions(const extension_ids: TStringList): boolean;
var
TempIDs : TCefStringList;
i, j : integer;
TempString : TCefString;
begin
TempIDs := cef_string_list_alloc;
try
Result := PCefRequestContext(FData).get_extensions(FData, TempIDs) <> 0;
if Assigned(TempIDs) then
begin
i := 0;
j := cef_string_list_size(TempIDs);
while (i < j) do
begin
FillChar(TempString, SizeOf(TempString), 0);
cef_string_list_value(TempIDs, i, @TempString);
extension_ids.Add(CefStringClearAndGet(TempString));
inc(i);
end;
end;
finally
cef_string_list_free(TempIDs);
end;
end;
function TCefRequestContextRef.GetExtension(const extension_id: ustring): ICefExtension;
var
TempID : TCefString;
begin
TempID := CefString(extension_id);
Result := TCefExtensionRef.UnWrap(PCefRequestContext(FData).get_extension(FData, @TempID));
end;
function TCefRequestContextRef.RegisterSchemeHandlerFactory(const schemeName : ustring;
const domainName : ustring;
const factory : ICefSchemeHandlerFactory): Boolean;
var var
s, d: TCefString; s, d: TCefString;
begin begin
s := CefString(schemeName); s := CefString(schemeName);
d := CefString(domainName); d := CefString(domainName);
Result := PCefRequestContext(FData).register_scheme_handler_factory(FData, @s, @d, CefGetData(factory)) <> 0; Result := PCefRequestContext(FData).register_scheme_handler_factory(FData, @s, @d, CefGetData(factory)) <> 0;
end; end;
class function TCefRequestContextRef.Shared(const other: ICefRequestContext; class function TCefRequestContextRef.Shared(const other : ICefRequestContext;
const handler: ICefRequestContextHandler): ICefRequestContext; const handler : ICefRequestContextHandler): ICefRequestContext;
begin begin
Result := UnWrap(cef_create_context_shared(CefGetData(other), CefGetData(handler))); Result := UnWrap(cef_create_context_shared(CefGetData(other), CefGetData(handler)));
end; end;
class function TCefRequestContextRef.UnWrap(data: Pointer): ICefRequestContext; class function TCefRequestContextRef.UnWrap(data: Pointer): ICefRequestContext;
begin begin
if data <> nil then if (data <> nil) then
Result := Create(data) as ICefRequestContext else Result := Create(data) as ICefRequestContext
else
Result := nil; Result := nil;
end; end;

View File

@ -54,8 +54,9 @@ type
TCefRequestContextHandlerRef = class(TCefBaseRefCountedRef, ICefRequestContextHandler) TCefRequestContextHandlerRef = class(TCefBaseRefCountedRef, ICefRequestContextHandler)
protected protected
function GetCookieManager: ICefCookieManager; procedure OnRequestContextInitialized(const request_context: ICefRequestContext);
function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; function GetCookieManager: ICefCookieManager;
function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean;
public public
class function UnWrap(data: Pointer): ICefRequestContextHandler; class function UnWrap(data: Pointer): ICefRequestContextHandler;
@ -63,8 +64,9 @@ type
TCefRequestContextHandlerOwn = class(TCefBaseRefCountedOwn, ICefRequestContextHandler) TCefRequestContextHandlerOwn = class(TCefBaseRefCountedOwn, ICefRequestContextHandler)
protected protected
function GetCookieManager: ICefCookieManager; virtual; procedure OnRequestContextInitialized(const request_context: ICefRequestContext);
function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; virtual; function GetCookieManager: ICefCookieManager; virtual;
function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; virtual;
public public
constructor Create; virtual; constructor Create; virtual;
@ -83,12 +85,18 @@ type
implementation implementation
uses uses
uCEFMiscFunctions, uCEFLibFunctions, uCEFCookieManager, uCEFWebPluginInfo; uCEFMiscFunctions, uCEFLibFunctions, uCEFCookieManager, uCEFWebPluginInfo, uCEFRequestContext;
// TCefRequestContextHandlerOwn
procedure cef_request_context_handler_on_request_context_initialized(self: PCefRequestContextHandler; request_context: PCefRequestContext); stdcall;
begin
TCefRequestContextHandlerOwn(CefGetObject(self)).OnRequestContextInitialized(TCefRequestContextRef.UnWrap(request_context));
end;
function cef_request_context_handler_get_cookie_manager(self: PCefRequestContextHandler): PCefCookieManager; stdcall; function cef_request_context_handler_get_cookie_manager(self: PCefRequestContextHandler): PCefCookieManager; stdcall;
begin begin
with TCefRequestContextHandlerOwn(CefGetObject(self)) do Result := CefGetData(TCefRequestContextHandlerOwn(CefGetObject(self)).GetCookieManager());
Result := CefGetData(GetCookieManager());
end; end;
function cef_request_context_handler_on_before_plugin_load(self: PCefRequestContextHandler; function cef_request_context_handler_on_before_plugin_load(self: PCefRequestContextHandler;
@ -107,6 +115,44 @@ begin
plugin_policy)); plugin_policy));
end; end;
constructor TCefRequestContextHandlerOwn.Create;
begin
CreateData(SizeOf(TCefRequestContextHandler), False);
with PCefRequestContextHandler(FData)^ do
begin
on_request_context_initialized := cef_request_context_handler_on_request_context_initialized;
get_cookie_manager := cef_request_context_handler_get_cookie_manager;
on_before_plugin_load := cef_request_context_handler_on_before_plugin_load;
end;
end;
procedure TCefRequestContextHandlerOwn.OnRequestContextInitialized(const request_context: ICefRequestContext);
begin
end;
function TCefRequestContextHandlerOwn.GetCookieManager: ICefCookieManager;
begin
Result:= nil;
end;
function TCefRequestContextHandlerOwn.OnBeforePluginLoad(const mimeType, pluginUrl : ustring;
isMainFrame : boolean;
const topOriginUrl: ustring;
const pluginInfo: ICefWebPluginInfo;
pluginPolicy: PCefPluginPolicy): Boolean;
begin
Result := False;
end;
// TCefRequestContextHandlerRef
procedure TCefRequestContextHandlerRef.OnRequestContextInitialized(const request_context: ICefRequestContext);
begin
PCefRequestContextHandler(FData).on_request_context_initialized(FData, CefGetData(request_context));
end;
function TCefRequestContextHandlerRef.GetCookieManager: ICefCookieManager; function TCefRequestContextHandlerRef.GetCookieManager: ICefCookieManager;
begin begin
Result := TCefCookieManagerRef.UnWrap(PCefRequestContextHandler(FData).get_cookie_manager(FData)); Result := TCefCookieManagerRef.UnWrap(PCefRequestContextHandler(FData).get_cookie_manager(FData));
@ -135,33 +181,6 @@ begin
Result := nil; Result := nil;
end; end;
// TCefRequestContextHandlerOwn
constructor TCefRequestContextHandlerOwn.Create;
begin
CreateData(SizeOf(TCefRequestContextHandler), False);
with PCefRequestContextHandler(FData)^ do
begin
get_cookie_manager := cef_request_context_handler_get_cookie_manager;
on_before_plugin_load := cef_request_context_handler_on_before_plugin_load;
end;
end;
function TCefRequestContextHandlerOwn.GetCookieManager: ICefCookieManager;
begin
Result:= nil;
end;
function TCefRequestContextHandlerOwn.OnBeforePluginLoad(const mimeType, pluginUrl : ustring;
isMainFrame : boolean;
const topOriginUrl: ustring;
const pluginInfo: ICefWebPluginInfo;
pluginPolicy: PCefPluginPolicy): Boolean;
begin
Result := False;
end;
// TCefFastRequestContextHandler // TCefFastRequestContextHandler
constructor TCefFastRequestContextHandler.Create(const proc: TCefRequestContextHandlerProc); constructor TCefFastRequestContextHandler.Create(const proc: TCefRequestContextHandlerProc);

View File

@ -689,7 +689,8 @@ type
PK_FILE_EXE, PK_FILE_EXE,
PK_FILE_MODULE, PK_FILE_MODULE,
PK_LOCAL_APP_DATA, PK_LOCAL_APP_DATA,
PK_USER_DATA PK_USER_DATA,
PK_DIR_RESOURCES
); );
// /include/internal/cef_types.h (cef_storage_type_t) // /include/internal/cef_types.h (cef_storage_type_t)
@ -1064,6 +1065,7 @@ type
on_tooltip: function(self: PCefDisplayHandler; browser: PCefBrowser; text: PCefString): Integer; stdcall; on_tooltip: function(self: PCefDisplayHandler; browser: PCefBrowser; text: PCefString): Integer; stdcall;
on_status_message: procedure(self: PCefDisplayHandler; browser: PCefBrowser; const value: PCefString); stdcall; on_status_message: procedure(self: PCefDisplayHandler; browser: PCefBrowser; const value: PCefString); stdcall;
on_console_message: function(self: PCefDisplayHandler; browser: PCefBrowser; const message: PCefString; const source: PCefString; line: Integer): Integer; stdcall; on_console_message: function(self: PCefDisplayHandler; browser: PCefBrowser; const message: PCefString; const source: PCefString; line: Integer): Integer; stdcall;
on_auto_resize: function(self: PCefDisplayHandler; browser: PCefBrowser; const new_size: PCefSize): Integer; stdcall;
end; end;
// /include/capi/cef_download_handler_capi.h (cef_download_handler_t) // /include/capi/cef_download_handler_capi.h (cef_download_handler_t)
@ -1172,6 +1174,7 @@ type
on_extension_loaded: procedure(self: PCefExtensionHandler; extension: PCefExtension); stdcall; on_extension_loaded: procedure(self: PCefExtensionHandler; extension: PCefExtension); stdcall;
on_extension_unloaded: procedure(self: PCefExtensionHandler; extension: PCefExtension); stdcall; on_extension_unloaded: procedure(self: PCefExtensionHandler; extension: PCefExtension); stdcall;
on_before_background_browser: function(self: PCefExtensionHandler; extension: PCefExtension; const url: PCefString; var client: PCefClient; settings: PCefBrowserSettings) : Integer; stdcall; on_before_background_browser: function(self: PCefExtensionHandler; extension: PCefExtension; const url: PCefString; var client: PCefClient; settings: PCefBrowserSettings) : Integer; stdcall;
on_before_browser: function(self: PCefExtensionHandler; extension: PCefExtension; browser, active_browser: PCefBrowser; index: Integer; const url: PCefString; active: Integer; windowInfo: PCefWindowInfo; var client: PCefClient; settings: PCefBrowserSettings) : Integer; stdcall;
get_active_browser: function(self: PCefExtensionHandler; extension: PCefExtension; browser: PCefBrowser; include_incognito: Integer): PCefBrowser; stdcall; get_active_browser: function(self: PCefExtensionHandler; extension: PCefExtension; browser: PCefBrowser; include_incognito: Integer): PCefBrowser; stdcall;
can_access_browser: function(self: PCefExtensionHandler; extension: PCefExtension; browser: PCefBrowser; include_incognito: Integer; target_browser: PCefBrowser): Integer; stdcall; can_access_browser: function(self: PCefExtensionHandler; extension: PCefExtension; browser: PCefBrowser; include_incognito: Integer; target_browser: PCefBrowser): Integer; stdcall;
get_extension_resource: function(self: PCefExtensionHandler; extension: PCefExtension; browser: PCefBrowser; const file_: PCefString; callback: PCefGetExtensionResourceCallback): Integer; stdcall; get_extension_resource: function(self: PCefExtensionHandler; extension: PCefExtension; browser: PCefBrowser; const file_: PCefString; callback: PCefGetExtensionResourceCallback): Integer; stdcall;
@ -1657,11 +1660,17 @@ type
close_all_connections: procedure(self: PCefRequestContext; callback: PCefCompletionCallback); stdcall; close_all_connections: procedure(self: PCefRequestContext; callback: PCefCompletionCallback); stdcall;
resolve_host: procedure(self: PCefRequestContext; const origin: PCefString; callback: PCefResolveCallback); stdcall; resolve_host: procedure(self: PCefRequestContext; const origin: PCefString; callback: PCefResolveCallback); stdcall;
resolve_host_cached: function(self: PCefRequestContext; const origin: PCefString; resolved_ips: TCefStringList): TCefErrorCode; stdcall; resolve_host_cached: function(self: PCefRequestContext; const origin: PCefString; resolved_ips: TCefStringList): TCefErrorCode; stdcall;
load_extension: procedure(self: PCefRequestContext; const root_directory: PCefString; manifest: PCefDictionaryValue; handler: PCefExtensionHandler); stdcall;
did_load_extension: function(self: PCefRequestContext; const extension_id: PCefString): Integer; stdcall;
has_extension: function(self: PCefRequestContext; const extension_id: PCefString): Integer; stdcall;
get_extensions: function(self: PCefRequestContext; extension_ids: TCefStringList): Integer; stdcall;
get_extension: function(self: PCefRequestContext; const extension_id: PCefString): PCefExtension; stdcall;
end; end;
// /include/capi/cef_request_context_handler_capi.h (cef_request_context_handler_t) // /include/capi/cef_request_context_handler_capi.h (cef_request_context_handler_t)
TCefRequestContextHandler = record TCefRequestContextHandler = record
base: TCefBaseRefCounted; base: TCefBaseRefCounted;
on_request_context_initialized: procedure(self: PCefRequestContextHandler; request_context: PCefRequestContext); stdcall;
get_cookie_manager: function(self: PCefRequestContextHandler): PCefCookieManager; stdcall; get_cookie_manager: function(self: PCefRequestContextHandler): PCefCookieManager; stdcall;
on_before_plugin_load: function(self: PCefRequestContextHandler; const mime_type, plugin_url : PCefString; is_main_frame : integer; const top_origin_url: PCefString; plugin_info: PCefWebPluginInfo; plugin_policy: PCefPluginPolicy): Integer; stdcall; on_before_plugin_load: function(self: PCefRequestContextHandler; const mime_type, plugin_url : PCefString; is_main_frame : integer; const top_origin_url: PCefString; plugin_info: PCefWebPluginInfo; plugin_policy: PCefPluginPolicy): Integer; stdcall;
end; end;
@ -2487,6 +2496,9 @@ type
drag_source_system_drag_ended: procedure(self: PCefBrowserHost); stdcall; drag_source_system_drag_ended: procedure(self: PCefBrowserHost); stdcall;
get_visible_navigation_entry: function(self: PCefBrowserHost): PCefNavigationEntry; stdcall; get_visible_navigation_entry: function(self: PCefBrowserHost): PCefNavigationEntry; stdcall;
set_accessibility_state: procedure(self: PCefBrowserHost; accessibility_state: TCefState); stdcall; set_accessibility_state: procedure(self: PCefBrowserHost; accessibility_state: TCefState); stdcall;
set_auto_resize_enabled: procedure(self: PCefBrowserHost; enabled: integer; const min_size, max_size: PCefSize); stdcall;
get_extension: function(self: PCefBrowserHost): PCefExtension; stdcall;
is_background_host: function(self: PCefBrowserHost): integer; stdcall;
end; end;
// /include/capi/cef_browser_capi.h (cef_browser_t) // /include/capi/cef_browser_capi.h (cef_browser_t)