From 26f286cae7e4ac0147fe9eeb80969b11998fb6cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Thu, 26 Oct 2017 13:23:13 +0200 Subject: [PATCH] Update to CEF 3.3202.1674.g2a991c4 --- source/uCEFApplication.pas | 10 +- source/uCEFBrowser.pas | 21 +++- source/uCEFChromium.pas | 12 ++ source/uCEFChromiumEvents.pas | 1 + source/uCEFDisplayHandler.pas | 59 +++++---- source/uCEFExtension.pas | 14 +-- source/uCEFExtensionHandler.pas | 79 ++++++++++-- source/uCEFInterfaces.pas | 87 +++++++------ source/uCEFRequestContext.pas | 181 ++++++++++++++++++--------- source/uCEFRequestContextHandler.pas | 87 ++++++++----- source/uCEFTypes.pas | 14 ++- 11 files changed, 393 insertions(+), 172 deletions(-) diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas index 0d73acfa..b2cfd8ce 100644 --- a/source/uCEFApplication.pas +++ b/source/uCEFApplication.pas @@ -56,14 +56,14 @@ uses const CEF_SUPPORTED_VERSION_MAJOR = 3; - CEF_SUPPORTED_VERSION_MINOR = 3163; - CEF_SUPPORTED_VERSION_RELEASE = 1671; + CEF_SUPPORTED_VERSION_MINOR = 3202; + CEF_SUPPORTED_VERSION_RELEASE = 1674; CEF_SUPPORTED_VERSION_BUILD = 0; - CEF_CHROMEELF_VERSION_MAJOR = 61; + CEF_CHROMEELF_VERSION_MAJOR = 62; CEF_CHROMEELF_VERSION_MINOR = 0; - CEF_CHROMEELF_VERSION_RELEASE = 3163; - CEF_CHROMEELF_VERSION_BUILD = 91; + CEF_CHROMEELF_VERSION_RELEASE = 3202; + CEF_CHROMEELF_VERSION_BUILD = 62; LIBCEF_DLL = 'libcef.dll'; CHROMEELF_DLL = 'chrome_elf.dll'; diff --git a/source/uCEFBrowser.pas b/source/uCEFBrowser.pas index c62896c6..bf0573be 100644 --- a/source/uCEFBrowser.pas +++ b/source/uCEFBrowser.pas @@ -140,6 +140,9 @@ type procedure DragSourceSystemDragEnded; function GetVisibleNavigationEntry : ICefNavigationEntry; procedure SetAccessibilityState(accessibilityState: TCefState); + procedure SetAutoResizeEnabled(enabled: boolean; const min_size, max_size: PCefSize); + function GetExtension : ICefExtension; + function IsBackgroundHost : boolean; public class function UnWrap(data: Pointer): ICefBrowserHost; @@ -149,7 +152,8 @@ implementation uses uCEFMiscFunctions, uCEFLibFunctions, uCEFDownloadImageCallBack, uCEFFrame, uCEFPDFPrintCallback, - uCEFRunFileDialogCallback, uCEFRequestContext, uCEFNavigationEntryVisitor, uCEFNavigationEntry; + uCEFRunFileDialogCallback, uCEFRequestContext, uCEFNavigationEntryVisitor, uCEFNavigationEntry, + uCEFExtension; function TCefBrowserRef.GetHost: ICefBrowserHost; begin @@ -369,6 +373,21 @@ begin PCefBrowserHost(FData).set_accessibility_state(FData, accessibilityState); 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; const event: PCefMouseEvent; allowedOps: TCefDragOperations); begin diff --git a/source/uCEFChromium.pas b/source/uCEFChromium.pas index 4aff362c..24bfe75e 100644 --- a/source/uCEFChromium.pas +++ b/source/uCEFChromium.pas @@ -136,6 +136,7 @@ type FOnTooltip : TOnTooltip; FOnStatusMessage : TOnStatusMessage; FOnConsoleMessage : TOnConsoleMessage; + FOnAutoResize : TOnAutoResize; // ICefDownloadHandler FOnBeforeDownload : TOnBeforeDownload; @@ -319,6 +320,7 @@ type function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; virtual; procedure doOnStatusMessage(const browser: ICefBrowser; const value: ustring); 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 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 OnStatusMessage : TOnStatusMessage read FOnStatusMessage write FOnStatusMessage; property OnConsoleMessage : TOnConsoleMessage read FOnConsoleMessage write FOnConsoleMessage; + property OnAutoResize : TOnAutoResize read FOnAutoResize write FOnAutoResize; // ICefDownloadHandler property OnBeforeDownload : TOnBeforeDownload read FOnBeforeDownload write FOnBeforeDownload; @@ -813,6 +816,7 @@ begin FOnTooltip := nil; FOnStatusMessage := nil; FOnConsoleMessage := nil; + FOnAutoResize := nil; // ICefDownloadHandler FOnBeforeDownload := nil; @@ -2567,6 +2571,14 @@ begin if Assigned(FOnConsoleMessage) then FOnConsoleMessage(Self, browser, aMessage, source, line, Result); 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; const frame : ICefFrame; const params : ICefContextMenuParams; diff --git a/source/uCEFChromiumEvents.pas b/source/uCEFChromiumEvents.pas index f1aa6fd9..5a969d0d 100644 --- a/source/uCEFChromiumEvents.pas +++ b/source/uCEFChromiumEvents.pas @@ -80,6 +80,7 @@ type 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; 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; 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; diff --git a/source/uCEFDisplayHandler.pas b/source/uCEFDisplayHandler.pas index 0b862ffa..fb34aaa4 100644 --- a/source/uCEFDisplayHandler.pas +++ b/source/uCEFDisplayHandler.pas @@ -64,6 +64,8 @@ type function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; virtual; procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring); 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 constructor Create; virtual; end; @@ -79,6 +81,7 @@ type function OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; override; procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring); 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 constructor Create(const events: IChromiumEvents); reintroduce; virtual; @@ -165,30 +168,40 @@ begin CefString(message), CefString(source), line)); 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; begin inherited CreateData(SizeOf(TCefDisplayHandler)); + with PCefDisplayHandler(FData)^ do - begin - on_address_change := cef_display_handler_on_address_change; - on_title_change := cef_display_handler_on_title_change; - on_favicon_urlchange := cef_display_handler_on_favicon_urlchange; - on_fullscreen_mode_change := cef_display_handler_on_fullscreen_mode_change; - on_tooltip := cef_display_handler_on_tooltip; - on_status_message := cef_display_handler_on_status_message; - on_console_message := cef_display_handler_on_console_message; - end; + begin + on_address_change := cef_display_handler_on_address_change; + on_title_change := cef_display_handler_on_title_change; + on_favicon_urlchange := cef_display_handler_on_favicon_urlchange; + on_fullscreen_mode_change := cef_display_handler_on_fullscreen_mode_change; + on_tooltip := cef_display_handler_on_tooltip; + on_status_message := cef_display_handler_on_status_message; + on_console_message := cef_display_handler_on_console_message; + on_auto_resize := cef_display_handler_on_auto_resize; + end; end; -procedure TCefDisplayHandlerOwn.OnAddressChange(const browser: ICefBrowser; - const frame: ICefFrame; const url: ustring); +procedure TCefDisplayHandlerOwn.OnAddressChange(const browser: ICefBrowser; const frame: ICefFrame; const url: ustring); begin end; -function TCefDisplayHandlerOwn.OnConsoleMessage(const browser: ICefBrowser; - const message, source: ustring; line: Integer): Boolean; +function TCefDisplayHandlerOwn.OnConsoleMessage(const browser: ICefBrowser; const message, source: ustring; line: Integer): Boolean; +begin + Result := False; +end; + +function TCefDisplayHandlerOwn.OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; begin Result := False; end; @@ -199,26 +212,22 @@ begin end; -procedure TCefDisplayHandlerOwn.OnFullScreenModeChange( - const browser: ICefBrowser; fullscreen: Boolean); +procedure TCefDisplayHandlerOwn.OnFullScreenModeChange(const browser: ICefBrowser; fullscreen: Boolean); begin end; -procedure TCefDisplayHandlerOwn.OnStatusMessage(const browser: ICefBrowser; - const value: ustring); +procedure TCefDisplayHandlerOwn.OnStatusMessage(const browser: ICefBrowser; const value: ustring); begin end; -procedure TCefDisplayHandlerOwn.OnTitleChange(const browser: ICefBrowser; - const title: ustring); +procedure TCefDisplayHandlerOwn.OnTitleChange(const browser: ICefBrowser; const title: ustring); begin end; -function TCefDisplayHandlerOwn.OnTooltip(const browser: ICefBrowser; - var text: ustring): Boolean; +function TCefDisplayHandlerOwn.OnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; begin Result := False; end; @@ -257,6 +266,14 @@ begin Result := inherited OnConsoleMessage(browser, message, source, line); 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); begin if (FEvent <> nil) then FEvent.doOnFaviconUrlChange(browser, iconUrls); diff --git a/source/uCEFExtension.pas b/source/uCEFExtension.pas index dabb3680..e0a23d81 100644 --- a/source/uCEFExtension.pas +++ b/source/uCEFExtension.pas @@ -52,13 +52,13 @@ uses type TCefExtensionRef = class(TCefBaseRefCountedRef, ICefExtension) protected - function GetIdentifier : ustring; - function GetPath : ustring; - function GetManifest : ICefDictionaryValue; - function IsSame(const that : ICefExtension) : boolean; - function GetHandler : ICefExtensionHandler; - function GetLoaderContext: ICefRequestContext; - function IsLoaded : boolean; + function GetIdentifier : ustring; + function GetPath : ustring; + function GetManifest : ICefDictionaryValue; + function IsSame(const that : ICefExtension) : boolean; + function GetHandler : ICefExtensionHandler; + function GetLoaderContext: ICefRequestContext; + function IsLoaded : boolean; procedure unload; public diff --git a/source/uCEFExtensionHandler.pas b/source/uCEFExtensionHandler.pas index 5fa8c15f..2081db80 100644 --- a/source/uCEFExtensionHandler.pas +++ b/source/uCEFExtensionHandler.pas @@ -55,10 +55,11 @@ type procedure OnExtensionLoadFailed(result: TCefErrorcode); procedure OnExtensionLoaded(const extension: ICefExtension); procedure OnExtensionUnloaded(const extension: ICefExtension); - 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 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; + function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; + 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 GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; + 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 class function UnWrap(data: Pointer): ICefExtensionHandler; @@ -69,10 +70,11 @@ type procedure OnExtensionLoadFailed(result: TCefErrorcode); virtual; procedure OnExtensionLoaded(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 GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; 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; + function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; 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 GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; 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 constructor Create; virtual; @@ -111,6 +113,19 @@ begin Result := False; 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; const browser : ICefBrowser; include_incognito : boolean): ICefBrowser; @@ -203,6 +218,40 @@ begin client := CefGetData(TempClient); 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; extension : PCefExtension; browser : PCefBrowser; @@ -247,6 +296,7 @@ begin on_extension_loaded := cef_extension_handler_on_extension_loaded; on_extension_unloaded := cef_extension_handler_on_extension_unloaded; 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; can_access_browser := cef_extension_handler_can_access_browser; get_extension_resource := cef_extension_handler_get_extension_resource; @@ -276,6 +326,19 @@ begin Result := True; 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; const browser : ICefBrowser; include_incognito : boolean): ICefBrowser; diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index b5d6126b..0146ea86 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -221,6 +221,9 @@ type procedure DragSourceSystemDragEnded; function GetVisibleNavigationEntry : ICefNavigationEntry; 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 WindowHandle: TCefWindowHandle read GetWindowHandle; @@ -1209,27 +1212,28 @@ type procedure OnExtensionLoadFailed(result: TCefErrorcode); procedure OnExtensionLoaded(const extension: ICefExtension); procedure OnExtensionUnloaded(const extension: ICefExtension); - 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 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; + function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; + 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 GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; + 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; ICefExtension = interface(ICefBaseRefCounted) ['{D30D1C64-A26F-49C0-AEB7-C55EC68951CA}'] - function GetIdentifier : ustring; - function GetPath : ustring; - function GetManifest : ICefDictionaryValue; - function IsSame(const that : ICefExtension) : boolean; - function GetHandler : ICefExtensionHandler; - function GetLoaderContext: ICefRequestContext; - function IsLoaded : boolean; + function GetIdentifier : ustring; + function GetPath : ustring; + function GetManifest : ICefDictionaryValue; + function IsSame(const that : ICefExtension) : boolean; + function GetHandler : ICefExtensionHandler; + function GetLoaderContext : ICefRequestContext; + function IsLoaded : boolean; procedure unload; - property Identifier : ustring read GetIdentifier; - property Path : ustring read GetPath; - property Manifest : ICefDictionaryValue read GetManifest; - property Handler : ICefExtensionHandler read GetHandler; - property LoaderContext : ICefRequestContext read GetLoaderContext; + property Identifier : ustring read GetIdentifier; + property Path : ustring read GetPath; + property Manifest : ICefDictionaryValue read GetManifest; + property Handler : ICefExtensionHandler read GetHandler; + property LoaderContext : ICefRequestContext read GetLoaderContext; end; @@ -1238,8 +1242,7 @@ type procedure OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); procedure OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType); procedure OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); - procedure OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; - const errorText, failedUrl: ustring); + procedure OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring); end; ICefRequestCallback = interface(ICefBaseRefCounted) @@ -1280,9 +1283,10 @@ type procedure OnTitleChange(const browser: ICefBrowser; const title: ustring); procedure OnFaviconUrlChange(const browser: ICefBrowser; icon_urls: TStrings); 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); - 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; ICefFocusHandler = interface(ICefBaseRefCounted) @@ -1485,6 +1489,7 @@ type ICefRequestContextHandler = interface(ICefBaseRefCounted) ['{76EB1FA7-78DF-4FD5-ABB3-1CDD3E73A140}'] + procedure OnRequestContextInitialized(const request_context: ICefRequestContext); function GetCookieManager: ICefCookieManager; function OnBeforePluginLoad(const mimeType, pluginUrl:ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; @@ -1497,28 +1502,33 @@ type ICefRequestContext = interface(ICefBaseRefCounted) ['{5830847A-2971-4BD5-ABE6-21451F8923F7}'] - function IsSame(const other: ICefRequestContext): Boolean; - function IsSharingWith(const other: ICefRequestContext): Boolean; - function IsGlobal: Boolean; - function GetHandler: ICefRequestContextHandler; - function GetCachePath: ustring; - function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager; - function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; - function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; - const factory: ICefSchemeHandlerFactory): Boolean; - function ClearSchemeHandlerFactories: Boolean; + function IsSame(const other: ICefRequestContext): Boolean; + function IsSharingWith(const other: ICefRequestContext): Boolean; + function IsGlobal: Boolean; + function GetHandler: ICefRequestContextHandler; + function GetCachePath: ustring; + function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager; + function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; + function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; + function ClearSchemeHandlerFactories: Boolean; procedure PurgePluginListCache(reloadPages: Boolean); - function HasPreference(const name: ustring): Boolean; - function GetPreference(const name: ustring): ICefValue; - function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; - function CanSetPreference(const name: ustring): Boolean; - function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; + function HasPreference(const name: ustring): Boolean; + function GetPreference(const name: ustring): ICefValue; + function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; + function CanSetPreference(const name: ustring): Boolean; + function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; procedure ClearCertificateExceptions(const callback: ICefCompletionCallback); procedure CloseAllConnections(const callback: ICefCompletionCallback); procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback); - function ResolveHostCached(const origin: ustring; resolvedIps: TStrings): TCefErrorCode; - property CachePath: ustring read GetCachePath; - property IsGlobalContext: boolean read IsGlobal; + 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; + + property CachePath : ustring read GetCachePath; + property IsGlobalContext : boolean read IsGlobal; end; ICefPrintSettings = Interface(ICefBaseRefCounted) @@ -1732,6 +1742,7 @@ type function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; procedure doOnStatusMessage(const browser: ICefBrowser; const value: ustring); 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; procedure doOnCancelGeolocationPermission(const browser: ICefBrowser; requestId: Integer); diff --git a/source/uCEFRequestContext.pas b/source/uCEFRequestContext.pas index b8fc0177..7e27fb0f 100644 --- a/source/uCEFRequestContext.pas +++ b/source/uCEFRequestContext.pas @@ -57,25 +57,30 @@ uses type TCefRequestContextRef = class(TCefBaseRefCountedRef, ICefRequestContext) protected - function IsSame(const other: ICefRequestContext): Boolean; - function IsSharingWith(const other: ICefRequestContext): Boolean; - function IsGlobal: Boolean; - function GetHandler: ICefRequestContextHandler; - function GetCachePath: ustring; - function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager; - function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; - function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; - function ClearSchemeHandlerFactories: Boolean; + function IsSame(const other: ICefRequestContext): Boolean; + function IsSharingWith(const other: ICefRequestContext): Boolean; + function IsGlobal: Boolean; + function GetHandler: ICefRequestContextHandler; + function GetCachePath: ustring; + function GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager; + function GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; + function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; + function ClearSchemeHandlerFactories: Boolean; procedure PurgePluginListCache(reloadPages: Boolean); - function HasPreference(const name: ustring): Boolean; - function GetPreference(const name: ustring): ICefValue; - function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; - function CanSetPreference(const name: ustring): Boolean; - function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; + function HasPreference(const name: ustring): Boolean; + function GetPreference(const name: ustring): ICefValue; + function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; + function CanSetPreference(const name: ustring): Boolean; + function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; procedure ClearCertificateExceptions(const callback: ICefCompletionCallback); procedure CloseAllConnections(const callback: ICefCompletionCallback); 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 class function UnWrap(data: Pointer): ICefRequestContext; @@ -89,7 +94,7 @@ implementation uses uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, uCEFCookieManager, - uCEFCompletionCallback, uCEFRequestContextHandler; + uCEFCompletionCallback, uCEFRequestContextHandler, uCEFExtension; function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean; begin @@ -101,16 +106,12 @@ begin Result := CefStringFreeAndGet(PCefRequestContext(FData).get_cache_path(FData)); end; -function TCefRequestContextRef.GetDefaultCookieManager( - const callback: ICefCompletionCallback): ICefCookieManager; +function TCefRequestContextRef.GetDefaultCookieManager(const callback: ICefCompletionCallback): ICefCookieManager; begin - Result := TCefCookieManagerRef.UnWrap( - PCefRequestContext(FData).get_default_cookie_manager( - FData, CefGetData(callback))); + Result := TCefCookieManagerRef.UnWrap(PCefRequestContext(FData).get_default_cookie_manager(FData, CefGetData(callback))); end; -function TCefRequestContextRef.GetDefaultCookieManagerProc( - const callback: TCefCompletionCallbackProc): ICefCookieManager; +function TCefRequestContextRef.GetDefaultCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; begin Result := GetDefaultCookieManager(TCefFastCompletionCallback.Create(callback)); end; @@ -122,23 +123,22 @@ end; class function TCefRequestContextRef.Global: ICefRequestContext; begin - Result:= UnWrap(cef_request_context_get_global_context()); + Result := UnWrap(cef_request_context_get_global_context()); end; function TCefRequestContextRef.IsGlobal: Boolean; begin - Result:= PCefRequestContext(FData).is_global(FData) <> 0; + Result := PCefRequestContext(FData).is_global(FData) <> 0; end; function TCefRequestContextRef.IsSame(const other: ICefRequestContext): Boolean; begin - Result:= PCefRequestContext(FData).is_same(FData, CefGetData(other)) <> 0; + Result := PCefRequestContext(FData).is_same(FData, CefGetData(other)) <> 0; end; -function TCefRequestContextRef.IsSharingWith( - const other: ICefRequestContext): Boolean; +function TCefRequestContextRef.IsSharingWith(const other: ICefRequestContext): Boolean; begin - Result:= PCefRequestContext(FData).is_sharing_with(FData, CefGetData(other)) <> 0; + Result := PCefRequestContext(FData).is_sharing_with(FData, CefGetData(other)) <> 0; end; class function TCefRequestContextRef.New(const settings: PCefRequestContextSettings; @@ -175,17 +175,17 @@ end; function TCefRequestContextRef.HasPreference(const name: ustring): Boolean; var - n: TCefString; + n : TCefString; begin - n := CefString(name); + n := CefString(name); Result := PCefRequestContext(FData).has_preference(FData, @n) <> 0; end; function TCefRequestContextRef.GetPreference(const name: ustring): ICefValue; var - n: TCefString; + n : TCefString; begin - n := CefString(name); + n := CefString(name); Result := TCefValueRef.UnWrap(PCefRequestContext(FData).get_preference(FData, @n)); end; @@ -198,18 +198,20 @@ function TCefRequestContextRef.CanSetPreference(const name: ustring): Boolean; var n: TCefString; begin - n := CefString(name); + n := CefString(name); Result := PCefRequestContext(FData).can_set_preference(FData, @n) <> 0; 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 n, e: TCefString; begin n := CefString(name); FillChar(e, SizeOf(e), 0); Result := PCefRequestContext(FData).set_preference(FData, @n, CefGetData(value), @e) <> 0; - error := CefString(@e); + error := CefString(@e); end; procedure TCefRequestContextRef.ClearCertificateExceptions(const callback: ICefCompletionCallback); @@ -222,8 +224,8 @@ begin PCefRequestContext(FData).close_all_connections(FData, CefGetData(callback)); end; -procedure TCefRequestContextRef.ResolveHost(const origin: ustring; - const callback: ICefResolveCallback); +procedure TCefRequestContextRef.ResolveHost(const origin : ustring; + const callback : ICefResolveCallback); var o: TCefString; begin @@ -231,49 +233,114 @@ begin PCefRequestContext(FData).resolve_host(FData, @o, CefGetData(callback)); end; -function TCefRequestContextRef.ResolveHostCached(const origin: ustring; - resolvedIps: TStrings): TCefErrorCode; +function TCefRequestContextRef.ResolveHostCached(const origin : ustring; + const resolvedIps : TStrings): TCefErrorCode; var - ips: TCefStringList; - o, str: TCefString; - i: Integer; + ips : TCefStringList; + o, str : TCefString; + i : Integer; begin ips := cef_string_list_alloc; + try - o := CefString(origin); + o := CefString(origin); Result := PCefRequestContext(FData).resolve_host_cached(FData, @o, ips); + if Assigned(ips) then for i := 0 to cef_string_list_size(ips) - 1 do - begin - FillChar(str, SizeOf(str), 0); - cef_string_list_value(ips, i, @str); - resolvedIps.Add(CefStringClearAndGet(str)); - end; + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(ips, i, @str); + resolvedIps.Add(CefStringClearAndGet(str)); + end; finally cef_string_list_free(ips); end; end; -function TCefRequestContextRef.RegisterSchemeHandlerFactory(const schemeName, - domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; +procedure TCefRequestContextRef.LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue; const handler: ICefExtensionHandler); +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 s, d: TCefString; begin - s := CefString(schemeName); - d := CefString(domainName); + s := CefString(schemeName); + d := CefString(domainName); Result := PCefRequestContext(FData).register_scheme_handler_factory(FData, @s, @d, CefGetData(factory)) <> 0; end; -class function TCefRequestContextRef.Shared(const other: ICefRequestContext; - const handler: ICefRequestContextHandler): ICefRequestContext; +class function TCefRequestContextRef.Shared(const other : ICefRequestContext; + const handler : ICefRequestContextHandler): ICefRequestContext; begin Result := UnWrap(cef_create_context_shared(CefGetData(other), CefGetData(handler))); end; class function TCefRequestContextRef.UnWrap(data: Pointer): ICefRequestContext; begin - if data <> nil then - Result := Create(data) as ICefRequestContext else + if (data <> nil) then + Result := Create(data) as ICefRequestContext + else Result := nil; end; diff --git a/source/uCEFRequestContextHandler.pas b/source/uCEFRequestContextHandler.pas index a7c15b15..7cb649f6 100644 --- a/source/uCEFRequestContextHandler.pas +++ b/source/uCEFRequestContextHandler.pas @@ -54,8 +54,9 @@ type TCefRequestContextHandlerRef = class(TCefBaseRefCountedRef, ICefRequestContextHandler) protected - function GetCookieManager: ICefCookieManager; - function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; + procedure OnRequestContextInitialized(const request_context: ICefRequestContext); + function GetCookieManager: ICefCookieManager; + function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; public class function UnWrap(data: Pointer): ICefRequestContextHandler; @@ -63,8 +64,9 @@ type TCefRequestContextHandlerOwn = class(TCefBaseRefCountedOwn, ICefRequestContextHandler) protected - function GetCookieManager: ICefCookieManager; virtual; - function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; virtual; + procedure OnRequestContextInitialized(const request_context: ICefRequestContext); + function GetCookieManager: ICefCookieManager; virtual; + function OnBeforePluginLoad(const mimeType, pluginUrl: ustring; isMainFrame : boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; pluginPolicy: PCefPluginPolicy): Boolean; virtual; public constructor Create; virtual; @@ -83,12 +85,18 @@ type implementation 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; begin - with TCefRequestContextHandlerOwn(CefGetObject(self)) do - Result := CefGetData(GetCookieManager()); + Result := CefGetData(TCefRequestContextHandlerOwn(CefGetObject(self)).GetCookieManager()); end; function cef_request_context_handler_on_before_plugin_load(self: PCefRequestContextHandler; @@ -107,6 +115,44 @@ begin plugin_policy)); 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; begin Result := TCefCookieManagerRef.UnWrap(PCefRequestContextHandler(FData).get_cookie_manager(FData)); @@ -135,33 +181,6 @@ begin Result := nil; 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 constructor TCefFastRequestContextHandler.Create(const proc: TCefRequestContextHandlerProc); diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas index c67f009f..2c29868f 100644 --- a/source/uCEFTypes.pas +++ b/source/uCEFTypes.pas @@ -689,7 +689,8 @@ type PK_FILE_EXE, PK_FILE_MODULE, PK_LOCAL_APP_DATA, - PK_USER_DATA + PK_USER_DATA, + PK_DIR_RESOURCES ); // /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_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_auto_resize: function(self: PCefDisplayHandler; browser: PCefBrowser; const new_size: PCefSize): Integer; stdcall; end; // /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_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_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; 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; @@ -1657,11 +1660,17 @@ type close_all_connections: procedure(self: PCefRequestContext; callback: PCefCompletionCallback); 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; + 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; // /include/capi/cef_request_context_handler_capi.h (cef_request_context_handler_t) TCefRequestContextHandler = record base: TCefBaseRefCounted; + on_request_context_initialized: procedure(self: PCefRequestContextHandler; request_context: PCefRequestContext); 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; end; @@ -2487,6 +2496,9 @@ type drag_source_system_drag_ended: procedure(self: PCefBrowserHost); stdcall; get_visible_navigation_entry: function(self: PCefBrowserHost): PCefNavigationEntry; 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; // /include/capi/cef_browser_capi.h (cef_browser_t)