From 50c526f3390f96e5eaf66b60f60ae347857db883 Mon Sep 17 00:00:00 2001 From: "d.l.i.w" Date: Thu, 16 May 2013 20:36:35 +0200 Subject: [PATCH] Initial import --- .gitignore | 9 + Component/cef3.lpk | 77 + Component/cef3.pas | 22 + Component/cef3lcl.pas | 1031 +++++ Component/icon.lrs | 54 + Examples/LCLSimple/main.lfm | 71 + Examples/LCLSimple/main.pas | 63 + Examples/LCLSimple/simple.ico | Bin 0 -> 137040 bytes Examples/LCLSimple/simple.lpi | 107 + Examples/LCLSimple/simple.lpr | 22 + Examples/Minimal/minimal.lpi | 99 + Examples/Minimal/minimal.lpr | 349 ++ Readme.md | 68 + cef.inc | 36 + cef3api.pas | 969 ++++ cef3api_static.pas | 672 +++ cef3class.pas | 8113 +++++++++++++++++++++++++++++++++ cef3gui.pas | 1043 +++++ cef3intf.pas | 1157 +++++ cef3lib.pas | 4550 ++++++++++++++++++ 20 files changed, 18512 insertions(+) create mode 100644 .gitignore create mode 100644 Component/cef3.lpk create mode 100644 Component/cef3.pas create mode 100644 Component/cef3lcl.pas create mode 100644 Component/icon.lrs create mode 100644 Examples/LCLSimple/main.lfm create mode 100644 Examples/LCLSimple/main.pas create mode 100644 Examples/LCLSimple/simple.ico create mode 100644 Examples/LCLSimple/simple.lpi create mode 100644 Examples/LCLSimple/simple.lpr create mode 100644 Examples/Minimal/minimal.lpi create mode 100644 Examples/Minimal/minimal.lpr create mode 100644 Readme.md create mode 100644 cef.inc create mode 100644 cef3api.pas create mode 100644 cef3api_static.pas create mode 100644 cef3class.pas create mode 100644 cef3gui.pas create mode 100644 cef3intf.pas create mode 100644 cef3lib.pas diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..776fcab --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +backup/ +lib/ +*.lps +*.[oa] +*.exe +*.res +.directory +gmon.out +ppas.sh \ No newline at end of file diff --git a/Component/cef3.lpk b/Component/cef3.lpk new file mode 100644 index 0000000..484f9fd --- /dev/null +++ b/Component/cef3.lpk @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Component/cef3.pas b/Component/cef3.pas new file mode 100644 index 0000000..9f40c1c --- /dev/null +++ b/Component/cef3.pas @@ -0,0 +1,22 @@ +{ This file was automatically created by Lazarus. Do not edit! + This source is only used to compile and install the package. + } + +unit CEF3; + +interface + +uses + cef3lcl, cef3api, cef3api_static, cef3class, cef3gui, cef3intf, + LazarusPackageIntf; + +implementation + +procedure Register; +begin + RegisterUnit('cef3lcl', @cef3lcl.Register); +end; + +initialization + RegisterPackage('CEF3', @Register); +end. diff --git a/Component/cef3lcl.pas b/Component/cef3lcl.pas new file mode 100644 index 0000000..43742aa --- /dev/null +++ b/Component/cef3lcl.pas @@ -0,0 +1,1031 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Author: d.l.i.w + * Repository: http://github.com/dliw/fpCEF3 + * + *) + +Unit cef3lcl; + +{$I cef.inc} + +{ + Choose the right backend depending on used LCL widgetset + Currently supported: + gtk2 / Linux +} +(* +{$IFDEF LCLGTK} + {$IFDEF Linux} + {$DEFINE TargetDefined} + {$ENDIF} +{$ENDIF} +*) +{$IFDEF LCLGTK2} + {$IFDEF Linux} + {$DEFINE TargetDefined} + {$ENDIF} +{$ENDIF} +(* +{$IFDEF LCLCarbon} + {$DEFINE TargetDefined} +{$ENDIF} +{$IFDEF LCLWin32} + {$DEFINE TargetDefined} +{$ENDIF} +{$IFDEF LCLQT} + {$DEFINE TargetDefined} +{$ENDIF} +*) +{$IFNDEF TargetDefined} + {$ERROR this LCL widgetset/OS is not yet supported} +{$ENDIF} + +Interface +Uses + Classes, SysUtils, LCLProc, Forms, Controls, LCLType, LCLIntf, LResources, InterfaceBase, + Graphics, LMessages, WSLCLClasses, WSControls, + {$IFDEF LCLGTK2} + Gtk2Def, gdk2x, glib2, gdk2, gtk2, Gtk2Int, Gtk2Proc, + {$ENDIF} + cef3lib, cef3intf, cef3class, cef3gui; + +type + + { TCustomChromium } + + TCustomChromium = class(TWinControl, IChromiumEvents) + private + FHandler: ICefClient; + FBrowser: ICefBrowser; + FBrowserId: Integer; + FDefaultUrl: ustring; + + FWidget : PGtkWidget; + FCanvas : TCanvas; + + FOnProcessMessageReceived: TOnProcessMessageReceived; + FOnLoadStart: TOnLoadStart; + FOnLoadEnd: TOnLoadEnd; + FOnLoadError: TOnLoadError; + FOnRenderProcessTerminated: TOnRenderProcessTerminated; + FOnPluginCrashed: TOnPluginCrashed; + + FOnTakeFocus: TOnTakeFocus; + FOnSetFocus: TOnSetFocus; + FOnGotFocus: TOnGotFocus; + FOnBeforeContextMenu: TOnBeforeContextMenu; + FOnContextMenuCommand: TOnContextMenuCommand; + FOnContextMenuDismissed: TOnContextMenuDismissed; + FOnPreKeyEvent: TOnPreKeyEvent; + FOnKeyEvent: TOnKeyEvent; + FOnLoadingStateChange: TOnLoadingStateChange; + + FOnAddressChange: TOnAddressChange; + FOnTitleChange: TOnTitleChange; + FOnTooltip: TOnTooltip; + FOnStatusMessage: TOnStatusMessage; + FOnConsoleMessage: TOnConsoleMessage; + FOnBeforeDownload: TOnBeforeDownload; + FOnDownloadUpdated: TOnDownloadUpdated; + FOnRequestGeolocationPermission: TOnRequestGeolocationPermission; + FOnCancelGeolocationPermission: TOnCancelGeolocationPermission; + FOnJsdialog: TOnJsdialog; + + FOnBeforeUnloadDialog: TOnBeforeUnloadDialog; + FOnResetDialogState: TOnResetDialogState; + FOnBeforePopup: TOnBeforePopup; + FOnAfterCreated: TOnAfterCreated; + FOnBeforeClose: TOnBeforeClose; + FOnRunModal: TOnRunModal; + FOnClose: TOnClose; + FOnBeforeResourceLoad: TOnBeforeResourceLoad; + FOnGetResourceHandler: TOnGetResourceHandler; + FOnResourceRedirect: TOnResourceRedirect; + FOnGetAuthCredentials: TOnGetAuthCredentials; + FOnQuotaRequest: TOnQuotaRequest; + FOnGetCookieManager: TOnGetCookieManager; + FOnProtocolExecution: TOnProtocolExecution; + + FOnBeforePluginLoad: TOnBeforePluginLoad; + + FOnFileDialog: TOnFileDialog; + + FOptions: TChromiumOptions; + FUserStyleSheetLocation: ustring; + FDefaultEncoding: ustring; + FFontOptions: TChromiumFontOptions; + + procedure GetSettings(var settings: TCefBrowserSettings); + procedure CreateBrowser; + protected + procedure CreateWnd; override; + + procedure WMPaint(var Msg : TLMPaint); message LM_PAINT; + protected + function doOnProcessMessageReceived(const Browser: ICefBrowser; + sourceProcess: TCefProcessId; const Message: ICefProcessMessage): Boolean; virtual; + + procedure doOnLoadStart(const Browser: ICefBrowser; const Frame: ICefFrame); virtual; + procedure doOnLoadEnd(const Browser: ICefBrowser; const Frame: ICefFrame; httpStatusCode: Integer); virtual; + procedure doOnLoadError(const Browser: ICefBrowser; const Frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring); virtual; + procedure doOnRenderProcessTerminated(const Browser: ICefBrowser; Status: TCefTerminationStatus); virtual; + procedure doOnPluginCrashed(const Browser: ICefBrowser; const pluginPath: ustring); virtual; + + procedure doOnTakeFocus(const Browser: ICefBrowser; next: Boolean); virtual; + function doOnSetFocus(const Browser: ICefBrowser; Source: TCefFocusSource): Boolean; virtual; + procedure doOnGotFocus(const Browser: ICefBrowser); virtual; + + procedure doOnBeforeContextMenu(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); virtual; + function doOnContextMenuCommand(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags): Boolean; virtual; + procedure doOnContextMenuDismissed(const Browser: ICefBrowser; const Frame: ICefFrame); virtual; + + function doOnPreKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; virtual; + function doOnKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle): Boolean; virtual; + + procedure doOnLoadingStateChange(const Browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); virtual; + procedure doOnAddressChange(const Browser: ICefBrowser; const Frame: ICefFrame; const url: ustring); virtual; + procedure doOnTitleChange(const Browser: ICefBrowser; const title: ustring); virtual; + function doOnTooltip(const Browser: ICefBrowser; var atext: ustring): Boolean; virtual; + procedure doOnStatusMessage(const Browser: ICefBrowser; const value: ustring); virtual; + function doOnConsoleMessage(const Browser: ICefBrowser; const Message, Source: ustring; line: Integer): Boolean; virtual; + + procedure doOnBeforeDownload(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); virtual; + procedure doOnDownloadUpdated(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); virtual; + + procedure doOnRequestGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback); virtual; + procedure doOnCancelGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer); virtual; + + function doOnJsdialog(const Browser: ICefBrowser; const originUrl, acceptLang: ustring; + dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; + callback: ICefJsDialogCallback; out suppressMessage: Boolean): Boolean; virtual; + function doOnBeforeUnloadDialog(const Browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback): Boolean; virtual; + procedure doOnResetDialogState(const Browser: ICefBrowser); virtual; + + function doOnBeforePopup(const Browser: ICefBrowser; + const Frame: ICefFrame; const targetUrl, targetFrameName: ustring; + var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; + var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; virtual; + procedure doOnAfterCreated(const Browser: ICefBrowser); virtual; + procedure doOnBeforeClose(const Browser: ICefBrowser); virtual; + function doOnRunModal(const Browser: ICefBrowser): Boolean; virtual; + function doOnClose(const Browser: ICefBrowser): Boolean; virtual; + + function doOnBeforeResourceLoad(const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest): Boolean; virtual; + function doOnGetResourceHandler(const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest): ICefResourceHandler; virtual; + procedure doOnResourceRedirect(const Browser: ICefBrowser; const Frame: ICefFrame; + const oldUrl: ustring; var newUrl: ustring); virtual; + function doOnGetAuthCredentials(const Browser: ICefBrowser; const Frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback): Boolean; virtual; + function doOnQuotaRequest(const Browser: ICefBrowser; const originUrl: ustring; + newSize: Int64; const callback: ICefQuotaCallback): Boolean; virtual; + function doOnGetCookieManager(const Browser: ICefBrowser; + const mainUrl: ustring): ICefCookieManager; virtual; + procedure doOnProtocolExecution(const Browser: ICefBrowser; + + const url: ustring; out allowOsExecution: Boolean); virtual; + + function doOnBeforePluginLoad(const Browser: ICefBrowser; const url, + policyUrl: ustring; const info: ICefWebPluginInfo): Boolean; virtual; + + function doOnFileDialog(const Browser: ICefBrowser; mode: TCefFileDialogMode; + const title, defaultFileName: ustring; acceptTypes: TStrings; + const callback: ICefFileDialogCallback): Boolean; + + function doOnGetRootScreenRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; + function doOnGetViewRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; + function doOnGetScreenPoint(const Browser: ICefBrowser; viewX, viewY: Integer; + screenX, screenY: PInteger): Boolean; + procedure doOnPopupShow(const Browser: ICefBrowser; doshow: Boolean); + procedure doOnPopupSize(const Browser: ICefBrowser; const rect: PCefRect); + procedure doOnPaint(const Browser: ICefBrowser; kind: TCefPaintElementType; + dirtyRectsCount: Cardinal; const dirtyRects: PCefRectArray; + const buffer: Pointer; awidth, aheight: Integer); + procedure doOnCursorChange(const Browser: ICefBrowser; acursor: TCefCursorHandle); + + property OnProcessMessageReceived: TOnProcessMessageReceived read FOnProcessMessageReceived write FOnProcessMessageReceived; + property OnLoadStart: TOnLoadStart read FOnLoadStart write FOnLoadStart; + property OnLoadEnd: TOnLoadEnd read FOnLoadEnd write FOnLoadEnd; + property OnLoadError: TOnLoadError read FOnLoadError write FOnLoadError; + property OnRenderProcessTerminated: TOnRenderProcessTerminated read FOnRenderProcessTerminated write FOnRenderProcessTerminated; + property OnPluginCrashed: TOnPluginCrashed read FOnPluginCrashed write FOnPluginCrashed; + + property OnTakeFocus: TOnTakeFocus read FOnTakeFocus write FOnTakeFocus; + property OnSetFocus: TOnSetFocus read FOnSetFocus write FOnSetFocus; + property OnGotFocus: TOnGotFocus read FOnGotFocus write FOnGotFocus; + property OnBeforeContextMenu: TOnBeforeContextMenu read FOnBeforeContextMenu write FOnBeforeContextMenu; + property OnContextMenuCommand: TOnContextMenuCommand read FOnContextMenuCommand write FOnContextMenuCommand; + property OnContextMenuDismissed: TOnContextMenuDismissed read FOnContextMenuDismissed write FOnContextMenuDismissed; + property OnPreKeyEvent: TOnPreKeyEvent read FOnPreKeyEvent write FOnPreKeyEvent; + property OnKeyEvent: TOnKeyEvent read FOnKeyEvent write FOnKeyEvent; + property OnLoadingStateChange: TOnLoadingStateChange read FOnLoadingStateChange write FOnLoadingStateChange; + + property OnAddressChange: TOnAddressChange read FOnAddressChange write FOnAddressChange; + property OnTitleChange: TOnTitleChange read FOnTitleChange write FOnTitleChange; + property OnTooltip: TOnTooltip read FOnTooltip write FOnTooltip; + property OnStatusMessage: TOnStatusMessage read FOnStatusMessage write FOnStatusMessage; + property OnConsoleMessage: TOnConsoleMessage read FOnConsoleMessage write FOnConsoleMessage; + property OnBeforeDownload: TOnBeforeDownload read FOnBeforeDownload write FOnBeforeDownload; + property OnDownloadUpdated: TOnDownloadUpdated read FOnDownloadUpdated write FOnDownloadUpdated; + property OnRequestGeolocationPermission: TOnRequestGeolocationPermission read FOnRequestGeolocationPermission write FOnRequestGeolocationPermission; + property OnCancelGeolocationPermission: TOnCancelGeolocationPermission read FOnCancelGeolocationPermission write FOnCancelGeolocationPermission; + property OnJsdialog: TOnJsdialog read FOnJsdialog write FOnJsdialog; + + property OnBeforeUnloadDialog: TOnBeforeUnloadDialog read FOnBeforeUnloadDialog write FOnBeforeUnloadDialog; + property OnResetDialogState: TOnResetDialogState read FOnResetDialogState write FOnResetDialogState; + property OnBeforePopup: TOnBeforePopup read FOnBeforePopup write FOnBeforePopup; + property OnAfterCreated: TOnAfterCreated read FOnAfterCreated write FOnAfterCreated; + property OnBeforeClose: TOnBeforeClose read FOnBeforeClose write FOnBeforeClose; + property OnRunModal: TOnRunModal read FOnRunModal write FOnRunModal; + property OnClose: TOnClose read FOnClose write FOnClose; + property OnBeforeResourceLoad: TOnBeforeResourceLoad read FOnBeforeResourceLoad write FOnBeforeResourceLoad; + property OnGetResourceHandler: TOnGetResourceHandler read FOnGetResourceHandler write FOnGetResourceHandler; + property OnResourceRedirect: TOnResourceRedirect read FOnResourceRedirect write FOnResourceRedirect; + property OnGetAuthCredentials: TOnGetAuthCredentials read FOnGetAuthCredentials write FOnGetAuthCredentials; + property OnQuotaRequest: TOnQuotaRequest read FOnQuotaRequest write FOnQuotaRequest; + property OnGetCookieManager: TOnGetCookieManager read FOnGetCookieManager write FOnGetCookieManager; + property OnProtocolExecution: TOnProtocolExecution read FOnProtocolExecution write FOnProtocolExecution; + + property OnBeforePluginLoad: TOnBeforePluginLoad read FOnBeforePluginLoad write FOnBeforePluginLoad; + + property OnFileDialog: TOnFileDialog read FOnFileDialog write FOnFileDialog; + + property DefaultUrl: ustring read FDefaultUrl write FDefaultUrl; + property Options: TChromiumOptions read FOptions write FOptions; + property FontOptions: TChromiumFontOptions read FFontOptions; + property DefaultEncoding: ustring read FDefaultEncoding write FDefaultEncoding; + property UserStyleSheetLocation: ustring read FUserStyleSheetLocation write FUserStyleSheetLocation; + property BrowserId: Integer read FBrowserId; + property Browser: ICefBrowser read FBrowser; + public + constructor Create(TheOwner : TComponent); override; + destructor Destroy; override; + procedure Load(const url: ustring); + end; + + TChromium = class(TCustomChromium) + public + property BrowserId; + property Browser; + published + property Color; + property Constraints; + property TabStop; + property Align; + property Anchors; + property DefaultUrl; + property TabOrder; + property Visible; + + property OnProcessMessageReceived; + property OnLoadStart; + property OnLoadEnd; + property OnLoadError; + property OnRenderProcessTerminated; + property OnPluginCrashed; + + property OnTakeFocus; + property OnSetFocus; + property OnGotFocus; + property OnBeforeContextMenu; + property OnContextMenuCommand; + property OnContextMenuDismissed; + property OnPreKeyEvent; + property OnKeyEvent; + property OnLoadingStateChange; + + property OnAddressChange; + property OnTitleChange; + property OnTooltip; + property OnStatusMessage; + property OnConsoleMessage; + property OnBeforeDownload; + property OnDownloadUpdated; + property OnRequestGeolocationPermission; + property OnCancelGeolocationPermission; + property OnJsdialog; + + property OnBeforeUnloadDialog; + property OnResetDialogState; + property OnBeforePopup; + property OnAfterCreated; + property OnBeforeClose; + property OnRunModal; + property OnClose; + property OnBeforeResourceLoad; + property OnGetResourceHandler; + property OnResourceRedirect; + property OnGetAuthCredentials; + property OnGetCookieManager; + property OnProtocolExecution; + + property OnFileDialog; + + + property Options; + property FontOptions; + property DefaultEncoding; + property UserStyleSheetLocation; + end; + +procedure Register; + +Implementation +{$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} +Uses ExtCtrls; +Var + CefInstances : Integer = 0; + CefTimer : UINT_PTR = 0; + Timer : TTimer; + Looping : Boolean = False; +{$ENDIF} + +Type + + { TLCLClientHandler } + + TLCLClientHandler = class(TCustomClientHandler) + private + class procedure OnTimer(Sender : TObject); + public + constructor Create(const crm: IChromiumEvents); override; + procedure Cleanup; + procedure StartTimer; + end; + + TWSChromiumControl = class(TWSWinControl) + published + class function CreateHandle(const AWinControl: TWinControl; + const AParams: TCreateParams): HWND; override; + class procedure DestroyHandle(const AWinControl: TWinControl); override; + end; + +procedure Register; +begin + RegisterComponents('Chromium',[TChromium]); +end; + +{$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} +class procedure TLCLClientHandler.OnTimer(Sender : TObject); +begin + If Looping then Exit; + If CefInstances > 0 then + begin + Looping := True; + try + CefDoMessageLoopWork; + finally + Looping := False; + end; + end; +end; +{$ENDIF} + +constructor TLCLClientHandler.Create(const crm : IChromiumEvents); +begin + inherited Create(crm); + + {$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} + If not assigned(Timer) then + begin + WriteLn('Creating Timer...'); + + Timer := TTimer.Create(nil); + Timer.Interval := 20; + Timer.Enabled := false; + Timer.OnTimer := @OnTimer; + end; + + InterLockedIncrement(CefInstances); + {$ENDIF} + + WriteLn('ClientHandler instances: ', CefInstances); +end; + +procedure TLCLClientHandler.Cleanup; +begin + { TODO : Check, why Destroy; override never gets called } + WriteLn('LCLClientHandler.Cleanup'); + + {$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} + InterLockedDecrement(CefInstances); + + If CefInstances = 0 then + begin + Timer.Enabled := false; + + FreeAndNil(Timer); + end; + {$ENDIF} + + // inherited; +end; + +procedure TLCLClientHandler.StartTimer; +begin + Assert(Assigned(Timer), 'Timer must be assigned...'); + + Timer.Enabled := true; +end; + +{ TCustomChromium } + +procedure TCustomChromium.GetSettings(var settings : TCefBrowserSettings); +begin + Assert(settings.size >= SizeOf(settings)); + settings.standard_font_family := CefString(FFontOptions.StandardFontFamily); + settings.fixed_font_family := CefString(FFontOptions.FixedFontFamily); + settings.serif_font_family := CefString(FFontOptions.SerifFontFamily); + settings.sans_serif_font_family := CefString(FFontOptions.SansSerifFontFamily); + settings.cursive_font_family := CefString(FFontOptions.CursiveFontFamily); + settings.fantasy_font_family := CefString(FFontOptions.FantasyFontFamily); + settings.default_font_size := FFontOptions.DefaultFontSize; + settings.default_fixed_font_size := FFontOptions.DefaultFixedFontSize; + settings.minimum_font_size := FFontOptions.MinimumFontSize; + settings.minimum_logical_font_size := FFontOptions.MinimumLogicalFontSize; + settings.remote_fonts := FFontOptions.RemoteFonts; + settings.default_encoding := CefString(DefaultEncoding); + settings.user_style_sheet_location := CefString(UserStyleSheetLocation); + + settings.javascript := FOptions.Javascript; + settings.javascript_open_windows := FOptions.JavascriptOpenWindows; + settings.javascript_close_windows := FOptions.JavascriptCloseWindows; + settings.javascript_access_clipboard := FOptions.JavascriptAccessClipboard; + settings.javascript_dom_paste := FOptions.JavascriptDomPaste; + settings.caret_browsing := FOptions.CaretBrowsing; + settings.java := FOptions.Java; + settings.plugins := FOptions.Plugins; + settings.universal_access_from_file_urls := FOptions.UniversalAccessFromFileUrls; + settings.file_access_from_file_urls := FOptions.FileAccessFromFileUrls; + settings.web_security := FOptions.WebSecurity; + settings.image_loading := FOptions.ImageLoading; + settings.image_shrink_standalone_to_fit := FOptions.ImageShrinkStandaloneToFit; + settings.text_area_resize := FOptions.TextAreaResize; + settings.page_cache := FOptions.PageCache; + settings.tab_to_links := FOptions.TabToLinks; + settings.author_and_user_styles := FOptions.AuthorAndUserStyles; + settings.local_storage := FOptions.LocalStorage; + settings.databases := FOptions.Databases; + settings.application_cache := FOptions.ApplicationCache; + settings.webgl := FOptions.Webgl; + settings.accelerated_compositing := FOptions.AcceleratedCompositing; + settings.developer_tools := FOptions.DeveloperTools; +end; + +procedure TCustomChromium.CreateWnd; +begin + inherited CreateWnd; + + CreateBrowser; +end; + +procedure TCustomChromium.WMPaint(var Msg : TLMPaint); +begin + Include(FControlState, csCustomPaint); + inherited WMPaint(Msg); + + If (csDesigning in ComponentState) and (FCanvas<>nil) then + begin + With FCanvas do + begin + If Msg.DC <> 0 then Handle := Msg.DC; + + Brush.Color := clLtGray; + Pen.Color := clRed; + Rectangle(0,0,Self.Width,Self.Height); + MoveTo(0,0); + LineTo(Self.Width,Self.Height); + MoveTo(0,Self.Height); + LineTo(Self.Width,0); + + If Msg.DC <> 0 then Handle := 0; + end; + end; + + Exclude(FControlState, csCustomPaint); +end; + +procedure TCustomChromium.CreateBrowser; +Var + info: TCefWindowInfo; + settings: TCefBrowserSettings; +begin + If not (csDesigning in ComponentState) then + begin + FillChar(info, SizeOf(info), 0); + info.parent_widget := Pointer(Handle); + + FillChar(settings, SizeOf(TCefBrowserSettings), 0); + settings.size := SizeOf(TCefBrowserSettings); + GetSettings(settings); + +{$IFDEF CEF_MULTI_THREADED_MESSAGE_LOOP} + CefBrowserHostCreate(@info, FHandler, FDefaultUrl, @settings); +{$ELSE} + FBrowser := CefBrowserHostCreateSync(@info, FHandler, '', @settings); + FBrowserId := FBrowser.Identifier; +{$ENDIF} + + (FHandler as TLCLClientHandler).StartTimer; + end; +end; + +constructor TCustomChromium.Create(TheOwner : TComponent); +begin + inherited; + + ControlStyle := ControlStyle - [csAcceptsControls]; + + If not (csDesigning in ComponentState) then + begin + FHandler := TLCLClientHandler.Create(Self); + end + Else + begin + FCanvas := TControlCanvas.Create; + TControlCanvas(FCanvas).Control := Self; + end; + + FOptions := TChromiumOptions.Create; + FFontOptions := TChromiumFontOptions.Create; + + FUserStyleSheetLocation := ''; + FDefaultEncoding := ''; + FBrowserId := 0; + FBrowser := nil; +end; + +destructor TCustomChromium.Destroy; +begin + WriteLn('CustomChromium.Destroy'); + + FreeAndNil(FCanvas); + + If FBrowser <> nil then + begin + FBrowser.StopLoad; + FBrowser.Host.ParentWindowWillClose; + end; + + If FHandler <> nil then + begin + (FHandler as TLCLClientHandler).Cleanup; + (FHandler as ICefClientHandler).Disconnect; + end; + + FHandler := nil; + FBrowser := nil; + FFontOptions.Free; + FOptions.Free; + + inherited; +end; + +procedure TCustomChromium.Load(const url : ustring); +Var + Frame : ICefFrame; +begin + If FBrowser <> nil then + begin + Frame := FBrowser.MainFrame; + If Frame <> nil then Frame.LoadUrl(url); + end; +end; + +function TCustomChromium.doOnClose(const Browser: ICefBrowser): Boolean; +begin + Result := False; + If Assigned(FOnClose) then FOnClose(Self, Browser, Result); +end; + +procedure TCustomChromium.doOnAddressChange(const Browser: ICefBrowser; + const Frame: ICefFrame; const url: ustring); +begin + If Assigned(FOnAddressChange) then FOnAddressChange(Self, Browser, Frame, url); +end; + +procedure TCustomChromium.doOnAfterCreated(const Browser: ICefBrowser); +begin + If Assigned(FOnAfterCreated) then FOnAfterCreated(Self, Browser); +end; + +procedure TCustomChromium.doOnBeforeClose(const Browser: ICefBrowser); +begin + If Assigned(FOnBeforeClose) then FOnBeforeClose(Self, Browser); +end; + +procedure TCustomChromium.doOnBeforeContextMenu(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + If Assigned(FOnBeforeContextMenu) then + FOnBeforeContextMenu(Self, Browser, Frame, params, model); +end; + +procedure TCustomChromium.doOnBeforeDownload(const Browser: ICefBrowser; + const downloadItem: ICefDownloadItem; const suggestedName: ustring; + const callback: ICefBeforeDownloadCallback); +begin + if Assigned(FOnBeforeDownload) then + FOnBeforeDownload(Self, Browser, downloadItem, suggestedName, callback); +end; + +function TCustomChromium.doOnBeforePluginLoad(const Browser: ICefBrowser; + const url, policyUrl: ustring; const info: ICefWebPluginInfo): Boolean; +begin + Result := False; + if Assigned(FOnBeforePluginLoad) then + FOnBeforePluginLoad(Self, Browser, url, policyUrl, info, Result); +end; + +function TCustomChromium.doOnBeforePopup(const Browser: ICefBrowser; + const Frame: ICefFrame; const targetUrl, targetFrameName: ustring; + var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; + var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; +begin + Result := False; + if Assigned(FOnBeforePopup) then + FOnBeforePopup(Self, Browser, Frame, targetUrl, targetFrameName, popupFeatures, + windowInfo, client, settings, noJavascriptAccess, Result); +end; + +function TCustomChromium.doOnBeforeResourceLoad(const Browser: ICefBrowser; + const Frame: ICefFrame; const request: ICefRequest): Boolean; +begin + Result := False; + if Assigned(FOnBeforeResourceLoad) then + FOnBeforeResourceLoad(Self, Browser, Frame, request, Result); +end; + +function TCustomChromium.doOnBeforeUnloadDialog(const Browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback): Boolean; +begin + Result := False; + If Assigned(FOnBeforeUnloadDialog) then + FOnBeforeUnloadDialog(Self, Browser, messageText, isReload, callback, Result); +end; + +procedure TCustomChromium.doOnCancelGeolocationPermission( + const Browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer); +begin + If Assigned(FOnCancelGeolocationPermission) then + FOnCancelGeolocationPermission(Self, Browser, requestingUrl, requestId); +end; + +function TCustomChromium.doOnConsoleMessage(const Browser: ICefBrowser; + const Message, Source: ustring; line: Integer): Boolean; +begin + Result := False; + If Assigned(FOnConsoleMessage) then + FOnConsoleMessage(Self, Browser, Message, Source, line, Result); +end; + +function TCustomChromium.doOnContextMenuCommand(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean; +begin + Result := False; + If Assigned(FOnContextMenuCommand) then + FOnContextMenuCommand(Self, Browser, Frame, params, commandId, eventFlags, Result); +end; + +procedure TCustomChromium.doOnContextMenuDismissed(const Browser: ICefBrowser; const Frame: ICefFrame); +begin + If Assigned(FOnContextMenuDismissed) then FOnContextMenuDismissed(Self, Browser, Frame); +end; + +procedure TCustomChromium.doOnCursorChange(const Browser: ICefBrowser; acursor: TCefCursorHandle); +begin + +end; + +procedure TCustomChromium.doOnDownloadUpdated(const Browser: ICefBrowser; + const downloadItem: ICefDownloadItem; const callback: ICefDownloadItemCallback); +begin + If Assigned(FOnDownloadUpdated) then FOnDownloadUpdated(Self, Browser, downloadItem, callback); +end; + +function TCustomChromium.doOnFileDialog(const Browser: ICefBrowser; mode: TCefFileDialogMode; + const title, defaultFileName: ustring; acceptTypes: TStrings; + const callback: ICefFileDialogCallback): Boolean; +begin + Result := False; + If Assigned(FOnFileDialog) then + FOnFileDialog(Self, Browser, mode, title, defaultFileName, acceptTypes, callback, Result); +end; + +function TCustomChromium.doOnGetAuthCredentials(const Browser: ICefBrowser; const Frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback): Boolean; +begin + Result := False; + If Assigned(FOnGetAuthCredentials) then + FOnGetAuthCredentials(Self, Browser, Frame, isProxy, host, + port, realm, scheme, callback, Result); +end; + +function TCustomChromium.doOnGetCookieManager(const Browser: ICefBrowser; + const mainUrl: ustring): ICefCookieManager; +begin + If Assigned(FOnGetCookieManager) then FOnGetCookieManager(Self, Browser, mainUrl, Result) + Else Result := nil; +end; + +function TCustomChromium.doOnGetResourceHandler(const Browser: ICefBrowser; + const Frame: ICefFrame; const request: ICefRequest): ICefResourceHandler; +begin + If Assigned(FOnGetResourceHandler) then + FOnGetResourceHandler(Self, Browser, Frame, request, Result) + Else Result := nil; +end; + +function TCustomChromium.doOnGetRootScreenRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; +begin + Result := False; +end; + +function TCustomChromium.doOnGetScreenPoint(const Browser: ICefBrowser; viewX, + viewY: Integer; screenX, screenY: PInteger): Boolean; +begin + Result := False; +end; + +function TCustomChromium.doOnGetViewRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; +begin + Result := False; +end; + +procedure TCustomChromium.doOnGotFocus(const Browser: ICefBrowser); +begin + If Assigned(FOnGotFocus) then FOnGotFocus(Self, Browser) +end; + +function TCustomChromium.doOnJsdialog(const Browser: ICefBrowser; + const originUrl, acceptLang: ustring; dialogType: TCefJsDialogType; + const messageText, defaultPromptText: ustring; callback: ICefJsDialogCallback; + out suppressMessage: Boolean): Boolean; +begin + Result := False; + If Assigned(FOnJsdialog) then + FOnJsdialog(Self, Browser, originUrl, acceptLang, dialogType, + messageText, defaultPromptText, callback, suppressMessage, Result); +end; + +function TCustomChromium.doOnKeyEvent(const Browser: ICefBrowser; + const event: PCefKeyEvent; osEvent: TCefEventHandle): Boolean; +begin + Result := False; + If Assigned(FOnKeyEvent) then FOnKeyEvent(Self, Browser, event, osEvent, Result); +end; + +procedure TCustomChromium.doOnLoadEnd(const Browser: ICefBrowser; + const Frame: ICefFrame; httpStatusCode: Integer); +begin + if Assigned(FOnLoadEnd) then + FOnLoadEnd(Self, Browser, Frame, httpStatusCode); +end; + +procedure TCustomChromium.doOnLoadError(const Browser: ICefBrowser; + const Frame: ICefFrame; errorCode: Integer; const errorText, + failedUrl: ustring); +begin + If Assigned(FOnLoadError) then + FOnLoadError(Self, Browser, Frame, errorCode, errorText, failedUrl); +end; + +procedure TCustomChromium.doOnLoadingStateChange(const Browser: ICefBrowser; + isLoading, canGoBack, canGoForward: Boolean); +begin + If Assigned(FOnLoadingStateChange) then + FOnLoadingStateChange(Self, Browser, isLoading, canGoBack, canGoForward); +end; + +procedure TCustomChromium.doOnLoadStart(const Browser: ICefBrowser; const Frame: ICefFrame); +begin + If Assigned(FOnLoadStart) then FOnLoadStart(Self, Browser, Frame); +end; + +procedure TCustomChromium.doOnPaint(const Browser: ICefBrowser; kind: TCefPaintElementType; + dirtyRectsCount: Cardinal; const dirtyRects: PCefRectArray; const buffer: Pointer; awidth, aheight: Integer); +begin + +end; + +procedure TCustomChromium.doOnPluginCrashed(const Browser: ICefBrowser; + const pluginPath: ustring); +begin + If Assigned(FOnPluginCrashed) then + FOnPluginCrashed(Self, Browser, pluginPath); +end; + +procedure TCustomChromium.doOnPopupShow(const Browser: ICefBrowser; doshow: Boolean); +begin + +end; + +procedure TCustomChromium.doOnPopupSize(const Browser: ICefBrowser; const rect: PCefRect); +begin + +end; + +function TCustomChromium.doOnPreKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; +begin + Result := False; + If Assigned(FOnPreKeyEvent) then + FOnPreKeyEvent(Self, Browser, event, osEvent, isKeyboardShortcut, Result); +end; + +function TCustomChromium.doOnProcessMessageReceived(const Browser: ICefBrowser; + sourceProcess: TCefProcessId; const Message: ICefProcessMessage): Boolean; +begin + Result := False; + If Assigned(FOnProcessMessageReceived) then + FOnProcessMessageReceived(Self, Browser, sourceProcess, Message, Result); +end; + +procedure TCustomChromium.doOnProtocolExecution(const Browser: ICefBrowser; + const url: ustring; out allowOsExecution: Boolean); +begin + If Assigned(FOnProtocolExecution) then FOnProtocolExecution(Self, Browser, url, allowOsExecution); +end; + +function TCustomChromium.doOnQuotaRequest(const Browser: ICefBrowser; const originUrl: ustring; + newSize: Int64; const callback: ICefQuotaCallback): Boolean; +begin + Result := False; + If Assigned(FOnQuotaRequest) then + FOnQuotaRequest(Self, Browser, originUrl, newSize, callback, Result); +end; + +procedure TCustomChromium.doOnRenderProcessTerminated(const Browser: ICefBrowser; + Status: TCefTerminationStatus); +begin + If Assigned(FOnRenderProcessTerminated) then FOnRenderProcessTerminated(Self, Browser, Status); +end; + +procedure TCustomChromium.doOnRequestGeolocationPermission( + const Browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; + const callback: ICefGeolocationCallback); +begin + If Assigned(FOnRequestGeolocationPermission) then + FOnRequestGeolocationPermission(Self, Browser, requestingUrl, requestId, callback); +end; + +procedure TCustomChromium.doOnResetDialogState(const Browser: ICefBrowser); +begin + If Assigned(FOnResetDialogState) then FOnResetDialogState(Self, Browser); +end; + +procedure TCustomChromium.doOnResourceRedirect(const Browser: ICefBrowser; + const Frame: ICefFrame; const oldUrl: ustring; var newUrl: ustring); +begin + If Assigned(FOnResourceRedirect) then FOnResourceRedirect(Self, Browser, Frame, oldUrl, newUrl); +end; + +function TCustomChromium.doOnSetFocus(const Browser: ICefBrowser; Source: TCefFocusSource): Boolean; +begin + Result := False; + If Assigned(FOnSetFocus) then FOnSetFocus(Self, Browser, Source, Result); +end; + +procedure TCustomChromium.doOnStatusMessage(const Browser: ICefBrowser; const value: ustring); +begin + If Assigned(FOnStatusMessage) then FOnStatusMessage(Self, Browser, value); +end; + +procedure TCustomChromium.doOnTakeFocus(const Browser: ICefBrowser; next: Boolean); +begin + If Assigned(FOnTakeFocus) then FOnTakeFocus(Self, Browser, next); +end; + +procedure TCustomChromium.doOnTitleChange(const Browser: ICefBrowser; const title: ustring); +begin + If Assigned(FOnTitleChange) then FOnTitleChange(Self, Browser, title); +end; + +function TCustomChromium.doOnTooltip(const Browser: ICefBrowser; var atext: ustring): Boolean; +begin + Result := False; + If Assigned(FOnTooltip) then FOnTooltip(Self, Browser, atext, Result); +end; + +function TCustomChromium.doOnRunModal(const Browser: ICefBrowser): Boolean; +begin + Result := False; + If Assigned(FOnRunModal) then FOnRunModal(Self, Browser, Result); +end; + +{$IFDEF LCLGTK2} +function size_allocateCB(Widget: PGtkWidget; Size: pGtkAllocation; + Data: gPointer): GBoolean; cdecl; +Const + CallBackDefaultReturn = {$IFDEF GTK2}false{$ELSE}true{$ENDIF}; +Var + SizeMsg: TLMSize; + GtkWidth, GtkHeight: integer; + LCLControl: TWinControl; +begin + Result := CallBackDefaultReturn; + + If not GTK_WIDGET_REALIZED(Widget) then Exit; + + If Size = nil then ; + LCLControl := TWinControl(Data); + If LCLControl = nil then Exit; + + gtk_widget_get_size_request(Widget, @GtkWidth, @GtkHeight); + + SizeMsg.Msg:=0; + FillChar(SizeMsg,SizeOf(SizeMsg),0); + With SizeMsg do + begin + Result := 0; + Msg := LM_SIZE; + SizeType := Size_SourceIsInterface; + Width := SmallInt(GtkWidth); + Height := SmallInt(GtkHeight); + end; + + LCLControl.WindowProc(TLMessage(SizeMsg)); +end; + +function LCreateContext(AWinControl: TWinControl; const AParams: TCreateParams): HWND; +Var NewWidget: PGtkWidget; +begin + NewWidget := gtk_vbox_new(False, 0); + Result := HWND(PtrUInt(Pointer(NewWidget))); + + //PGtkObject(NewWidget)^.flags := PGtkObject(NewWidget)^.flags or GTK_CAN_FOCUS; + + TGtk2WidgetSet(WidgetSet).FinishCreateHandle(AWinControl, NewWidget, AParams); + + g_signal_connect_after(PGtkObject(NewWidget), 'size-allocate', TGTKSignalFunc(@size_allocateCB), AWinControl); +end; + +procedure LDestroyContext(AWinControl: TWinControl); +begin + If not AWinControl.HandleAllocated then Exit; + // nothing to do +end; +{$ENDIF} + + +{ TWSChromiumControl } + +class function TWSChromiumControl.CreateHandle(const AWinControl: TWinControl; + const AParams: TCreateParams): HWND; +Var + ChromiumControl: TCustomChromium; +begin + If csDesigning in AWinControl.ComponentState then begin + // do not use "inherited CreateHandle", because the LCL changes the hierarchy at run time + Result := TWSWinControlClass(ClassParent).CreateHandle(AWinControl, AParams); + end + Else + begin + ChromiumControl := AWinControl as TCustomChromium; + + Result := LCreateContext(ChromiumControl, AParams); + end; +end; + +class procedure TWSChromiumControl.DestroyHandle(const AWinControl: TWinControl); +begin + WriteLn('DestroyHandle'); + + LDestroyContext(AWinControl); + // do not use "inherited DestroyHandle", because the LCL changes the hierarchy at run time + TWSWinControlClass(ClassParent).DestroyHandle(AWinControl); +end; + +Initialization + RegisterWSComponent(TCustomChromium, TWSChromiumControl); + {$I icon.lrs} + +end. + diff --git a/Component/icon.lrs b/Component/icon.lrs new file mode 100644 index 0000000..b58735f --- /dev/null +++ b/Component/icon.lrs @@ -0,0 +1,54 @@ +LazarusResources.Add('TChromium','PNG',[ + #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0 + +#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#1'L'#0#0#1'L'#1'i'#134#189 + +'9'#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'#155#238'<'#26#0#0#4'~IDATH' + +#137#181#150'['#136'UU'#24#199#255#235'[{'#239's'#217'g'#28#231#140#206#232 + +'Q'#27#134'f&3'#135#230'!'#29'M'#176'1R'#28'('#242#197#161'$'#210#7'#5'#162#2 + +#149#8'$'#164#160#4#9#17#236#162'TD'#15'E'#6#210#245#161#11#9#6'&'#8#165#168 + +'%Z'#232#212'L'#154'G'#230'\'#247'm'#221'z8g'#246#204#201'Q'#243#193#5#31'{' + +#195#250#246#239#191#254#223#183#22'k3c'#12'n'#231#176'n%y'#253'k'#135'Z'#133 + +#225#150#236#14#243#159#172']'#171#254#207'7'#236'F'#14#158#220#253#141'+' + +#131#242'FN4'#192'9_L'#196's'#0#160#180#137#180#150#231#148#212'G'#163'(x' + +#245#211'W'#214']'#188'%'#129#161#131#7'9'#206'`'#179'eY;8'#241'6N'#12'D'#4 + +'"'#6#24'@'#25#13#173#13#148#214'P'#218#132'2'#10#223#146#148#216'y'#232#229 + +'5'#133#155#10#12#13#29#228'r'#190#250#200#178#156#181'1'#152'1'#16'1'#176'z' + +#142'6'#128'15'#1'm'#12#180'6'#144'J'#142#138#192#27#248'b'#215#134's'#215#21 + +'X'#177#243#176#197'K'#23'?O'#167#146#131#142#205'A'#172#6'g'#140#129'1'#128 + +#213#21'L]@'#143#135'6'#136#132'D'#16#137#209'@'#4'K'#143#236'yjx'#156#217 + +#208'd'#149#191#176'Gs'#12#250'a'#4#169',8'#22#7#231'5'#17'0`'#220#131#129 + +#137'E'#164#210#16'R"'#18#10'J'#235#28#7#127#23#192#202'k'#28'l'#220#247'K.' + +#211#196#127';'#246#227#209'&'''#237#128#136#129#24#3#231#4'N'#4#203'"'#204 + +#203'f'#202#174#155'J'#228#203#129'#'#165#174#149'Hk'#24' ._(di^6'#179'u'#239 + +'s'#131#7#26#28'8I'#179#195'M'''#155#230'/'#232#198#201#19'g'#208#212#156#129 + +'&'#3#163#20#30#237#239'),'#189#167'3U'#142#180#163#13'9-'#174#13'_i'#228'=' + +#9'N'#12#156#24','#206#224'X'#4#219#194'4h'#243#18#128#3#177#3#6#176#23'>' + +#236'L'#242#1#0' '#0#208#161#236' '#170'oE'#6#228#230#182'cnG;V-'#234#130'&' + +#11'e_4FP'#139'_G*pm'#237'c'#138'a'#217#206#226'X@'#154'P5,'#128#1'K'#150#245 + +#162#239#174#217#248#227'r'#5#149'@4F'#221#197#233#225'"'#166'g'#146#13#165 + +'3'#13#148'z'#147#25'#Q'#219'v'#19'Y'#211#166'e'#16#25#200'9'#217#164'U'#246 + +#197'T'#139'D'#174'%'#137'b5'#16#128#177#27#142#171#1#12'L'#20';`'#148'('#140 + +#31#26'c'#0#163'k'#241#187'o'#244'}w'#182#232' '#146#248'o'#15#170#190#192 + +#170#222#25'a!'#144'db'#232#132#11'!'#213#185'X'#224#192#211'}'#199#164#148 + +#127'I'#165'c'#184'V@)'#128'sjd'#204#219#250'pWD'#12'q'#15#164#210'xby'#7#138 + +#129'IH'#195#147#147#235'R{7'#226#236#133#203#135#128'I'#7'm'#203#254#227#187 + +#166#183'4owS6'#28#135'@'#28'`T'#171'd'#214#166#168#195#229'Bk'#195'#'#5#27 + +#140#248#217#127'<'#220#127'w'#22#156#177'I'#220#218#179'P'#241#191']'#217';' + +'kU'#220#3#0#240#189#202#222'T'#198#221'bq'#202#16'1X``'#186'&'#144#151#218 + +#185'R'#213#142#146#6'c'#165#0'eO`'#197#194'Vp'#198'&'#22'_'#135#251'Bc'#228 + +'ji'#31'0'#11'q'#137#0#224#253#231#7'F'#202#165#210#182'0R'#8'B'#137'('#210 + +'P'#18#208#18'P'#18#136'"'#13'?'#148#240'C'#133#182#230#4':'#219#210#215#192 + +#171#161#194#159#249#202#151#27#6'z>'#27#159#154't'#254#128#253#155#250#223 + +'.'#21#11';'#253'P'#194#15'$'#188'@'#192#11'$<'#191#246#244'C'#9#165'4'#250 + +#187#167'O'#128#235#240#177#170#196#240'U'#255#196#249#209#242#227#147#153'S' + +'^8'#155#222'9'#254'z'#218'u'#183'qN'#196'X'#13#162#148'F$'#21':g'#186'X'#190 + +' '#27#231#150#3#133#130'/'#145'/'#5'G'#132#12#30'{'#230#161#158#209#155#10#0 + +#192#250#221#223'-M'#183#204'x'#147#147#221#167#235'9'#196#128'5'#253#179'aq' + +#6'?'#210#168#134#10'%O\'#202#23#199'^'#220#254'H'#239#7'Sqnx''3'#128#173#127 + +#227#251'Ev'#210']'#205#157#244#208#156'l*{G['#154'GZ]'#242#189#232#180#212 + +#226#176'M'#246#199#207#174#238'*]'#151'q'#187#127'['#254#5#220#135#138#30 + +#220#236'H'#214#0#0#0#0'IEND'#174'B`'#130 +]); diff --git a/Examples/LCLSimple/main.lfm b/Examples/LCLSimple/main.lfm new file mode 100644 index 0000000..c0c932f --- /dev/null +++ b/Examples/LCLSimple/main.lfm @@ -0,0 +1,71 @@ +object Mainform: TMainform + Left = 415 + Height = 382 + Top = 211 + Width = 628 + Caption = 'Browser -' + ClientHeight = 382 + ClientWidth = 628 + LCLVersion = '1.0.8.0' + object Chromium: TChromium + AnchorSideLeft.Control = Owner + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Control = Owner + AnchorSideBottom.Side = asrBottom + Left = 0 + Height = 332 + Top = 50 + Width = 628 + Anchors = [akTop, akLeft, akRight, akBottom] + TabOrder = 0 + OnLoadEnd = ChromiumLoadEnd + OnTitleChange = ChromiumTitleChange + end + object BGo: TButton + AnchorSideTop.Control = Owner + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 544 + Height = 25 + Top = 10 + Width = 79 + Anchors = [akTop, akRight] + BorderSpacing.Top = 10 + BorderSpacing.Right = 5 + Caption = 'Go' + OnClick = BGoClick + TabOrder = 1 + end + object LUrl: TStaticText + AnchorSideTop.Control = Owner + Left = 8 + Height = 22 + Top = 12 + Width = 25 + BorderSpacing.Top = 12 + Caption = 'Url:' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 2 + end + object EUrl: TEdit + AnchorSideLeft.Control = LUrl + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Owner + AnchorSideRight.Control = BGo + Left = 38 + Height = 25 + Top = 10 + Width = 501 + Anchors = [akTop, akLeft, akRight] + AutoSize = False + BorderSpacing.Left = 5 + BorderSpacing.Top = 10 + BorderSpacing.Right = 5 + OnEditingDone = EUrlEditingDone + TabOrder = 3 + Text = 'http://' + end +end diff --git a/Examples/LCLSimple/main.pas b/Examples/LCLSimple/main.pas new file mode 100644 index 0000000..929bff0 --- /dev/null +++ b/Examples/LCLSimple/main.pas @@ -0,0 +1,63 @@ +Unit Main; + +{$mode objfpc}{$H+} + +Interface + +Uses + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, + ExtCtrls, cef3lcl, cef3lib, cef3intf, cef3gui; + +Type + + { TMainform } + + TMainform = class(TForm) + BGo : TButton; + Chromium : TChromium; + EUrl : TEdit; + LUrl : TStaticText; + procedure BGoClick(Sender : TObject); + procedure ChromiumLoadEnd(Sender : TObject; const Browser : ICefBrowser; + const Frame : ICefFrame; httpStatusCode : Integer); + procedure ChromiumTitleChange(Sender : TObject; + const Browser : ICefBrowser; const title : ustring); + procedure EUrlEditingDone(Sender : TObject); + private + { private declarations } + public + { public declarations } + end; + +Var + Mainform : TMainform; + +Implementation + +{$R *.lfm} + +{ TMainform } + +procedure TMainform.BGoClick(Sender : TObject); +begin + Chromium.Load(EUrl.Text); +end; + +procedure TMainform.ChromiumLoadEnd(Sender : TObject; const Browser : ICefBrowser; const Frame : ICefFrame; + httpStatusCode : Integer); +begin + //EUrl.Text := Browser.MainFrame.Url; +end; + +procedure TMainform.ChromiumTitleChange(Sender : TObject; const Browser : ICefBrowser; const title : ustring); +begin + Caption := 'Browser - ' + title; +end; + +procedure TMainform.EUrlEditingDone(Sender : TObject); +begin + BGoClick(Sender); +end; + +end. + diff --git a/Examples/LCLSimple/simple.ico b/Examples/LCLSimple/simple.ico new file mode 100644 index 0000000000000000000000000000000000000000..0341321b5d952e1662a3d9444a73cf9f42a7db37 GIT binary patch literal 137040 zcmXV11ymH@_upNX?(Rmq1f;tg1O*8J5$Q%sVwXk)X#uIFK~f~8LAtwP>F%!GKi~8F z&pC5u?!1{dciz44#^=5P0Du5Az<(PMzyMf}2LP;}&!N!&(d-yNfNBB&AS?U-v^)Ud z`V$D?=l>sF`~m<-U3z|!;s0rZ=X*gQ0KxO|zy55&0KhI02=G-`TLl-33hTLRTs2ii zz5iP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@9G;^XnvD z*7t)2J}%0P2wdzsj0m*+jC=<6)iL!~_7p}G6Yagi7&rwH}E-2SHZ1N4I$Rx>k8esjk- zNDZm?tvuM*7A~(F$@tY~>G$g18AhfGf$|Z&KRW(pl%I!drn}kdvn$5I{`X25KSqQ4 z_QY@IT)4JnI!rB0z}Rk<;O%G*JLe3C1tsaQb;eNUUd^mwyhrb71KjKX@cr3v5d8tBxS3DD=Q4Tk^igtlU;4=Fx>4Z{<4-zu}=NE|o!m@3s4MvB%fA;l>8fM?^CZ=YF zJeXEG0!j;{OdI5|A;xKd*l~jW>(CvSVp0bN;q&_%*Xxk$B*vbQH-IF@847Wr?K_7+h4<~F@?Y5 z*e#?o>W9Q>kj*qn_*XYhAC^73e;4X%Wl;B`7JkP)lur&+)s{#3TtK@0)ypZL z0({3z8x!t&3VlW$&T%m)!)va}`Pl!@4XZ?VI#h|yw5<|NZe0(pT2+a-fW1$7smx<6 G`+orYGy**U literal 0 HcmV?d00001 diff --git a/Examples/LCLSimple/simple.lpi b/Examples/LCLSimple/simple.lpi new file mode 100644 index 0000000..30139c3 --- /dev/null +++ b/Examples/LCLSimple/simple.lpi @@ -0,0 +1,107 @@ + + + + + + + + + <ResourceType Value="res"/> + <UseXPManifest Value="True"/> + <Icon Value="0"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + <environment> + <UserOverrides Count="1"> + <Variable0 Name="LD_LIBRARY_PATH" Value="."/> + </UserOverrides> + </environment> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF3"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="simple.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="simple"/> + </Unit0> + <Unit1> + <Filename Value="main.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Mainform"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <UnitName Value="Main"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="simple"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <TargetCPU Value="x86_64"/> + <TargetOS Value="linux"/> + </CodeGeneration> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/Examples/LCLSimple/simple.lpr b/Examples/LCLSimple/simple.lpr new file mode 100644 index 0000000..c6c9351 --- /dev/null +++ b/Examples/LCLSimple/simple.lpr @@ -0,0 +1,22 @@ +program simple; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + Forms, Main + { you can add units after this }; + +{$R *.res} + +begin + Application.Title := 'Simple'; + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TMainform, Mainform); + Application.Run; +end. + diff --git a/Examples/Minimal/minimal.lpi b/Examples/Minimal/minimal.lpi new file mode 100644 index 0000000..612a2ef --- /dev/null +++ b/Examples/Minimal/minimal.lpi @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="Minimal"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + <environment> + <UserOverrides Count="1"> + <Variable0 Name="LD_LIBRARY_PATH" Value="."/> + </UserOverrides> + </environment> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="CEF3"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="minimal.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="minimal"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="minimal"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <AllowLabel Value="False"/> + </SyntaxOptions> + </Parsing> + <CodeGeneration> + <TargetCPU Value="x86_64"/> + <TargetOS Value="linux"/> + </CodeGeneration> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CompilerMessages> + <UseMsgFile Value="True"/> + </CompilerMessages> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/Examples/Minimal/minimal.lpr b/Examples/Minimal/minimal.lpr new file mode 100644 index 0000000..1993521 --- /dev/null +++ b/Examples/Minimal/minimal.lpr @@ -0,0 +1,349 @@ +Program minimal; + +{$MODE objfpc}{$H+} + +Uses + {$IFDEF UNIX}{$IFDEF UseCThreads}cthreads,{$ENDIF}{$ENDIF} + Classes, Glib2, Gdk2, Gtk2, + cef3lib, cef3api, cef3class; + +Var + Window : PGtkWidget; + VBox : PGtkWidget; + Button : PGtkWidget; + + MainArgs : TCefMainArgs; + Settings : TCefSettings; + ExitCode : Integer; + + BrowserSettings : TCefBrowserSettings; + Info : TCefWindowInfo; + + URL : TCefString; + + Client : TCefClientOwn; + + Browser : PCefBrowser; + Frame : PCefFrame; + Host : PCefBrowserHost; + +procedure Release(var base : TCefBase); +begin + base.release(@base); +end; + +function idle(widget: PGtkWidget): gboolean; cdecl; +begin + cef_do_message_loop_work; + + Result := true; +end; + +procedure destroy(Widget: PGtkWidget; Data: gpointer); cdecl; +begin + Host := Browser^.get_host(Browser); + Host^.parent_window_will_close(Host); + + Release(Host^.base); + Release(Browser^.base); + + gtk_main_quit; + cef_shutdown; + + Client.Free; +end; + +procedure bclicked(widget : PGtkWidget; data : gpointer); cdecl; +Var + Dest : TCefString; +begin + WriteLn('Reloading...'); + + Dest := CefString('http://www.google.de'); + Frame := Browser^.get_main_frame(Browser); + Frame^.load_url(Frame, @Dest); + + Release(Frame^.base); +end; + +begin + MainArgs.argc := argc; + MainArgs.argv := argv; + + CefLoadLibrary; + + ExitCode := cef_execute_process(@MainArgs, nil); + If ExitCode >= 0 then Halt(ExitCode); + + Settings.multi_threaded_message_loop := false; + Settings.single_process := true; + Settings.context_safety_implementation := 0; + Settings.log_severity := LOGSEVERITY_VERBOSE; + Settings.uncaught_exception_stack_size := 20; + Settings.release_dcheck_enabled := true; + + cef_initialize(@MainArgs, @Settings, nil); + + gtk_init(nil, nil); + + // Window + Window := gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), 'CEF3 Bare Bones'); + gtk_window_set_default_size(GTK_WINDOW(window), 400, 400); + + VBox := gtk_vbox_new(False, 0); + gtk_container_add(GTK_CONTAINER(window), VBox); + + Button := gtk_button_new_with_label('Los'); + g_signal_connect (G_OBJECT (button), 'clicked', G_CALLBACK (@bclicked), PChar('run')); + gtk_box_pack_start(GTK_BOX(VBox), Button, TRUE, TRUE, 0); + + + info.parent_widget := VBox; + Client := TCefClientOwn.Create; + + URL := CefString(''); + Browser := cef_browser_host_create_browser_sync(@info, Client.Wrap, @URL, @BrowserSettings); + + g_signal_connect(G_OBJECT(window), 'destroy', G_CALLBACK(@Destroy), nil); + g_idle_add_full(G_PRIORITY_HIGH_IDLE,TGSourceFunc(@idle), Window, nil); + + gtk_widget_show_all(Window); + + gtk_main; +end. + + + + + + + +Program test; + +{$mode objfpc}{$H+} + +{.$DEFINE MULTI} + +Uses + {$IFDEF UNIX}cthreads,{$ENDIF} + Math, + cwstring, Messages, Glib2, Gdk2, Gtk2, + cef3lib, cef3api_static, cef3intf, cef3class; + + + + +function CefStringAlloc(const str: ustring): TCefString; +begin + FillChar(Result, SizeOf(Result), 0); + If str <> '' then + WriteLn('Status: ',cef_string_wide_to_utf16(PWideChar(str), Length(str), @Result) <> 0); +end; + +function AsciiToCefString(const Value : String) : TCefString; +begin + FillChar(Result, SizeOf(Result), 0); + + if Value <> '' then + cef_string_ascii_to_utf16(PChar(Value), Length(Value), @Result); +end; + + + +procedure destroy(Widget: PGtkWidget; Data: gpointer); cdecl; +begin + WriteLn('Exiting...'); + WriteLn('RefCount: ',Client.RefCount); + + {$IFDEF MULTI} + cef_shutdown; + gtk_main_quit; + {$ELSE} + Host := Browser^.get_host(Browser); + Host^.parent_window_will_close(Host); + + Release(Host^.base); + Release(Browser^.base); + + cef_shutdown; + + gtk_main_quit; + + //cef_quit_message_loop; + {$ENDIF} +end; + +procedure bclicked(widget : PGtkWidget; data : gpointer); cdecl; +Var + Dest : TCefString; +begin + WriteLn('Reloading...'); + + //Dest := CefString('http://localhost'); + Dest := AsciiToCefString('http://localhost'); + //Dest := AsciiToCefString('http://www.google.de'); + Frame := Browser^.get_main_frame(Browser); + Frame^.load_url(Frame, @Dest); + + Release(Frame^.base); + + cef_do_message_loop_work; +end; + +begin + MainArgs.argc := argc; + MainArgs.argv := argv; + + WriteLn(argv[1]); + + ExitCode := cef_execute_process(@MainArgs, nil); + If ExitCode >= 0 then Halt(ExitCode); + + {$IFDEF MULTI} + Settings.multi_threaded_message_loop := true; + {$ELSE} + Settings.multi_threaded_message_loop := false; + {$ENDIF} + Settings.single_process := false; + Settings.context_safety_implementation := 0; + Settings.log_severity := LOGSEVERITY_VERBOSE; + Settings.uncaught_exception_stack_size := 20; + Settings.release_dcheck_enabled := false; + + cef_initialize(@MainArgs, @Settings, nil); + + gtk_init(nil, nil); + + // Fenster + Window := gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), 'CEF3 Bare Bones'); + gtk_window_set_default_size(GTK_WINDOW(window), 400, 400); + + VBox := gtk_vbox_new(False, 0); + gtk_container_add(GTK_CONTAINER(window), VBox); + + Button := gtk_button_new_with_label('Los'); + g_signal_connect (G_OBJECT (button), 'clicked', G_CALLBACK (@bclicked), PChar('run')); + gtk_box_pack_start(GTK_BOX(VBox), Button, TRUE, TRUE, 0); + + g_signal_connect(G_OBJECT(window), 'destroy', G_CALLBACK(@Destroy), nil); + + + info.parent_widget := VBox; + Client := TCefClientOwn.Create; + + //URL := CefStringAlloc('http://www.google.de'); + //URL := AsciiToCefString('http://localhost'); + //URL := CefString('about:blank'); + URL := CefString(''); + + + {$IFDEF MULTI} + cef_browser_host_create_browser(@info, Client.Wrap, @URL, @BrowserSettings); + {$ELSE} + Browser := cef_browser_host_create_browser_sync(@info, Client.Wrap, @URL, @BrowserSettings); + g_idle_add_full(G_PRIORITY_DEFAULT_IDLE,TGSourceFunc(@idle), Window, nil); + {$ENDIF} + + gtk_widget_show_all(Window); + + {$IFDEF MULTI} + gtk_main; + {$ELSE} + + gtk_main; + + //cef_run_message_loop; + //cef_shutdown; + {$ENDIF} +end. + +(* + + + + + + + + +// CEF3 Bare Bones +// https://github.com/aphistic/cef3barebones +// +// For some details on what this code is doing, please see +// my blog post at: +// http://blog.erikd.org/2013/01/14/chromium-embedded-framework-3-bare-bones/ +// +// PLEASE READ: +// Check out the README file for information about this code. +// TLDR version: This code is not good, it's the bare minimum you need and +// it's probably not correct in many (most?) cases. It creates a window, +// loads some pages and that's it. + +#include <gtk/gtk.h> + +#include "include/cef_app.h" + +#include "bareboneshandler.h" + +CefRefPtr<BareBonesHandler> g_handler; + +void destroy(void) { + // Tells CEF to quit its message loop so the application can exit. + CefQuitMessageLoop(); +} + +int main(int argc, char* argv[]) { + CefMainArgs main_args(argc, argv); + + int exitCode = CefExecuteProcess(main_args, NULL); + if (exitCode >= 0) { + return exitCode; + } + + CefSettings settings; + CefInitialize(main_args, settings, NULL); + + gtk_init(&argc, &argv); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), "CEF3 Bare Bones"); + // Set the window to 400x400 + gtk_window_set_default_size(GTK_WINDOW(window), 400, 400); + + vbox = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(window), vbox); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); + + g_signal_connect(window, "destroy", G_CALLBACK(destroy), NULL); + + CefBrowserSettings browserSettings; + CefWindowInfo info; + + g_handler = new BareBonesHandler(); + + info.SetAsChild(hbox); + CefBrowserHost::CreateBrowserSync(info, g_handler.get(), + "http://code.google.com", browserSettings); + CefBrowserHost::CreateBrowserSync(info, g_handler.get(), + "http://www.github.com", browserSettings); + + info.SetAsChild(vbox); + CefBrowserHost::CreateBrowserSync(info, g_handler.get(), + "http://www.google.com", browserSettings); + + gtk_widget_show_all(window); + + CefRunMessageLoop(); + + CefShutdown(); + + return 0; +} + +*) + + diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..717e9d2 --- /dev/null +++ b/Readme.md @@ -0,0 +1,68 @@ +fpCEF3 +====== + +Chromium Embedded Framework for Free Pascal + +It is still in an early state, expect crashes, exceptions and other bad things... + +## How to get started on +#### [Linux] +Download CEF3 from [here][1] and copy / link _libcef.so_, + a) to the default library paths, eg. `/usr/lib(64)`, `/usr/local/lib(64)` __OR__ + b) somewhere and set `LD_LIBRARY_PATH` accordingly + +Install `cef3.lpk` into Lazarus + +Look into the examples + +### Very important: +Make sure to switch **off** any runtime checks in the project settings: +**No** `-Ci` `-Co` `-Cr` `-Ct`, unless you want to have various crashes at different places. +Unfortunately it's not clear to me, what the reason is... + + +## FAQ: +### Which versions of CEF are supported? + +fpCEF3 only supports CEF3, *no* support for CEF1. +Version 3.1453.1255 (and newer) should work, didn't test for older ones. + +### Which platforms are supported? + +Currently only Linux with gtk2 is tested and fully implemented. + +The plain header should be ready for Windows and Mac (maybe with small changes), but the component definitely needs a bit of work to support more platforms. + + +### Is there a documentation for fpCEF? +No, but you can find information in + +- cef3lib.pas / cef3api.pas +- the sample programs (admittedly very basic ones) +- the official api docs [here][2] +- the official cefclient example program [here][3] + +If you feel like contributing some more Pascal examples - please do. + +### What are the differences to dcef3? +- compatibility with Free Pascal / Lazarus +- reworked unit layout - more modular +- slightly changed mechanism for loading the library +- cef3api_static unit +- _removed_ VLC and FMX component + +### Can I help? +Of course - patches are always welcome :) + +### Can you help? +To a certain amount - yes, but don't expect too much. + +## Links: + * [Chromium Embedded Framework](http://code.google.com/p/chromiumembedded) + * [Delphi CEF](http://code.google.com/p/dcef3) + + * [fpCEF3](http://github.com/dliw/fpCEF3) + +[1]:http://www.magpcss.net/cef_downloads +[2]:http://magpcss.org/ceforum/apidocs3/ +[3]:http://code.google.com/p/chromiumembedded/source/browse/#svn%2Ftrunk%2Fcef3%2Ftests%2Fcefclient \ No newline at end of file diff --git a/cef.inc b/cef.inc new file mode 100644 index 0000000..f237ad9 --- /dev/null +++ b/cef.inc @@ -0,0 +1,36 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Ported to Free Pascal and Linux by d.l.i.w <dev.dliw@gmail.com> + * based on 'Delphi Chromium Embedded' + * + * Repository: http://github.com/dliw/fpCEF3 + * + * + * Originally created for Delphi by: Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +// Don't change this, unless you know, what you are doing +{$DEFINE CEF_STRING_TYPE_UTF16} + + {.$DEFINE CEF_STRING_TYPE_UTF8} + {.$DEFINE CEF_STRING_TYPE_WIDE} + +//original comment: force multithreading message loop on FPC, still not work +//seems to be wrong, works perfectly without on fpc +{.$DEFINE CEF_MULTI_THREADED_MESSAGE_LOOP} +{$DEFINE SUPPORTS_INLINE} \ No newline at end of file diff --git a/cef3api.pas b/cef3api.pas new file mode 100644 index 0000000..6618c3b --- /dev/null +++ b/cef3api.pas @@ -0,0 +1,969 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Ported to Free Pascal and Linux by d.l.i.w <dev.dliw@gmail.com> + * based on 'Delphi Chromium Embedded' + * + * Repository: http://github.com/dliw/fpCEF3 + * + * + * Originally created for Delphi by: Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +Unit cef3api; + +{.$MODE objfpc}{$H+} +{$MODE Delphi} + +{$I cef.inc} + +Interface + +Uses + {$IFDEF WINDOWS}Windows,{$ENDIF} + {$IFDEF LINUX}Dynlibs,{$ENDIF} + sysutils, cef3lib; + +Var + // These functions set string values. If |copy| is true (1) the value will be + // copied instead of referenced. It is up to the user to properly manage + // the lifespan of references. + + cef_string_wide_set: function(const src: PWideChar; src_len: Cardinal; output: PCefStringWide; copy: Integer): Integer; cdecl; + cef_string_utf8_set: function(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf8; copy: Integer): Integer; cdecl; + cef_string_utf16_set: function(const src: PChar16; src_len: Cardinal; output: PCefStringUtf16; copy: Integer): Integer; cdecl; + cef_string_set: function(const src: PCefChar; src_len: Cardinal; output: PCefString; copy: Integer): Integer; cdecl; + + // These functions clear string values. The structure itself is not freed. + + cef_string_wide_clear: procedure(str: PCefStringWide); cdecl; + cef_string_utf8_clear: procedure(str: PCefStringUtf8); cdecl; + cef_string_utf16_clear: procedure(str: PCefStringUtf16); cdecl; + cef_string_clear: procedure(str: PCefString); cdecl; + + // These functions compare two string values with the same results as strcmp(). + + cef_string_wide_cmp: function(const str1, str2: PCefStringWide): Integer; cdecl; + cef_string_utf8_cmp: function(const str1, str2: PCefStringUtf8): Integer; cdecl; + cef_string_utf16_cmp: function(const str1, str2: PCefStringUtf16): Integer; cdecl; + + // These functions convert between UTF-8, -16, and -32 strings. They are + // potentially slow so unnecessary conversions should be avoided. The best + // possible result will always be written to |output| with the boolean return + // value indicating whether the conversion is 100% valid. + + cef_string_wide_to_utf8: function(const src: PWideChar; src_len: Cardinal; output: PCefStringUtf8): Integer; cdecl; + cef_string_utf8_to_wide: function(const src: PAnsiChar; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; + + cef_string_wide_to_utf16: function (const src: PWideChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; + cef_string_utf16_to_wide: function(const src: PChar16; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; + + cef_string_utf8_to_utf16: function(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; + cef_string_utf16_to_utf8: function(const src: PChar16; src_len: Cardinal; output: PCefStringUtf8): Integer; cdecl; + + cef_string_to_utf8: function(const src: PCefChar; src_len: Cardinal; output: PCefStringUtf8): Integer; cdecl; + cef_string_from_utf8: function(const src: PAnsiChar; src_len: Cardinal; output: PCefString): Integer; cdecl; + cef_string_to_utf16: function(const src: PCefChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; + cef_string_from_utf16: function(const src: PChar16; src_len: Cardinal; output: PCefString): Integer; cdecl; + cef_string_to_wide: function(const src: PCefChar; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; + cef_string_from_wide: function(const src: PWideChar; src_len: Cardinal; output: PCefString): Integer; cdecl; + + // These functions convert an ASCII string, typically a hardcoded constant, to a + // Wide/UTF16 string. Use instead of the UTF8 conversion routines if you know + // the string is ASCII. + + cef_string_ascii_to_wide: function(const src: PAnsiChar; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; + cef_string_ascii_to_utf16: function(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; + cef_string_from_ascii: function(const src: PAnsiChar; src_len: Cardinal; output: PCefString): Integer; cdecl; + + // These functions allocate a new string structure. They must be freed by + // calling the associated free function. + + cef_string_userfree_wide_alloc: function(): PCefStringUserFreeWide; cdecl; + cef_string_userfree_utf8_alloc: function(): PCefStringUserFreeUtf8; cdecl; + cef_string_userfree_utf16_alloc: function(): PCefStringUserFreeUtf16; cdecl; + cef_string_userfree_alloc: function(): PCefStringUserFree; cdecl; + + // These functions free the string structure allocated by the associated + // alloc function. Any string contents will first be cleared. + + cef_string_userfree_wide_free: procedure(str: PCefStringUserFreeWide); cdecl; + cef_string_userfree_utf8_free: procedure(str: PCefStringUserFreeUtf8); cdecl; + cef_string_userfree_utf16_free: procedure(str: PCefStringUserFreeUtf16); cdecl; + cef_string_userfree_free: procedure(str: PCefStringUserFree); cdecl; + +Var + // Create a new browser window using the window parameters specified by + // |windowInfo|. All values will be copied internally and the actual window will + // be created on the UI thread. This function can be called on any browser + // process thread and will not block. + cef_browser_host_create_browser: function( + const windowInfo: PCefWindowInfo; client: PCefClient; + const url: PCefString; const settings: PCefBrowserSettings): Integer; cdecl; + + // Create a new browser window using the window parameters specified by + // |windowInfo|. This function can only be called on the browser process UI + // thread. + cef_browser_host_create_browser_sync: function( + const windowInfo: PCefWindowInfo; client: PCefClient; + const url: PCefString; const settings: PCefBrowserSettings): PCefBrowser; cdecl; + + // Perform a single iteration of CEF message loop processing. This function is + // used to integrate the CEF message loop into an existing application message + // loop. Care must be taken to balance performance against excessive CPU usage. + // This function should only be called on the main application thread and only + // if cef_initialize() is called with a CefSettings.multi_threaded_message_loop + // value of false (0). This function will not block. + cef_do_message_loop_work: procedure(); cdecl; + + // Run the CEF message loop. Use this function instead of an application- + // provided message loop to get the best balance between performance and CPU + // usage. This function should only be called on the main application thread and + // only if cef_initialize() is called with a + // CefSettings.multi_threaded_message_loop value of false (0). This function + // will block until a quit message is received by the system. + cef_run_message_loop: procedure; cdecl; + + // Quit the CEF message loop that was started by calling cef_run_message_loop(). + // This function should only be called on the main application thread and only + // if cef_run_message_loop() was used. + cef_quit_message_loop: procedure; cdecl; + + // This function should be called from the application entry point function to + // execute a secondary process. It can be used to run secondary processes from + // the browser client executable (default behavior) or from a separate + // executable specified by the CefSettings.browser_subprocess_path value. If + // called for the browser process (identified by no "type" command-line value) + // it will return immediately with a value of -1. If called for a recognized + // secondary process it will block until the process should exit and then return + // the process exit code. The |application| parameter may be NULL. + cef_execute_process: function(const args: PCefMainArgs; application: PCefApp): Integer; cdecl; + + // This function should be called on the main application thread to initialize + // the CEF browser process. The |application| parameter may be NULL. A return + // value of true (1) indicates that it succeeded and false (0) indicates that it + // failed. + cef_initialize: function(const args: PCefMainArgs; const settings: PCefSettings; application: PCefApp): Integer; cdecl; + + // This function should be called on the main application thread to shut down + // the CEF browser process before the application exits. + cef_shutdown: procedure(); cdecl; + + // Allocate a new string map. + cef_string_map_alloc: function(): TCefStringMap; cdecl; + //function cef_string_map_size(map: TCefStringMap): Integer; cdecl; + cef_string_map_size: function(map: TCefStringMap): Integer; cdecl; + // Return the value assigned to the specified key. + cef_string_map_find: function(map: TCefStringMap; const key: PCefString; var value: TCefString): Integer; cdecl; + // Return the key at the specified zero-based string map index. + cef_string_map_key: function(map: TCefStringMap; index: Integer; var key: TCefString): Integer; cdecl; + // Return the value at the specified zero-based string map index. + cef_string_map_value: function(map: TCefStringMap; index: Integer; var value: TCefString): Integer; cdecl; + // Append a new key/value pair at the end of the string map. + cef_string_map_append: function(map: TCefStringMap; const key, value: PCefString): Integer; cdecl; + // Clear the string map. + cef_string_map_clear: procedure(map: TCefStringMap); cdecl; + // Free the string map. + cef_string_map_free: procedure(map: TCefStringMap); cdecl; + + // Allocate a new string map. + cef_string_list_alloc: function(): TCefStringList; cdecl; + // Return the number of elements in the string list. + cef_string_list_size: function(list: TCefStringList): Integer; cdecl; + // Retrieve the value at the specified zero-based string list index. Returns + // true (1) if the value was successfully retrieved. + cef_string_list_value: function(list: TCefStringList; index: Integer; value: PCefString): Integer; cdecl; + // Append a new value at the end of the string list. + cef_string_list_append: procedure(list: TCefStringList; const value: PCefString); cdecl; + // Clear the string list. + cef_string_list_clear: procedure(list: TCefStringList); cdecl; + // Free the string list. + cef_string_list_free: procedure(list: TCefStringList); cdecl; + // Creates a copy of an existing string list. + cef_string_list_copy: function(list: TCefStringList): TCefStringList; + + + // Register a new V8 extension with the specified JavaScript extension code and + // handler. Functions implemented by the handler are prototyped using the + // keyword 'native'. The calling of a native function is restricted to the scope + // in which the prototype of the native function is defined. This function may + // only be called on the render process main thread. + // + // Example JavaScript extension code: + // + // // create the 'example' global object if it doesn't already exist. + // if (!example) + // example = {}; + // // create the 'example.test' global object if it doesn't already exist. + // if (!example.test) + // example.test = {}; + // (function() { + // // Define the function 'example.test.myfunction'. + // example.test.myfunction = function() { + // // Call CefV8Handler::Execute() with the function name 'MyFunction' + // // and no arguments. + // native function MyFunction(); + // return MyFunction(); + // }; + // // Define the getter function for parameter 'example.test.myparam'. + // example.test.__defineGetter__('myparam', function() { + // // Call CefV8Handler::Execute() with the function name 'GetMyParam' + // // and no arguments. + // native function GetMyParam(); + // return GetMyParam(); + // }); + // // Define the setter function for parameter 'example.test.myparam'. + // example.test.__defineSetter__('myparam', function(b) { + // // Call CefV8Handler::Execute() with the function name 'SetMyParam' + // // and a single argument. + // native function SetMyParam(); + // if(b) SetMyParam(b); + // }); + // + // // Extension definitions can also contain normal JavaScript variables + // // and functions. + // var myint = 0; + // example.test.increment = function() { + // myint += 1; + // return myint; + // }; + // })(); + // + // Example usage in the page: + // + // // Call the function. + // example.test.myfunction(); + // // Set the parameter. + // example.test.myparam = value; + // // Get the parameter. + // value = example.test.myparam; + // // Call another function. + // example.test.increment(); + // + cef_register_extension: function(const extension_name, + javascript_code: PCefString; handler: PCefv8Handler): Integer; cdecl; + + // Register a scheme handler factory for the specified |scheme_name| and + // optional |domain_name|. An NULL |domain_name| value for a standard scheme + // will cause the factory to match all domain names. The |domain_name| value + // will be ignored for non-standard schemes. If |scheme_name| is a built-in + // scheme and no handler is returned by |factory| then the built-in scheme + // handler factory will be called. If |scheme_name| is a custom scheme the + // CefRegisterCustomScheme() function should be called for that scheme. This + // function may be called multiple times to change or remove the factory that + // matches the specified |scheme_name| and optional |domain_name|. Returns false + // (0) if an error occurs. This function may be called on any thread. + cef_register_scheme_handler_factory: function( + const scheme_name, domain_name: PCefString; + factory: PCefSchemeHandlerFactory): Integer; cdecl; + + // Clear all registered scheme handler factories. Returns false (0) on error. + // This function may be called on any thread. + cef_clear_scheme_handler_factories: function: Integer; cdecl; + + // Add an entry to the cross-origin access whitelist. + // + // The same-origin policy restricts how scripts hosted from different origins + // (scheme + domain + port) can communicate. By default, scripts can only access + // resources with the same origin. Scripts hosted on the HTTP and HTTPS schemes + // (but no other schemes) can use the "Access-Control-Allow-Origin" header to + // allow cross-origin requests. For example, https://source.example.com can make + // XMLHttpRequest requests on http://target.example.com if the + // http://target.example.com request returns an "Access-Control-Allow-Origin: + // https://source.example.com" response header. + // + // Scripts in separate frames or iframes and hosted from the same protocol and + // domain suffix can execute cross-origin JavaScript if both pages set the + // document.domain value to the same domain suffix. For example, + // scheme://foo.example.com and scheme://bar.example.com can communicate using + // JavaScript if both domains set document.domain="example.com". + // + // This function is used to allow access to origins that would otherwise violate + // the same-origin policy. Scripts hosted underneath the fully qualified + // |source_origin| URL (like http://www.example.com) will be allowed access to + // all resources hosted on the specified |target_protocol| and |target_domain|. + // If |target_domain| is non-NULL and |allow_target_subdomains| if false (0) + // only exact domain matches will be allowed. If |target_domain| is non-NULL and + // |allow_target_subdomains| is true (1) sub-domain matches will be allowed. If + // |target_domain| is NULL and |allow_target_subdomains| if true (1) all domains + // and IP addresses will be allowed. + // + // This function cannot be used to bypass the restrictions on local or display + // isolated schemes. See the comments on CefRegisterCustomScheme for more + // information. + // + // This function may be called on any thread. Returns false (0) if + // |source_origin| is invalid or the whitelist cannot be accessed. + + cef_add_cross_origin_whitelist_entry: function(const source_origin, target_protocol, + target_domain: PCefString; allow_target_subdomains: Integer): Integer; cdecl; + + // Remove an entry from the cross-origin access whitelist. Returns false (0) if + // |source_origin| is invalid or the whitelist cannot be accessed. + cef_remove_cross_origin_whitelist_entry: function( + const source_origin, target_protocol, target_domain: PCefString; + allow_target_subdomains: Integer): Integer; cdecl; + + // Remove all entries from the cross-origin access whitelist. Returns false (0) + // if the whitelist cannot be accessed. + cef_clear_cross_origin_whitelist: function: Integer; cdecl; + + // Returns true (1) if called on the specified thread. Equivalent to using + // cef_task_runner_t::GetForThread(threadId)->belongs_to_current_thread(). + cef_currently_on: function(threadId: TCefThreadId): Integer; cdecl; + + // Post a task for execution on the specified thread. Equivalent to using + // cef_task_runner_t::GetForThread(threadId)->PostTask(task). + cef_post_task: function(threadId: TCefThreadId; task: PCefTask): Integer; cdecl; + + // Post a task for delayed execution on the specified thread. Equivalent to + // using cef_task_runner_t::GetForThread(threadId)->PostDelayedTask(task, + // delay_ms). + cef_post_delayed_task: function(threadId: TCefThreadId; + task: PCefTask; delay_ms: Int64): Integer; cdecl; + + // Parse the specified |url| into its component parts. Returns false (0) if the + // URL is NULL or invalid. + cef_parse_url: function(const url: PCefString; var parts: TCefUrlParts): Integer; cdecl; + + // Creates a URL from the specified |parts|, which must contain a non-NULL spec + // or a non-NULL host and path (at a minimum), but not both. Returns false (0) + // if |parts| isn't initialized as described. + cef_create_url: function(parts: PCefUrlParts; url: PCefString): Integer; cdecl; + + // Create a new TCefRequest object. + cef_request_create: function(): PCefRequest; cdecl; + + // Create a new TCefPostData object. + cef_post_data_create: function(): PCefPostData; cdecl; + + // Create a new cef_post_data_Element object. + cef_post_data_element_create: function(): PCefPostDataElement; cdecl; + + // Create a new cef_stream_reader_t object from a file. + cef_stream_reader_create_for_file: function(const fileName: PCefString): PCefStreamReader; cdecl; + // Create a new cef_stream_reader_t object from data. + cef_stream_reader_create_for_data: function(data: Pointer; size: Cardinal): PCefStreamReader; cdecl; + // Create a new cef_stream_reader_t object from a custom handler. + cef_stream_reader_create_for_handler: function(handler: PCefReadHandler): PCefStreamReader; cdecl; + + // Create a new cef_stream_writer_t object for a file. + cef_stream_writer_create_for_file: function(const fileName: PCefString): PCefStreamWriter; cdecl; + // Create a new cef_stream_writer_t object for a custom handler. + cef_stream_writer_create_for_handler: function(handler: PCefWriteHandler): PCefStreamWriter; cdecl; + + // Returns the current (top) context object in the V8 context stack. + cef_v8context_get_current_context: function(): PCefv8Context; cdecl; + + // Returns the entered (bottom) context object in the V8 context stack. + cef_v8context_get_entered_context: function(): PCefv8Context; cdecl; + + // Returns true (1) if V8 is currently inside a context. + cef_v8context_in_context: function(): Integer; + + // Create a new cef_v8value_t object of type undefined. + cef_v8value_create_undefined: function(): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type null. + cef_v8value_create_null: function(): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type bool. + cef_v8value_create_bool: function(value: Integer): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type int. + cef_v8value_create_int: function(value: Integer): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type unsigned int. + cef_v8value_create_uint: function(value: Cardinal): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type double. + cef_v8value_create_double: function(value: Double): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type Date. This function should only be + // called from within the scope of a cef_v8context_tHandler, cef_v8handler_t or + // cef_v8accessor_t callback, or in combination with calling enter() and exit() + // on a stored cef_v8context_t reference. + cef_v8value_create_date: function(const value: PCefTime): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type string. + cef_v8value_create_string: function(const value: PCefString): PCefv8Value; cdecl; + + // Create a new cef_v8value_t object of type object with optional accessor. This + // function should only be called from within the scope of a + // cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in + // combination with calling enter() and exit() on a stored cef_v8context_t + // reference. + cef_v8value_create_object: function(accessor: PCefV8Accessor): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type array with the specified |length|. + // If |length| is negative the returned array will have length 0. This function + // should only be called from within the scope of a cef_v8context_tHandler, + // cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling + // enter() and exit() on a stored cef_v8context_t reference. + cef_v8value_create_array: function(length: Integer): PCefv8Value; cdecl; + // Create a new cef_v8value_t object of type function. + cef_v8value_create_function: function(const name: PCefString; handler: PCefv8Handler): PCefv8Value; cdecl; + + // Returns the stack trace for the currently active context. |frame_limit| is + // the maximum number of frames that will be captured. + cef_v8stack_trace_get_current: function(frame_limit: Integer): PCefV8StackTrace; cdecl; + + // Create a new cef_xml_reader_t object. The returned object's functions can + // only be called from the thread that created the object. + cef_xml_reader_create: function(stream: PCefStreamReader; + encodingType: TCefXmlEncodingType; const URI: PCefString): PCefXmlReader; cdecl; + + // Create a new cef_zip_reader_t object. The returned object's functions can + // only be called from the thread that created the object. + cef_zip_reader_create: function(stream: PCefStreamReader): PCefZipReader; cdecl; + + // Allocate a new string multimap. + cef_string_multimap_alloc: function: TCefStringMultimap; cdecl; + + // Return the number of elements in the string multimap. + cef_string_multimap_size: function(map: TCefStringMultimap): Integer; cdecl; + + // Return the number of values with the specified key. + cef_string_multimap_find_count: function(map: TCefStringMultimap; const key: PCefString): Integer; cdecl; + + // Return the value_index-th value with the specified key. + cef_string_multimap_enumerate: function(map: TCefStringMultimap; + const key: PCefString; value_index: Integer; var value: TCefString): Integer; cdecl; + + // Return the key at the specified zero-based string multimap index. + cef_string_multimap_key: function(map: TCefStringMultimap; index: Integer; var key: TCefString): Integer; cdecl; + + // Return the value at the specified zero-based string multimap index. + cef_string_multimap_value: function(map: TCefStringMultimap; index: Integer; var value: TCefString): Integer; cdecl; + + // Append a new key/value pair at the end of the string multimap. + cef_string_multimap_append: function(map: TCefStringMultimap; const key, value: PCefString): Integer; cdecl; + + // Clear the string multimap. + cef_string_multimap_clear: procedure(map: TCefStringMultimap); cdecl; + + // Free the string multimap. + cef_string_multimap_free: procedure(map: TCefStringMultimap); cdecl; + + cef_build_revision: function: Integer; cdecl; + + // Returns the global cookie manager. By default data will be stored at + // CefSettings.cache_path if specified or in memory otherwise. + cef_cookie_manager_get_global_manager: function(): PCefCookieManager; cdecl; + + // Creates a new cookie manager. If |path| is NULL data will be stored in memory + // only. Returns NULL if creation fails. + cef_cookie_manager_create_manager: function(const path: PCefString): PCefCookieManager; cdecl; + + // Create a new cef_command_line_t instance. + cef_command_line_create: function(): PCefCommandLine; cdecl; + + // Returns the singleton global cef_command_line_t object. The returned object + // will be read-only. + cef_command_line_get_global: function(): PCefCommandLine; cdecl; + + + // Create a new cef_process_message_t object with the specified name. + cef_process_message_create: function(const name: PCefString): PCefProcessMessage; cdecl; + + // Creates a new object that is not owned by any other object. The specified + // |data| will be copied. + cef_binary_value_create: function(const data: Pointer; data_size: Cardinal): PCefBinaryValue; cdecl; + + // Creates a new object that is not owned by any other object. + cef_dictionary_value_create: function: PCefDictionaryValue; cdecl; + + // Creates a new object that is not owned by any other object. + cef_list_value_create: function: PCefListValue; cdecl; + + // Retrieve the path associated with the specified |key|. Returns true (1) on + // success. Can be called on any thread in the browser process. + cef_get_path: function(key: TCefPathKey; path: PCefString): Integer; cdecl; + + // Launches the process specified via |command_line|. Returns true (1) upon + // success. Must be called on the browser process TID_PROCESS_LAUNCHER thread. + // + // Unix-specific notes: - All file descriptors open in the parent process will + // be closed in the + // child process except for stdin, stdout, and stderr. + // - If the first argument on the command line does not contain a slash, + // PATH will be searched. (See man execvp.) + cef_launch_process: function(command_line: PCefCommandLine): Integer; cdecl; + + // Create a new cef_response_t object. + cef_response_create: function: PCefResponse; cdecl; + + // Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request + // functions are supported. The |request| object will be marked as read-only + // after calling this function. + cef_urlrequest_create: function(request: PCefRequest; client: PCefUrlRequestClient): PCefUrlRequest; cdecl; + + // Visit web plugin information. + cef_visit_web_plugin_info: procedure(visitor: PCefWebPluginInfoVisitor); cdecl; + + // Cause the plugin list to refresh the next time it is accessed regardless of + // whether it has already been loaded. Can be called on any thread in the + // browser process. + cef_refresh_web_plugins: procedure; cdecl; + + // Add a plugin path (directory + file). This change may not take affect until + // after cef_refresh_web_plugins() is called. Can be called on any thread in the + // browser process. + cef_add_web_plugin_path: procedure(const path: PCefString); cdecl; + + // Add a plugin directory. This change may not take affect until after + // cef_refresh_web_plugins() is called. Can be called on any thread in the + // browser process. + cef_add_web_plugin_directory: procedure(const dir: PCefString); cdecl; + + // Remove a plugin path (directory + file). This change may not take affect + // until after cef_refresh_web_plugins() is called. Can be called on any thread + // in the browser process. + cef_remove_web_plugin_path: procedure(const path: PCefString); cdecl; + + // Unregister an internal plugin. This may be undone the next time + // cef_refresh_web_plugins() is called. Can be called on any thread in the + // browser process. + cef_unregister_internal_web_plugin: procedure(const path: PCefString); cdecl; + + // Force a plugin to shutdown. Can be called on any thread in the browser + // process but will be executed on the IO thread. + cef_force_web_plugin_shutdown: procedure(const path: PCefString); cdecl; + + // Register a plugin crash. Can be called on any thread in the browser process + // but will be executed on the IO thread. + cef_register_web_plugin_crash: procedure(const path: PCefString); cdecl; + + // Query if a plugin is unstable. Can be called on any thread in the browser + // process. + cef_is_web_plugin_unstable: procedure(const path: PCefString; + callback: PCefWebPluginUnstableCallback); cdecl; + + // Request a one-time geolocation update. This function bypasses any user + // permission checks so should only be used by code that is allowed to access + // location information. + cef_get_geolocation: function(callback: PCefGetGeolocationCallback): Integer; cdecl; + + // Returns the task runner for the current thread. Only CEF threads will have + // task runners. An NULL reference will be returned if this function is called + // on an invalid thread. + cef_task_runner_get_for_current_thread: function: PCefTaskRunner; cdecl; + + // Returns the task runner for the specified CEF thread. + cef_task_runner_get_for_thread: function(threadId: TCefThreadId): PCefTaskRunner; cdecl; + + + + // Start tracing events on all processes. Tracing begins immediately locally, + // and asynchronously on child processes as soon as they receive the + // BeginTracing request. + // + // If CefBeginTracing was called previously, or if a CefEndTracingAsync call is + // pending, CefBeginTracing will fail and return false (0). + // + // |categories| is a comma-delimited list of category wildcards. A category can + // have an optional '-' prefix to make it an excluded category. Having both + // included and excluded categories in the same list is not supported. + // + // Example: "test_MyTest*" Example: "test_MyTest*,test_OtherStuff" Example: + // "-excluded_category1,-excluded_category2" + // + // This function must be called on the browser process UI thread. + + cef_begin_tracing: function(client: PCefTraceClient; const categories: PCefString): Integer; cdecl; + + // Get the maximum trace buffer percent full state across all processes. + // + // cef_trace_client_t::OnTraceBufferPercentFullReply will be called + // asynchronously after the value is determibed. When any child process reaches + // 100% full tracing will end automatically and + // cef_trace_client_t::OnEndTracingComplete will be called. This function fails + // and returns false (0) if trace is ending or disabled, no cef_trace_client_t + // was passed to CefBeginTracing, or if a previous call to + // CefGetTraceBufferPercentFullAsync is pending. + // + // This function must be called on the browser process UI thread. + + cef_get_trace_buffer_percent_full_async: function: Integer; cdecl; + + // Stop tracing events on all processes. + // + // This function will fail and return false (0) if a previous call to + // CefEndTracingAsync is already pending or if CefBeginTracing was not called. + // + // This function must be called on the browser process UI thread. + + cef_end_tracing_async: function: Integer; cdecl; + + +procedure CefLoadLibrary; +procedure CefCloseLibrary; + +Implementation + +Uses Math; + +Const + CefLibrary: String = {$IFDEF MSWINDOWS}'libcef.dll'{$ELSE}'libcef.so'{$ENDIF}; +Var + LibHandle : THandle = 0; + +// Convenience macros for copying values. +function cef_string_wide_copy(const src: PWideChar; src_len: Cardinal; output: PCefStringWide): Integer; +begin + Result := cef_string_wide_set(src, src_len, output, ord(True)) +end; + +function cef_string_utf8_copy(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf8): Integer; +begin + Result := cef_string_utf8_set(src, src_len, output, ord(True)) +end; + +function cef_string_utf16_copy(const src: PChar16; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; +begin + Result := cef_string_utf16_set(src, src_len, output, ord(True)) +end; + +function cef_string_copy(const src: PCefChar; src_len: Cardinal; output: PCefString): Integer; cdecl; +begin + Result := cef_string_set(src, src_len, output, ord(True)); +end; + +procedure CefLoadLibrary; +begin + Write('CefLoadLibrary'); + + If LibHandle = 0 then + begin + Set8087CW(Get8087CW or $3F); // deactivate FPU exception + SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); + + LibHandle := LoadLibrary(CefLibrary); + If LibHandle = 0 then RaiseLastOsError; + + cef_string_wide_set := GetProcAddress(LibHandle, 'cef_string_wide_set'); + cef_string_utf8_set := GetProcAddress(LibHandle, 'cef_string_utf8_set'); + cef_string_utf16_set := GetProcAddress(LibHandle, 'cef_string_utf16_set'); + cef_string_wide_clear := GetProcAddress(LibHandle, 'cef_string_wide_clear'); + cef_string_utf8_clear := GetProcAddress(LibHandle, 'cef_string_utf8_clear'); + cef_string_utf16_clear := GetProcAddress(LibHandle, 'cef_string_utf16_clear'); + cef_string_wide_cmp := GetProcAddress(LibHandle, 'cef_string_wide_cmp'); + cef_string_utf8_cmp := GetProcAddress(LibHandle, 'cef_string_utf8_cmp'); + cef_string_utf16_cmp := GetProcAddress(LibHandle, 'cef_string_utf16_cmp'); + cef_string_wide_to_utf8 := GetProcAddress(LibHandle, 'cef_string_wide_to_utf8'); + cef_string_utf8_to_wide := GetProcAddress(LibHandle, 'cef_string_utf8_to_wide'); + cef_string_wide_to_utf16 := GetProcAddress(LibHandle, 'cef_string_wide_to_utf16'); + cef_string_utf16_to_wide := GetProcAddress(LibHandle, 'cef_string_utf16_to_wide'); + cef_string_utf8_to_utf16 := GetProcAddress(LibHandle, 'cef_string_utf8_to_utf16'); + cef_string_utf16_to_utf8 := GetProcAddress(LibHandle, 'cef_string_utf16_to_utf8'); + cef_string_ascii_to_wide := GetProcAddress(LibHandle, 'cef_string_ascii_to_wide'); + cef_string_ascii_to_utf16 := GetProcAddress(LibHandle, 'cef_string_ascii_to_utf16'); + cef_string_userfree_wide_alloc := GetProcAddress(LibHandle, 'cef_string_userfree_wide_alloc'); + cef_string_userfree_utf8_alloc := GetProcAddress(LibHandle, 'cef_string_userfree_utf8_alloc'); + cef_string_userfree_utf16_alloc := GetProcAddress(LibHandle, 'cef_string_userfree_utf16_alloc'); + cef_string_userfree_wide_free := GetProcAddress(LibHandle, 'cef_string_userfree_wide_free'); + cef_string_userfree_utf8_free := GetProcAddress(LibHandle, 'cef_string_userfree_utf8_free'); + cef_string_userfree_utf16_free := GetProcAddress(LibHandle, 'cef_string_userfree_utf16_free'); + +{$IFDEF CEF_STRING_TYPE_UTF8} + cef_string_set := cef_string_utf8_set; + cef_string_clear := cef_string_utf8_clear; + cef_string_userfree_alloc := cef_string_userfree_utf8_alloc; + cef_string_userfree_free := cef_string_userfree_utf8_free; + cef_string_from_ascii := cef_string_utf8_copy; + cef_string_to_utf8 := cef_string_utf8_copy; + cef_string_from_utf8 := cef_string_utf8_copy; + cef_string_to_utf16 := cef_string_utf8_to_utf16; + cef_string_from_utf16 := cef_string_utf16_to_utf8; + cef_string_to_wide := cef_string_utf8_to_wide; + cef_string_from_wide := cef_string_wide_to_utf8; +{$ENDIF} +{$IFDEF CEF_STRING_TYPE_UTF16} + cef_string_set := cef_string_utf16_set; + cef_string_clear := cef_string_utf16_clear; + cef_string_userfree_alloc := cef_string_userfree_utf16_alloc; + cef_string_userfree_free := cef_string_userfree_utf16_free; + cef_string_from_ascii := cef_string_ascii_to_utf16; + cef_string_to_utf8 := cef_string_utf16_to_utf8; + cef_string_from_utf8 := cef_string_utf8_to_utf16; + cef_string_to_utf16 := cef_string_utf16_copy; + cef_string_from_utf16 := cef_string_utf16_copy; + cef_string_to_wide := cef_string_utf16_to_wide; + cef_string_from_wide := cef_string_wide_to_utf16; +{$ENDIF} + +{$IFDEF CEF_STRING_TYPE_WIDE} + cef_string_set := cef_string_wide_set; + cef_string_clear := cef_string_wide_clear; + cef_string_userfree_alloc := cef_string_userfree_wide_alloc; + cef_string_userfree_free := cef_string_userfree_wide_free; + cef_string_from_ascii := cef_string_ascii_to_wide; + cef_string_to_utf8 := cef_string_wide_to_utf8; + cef_string_from_utf8 := cef_string_utf8_to_wide; + cef_string_to_utf16 := cef_string_wide_to_utf16; + cef_string_from_utf16 := cef_string_utf16_to_wide; + cef_string_to_wide := cef_string_wide_copy; + cef_string_from_wide := cef_string_wide_copy; +{$ENDIF} + + cef_string_map_alloc := GetProcAddress(LibHandle, 'cef_string_map_alloc'); + cef_string_map_size := GetProcAddress(LibHandle, 'cef_string_map_size'); + cef_string_map_find := GetProcAddress(LibHandle, 'cef_string_map_find'); + cef_string_map_key := GetProcAddress(LibHandle, 'cef_string_map_key'); + cef_string_map_value := GetProcAddress(LibHandle, 'cef_string_map_value'); + cef_string_map_append := GetProcAddress(LibHandle, 'cef_string_map_append'); + cef_string_map_clear := GetProcAddress(LibHandle, 'cef_string_map_clear'); + cef_string_map_free := GetProcAddress(LibHandle, 'cef_string_map_free'); + cef_string_list_alloc := GetProcAddress(LibHandle, 'cef_string_list_alloc'); + cef_string_list_size := GetProcAddress(LibHandle, 'cef_string_list_size'); + cef_string_list_value := GetProcAddress(LibHandle, 'cef_string_list_value'); + cef_string_list_append := GetProcAddress(LibHandle, 'cef_string_list_append'); + cef_string_list_clear := GetProcAddress(LibHandle, 'cef_string_list_clear'); + cef_string_list_free := GetProcAddress(LibHandle, 'cef_string_list_free'); + cef_string_list_copy := GetProcAddress(LibHandle, 'cef_string_list_copy'); + cef_initialize := GetProcAddress(LibHandle, 'cef_initialize'); + cef_execute_process := GetProcAddress(LibHandle, 'cef_execute_process'); + cef_shutdown := GetProcAddress(LibHandle, 'cef_shutdown'); + cef_do_message_loop_work := GetProcAddress(LibHandle, 'cef_do_message_loop_work'); + cef_run_message_loop := GetProcAddress(LibHandle, 'cef_run_message_loop'); + cef_quit_message_loop := GetProcAddress(LibHandle, 'cef_quit_message_loop'); + cef_register_extension := GetProcAddress(LibHandle, 'cef_register_extension'); + cef_register_scheme_handler_factory := GetProcAddress(LibHandle, 'cef_register_scheme_handler_factory'); + cef_clear_scheme_handler_factories := GetProcAddress(LibHandle, 'cef_clear_scheme_handler_factories'); + cef_add_cross_origin_whitelist_entry := GetProcAddress(LibHandle, 'cef_add_cross_origin_whitelist_entry'); + cef_remove_cross_origin_whitelist_entry := GetProcAddress(LibHandle, 'cef_remove_cross_origin_whitelist_entry'); + cef_clear_cross_origin_whitelist := GetProcAddress(LibHandle, 'cef_clear_cross_origin_whitelist'); + cef_currently_on := GetProcAddress(LibHandle, 'cef_currently_on'); + cef_post_task := GetProcAddress(LibHandle, 'cef_post_task'); + cef_post_delayed_task := GetProcAddress(LibHandle, 'cef_post_delayed_task'); + cef_parse_url := GetProcAddress(LibHandle, 'cef_parse_url'); + cef_create_url := GetProcAddress(LibHandle, 'cef_create_url'); + cef_browser_host_create_browser := GetProcAddress(LibHandle, 'cef_browser_host_create_browser'); + cef_browser_host_create_browser_sync := GetProcAddress(LibHandle, 'cef_browser_host_create_browser_sync'); + cef_request_create := GetProcAddress(LibHandle, 'cef_request_create'); + cef_post_data_create := GetProcAddress(LibHandle, 'cef_post_data_create'); + cef_post_data_element_create := GetProcAddress(LibHandle, 'cef_post_data_element_create'); + cef_stream_reader_create_for_file := GetProcAddress(LibHandle, 'cef_stream_reader_create_for_file'); + cef_stream_reader_create_for_data := GetProcAddress(LibHandle, 'cef_stream_reader_create_for_data'); + cef_stream_reader_create_for_handler := GetProcAddress(LibHandle, 'cef_stream_reader_create_for_handler'); + cef_stream_writer_create_for_file := GetProcAddress(LibHandle, 'cef_stream_writer_create_for_file'); + cef_stream_writer_create_for_handler := GetProcAddress(LibHandle, 'cef_stream_writer_create_for_handler'); + cef_v8context_get_current_context := GetProcAddress(LibHandle, 'cef_v8context_get_current_context'); + cef_v8context_get_entered_context := GetProcAddress(LibHandle, 'cef_v8context_get_entered_context'); + cef_v8context_in_context := GetProcAddress(LibHandle, 'cef_v8context_in_context'); + cef_v8value_create_undefined := GetProcAddress(LibHandle, 'cef_v8value_create_undefined'); + cef_v8value_create_null := GetProcAddress(LibHandle, 'cef_v8value_create_null'); + cef_v8value_create_bool := GetProcAddress(LibHandle, 'cef_v8value_create_bool'); + cef_v8value_create_int := GetProcAddress(LibHandle, 'cef_v8value_create_int'); + cef_v8value_create_uint := GetProcAddress(LibHandle, 'cef_v8value_create_uint'); + cef_v8value_create_double := GetProcAddress(LibHandle, 'cef_v8value_create_double'); + cef_v8value_create_date := GetProcAddress(LibHandle, 'cef_v8value_create_date'); + cef_v8value_create_string := GetProcAddress(LibHandle, 'cef_v8value_create_string'); + cef_v8value_create_object := GetProcAddress(LibHandle, 'cef_v8value_create_object'); + cef_v8value_create_array := GetProcAddress(LibHandle, 'cef_v8value_create_array'); + cef_v8value_create_function := GetProcAddress(LibHandle, 'cef_v8value_create_function'); + cef_v8stack_trace_get_current := GetProcAddress(LibHandle, 'cef_v8stack_trace_get_current'); + cef_xml_reader_create := GetProcAddress(LibHandle, 'cef_xml_reader_create'); + cef_zip_reader_create := GetProcAddress(LibHandle, 'cef_zip_reader_create'); + + cef_string_multimap_alloc := GetProcAddress(LibHandle, 'cef_string_multimap_alloc'); + cef_string_multimap_size := GetProcAddress(LibHandle, 'cef_string_multimap_size'); + cef_string_multimap_find_count := GetProcAddress(LibHandle, 'cef_string_multimap_find_count'); + cef_string_multimap_enumerate := GetProcAddress(LibHandle, 'cef_string_multimap_enumerate'); + cef_string_multimap_key := GetProcAddress(LibHandle, 'cef_string_multimap_key'); + cef_string_multimap_value := GetProcAddress(LibHandle, 'cef_string_multimap_value'); + cef_string_multimap_append := GetProcAddress(LibHandle, 'cef_string_multimap_append'); + cef_string_multimap_clear := GetProcAddress(LibHandle, 'cef_string_multimap_clear'); + cef_string_multimap_free := GetProcAddress(LibHandle, 'cef_string_multimap_free'); + cef_build_revision := GetProcAddress(LibHandle, 'cef_build_revision'); + + cef_cookie_manager_get_global_manager := GetProcAddress(LibHandle, 'cef_cookie_manager_get_global_manager'); + cef_cookie_manager_create_manager := GetProcAddress(LibHandle, 'cef_cookie_manager_create_manager'); + + cef_command_line_create := GetProcAddress(LibHandle, 'cef_command_line_create'); + cef_command_line_get_global := GetProcAddress(LibHandle, 'cef_command_line_get_global'); + + cef_process_message_create := GetProcAddress(LibHandle, 'cef_process_message_create'); + + cef_binary_value_create := GetProcAddress(LibHandle, 'cef_binary_value_create'); + + cef_dictionary_value_create := GetProcAddress(LibHandle, 'cef_dictionary_value_create'); + + cef_list_value_create := GetProcAddress(LibHandle, 'cef_list_value_create'); + + cef_get_path := GetProcAddress(LibHandle, 'cef_get_path'); + + cef_launch_process := GetProcAddress(LibHandle, 'cef_launch_process'); + + cef_response_create := GetProcAddress(LibHandle, 'cef_response_create'); + + cef_urlrequest_create := GetProcAddress(LibHandle, 'cef_urlrequest_create'); + + cef_visit_web_plugin_info := GetProcAddress(LibHandle, 'cef_visit_web_plugin_info'); + cef_refresh_web_plugins := GetProcAddress(LibHandle, 'cef_refresh_web_plugins'); + cef_add_web_plugin_path := GetProcAddress(LibHandle, 'cef_add_web_plugin_path'); + cef_add_web_plugin_directory := GetProcAddress(LibHandle, 'cef_add_web_plugin_directory'); + cef_remove_web_plugin_path := GetProcAddress(LibHandle, 'cef_remove_web_plugin_path'); + cef_unregister_internal_web_plugin := GetProcAddress(LibHandle, 'cef_unregister_internal_web_plugin'); + cef_force_web_plugin_shutdown := GetProcAddress(LibHandle, 'cef_force_web_plugin_shutdown'); + cef_register_web_plugin_crash := GetProcAddress(LibHandle, 'cef_register_web_plugin_crash'); + cef_is_web_plugin_unstable := GetProcAddress(LibHandle, 'cef_is_web_plugin_unstable'); + + cef_get_geolocation := GetProcAddress(LibHandle, 'cef_get_geolocation'); + + cef_task_runner_get_for_current_thread := GetProcAddress(LibHandle, 'cef_task_runner_get_for_current_thread'); + cef_task_runner_get_for_thread := GetProcAddress(LibHandle, 'cef_task_runner_get_for_thread'); + + cef_begin_tracing := GetProcAddress(LibHandle, 'cef_begin_tracing'); + cef_get_trace_buffer_percent_full_async := GetProcAddress(LibHandle, 'cef_get_trace_buffer_percent_full_async'); + cef_end_tracing_async := GetProcAddress(LibHandle, 'cef_end_tracing_async'); + + If not ( + Assigned(cef_string_wide_set) and + Assigned(cef_string_utf8_set) and + Assigned(cef_string_utf16_set) and + Assigned(cef_string_wide_clear) and + Assigned(cef_string_utf8_clear) and + Assigned(cef_string_utf16_clear) and + Assigned(cef_string_wide_cmp) and + Assigned(cef_string_utf8_cmp) and + Assigned(cef_string_utf16_cmp) and + Assigned(cef_string_wide_to_utf8) and + Assigned(cef_string_utf8_to_wide) and + Assigned(cef_string_wide_to_utf16) and + Assigned(cef_string_utf16_to_wide) and + Assigned(cef_string_utf8_to_utf16) and + Assigned(cef_string_utf16_to_utf8) and + Assigned(cef_string_ascii_to_wide) and + Assigned(cef_string_ascii_to_utf16) and + Assigned(cef_string_userfree_wide_alloc) and + Assigned(cef_string_userfree_utf8_alloc) and + Assigned(cef_string_userfree_utf16_alloc) and + Assigned(cef_string_userfree_wide_free) and + Assigned(cef_string_userfree_utf8_free) and + Assigned(cef_string_userfree_utf16_free) and + Assigned(cef_string_map_alloc) and + Assigned(cef_string_map_size) and + Assigned(cef_string_map_find) and + Assigned(cef_string_map_key) and + Assigned(cef_string_map_value) and + Assigned(cef_string_map_append) and + Assigned(cef_string_map_clear) and + Assigned(cef_string_map_free) and + Assigned(cef_string_list_alloc) and + Assigned(cef_string_list_size) and + Assigned(cef_string_list_value) and + Assigned(cef_string_list_append) and + Assigned(cef_string_list_clear) and + Assigned(cef_string_list_free) and + Assigned(cef_string_list_copy) and + Assigned(cef_initialize) and + Assigned(cef_execute_process) and + Assigned(cef_shutdown) and + Assigned(cef_do_message_loop_work) and + Assigned(cef_run_message_loop) and + Assigned(cef_quit_message_loop) and + Assigned(cef_register_extension) and + Assigned(cef_register_scheme_handler_factory) and + Assigned(cef_clear_scheme_handler_factories) and + Assigned(cef_add_cross_origin_whitelist_entry) and + Assigned(cef_remove_cross_origin_whitelist_entry) and + Assigned(cef_clear_cross_origin_whitelist) and + Assigned(cef_currently_on) and + Assigned(cef_post_task) and + Assigned(cef_post_delayed_task) and + Assigned(cef_parse_url) and + Assigned(cef_create_url) and + Assigned(cef_browser_host_create_browser) and + Assigned(cef_browser_host_create_browser_sync) and + Assigned(cef_request_create) and + Assigned(cef_post_data_create) and + Assigned(cef_post_data_element_create) and + Assigned(cef_stream_reader_create_for_file) and + Assigned(cef_stream_reader_create_for_data) and + Assigned(cef_stream_reader_create_for_handler) and + Assigned(cef_stream_writer_create_for_file) and + Assigned(cef_stream_writer_create_for_handler) and + Assigned(cef_v8context_get_current_context) and + Assigned(cef_v8context_get_entered_context) and + Assigned(cef_v8context_in_context) and + Assigned(cef_v8value_create_undefined) and + Assigned(cef_v8value_create_null) and + Assigned(cef_v8value_create_bool) and + Assigned(cef_v8value_create_int) and + Assigned(cef_v8value_create_uint) and + Assigned(cef_v8value_create_double) and + Assigned(cef_v8value_create_date) and + Assigned(cef_v8value_create_string) and + Assigned(cef_v8value_create_object) and + Assigned(cef_v8value_create_array) and + Assigned(cef_v8value_create_function) and + Assigned(cef_v8stack_trace_get_current) and + Assigned(cef_xml_reader_create) and + Assigned(cef_zip_reader_create) and + Assigned(cef_string_multimap_alloc) and + Assigned(cef_string_multimap_size) and + Assigned(cef_string_multimap_find_count) and + Assigned(cef_string_multimap_enumerate) and + Assigned(cef_string_multimap_key) and + Assigned(cef_string_multimap_value) and + Assigned(cef_string_multimap_append) and + Assigned(cef_string_multimap_clear) and + Assigned(cef_string_multimap_free) and + Assigned(cef_build_revision) and + Assigned(cef_cookie_manager_get_global_manager) and + Assigned(cef_cookie_manager_create_manager) and + Assigned(cef_command_line_create) and + Assigned(cef_command_line_get_global) and + Assigned(cef_process_message_create) and + Assigned(cef_binary_value_create) and + Assigned(cef_dictionary_value_create) and + Assigned(cef_list_value_create) and + Assigned(cef_get_path) and + Assigned(cef_launch_process) and + Assigned(cef_response_create) and + Assigned(cef_urlrequest_create) and + Assigned(cef_visit_web_plugin_info) and + Assigned(cef_refresh_web_plugins) and + Assigned(cef_add_web_plugin_path) and + Assigned(cef_add_web_plugin_directory) and + Assigned(cef_remove_web_plugin_path) and + Assigned(cef_unregister_internal_web_plugin) and + Assigned(cef_force_web_plugin_shutdown) and + Assigned(cef_register_web_plugin_crash) and + Assigned(cef_is_web_plugin_unstable) and + Assigned(cef_get_geolocation) and + Assigned(cef_task_runner_get_for_current_thread) and + Assigned(cef_task_runner_get_for_thread) and + Assigned(cef_begin_tracing) and + Assigned(cef_get_trace_buffer_percent_full_async) and + Assigned(cef_end_tracing_async) + ) then raise Exception.Create('Invalid CEF Library version'); + //) then raise ECefException.Create('Invalid CEF Library version'); + + WriteLn(': Loaded'); + end; +end; + +procedure CefCloseLibrary; +begin + Write('CefCloseLibrary'); + If LibHandle <> 0 then + begin + Writeln(': Freed'); + + FreeLibrary(LibHandle); + LibHandle := 0; + end; +end; + +Finalization + CefCloseLibrary; + +end. diff --git a/cef3api_static.pas b/cef3api_static.pas new file mode 100644 index 0000000..0325173 --- /dev/null +++ b/cef3api_static.pas @@ -0,0 +1,672 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Author: d.l.i.w <dev.dliw@gmail.com> + * Repository: http://github.com/dliw/fpCEF3 + * + *) + +Unit cef3api_static; + +{$mode objfpc}{$H+} + +Interface + +Uses + cef3lib; + +{$IFDEF WINDOWS} + {$DEFINE DYNLINK} +{$ENDIF} + +{$IF Defined(DYNLINK)} +Const +{$IF Defined(WINDOWS)} + ceflib = 'libcef.dll'; +{$ELSEIF Defined(UNIX)} + ceflib = 'libcef.so'; +{$ELSE} + {$MESSAGE ERROR 'DYNLINK not supported'} +{$IFEND} +{$ELSEIF Defined(Darwin)} + {$linkframework cef} +{$ELSE} + {$LINKLIB cef} +{$ENDIF} + +// These functions set string values. If |copy| is true (1) the value will be +// copied instead of referenced. It is up to the user to properly manage +// the lifespan of references. +//function cef_string_wide_set(const src: PWideChar; src_len: Cardinal; output: PCefStringWide; copy: Integer): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_utf8_set(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf8; copy: Integer): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_utf16_set(const src: PChar16; src_len: Cardinal; output: PCefStringUtf16; copy: Integer): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_set(const src: PCefChar; src_len: Cardinal; output: PCefString; copy: Integer): Integer; + + +// These functions clear string values. The structure itself is not freed. +//procedure cef_string_wide_clear(str: PCefStringWide); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//procedure cef_string_utf8_clear(str: PCefStringUtf8); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +procedure cef_string_utf16_clear(str: PCefStringUtf16); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +procedure cef_string_clear(str: PCefString); + + +// These functions compare two string values with the same results as strcmp(). +//function cef_string_wide_cmp(const str1, str2: PCefStringWide): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_utf8_cmp(const str1, str2: PCefStringUtf8): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_utf16_cmp(const str1, str2: PCefStringUtf16): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + + +// These functions convert between UTF-8, -16, and -32 strings. They are +// potentially slow so unnecessary conversions should be avoided. The best +// possible result will always be written to |output| with the boolean return +// value indicating whether the conversion is 100% valid. +//function cef_string_wide_to_utf8(const src: PWideChar; src_len: Cardinal; output: PCefStringUtf8): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_utf8_to_wide(const src: PAnsiChar; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +function cef_string_wide_to_utf16(const src: PWideChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_utf16_to_wide(const src: PChar16; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +function cef_string_utf8_to_utf16(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_utf16_to_utf8(const src: PChar16; src_len: Cardinal; output: PCefStringUtf8): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +function cef_string_from_utf8(const src: PAnsiChar; src_len: Cardinal; output: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_from_utf16(const src: PChar16; src_len: Cardinal; output: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_from_wide(const src: PWideChar; src_len: Cardinal; output: PCefString): Integer; +//function cef_string_to_utf8(const src: PCefChar; src_len: Cardinal; output: PCefStringUtf8): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_to_utf16(const src: PCefChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_to_wide(const src: PCefChar; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + + +// These functions convert an ASCII string, typically a hardcoded constant, to a +// Wide/UTF16 string. Use instead of the UTF8 conversion routines if you know +// the string is ASCII. +//function cef_string_ascii_to_wide(const src: PAnsiChar; src_len: Cardinal; output: PCefStringWide): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_ascii_to_utf16(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf16): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_from_ascii(const src: PAnsiChar; src_len: Cardinal; output: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + + +// These functions allocate a new string structure. They must be freed by +// calling the associated free function. +//function cef_string_userfree_wide_alloc(): PCefStringUserFreeWide; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_userfree_utf8_alloc(): PCefStringUserFreeUtf8; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_userfree_utf16_alloc(): PCefStringUserFreeUtf16; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_userfree_alloc(): PCefStringUserFree; + + +// These functions free the string structure allocated by the associated +// alloc function. Any string contents will first be cleared. +//procedure cef_string_userfree_wide_free(str: PCefStringUserFreeWide); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//procedure cef_string_userfree_utf8_free(str: PCefStringUserFreeUtf8); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +procedure cef_string_userfree_utf16_free(str: PCefStringUserFreeUtf16); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +procedure cef_string_userfree_free(str: PCefStringUserFree); + +{ + +// Convenience macros for copying values. +function cef_string_wide_copy(const src: PWideChar; src_len: Cardinal; output: PCefStringWide): Integer; +begin + Result := cef_string_wide_set(src, src_len, output, ord(True)) +end; + +function cef_string_utf8_copy(const src: PAnsiChar; src_len: Cardinal; output: PCefStringUtf8): Integer; +begin + Result := cef_string_utf8_set(src, src_len, output, ord(True)) +end; + +function cef_string_utf16_copy(const src: PChar16; src_len: Cardinal; output: PCefStringUtf16): Integer; +begin + Result := cef_string_utf16_set(src, src_len, output, ord(True)) +end; + +function cef_string_copy(const src: PCefChar; src_len: Cardinal; output: PCefString): Integer; +begin + Result := cef_string_set(src, src_len, output, ord(True)); +end; + +} + +// Create a new browser window using the window parameters specified by +// |windowInfo|. All values will be copied internally and the actual window will +// be created on the UI thread. This function can be called on any browser +// process thread and will not block. +function cef_browser_host_create_browser( + const windowInfo: PCefWindowInfo; client: PCefClient; + const url: PCefString; const settings: PCefBrowserSettings): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new browser window using the window parameters specified by +// |windowInfo|. This function can only be called on the browser process UI +// thread. +function cef_browser_host_create_browser_sync( + const windowInfo: PCefWindowInfo; client: PCefClient; + const url: PCefString; const settings: PCefBrowserSettings): PCefBrowser; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Perform a single iteration of CEF message loop processing. This function is +// used to integrate the CEF message loop into an existing application message +// loop. Care must be taken to balance performance against excessive CPU usage. +// This function should only be called on the main application thread and only +// if cef_initialize() is called with a CefSettings.multi_threaded_message_loop +// value of false (0). This function will not block. +procedure cef_do_message_loop_work(); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Run the CEF message loop. Use this function instead of an application- +// provided message loop to get the best balance between performance and CPU +// usage. This function should only be called on the main application thread and +// only if cef_initialize() is called with a +// CefSettings.multi_threaded_message_loop value of false (0). This function +// will block until a quit message is received by the system. +procedure cef_run_message_loop; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Quit the CEF message loop that was started by calling cef_run_message_loop(). +// This function should only be called on the main application thread and only +// if cef_run_message_loop() was used. +procedure cef_quit_message_loop; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// This function should be called from the application entry point function to +// execute a secondary process. It can be used to run secondary processes from +// the browser client executable (default behavior) or from a separate +// executable specified by the CefSettings.browser_subprocess_path value. If +// called for the browser process (identified by no "type" command-line value) +// it will return immediately with a value of -1. If called for a recognized +// secondary process it will block until the process should exit and then return +// the process exit code. The |application| parameter may be NULL. +function cef_execute_process(const args: PCefMainArgs; application: PCefApp): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// This function should be called on the main application thread to initialize +// the CEF browser process. The |application| parameter may be NULL. A return +// value of true (1) indicates that it succeeded and false (0) indicates that it +// failed. +function cef_initialize(const args: PCefMainArgs; const settings: PCefSettings; application: PCefApp): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// This function should be called on the main application thread to shut down +// the CEF browser process before the application exits. +procedure cef_shutdown(); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Allocate a new string map. +function cef_string_map_alloc(): TCefStringMap; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +//function cef_string_map_size(map: TCefStringMap): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +function cef_string_map_size(map: TCefStringMap): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Return the value assigned to the specified key. +function cef_string_map_find(map: TCefStringMap; const key: PCefString; var value: TCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Return the key at the specified zero-based string map index. +function cef_string_map_key(map: TCefStringMap; index: Integer; var key: TCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Return the value at the specified zero-based string map index. +function cef_string_map_value(map: TCefStringMap; index: Integer; var value: TCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Append a new key/value pair at the end of the string map. +function cef_string_map_append(map: TCefStringMap; const key, value: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Clear the string map. +procedure cef_string_map_clear(map: TCefStringMap); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Free the string map. +procedure cef_string_map_free(map: TCefStringMap); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Allocate a new string map. +function cef_string_list_alloc(): TCefStringList; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Return the number of elements in the string list. +function cef_string_list_size(list: TCefStringList): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Retrieve the value at the specified zero-based string list index. Returns +// true (1) if the value was successfully retrieved. +function cef_string_list_value(list: TCefStringList; index: Integer; value: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Append a new value at the end of the string list. +procedure cef_string_list_append(list: TCefStringList; const value: PCefString); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Clear the string list. +procedure cef_string_list_clear(list: TCefStringList); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Free the string list. +procedure cef_string_list_free(list: TCefStringList); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Creates a copy of an existing string list. +function cef_string_list_copy(list: TCefStringList): TCefStringList; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + + +// Register a new V8 extension with the specified JavaScript extension code and +// handler. Functions implemented by the handler are prototyped using the +// keyword 'native'. The calling of a native function is restricted to the scope +// in which the prototype of the native function is defined. This function may +// only be called on the render process main thread. +// +// Example JavaScript extension code: +// +// // create the 'example' global object if it doesn't already exist. +// if (!example) +// example = {}; +// // create the 'example.test' global object if it doesn't already exist. +// if (!example.test) +// example.test = {}; +// (function() { +// // Define the function 'example.test.myfunction'. +// example.test.myfunction = function() { +// // Call CefV8Handler::Execute() with the function name 'MyFunction' +// // and no arguments. +// native function MyFunction(); +// return MyFunction(); +// }; +// // Define the getter function for parameter 'example.test.myparam'. +// example.test.__defineGetter__('myparam', function() { +// // Call CefV8Handler::Execute() with the function name 'GetMyParam' +// // and no arguments. +// native function GetMyParam(); +// return GetMyParam(); +// }); +// // Define the setter function for parameter 'example.test.myparam'. +// example.test.__defineSetter__('myparam', function(b) { +// // Call CefV8Handler::Execute() with the function name 'SetMyParam' +// // and a single argument. +// native function SetMyParam(); +// if(b) SetMyParam(b); +// }); +// +// // Extension definitions can also contain normal JavaScript variables +// // and functions. +// var myint = 0; +// example.test.increment = function() { +// myint += 1; +// return myint; +// }; +// })(); +// +// Example usage in the page: +// +// // Call the function. +// example.test.myfunction(); +// // Set the parameter. +// example.test.myparam = value; +// // Get the parameter. +// value = example.test.myparam; +// // Call another function. +// example.test.increment(); +// +function cef_register_extension(const extension_name, + javascript_code: PCefString; handler: PCefv8Handler): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Register a scheme handler factory for the specified |scheme_name| and +// optional |domain_name|. An NULL |domain_name| value for a standard scheme +// will cause the factory to match all domain names. The |domain_name| value +// will be ignored for non-standard schemes. If |scheme_name| is a built-in +// scheme and no handler is returned by |factory| then the built-in scheme +// handler factory will be called. If |scheme_name| is a custom scheme the +// CefRegisterCustomScheme() function should be called for that scheme. This +// function may be called multiple times to change or remove the factory that +// matches the specified |scheme_name| and optional |domain_name|. Returns false +// (0) if an error occurs. This function may be called on any thread. +function cef_register_scheme_handler_factory( + const scheme_name, domain_name: PCefString; + factory: PCefSchemeHandlerFactory): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Clear all registered scheme handler factories. Returns false (0) on error. +// This function may be called on any thread. +function cef_clear_scheme_handler_factories: Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Add an entry to the cross-origin access whitelist. +// +// The same-origin policy restricts how scripts hosted from different origins +// (scheme + domain + port) can communicate. By default, scripts can only access +// resources with the same origin. Scripts hosted on the HTTP and HTTPS schemes +// (but no other schemes) can use the "Access-Control-Allow-Origin" header to +// allow cross-origin requests. For example, https://source.example.com can make +// XMLHttpRequest requests on http://target.example.com if the +// http://target.example.com request returns an "Access-Control-Allow-Origin: +// https://source.example.com" response header. +// +// Scripts in separate frames or iframes and hosted from the same protocol and +// domain suffix can execute cross-origin JavaScript if both pages set the +// document.domain value to the same domain suffix. For example, +// scheme://foo.example.com and scheme://bar.example.com can communicate using +// JavaScript if both domains set document.domain="example.com". +// +// This function is used to allow access to origins that would otherwise violate +// the same-origin policy. Scripts hosted underneath the fully qualified +// |source_origin| URL (like http://www.example.com) will be allowed access to +// all resources hosted on the specified |target_protocol| and |target_domain|. +// If |target_domain| is non-NULL and |allow_target_subdomains| if false (0) +// only exact domain matches will be allowed. If |target_domain| is non-NULL and +// |allow_target_subdomains| is true (1) sub-domain matches will be allowed. If +// |target_domain| is NULL and |allow_target_subdomains| if true (1) all domains +// and IP addresses will be allowed. +// +// This function cannot be used to bypass the restrictions on local or display +// isolated schemes. See the comments on CefRegisterCustomScheme for more +// information. +// +// This function may be called on any thread. Returns false (0) if +// |source_origin| is invalid or the whitelist cannot be accessed. +function cef_add_cross_origin_whitelist_entry(const source_origin, target_protocol, + target_domain: PCefString; allow_target_subdomains: Integer): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Remove an entry from the cross-origin access whitelist. Returns false (0) if +// |source_origin| is invalid or the whitelist cannot be accessed. +function cef_remove_cross_origin_whitelist_entry( + const source_origin, target_protocol, target_domain: PCefString; + allow_target_subdomains: Integer): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Remove all entries from the cross-origin access whitelist. Returns false (0) +// if the whitelist cannot be accessed. +function cef_clear_cross_origin_whitelist: Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns true (1) if called on the specified thread. Equivalent to using +// cef_task_runner_t::GetForThread(threadId)->belongs_to_current_thread(). +function cef_currently_on(threadId: TCefThreadId): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Post a task for execution on the specified thread. Equivalent to using +// cef_task_runner_t::GetForThread(threadId)->PostTask(task). +function cef_post_task(threadId: TCefThreadId; task: PCefTask): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Post a task for delayed execution on the specified thread. Equivalent to +// using cef_task_runner_t::GetForThread(threadId)->PostDelayedTask(task, +// delay_ms). +function cef_post_delayed_task(threadId: TCefThreadId; + task: PCefTask; delay_ms: Int64): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Parse the specified |url| into its component parts. Returns false (0) if the +// URL is NULL or invalid. +function cef_parse_url(const url: PCefString; var parts: TCefUrlParts): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Creates a URL from the specified |parts|, which must contain a non-NULL spec +// or a non-NULL host and path (at a minimum), but not both. Returns false (0) +// if |parts| isn't initialized as described. +function cef_create_url(parts: PCefUrlParts; url: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new TCefRequest object. +function cef_request_create(): PCefRequest; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new TCefPostData object. +function cef_post_data_create(): PCefPostData; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_post_data_Element object. +function cef_post_data_element_create(): PCefPostDataElement; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_stream_reader_t object from a file. +function cef_stream_reader_create_for_file(const fileName: PCefString): PCefStreamReader; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_stream_reader_t object from data. +function cef_stream_reader_create_for_data(data: Pointer; size: Cardinal): PCefStreamReader; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_stream_reader_t object from a custom handler. +function cef_stream_reader_create_for_handler(handler: PCefReadHandler): PCefStreamReader; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_stream_writer_t object for a file. +function cef_stream_writer_create_for_file(const fileName: PCefString): PCefStreamWriter; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_stream_writer_t object for a custom handler. +function cef_stream_writer_create_for_handler(handler: PCefWriteHandler): PCefStreamWriter; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns the current (top) context object in the V8 context stack. +function cef_v8context_get_current_context(): PCefv8Context; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns the entered (bottom) context object in the V8 context stack. +function cef_v8context_get_entered_context(): PCefv8Context; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns true (1) if V8 is currently inside a context. +function cef_v8context_in_context(): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_v8value_t object of type undefined. +function cef_v8value_create_undefined(): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type null. +function cef_v8value_create_null(): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type bool. +function cef_v8value_create_bool(value: Integer): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type int. +function cef_v8value_create_int(value: Integer): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type unsigned int. +function cef_v8value_create_uint(value: Cardinal): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type double. +function cef_v8value_create_double(value: Double): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type Date. This function should only be +// called from within the scope of a cef_v8context_tHandler, cef_v8handler_t or +// cef_v8accessor_t callback, or in combination with calling enter() and exit() +// on a stored cef_v8context_t reference. +function cef_v8value_create_date(const value: PCefTime): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type string. +function cef_v8value_create_string(const value: PCefString): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_v8value_t object of type object with optional accessor. This +// function should only be called from within the scope of a +// cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in +// combination with calling enter() and exit() on a stored cef_v8context_t +// reference. +function cef_v8value_create_object(accessor: PCefV8Accessor): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type array with the specified |length|. +// If |length| is negative the returned array will have length 0. This function +// should only be called from within the scope of a cef_v8context_tHandler, +// cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling +// enter() and exit() on a stored cef_v8context_t reference. +function cef_v8value_create_array(length: Integer): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; +// Create a new cef_v8value_t object of type function. +function cef_v8value_create_function(const name: PCefString; handler: PCefv8Handler): PCefv8Value; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns the stack trace for the currently active context. |frame_limit| is +// the maximum number of frames that will be captured. +function cef_v8stack_trace_get_current(frame_limit: Integer): PCefV8StackTrace; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_xml_reader_t object. The returned object's functions can +// only be called from the thread that created the object. +function cef_xml_reader_create(stream: PCefStreamReader; + encodingType: TCefXmlEncodingType; const URI: PCefString): PCefXmlReader; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_zip_reader_t object. The returned object's functions can +// only be called from the thread that created the object. +function cef_zip_reader_create(stream: PCefStreamReader): PCefZipReader; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Allocate a new string multimap. +function cef_string_multimap_alloc: TCefStringMultimap; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Return the number of elements in the string multimap. +function cef_string_multimap_size(map: TCefStringMultimap): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Return the number of values with the specified key. +function cef_string_multimap_find_count(map: TCefStringMultimap; const key: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Return the value_index-th value with the specified key. +function cef_string_multimap_enumerate(map: TCefStringMultimap; + const key: PCefString; value_index: Integer; var value: TCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Return the key at the specified zero-based string multimap index. +function cef_string_multimap_key(map: TCefStringMultimap; index: Integer; var key: TCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Return the value at the specified zero-based string multimap index. +function cef_string_multimap_value(map: TCefStringMultimap; index: Integer; var value: TCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Append a new key/value pair at the end of the string multimap. +function cef_string_multimap_append(map: TCefStringMultimap; const key, value: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Clear the string multimap. +procedure cef_string_multimap_clear(map: TCefStringMultimap); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Free the string multimap. +procedure cef_string_multimap_free(map: TCefStringMultimap); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +function cef_build_revision: Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns the global cookie manager. By default data will be stored at +// CefSettings.cache_path if specified or in memory otherwise. +function cef_cookie_manager_get_global_manager(): PCefCookieManager; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Creates a new cookie manager. If |path| is NULL data will be stored in memory +// only. Returns NULL if creation fails. +function cef_cookie_manager_create_manager(const path: PCefString): PCefCookieManager; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_command_line_t instance. +function cef_command_line_create(): PCefCommandLine; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns the singleton global cef_command_line_t object. The returned object +// will be read-only. +function cef_command_line_get_global(): PCefCommandLine; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + + +// Create a new cef_process_message_t object with the specified name. +function cef_process_message_create(const name: PCefString): PCefProcessMessage; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Creates a new object that is not owned by any other object. The specified +// |data| will be copied. +function cef_binary_value_create(const data: Pointer; data_size: Cardinal): PCefBinaryValue; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Creates a new object that is not owned by any other object. +function cef_dictionary_value_create: PCefDictionaryValue; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Creates a new object that is not owned by any other object. +function cef_list_value_create: PCefListValue; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Retrieve the path associated with the specified |key|. Returns true (1) on +// success. Can be called on any thread in the browser process. +function cef_get_path(key: TCefPathKey; path: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Launches the process specified via |command_line|. Returns true (1) upon +// success. Must be called on the browser process TID_PROCESS_LAUNCHER thread. +// +// Unix-specific notes: - All file descriptors open in the parent process will +// be closed in the +// child process except for stdin, stdout, and stderr. +// - If the first argument on the command line does not contain a slash, +// PATH will be searched. (See man execvp.) +function cef_launch_process(command_line: PCefCommandLine): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new cef_response_t object. +function cef_response_create: PCefResponse; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Create a new URL request. Only GET, POST, HEAD, DELETE and PUT request +// functions are supported. The |request| object will be marked as read-only +// after calling this function. +function cef_urlrequest_create(request: PCefRequest; client: PCefUrlRequestClient): PCefUrlRequest; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Visit web plugin information. +procedure cef_visit_web_plugin_info(visitor: PCefWebPluginInfoVisitor); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Cause the plugin list to refresh the next time it is accessed regardless of +// whether it has already been loaded. Can be called on any thread in the +// browser process. +procedure cef_refresh_web_plugins; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Add a plugin path (directory + file). This change may not take affect until +// after cef_refresh_web_plugins() is called. Can be called on any thread in the +// browser process. +procedure cef_add_web_plugin_path(const path: PCefString); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Add a plugin directory. This change may not take affect until after +// cef_refresh_web_plugins() is called. Can be called on any thread in the +// browser process. +procedure cef_add_web_plugin_directory(const dir: PCefString); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Remove a plugin path (directory + file). This change may not take affect +// until after cef_refresh_web_plugins() is called. Can be called on any thread +// in the browser process. +procedure cef_remove_web_plugin_path(const path: PCefString); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Unregister an internal plugin. This may be undone the next time +// cef_refresh_web_plugins() is called. Can be called on any thread in the +// browser process. +procedure cef_unregister_internal_web_plugin(const path: PCefString); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Force a plugin to shutdown. Can be called on any thread in the browser +// process but will be executed on the IO thread. +procedure cef_force_web_plugin_shutdown(const path: PCefString); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Register a plugin crash. Can be called on any thread in the browser process +// but will be executed on the IO thread. +procedure cef_register_web_plugin_crash(const path: PCefString); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Query if a plugin is unstable. Can be called on any thread in the browser +// process. +procedure cef_is_web_plugin_unstable(const path: PCefString; + callback: PCefWebPluginUnstableCallback); cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Request a one-time geolocation update. This function bypasses any user +// permission checks so should only be used by code that is allowed to access +// location information. +function cef_get_geolocation(callback: PCefGetGeolocationCallback): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns the task runner for the current thread. Only CEF threads will have +// task runners. An NULL reference will be returned if this function is called +// on an invalid thread. +function cef_task_runner_get_for_current_thread: PCefTaskRunner; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Returns the task runner for the specified CEF thread. +function cef_task_runner_get_for_thread(threadId: TCefThreadId): PCefTaskRunner; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + + + +// Start tracing events on all processes. Tracing begins immediately locally, +// and asynchronously on child processes as soon as they receive the +// BeginTracing request. +// +// If CefBeginTracing was called previously, or if a CefEndTracingAsync call is +// pending, CefBeginTracing will fail and return false (0). +// +// |categories| is a comma-delimited list of category wildcards. A category can +// have an optional '-' prefix to make it an excluded category. Having both +// included and excluded categories in the same list is not supported. +// +// Example: "test_MyTest*" Example: "test_MyTest*,test_OtherStuff" Example: +// "-excluded_category1,-excluded_category2" +// +// This function must be called on the browser process UI thread. +function cef_begin_tracing(client: PCefTraceClient; const categories: PCefString): Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Get the maximum trace buffer percent full state across all processes. +// +// cef_trace_client_t::OnTraceBufferPercentFullReply will be called +// asynchronously after the value is determibed. When any child process reaches +// 100% full tracing will end automatically and +// cef_trace_client_t::OnEndTracingComplete will be called. This function fails +// and returns false (0) if trace is ending or disabled, no cef_trace_client_t +// was passed to CefBeginTracing, or if a previous call to +// CefGetTraceBufferPercentFullAsync is pending. +// +// This function must be called on the browser process UI thread. +function cef_get_trace_buffer_percent_full_async: Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +// Stop tracing events on all processes. +// +// This function will fail and return false (0) if a previous call to +// CefEndTracingAsync is already pending or if CefBeginTracing was not called. +// +// This function must be called on the browser process UI thread. +function cef_end_tracing_async: Integer; cdecl; external {$IFDEF DYNLINK}ceflib{$ENDIF}; + +{external {$IFDEF DYNLINK}ceflib{$ENDIF};} + +Implementation + +Uses Math; + +function cef_string_set(const src : PCefChar; src_len : Cardinal; output : PCefString; copy : Integer) : Integer; +begin + {$IFDEF CEF_STRING_TYPE_UTF16} + Result := cef_string_set(src, src_len, output, copy); + {$ENDIF} +end; + +procedure cef_string_clear(str : PCefString); +begin + {$IFDEF CEF_STRING_TYPE_UTF16} + cef_string_utf16_clear(str); + {$ENDIF} +end; + +function cef_string_from_wide(const src : PWideChar; src_len : Cardinal; output : PCefString) : Integer; +begin + {$IFDEF CEF_STRING_TYPE_UTF16} + Result := cef_string_wide_to_utf16(src, src_len, output); + {$ENDIF} +end; + +function cef_string_userfree_alloc : PCefStringUserFree; +begin + {$IFDEF CEF_STRING_TYPE_UTF16} + Result := cef_string_userfree_utf16_alloc; + {$ENDIF} +end; + +procedure cef_string_userfree_free(str : PCefStringUserFree); +begin + {$IFDEF CEF_STRING_TYPE_UTF16} + cef_string_userfree_utf16_free(str); + {$ENDIF} +end; + +Initialization + // Set exception masks + Set8087CW(Get8087CW or $3F); + SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]); + +end. + diff --git a/cef3class.pas b/cef3class.pas new file mode 100644 index 0000000..bf5c5f4 --- /dev/null +++ b/cef3class.pas @@ -0,0 +1,8113 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Ported to Free Pascal and Linux by d.l.i.w <dev.dliw@gmail.com> + * based on 'Delphi Chromium Embedded' + * + * Repository: http://github.com/dliw/fpCEF3 + * + * + * Originally created for Delphi by: Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +Unit cef3class; + +{$mode objfpc}{$H+} + +{$I cef.inc} + +Interface + +Uses + cwstring, + Classes, SysUtils, Math, + cef3lib, cef3api, cef3intf; + +Type + + TCefBaseOwn = class(TInterfacedObject, ICefBase) + private + FData: Pointer; + public + function Wrap: Pointer; + constructor CreateData(size: Cardinal; owned: Boolean = False); virtual; + destructor Destroy; override; + end; + + TCefBaseRef = class(TInterfacedObject, ICefBase) + private + FData: Pointer; + public + constructor Create(data: Pointer); virtual; + destructor Destroy; override; + function Wrap: Pointer; + class function UnWrap(data: Pointer): ICefBase; + end; + + TCefRunFileDialogCallbackOwn = class(TCefBaseOwn, ICefRunFileDialogCallback) + protected + procedure Cont(const browserHost: ICefBrowserHost; filePaths: TStrings); virtual; + public + constructor Create; + end; + + TCefFastRunFileDialogCallback = class(TCefRunFileDialogCallbackOwn) + private + FCallback: TCefRunFileDialogCallbackProc; + protected + procedure Cont(const browserHost: ICefBrowserHost; filePaths: TStrings); override; + public + constructor Create(callback: TCefRunFileDialogCallbackProc); reintroduce; virtual; + end; + + TCefBrowserHostRef = class(TCefBaseRef, ICefBrowserHost) + protected + function GetBrowser: ICefBrowser; + procedure ParentWindowWillClose; + procedure CloseBrowser; + procedure SetFocus(enable: Boolean); + function GetWindowHandle: TCefWindowHandle; + function GetOpenerWindowHandle: TCefWindowHandle; + function GetDevToolsUrl(httpScheme: Boolean): ustring; + function GetZoomLevel: Double; + procedure SetZoomLevel(zoomLevel: Double); + procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFileName: string; + acceptTypes: TStrings; const callback: ICefRunFileDialogCallback); + procedure RunFileDialogProc(mode: TCefFileDialogMode; const title, defaultFileName: string; + acceptTypes: TStrings; const callback: TCefRunFileDialogCallbackProc); + function IsWindowRenderingDisabled: Boolean; + procedure WasResized; + procedure Invalidate(const dirtyRect: PCefRect; kind: TCefPaintElementType); + procedure SendKeyEvent(const event: PCefKeyEvent); + procedure SendMouseClickEvent(const event: PCefMouseEvent; + kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer); + procedure SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean); + procedure SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer); + procedure SendFocusEvent(Focus: Boolean); + procedure SendCaptureLostEvent; + public + class function UnWrap(data: Pointer): ICefBrowserHost; + end; + + TCefBrowserRef = class(TCefBaseRef, ICefBrowser) + protected + function GetHost: ICefBrowserHost; + function CanGoBack: Boolean; + procedure GoBack; + function CanGoForward: Boolean; + procedure GoForward; + function IsLoading: Boolean; + procedure Reload; + procedure ReloadIgnoreCache; + procedure StopLoad; + function GetIdentifier: Integer; + function IsSame(const that: ICefBrowser): Boolean; + function IsPopup: Boolean; + function HasDocument: Boolean; + function GetMainFrame: ICefFrame; + function GetFocusedFrame: ICefFrame; + function GetFrameByident(identifier: Int64): ICefFrame; + function GetFrame(const name: ustring): ICefFrame; + function GetFrameCount: Cardinal; + procedure GetFrameIdentifiers(count: PCardinal; identifiers: PInt64); + procedure GetFrameNames(names: TStrings); + function SendProcessMessage(targetProcess: TCefProcessId; + message: ICefProcessMessage): Boolean; + public + class function UnWrap(data: Pointer): ICefBrowser; + end; + + TCefFrameRef = class(TCefBaseRef, ICefFrame) + protected + function IsValid: Boolean; + procedure Undo; + procedure Redo; + procedure Cut; + procedure Copy; + procedure Paste; + procedure Del; + procedure SelectAll; + procedure ViewSource; + procedure GetSource(const visitor: ICefStringVisitor); + procedure GetSourceProc(const proc: TCefStringVisitorProc); + procedure GetText(const visitor: ICefStringVisitor); + procedure GetTextProc(const proc: TCefStringVisitorProc); + procedure LoadRequest(const request: ICefRequest); + procedure LoadUrl(const url: ustring); + procedure LoadString(const str, url: ustring); + procedure ExecuteJavaScript(const code, scriptUrl: ustring; startLine: Integer); + function IsMain: Boolean; + function IsFocused: Boolean; + function GetName: ustring; + function GetIdentifier: Int64; + function GetParent: ICefFrame; + function GetUrl: ustring; + function GetBrowser: ICefBrowser; + function GetV8Context: ICefv8Context; + procedure VisitDom(const visitor: ICefDomVisitor); + procedure VisitDomProc(const proc: TCefDomVisitorProc); + public + class function UnWrap(data: Pointer): ICefFrame; + end; + + TCefPostDataRef = class(TCefBaseRef, ICefPostData) + protected + function IsReadOnly: Boolean; + function GetCount: Cardinal; + function GetElements(Count: Cardinal): IInterfaceList; // ICefPostDataElement + function RemoveElement(const element: ICefPostDataElement): Integer; + function AddElement(const element: ICefPostDataElement): Integer; + procedure RemoveElements; + public + class function UnWrap(data: Pointer): ICefPostData; + class function New: ICefPostData; + end; + + TCefPostDataElementRef = class(TCefBaseRef, ICefPostDataElement) + protected + function IsReadOnly: Boolean; + procedure SetToEmpty; + procedure SetToFile(const fileName: ustring); + procedure SetToBytes(size: Cardinal; bytes: Pointer); + function GetType: TCefPostDataElementType; + function GetFile: ustring; + function GetBytesCount: Cardinal; + function GetBytes(size: Cardinal; bytes: Pointer): Cardinal; + public + class function UnWrap(data: Pointer): ICefPostDataElement; + class function New: ICefPostDataElement; + end; + + TCefRequestRef = class(TCefBaseRef, ICefRequest) + protected + function IsReadOnly: Boolean; + function GetUrl: ustring; + function GetMethod: ustring; + function GetPostData: ICefPostData; + procedure GetHeaderMap(const HeaderMap: ICefStringMultimap); + procedure SetUrl(const value: ustring); + procedure SetMethod(const value: ustring); + procedure SetPostData(const value: ICefPostData); + procedure SetHeaderMap(const HeaderMap: ICefStringMultimap); + function GetFlags: TCefUrlRequestFlags; + procedure SetFlags(flags: TCefUrlRequestFlags); + function GetFirstPartyForCookies: ustring; + procedure SetFirstPartyForCookies(const url: ustring); + procedure Assign(const url, method: ustring; + const postData: ICefPostData; const headerMap: ICefStringMultimap); + public + class function UnWrap(data: Pointer): ICefRequest; + class function New: ICefRequest; + end; + + TCefStreamReaderRef = class(TCefBaseRef, ICefStreamReader) + protected + function Read(ptr: Pointer; size, n: Cardinal): Cardinal; + function Seek(offset: Int64; whence: Integer): Integer; + function Tell: Int64; + function Eof: Boolean; + public + class function UnWrap(data: Pointer): ICefStreamReader; + class function CreateForFile(const filename: ustring): ICefStreamReader; + class function CreateForCustomStream(const stream: ICefCustomStreamReader): ICefStreamReader; + class function CreateForStream(const stream: TSTream; owned: Boolean): ICefStreamReader; + class function CreateForData(data: Pointer; size: Cardinal): ICefStreamReader; + end; + + TCefV8AccessorGetterProc = function(const name: ustring; const obj: ICefv8Value; out value: ICefv8Value; const exception: string): Boolean; + TCefV8AccessorSetterProc = function(const name: ustring; const obj, value: ICefv8Value; const exception: string): Boolean; + + { TCefv8ValueRef } + + TCefv8ValueRef = class(TCefBaseRef, ICefv8Value) + protected + function IsValid: Boolean; + function IsUndefined: Boolean; + function IsNull: Boolean; + function IsBool: Boolean; + function IsInt: Boolean; + function IsUInt: Boolean; + function IsDouble: Boolean; + function IsDate: Boolean; + function IsString: Boolean; + function IsObject: Boolean; + function IsArray: Boolean; + function IsFunction: Boolean; + function IsSame(const that: ICefv8Value): Boolean; + function GetBoolValue: Boolean; + function GetIntValue: Integer; + function GetUIntValue: Cardinal; + function GetDoubleValue: Double; + function GetDateValue: TDateTime; + function GetStringValue: ustring; + function IsUserCreated: Boolean; + function HasException: Boolean; + function GetException: ICefV8Exception; + function ClearException: Boolean; + function WillRethrowExceptions: Boolean; + function SetRethrowExceptions(rethrow: Boolean): Boolean; + function HasValueByKey(const key: ustring): Boolean; + function HasValueByIndex(index: Integer): Boolean; + function DeleteValueByKey(const key: ustring): Boolean; + function DeleteValueByIndex(index: Integer): Boolean; + function GetValueByKey(const key: ustring): ICefv8Value; + function GetValueByIndex(index: Integer): ICefv8Value; + function SetValueByKey(const key: ustring; const value: ICefv8Value; + attribute: TCefV8PropertyAttributes): Boolean; + function SetValueByIndex(index: Integer; const value: ICefv8Value): Boolean; + function SetValueByAccessor(const key: ustring; settings: TCefV8AccessControls; + attribute: TCefV8PropertyAttributes): Boolean; + function GetKeys(const keys: TStrings): Integer; + function SetUserData(const data: ICefv8Value): Boolean; + function GetUserData: ICefv8Value; + function GetExternallyAllocatedMemory: Integer; + function AdjustExternallyAllocatedMemory(changeInBytes: Integer): Integer; + function GetArrayLength: Integer; + function GetFunctionName: ustring; + function GetFunctionHandler: ICefv8Handler; + function ExecuteFunction(const obj: ICefv8Value; + const arguments: TCefv8ValueArray): ICefv8Value; + function ExecuteFunctionWithContext(const context: ICefv8Context; + const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; + public + class function UnWrap(data: Pointer): ICefv8Value; + class function NewUndefined: ICefv8Value; + class function NewNull: ICefv8Value; + class function NewBool(value: Boolean): ICefv8Value; + class function NewInt(value: Integer): ICefv8Value; + class function NewUInt(value: Cardinal): ICefv8Value; + class function NewDouble(value: Double): ICefv8Value; + class function NewDate(value: TDateTime): ICefv8Value; + class function NewString(const str: ustring): ICefv8Value; + class function NewObject(const Accessor: ICefV8Accessor): ICefv8Value; + class function NewObjectProc(const getter: TCefV8AccessorGetterProc; + const setter: TCefV8AccessorSetterProc): ICefv8Value; + class function NewArray(len: Integer): ICefv8Value; + class function NewFunction(const name: ustring; const handler: ICefv8Handler): ICefv8Value; + end; + + TCefv8ContextRef = class(TCefBaseRef, ICefv8Context) + protected + function GetTaskRunner: ICefTaskRunner; + function IsValid: Boolean; + function GetBrowser: ICefBrowser; + function GetFrame: ICefFrame; + function GetGlobal: ICefv8Value; + function Enter: Boolean; + function Exit: Boolean; + function IsSame(const that: ICefv8Context): Boolean; + function Eval(const code: ustring; var retval: ICefv8Value; var exception: ICefV8Exception): Boolean; + public + class function UnWrap(data: Pointer): ICefv8Context; + class function Current: ICefv8Context; + class function Entered: ICefv8Context; + end; + + TCefV8StackFrameRef = class(TCefBaseRef, ICefV8StackFrame) + protected + function IsValid: Boolean; + function GetScriptName: ustring; + function GetScriptNameOrSourceUrl: ustring; + function GetFunctionName: ustring; + function GetLineNumber: Integer; + function GetColumn: Integer; + function IsEval: Boolean; + function IsConstructor: Boolean; + public + class function UnWrap(data: Pointer): ICefV8StackFrame; + end; + + TCefV8StackTraceRef = class(TCefBaseRef, ICefV8StackTrace) + protected + function IsValid: Boolean; + function GetFrameCount: Integer; + function GetFrame(index: Integer): ICefV8StackFrame; + public + class function UnWrap(data: Pointer): ICefV8StackTrace; + class function Current(frameLimit: Integer): ICefV8StackTrace; + end; + + TCefv8HandlerRef = class(TCefBaseRef, ICefv8Handler) + protected + function Execute(const name: ustring; const obj: ICefv8Value; + const arguments: TCefv8ValueArray; var retval: ICefv8Value; + var exception: ustring): Boolean; + public + class function UnWrap(data: Pointer): ICefv8Handler; + end; + + TCefClientOwn = class(TCefBaseOwn, ICefClient) + protected + function GetContextMenuHandler: ICefContextMenuHandler; virtual; + function GetDialogHandler: ICefDialogHandler; virtual; + function GetDisplayHandler: ICefDisplayHandler; virtual; + function GetDownloadHandler: ICefDownloadHandler; virtual; + function GetFocusHandler: ICefFocusHandler; virtual; + function GetGeolocationHandler: ICefGeolocationHandler; virtual; + function GetJsdialogHandler: ICefJsdialogHandler; virtual; + function GetKeyboardHandler: ICefKeyboardHandler; virtual; + function GetLifeSpanHandler: ICefLifeSpanHandler; virtual; + function GetRenderHandler: ICefRenderHandler; virtual; + function GetLoadHandler: ICefLoadHandler; virtual; + function GetRequestHandler: ICefRequestHandler; virtual; + function OnProcessMessageReceived(const browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefGeolocationHandlerOwn = class(TCefBaseOwn, ICefGeolocationHandler) + protected + procedure OnRequestGeolocationPermission(const browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer; + const callback: ICefGeolocationCallback); virtual; + procedure OnCancelGeolocationPermission(const browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer); virtual; + public + constructor Create; virtual; + end; + + TCefLifeSpanHandlerOwn = class(TCefBaseOwn, ICefLifeSpanHandler) + protected + function OnBeforePopup(const browser: ICefBrowser; const frame: ICefFrame; + const targetUrl, targetFrameName: ustring; var popupFeatures: TCefPopupFeatures; + var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; virtual; + procedure OnAfterCreated(const browser: ICefBrowser); virtual; + procedure OnBeforeClose(const browser: ICefBrowser); virtual; + function RunModal(const browser: ICefBrowser): Boolean; virtual; + function DoClose(const browser: ICefBrowser): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefLoadHandlerOwn = class(TCefBaseOwn, ICefLoadHandler) + protected + procedure OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame); virtual; + procedure OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); virtual; + procedure OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring); virtual; + procedure OnRenderProcessTerminated(const browser: ICefBrowser; status: TCefTerminationStatus); virtual; + procedure OnPluginCrashed(const browser: ICefBrowser; const pluginPath: ustring); virtual; + public + constructor Create; virtual; + end; + + TCefQuotaCallbackRef = class(TCefBaseRef, ICefQuotaCallback) + protected + procedure Cont(allow: Boolean); + procedure Cancel; + public + class function UnWrap(data: Pointer): ICefQuotaCallback; + end; + + TCefRequestHandlerOwn = class(TCefBaseOwn, ICefRequestHandler) + protected + function OnBeforeResourceLoad(const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest): Boolean; virtual; + function GetResourceHandler(const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest): ICefResourceHandler; virtual; + procedure OnResourceRedirect(const browser: ICefBrowser; const frame: ICefFrame; + const oldUrl: ustring; var newUrl: ustring); virtual; + function GetAuthCredentials(const browser: ICefBrowser; const frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback): Boolean; virtual; + function OnQuotaRequest(const browser: ICefBrowser; const originUrl: ustring; + newSize: Int64; const callback: ICefQuotaCallback): Boolean; virtual; + function GetCookieManager(const browser: ICefBrowser; const mainUrl: ustring): ICefCookieManager; virtual; + procedure OnProtocolExecution(const browser: ICefBrowser; const url: ustring; out allowOsExecution: Boolean); virtual; + function OnBeforePluginLoad(const browser: ICefBrowser; const url, policyUrl: ustring; + const info: ICefWebPluginInfo): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefDisplayHandlerOwn = class(TCefBaseOwn, ICefDisplayHandler) + protected + procedure OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); virtual; + procedure OnAddressChange(const browser: ICefBrowser; const frame: ICefFrame; const url: ustring); virtual; + procedure OnTitleChange(const browser: ICefBrowser; const title: ustring); virtual; + 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; + public + constructor Create; virtual; + end; + + TCefFocusHandlerOwn = class(TCefBaseOwn, ICefFocusHandler) + protected + procedure OnTakeFocus(const browser: ICefBrowser; next: Boolean); virtual; + function OnSetFocus(const browser: ICefBrowser; source: TCefFocusSource): Boolean; virtual; + procedure OnGotFocus(const browser: ICefBrowser); virtual; + public + constructor Create; virtual; + end; + + TCefKeyboardHandlerOwn = class(TCefBaseOwn, ICefKeyboardHandler) + protected + function OnPreKeyEvent(const browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; virtual; + function OnKeyEvent(const browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefJsDialogHandlerOwn = class(TCefBaseOwn, ICefJsDialogHandler) + protected + function OnJsdialog(const browser: ICefBrowser; const originUrl, acceptLang: ustring; + dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; + callback: ICefJsDialogCallback; out suppressMessage: Boolean): Boolean; virtual; + function OnBeforeUnloadDialog(const browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback): Boolean; virtual; + procedure OnResetDialogState(const browser: ICefBrowser); virtual; + public + constructor Create; virtual; + end; + + TCefContextMenuHandlerOwn = class(TCefBaseOwn, ICefContextMenuHandler) + protected + procedure OnBeforeContextMenu(const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); virtual; + function OnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags): Boolean; virtual; + procedure OnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); virtual; + public + constructor Create; virtual; + end; + + TCefDialogHandlerOwn = class(TCefBaseOwn, ICefDialogHandler) + protected + function OnFileDialog(const browser: ICefBrowser; mode: TCefFileDialogMode; + const title, defaultFileName: ustring; acceptTypes: TStrings; + const callback: ICefFileDialogCallback): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefDownloadHandlerOwn = class(TCefBaseOwn, ICefDownloadHandler) + protected + procedure OnBeforeDownload(const browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); virtual; + procedure OnDownloadUpdated(const browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); virtual; + public + constructor Create; virtual; + end; + + TCefCustomStreamReader = class(TCefBaseOwn, ICefCustomStreamReader) + private + FStream: TStream; + FOwned: Boolean; + protected + function Read(ptr: Pointer; size, n: Cardinal): Cardinal; virtual; + function Seek(offset: Int64; whence: Integer): Integer; virtual; + function Tell: Int64; virtual; + function Eof: Boolean; virtual; + public + constructor Create(Stream: TStream; Owned: Boolean); overload; virtual; + constructor Create(const filename: string); overload; virtual; + destructor Destroy; override; + end; + + TCefPostDataElementOwn = class(TCefBaseOwn, ICefPostDataElement) + private + FDataType: TCefPostDataElementType; + FValueByte: Pointer; + FValueStr: TCefString; + FSize: Cardinal; + FReadOnly: Boolean; + procedure Clear; + protected + function IsReadOnly: Boolean; virtual; + procedure SetToEmpty; virtual; + procedure SetToFile(const fileName: ustring); virtual; + procedure SetToBytes(size: Cardinal; bytes: Pointer); virtual; + function GetType: TCefPostDataElementType; virtual; + function GetFile: ustring; virtual; + function GetBytesCount: Cardinal; virtual; + function GetBytes(size: Cardinal; bytes: Pointer): Cardinal; virtual; + public + constructor Create(readonly: Boolean); virtual; + end; + + TCefCallbackRef = class(TCefBaseRef, ICefCallback) + protected + procedure Cont; + procedure Cancel; + public + class function UnWrap(data: Pointer): ICefCallback; + end; + + TCefResourceHandlerOwn = class(TCefBaseOwn, ICefResourceHandler) + protected + function ProcessRequest(const request: ICefRequest; const callback: ICefCallback): Boolean; virtual; + procedure GetResponseHeaders(const response: ICefResponse; + out responseLength: Int64; out redirectUrl: ustring); virtual; + function ReadResponse(const dataOut: Pointer; bytesToRead: Integer; + var bytesRead: Integer; const callback: ICefCallback): Boolean; virtual; + function CanGetCookie(const cookie: PCefCookie): Boolean; virtual; + function CanSetCookie(const cookie: PCefCookie): Boolean; virtual; + procedure Cancel; virtual; + public + constructor Create(const browser: ICefBrowser; const frame: ICefFrame; + const schemeName: ustring; const request: ICefRequest); virtual; + end; + TCefResourceHandlerClass = class of TCefResourceHandlerOwn; + + TCefSchemeHandlerFactoryOwn = class(TCefBaseOwn, ICefSchemeHandlerFactory) + private + FClass: TCefResourceHandlerClass; + protected + function New(const browser: ICefBrowser; const frame: ICefFrame; + const schemeName: ustring; const request: ICefRequest): ICefResourceHandler; virtual; + public + constructor Create(const AClass: TCefResourceHandlerClass; SyncMainThread: Boolean); virtual; + end; + + TCefv8HandlerOwn = class(TCefBaseOwn, ICefv8Handler) + protected + function Execute(const name: ustring; const obj: ICefv8Value; + const arguments: TCefv8ValueArray; var retval: ICefv8Value; + var exception: ustring): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefTaskOwn = class(TCefBaseOwn, ICefTask) + protected + procedure Execute; virtual; + public + constructor Create; virtual; + end; + + TCefTaskRef = class(TCefBaseRef, ICefTask) + protected + procedure Execute; virtual; + public + class function UnWrap(data: Pointer): ICefTask; + end; + + TCefTaskRunnerRef = class(TCefBaseRef, ICefTaskRunner) + protected + function IsSame(const that: ICefTaskRunner): Boolean; + function BelongsToCurrentThread: Boolean; + function BelongsToThread(threadId: TCefThreadId): Boolean; + function PostTask(const task: ICefTask): Boolean; cdecl; + function PostDelayedTask(const task: ICefTask; delayMs: Int64): Boolean; + public + class function UnWrap(data: Pointer): ICefTaskRunner; + class function GetForCurrentThread: ICefTaskRunner; + class function GetForThread(threadId: TCefThreadId): ICefTaskRunner; + end; + + TCefStringMapOwn = class(TInterfacedObject, ICefStringMap) + private + FStringMap: TCefStringMap; + protected + function GetHandle: TCefStringMap; virtual; + function GetSize: Integer; virtual; + function Find(const key: ustring): ustring; virtual; + function GetKey(index: Integer): ustring; virtual; + function GetValue(index: Integer): ustring; virtual; + procedure Append(const key, value: ustring); virtual; + procedure Clear; virtual; + public + constructor Create; virtual; + destructor Destroy; override; + end; + + TCefStringMultimapOwn = class(TInterfacedObject, ICefStringMultimap) + private + FStringMap: TCefStringMultimap; + protected + function GetHandle: TCefStringMultimap; virtual; + function GetSize: Integer; virtual; + function FindCount(const Key: ustring): Integer; virtual; + function GetEnumerate(const Key: ustring; ValueIndex: Integer): ustring; virtual; + function GetKey(Index: Integer): ustring; virtual; + function GetValue(Index: Integer): ustring; virtual; + procedure Append(const Key, Value: ustring); virtual; + procedure Clear; virtual; + public + constructor Create; virtual; + destructor Destroy; override; + end; + + TCefXmlReaderRef = class(TCefBaseRef, ICefXmlReader) + protected + function MoveToNextNode: Boolean; + function Close: Boolean; + function HasError: Boolean; + function GetError: ustring; + function GetType: TCefXmlNodeType; + function GetDepth: Integer; + function GetLocalName: ustring; + function GetPrefix: ustring; + function GetQualifiedName: ustring; + function GetNamespaceUri: ustring; + function GetBaseUri: ustring; + function GetXmlLang: ustring; + function IsEmptyElement: Boolean; + function HasValue: Boolean; + function GetValue: ustring; + function HasAttributes: Boolean; + function GetAttributeCount: Cardinal; + function GetAttributeByIndex(index: Integer): ustring; + function GetAttributeByQName(const qualifiedName: ustring): ustring; + function GetAttributeByLName(const localName, namespaceURI: ustring): ustring; + function GetInnerXml: ustring; + function GetOuterXml: ustring; + function GetLineNumber: Integer; + function MoveToAttributeByIndex(index: Integer): Boolean; + function MoveToAttributeByQName(const qualifiedName: ustring): Boolean; + function MoveToAttributeByLName(const localName, namespaceURI: ustring): Boolean; + function MoveToFirstAttribute: Boolean; + function MoveToNextAttribute: Boolean; + function MoveToCarryingElement: Boolean; + public + class function UnWrap(data: Pointer): ICefXmlReader; + class function New(const stream: ICefStreamReader; + encodingType: TCefXmlEncodingType; const URI: ustring): ICefXmlReader; + end; + + TCefZipReaderRef = class(TCefBaseRef, ICefZipReader) + protected + function MoveToFirstFile: Boolean; + function MoveToNextFile: Boolean; + function MoveToFile(const fileName: ustring; caseSensitive: Boolean): Boolean; + function Close: Boolean; + function GetFileName: ustring; + function GetFileSize: Int64; + function GetFileLastModified: LongInt; + function OpenFile(const password: ustring): Boolean; + function CloseFile: Boolean; + function ReadFile(buffer: Pointer; bufferSize: Cardinal): Integer; + function Tell: Int64; + function Eof: Boolean; + public + class function UnWrap(data: Pointer): ICefZipReader; + class function New(const stream: ICefStreamReader): ICefZipReader; + end; + + TCefDomVisitorOwn = class(TCefBaseOwn, ICefDomVisitor) + protected + procedure visit(const document: ICefDomDocument); virtual; + public + constructor Create; virtual; + end; + + TCefFastDomVisitor = class(TCefDomVisitorOwn) + private + FProc: TCefDomVisitorProc; + protected + procedure visit(const document: ICefDomDocument); override; + public + constructor Create(const proc: TCefDomVisitorProc); reintroduce; virtual; + end; + + TCefDomDocumentRef = class(TCefBaseRef, ICefDomDocument) + protected + function GetType: TCefDomDocumentType; + function GetDocument: ICefDomNode; + function GetBody: ICefDomNode; + function GetHead: ICefDomNode; + function GetTitle: ustring; + function GetElementById(const id: ustring): ICefDomNode; + function GetFocusedNode: ICefDomNode; + function HasSelection: Boolean; + function GetSelectionStartNode: ICefDomNode; + function GetSelectionStartOffset: Integer; + function GetSelectionEndNode: ICefDomNode; + function GetSelectionEndOffset: Integer; + function GetSelectionAsMarkup: ustring; + function GetSelectionAsText: ustring; + function GetBaseUrl: ustring; + function GetCompleteUrl(const partialURL: ustring): ustring; + public + class function UnWrap(data: Pointer): ICefDomDocument; + end; + + TCefDomNodeRef = class(TCefBaseRef, ICefDomNode) + protected + function GetType: TCefDomNodeType; + function IsText: Boolean; + function IsElement: Boolean; + function IsEditable: Boolean; + function IsFormControlElement: Boolean; + function GetFormControlElementType: ustring; + function IsSame(const that: ICefDomNode): Boolean; + function GetName: ustring; + function GetValue: ustring; + function SetValue(const value: ustring): Boolean; + function GetAsMarkup: ustring; + function GetDocument: ICefDomDocument; + function GetParent: ICefDomNode; + function GetPreviousSibling: ICefDomNode; + function GetNextSibling: ICefDomNode; + function HasChildren: Boolean; + function GetFirstChild: ICefDomNode; + function GetLastChild: ICefDomNode; + procedure AddEventListener(const eventType: ustring; + useCapture: Boolean; const listener: ICefDomEventListener); + procedure AddEventListenerProc(const eventType: ustring; useCapture: Boolean; + const proc: TCefDomEventListenerProc); + function GetElementTagName: ustring; + function HasElementAttributes: Boolean; + function HasElementAttribute(const attrName: ustring): Boolean; + function GetElementAttribute(const attrName: ustring): ustring; + procedure GetElementAttributes(const attrMap: ICefStringMap); + function SetElementAttribute(const attrName, value: ustring): Boolean; + function GetElementInnerText: ustring; + public + class function UnWrap(data: Pointer): ICefDomNode; + end; + + TCefDomEventRef = class(TCefBaseRef, ICefDomEvent) + protected + function GetType: ustring; + function GetCategory: TCefDomEventCategory; + function GetPhase: TCefDomEventPhase; + function CanBubble: Boolean; + function CanCancel: Boolean; + function GetDocument: ICefDomDocument; + function GetTarget: ICefDomNode; + function GetCurrentTarget: ICefDomNode; + public + class function UnWrap(data: Pointer): ICefDomEvent; + end; + + TCefDomEventListenerOwn = class(TCefBaseOwn, ICefDomEventListener) + protected + procedure HandleEvent(const event: ICefDomEvent); virtual; + public + constructor Create; virtual; + end; + + TCefResponseRef = class(TCefBaseRef, ICefResponse) + protected + function IsReadOnly: Boolean; + function GetStatus: Integer; + procedure SetStatus(status: Integer); + function GetStatusText: ustring; + procedure SetStatusText(const StatusText: ustring); + function GetMimeType: ustring; + procedure SetMimeType(const mimetype: ustring); + function GetHeader(const name: ustring): ustring; + procedure GetHeaderMap(const headerMap: ICefStringMultimap); + procedure SetHeaderMap(const headerMap: ICefStringMultimap); + public + class function UnWrap(data: Pointer): ICefResponse; + class function New: ICefResponse; + end; + + TCefFastDomEventListener = class(TCefDomEventListenerOwn) + private + FProc: TCefDomEventListenerProc; + protected + procedure HandleEvent(const event: ICefDomEvent); override; + public + constructor Create(const proc: TCefDomEventListenerProc); reintroduce; virtual; + end; + + TCefFastTaskProc = procedure; + + TCefFastTask = class(TCefTaskOwn) + private + FMethod: TCefFastTaskProc; + protected + procedure Execute; override; + public + class procedure New(threadId: TCefThreadId; const method: TCefFastTaskProc); + class procedure NewDelayed(threadId: TCefThreadId; Delay: Int64; const method: TCefFastTaskProc); + constructor Create(const method: TCefFastTaskProc); reintroduce; + end; + + TCefV8AccessorOwn = class(TCefBaseOwn, ICefV8Accessor) + protected + function Get(const name: ustring; const obj: ICefv8Value; + out value: ICefv8Value; const exception: string): Boolean; virtual; + function Put(const name: ustring; const obj, value: ICefv8Value; + const exception: string): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefFastV8Accessor = class(TCefV8AccessorOwn) + private + FGetter: TCefV8AccessorGetterProc; + FSetter: TCefV8AccessorSetterProc; + protected + function Get(const name: ustring; const obj: ICefv8Value; + out value: ICefv8Value; const exception: string): Boolean; override; + function Put(const name: ustring; const obj, value: ICefv8Value; + const exception: string): Boolean; override; + public + constructor Create(const getter: TCefV8AccessorGetterProc; + const setter: TCefV8AccessorSetterProc); reintroduce; + end; + + TCefCookieVisitorOwn = class(TCefBaseOwn, ICefCookieVisitor) + protected + function visit(const name, value, domain, path: ustring; secure, httponly, + hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; + count, total: Integer; out deleteCookie: Boolean): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefFastCookieVisitor = class(TCefCookieVisitorOwn) + private + FVisitor: TCefCookieVisitorProc; + protected + function visit(const name, value, domain, path: ustring; secure, httponly, + hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; + count, total: Integer; out deleteCookie: Boolean): Boolean; override; + public + constructor Create(const visitor: TCefCookieVisitorProc); reintroduce; + end; + + TCefV8ExceptionRef = class(TCefBaseRef, ICefV8Exception) + protected + function GetMessage: ustring; + function GetSourceLine: ustring; + function GetScriptResourceName: ustring; + function GetLineNumber: Integer; + function GetStartPosition: Integer; + function GetEndPosition: Integer; + function GetStartColumn: Integer; + function GetEndColumn: Integer; + public + class function UnWrap(data: Pointer): ICefV8Exception; + end; + + TCefResourceBundleHandlerOwn = class(TCefBaseOwn, ICefResourceBundleHandler) + protected + function GetDataResource(resourceId: Integer; out data: Pointer; + out dataSize: Cardinal): Boolean; virtual; abstract; + function GetLocalizedString(messageId: Integer; + out stringVal: ustring): Boolean; virtual; abstract; + public + constructor Create; virtual; + end; + + + TGetDataResource = function(resourceId: Integer; out data: Pointer; out dataSize: Cardinal): Boolean; + TGetLocalizedString = function(messageId: Integer; out stringVal: ustring): Boolean; + + TCefFastResourceBundle = class(TCefResourceBundleHandlerOwn) + private + FGetDataResource: TGetDataResource; + FGetLocalizedString: TGetLocalizedString; + protected + function GetDataResource(resourceId: Integer; out data: Pointer; + out dataSize: Cardinal): Boolean; override; + function GetLocalizedString(messageId: Integer; + out stringVal: ustring): Boolean; override; + public + constructor Create(AGetDataResource: TGetDataResource; + AGetLocalizedString: TGetLocalizedString); reintroduce; + end; + + TCefAppOwn = class(TCefBaseOwn, ICefApp) + protected + procedure OnBeforeCommandLineProcessing(const processType: ustring; + const commandLine: ICefCommandLine); virtual; abstract; + procedure OnRegisterCustomSchemes(const registrar: ICefSchemeRegistrar); virtual; abstract; + function GetResourceBundleHandler: ICefResourceBundleHandler; virtual; abstract; + function GetBrowserProcessHandler: ICefBrowserProcessHandler; virtual; abstract; + function GetRenderProcessHandler: ICefRenderProcessHandler; virtual; abstract; + public + constructor Create; virtual; + end; + + TCefCookieManagerRef = class(TCefBaseRef, ICefCookieManager) + protected + procedure SetSupportedSchemes(schemes: TStrings); + function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean; + function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean; + function VisitUrlCookies(const url: ustring; + includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean; + function VisitUrlCookiesProc(const url: ustring; + includeHttpOnly: Boolean; const visitor: TCefCookieVisitorProc): Boolean; + function SetCookie(const url: ustring; const name, value, domain, path: ustring; secure, httponly, + hasExpires: Boolean; const creation, lastAccess, expires: TDateTime): Boolean; + function DeleteCookies(const url, cookieName: ustring): Boolean; + function SetStoragePath(const path: ustring): Boolean; + public + class function UnWrap(data: Pointer): ICefCookieManager; + class function Global: ICefCookieManager; + class function New(const path: ustring): ICefCookieManager; + end; + + TCefWebPluginInfoRef = class(TCefBaseRef, ICefWebPluginInfo) + protected + function GetName: ustring; + function GetPath: ustring; + function GetVersion: ustring; + function GetDescription: ustring; + public + class function UnWrap(data: Pointer): ICefWebPluginInfo; + end; + + TCefProcessMessageRef = class(TCefBaseRef, ICefProcessMessage) + protected + function IsValid: Boolean; + function IsReadOnly: Boolean; + function Copy: ICefProcessMessage; + function GetName: ustring; + function GetArgumentList: ICefListValue; + public + class function UnWrap(data: Pointer): ICefProcessMessage; + class function New(const name: ustring): ICefProcessMessage; + end; + + TCefStringVisitorOwn = class(TCefBaseOwn, ICefStringVisitor) + protected + procedure Visit(const str: ustring); virtual; + public + constructor Create; virtual; + end; + + TCefFastStringVisitor = class(TCefStringVisitorOwn, ICefStringVisitor) + private + FVisit: TCefStringVisitorProc; + protected + procedure Visit(const str: ustring); override; + public + constructor Create(const callback: TCefStringVisitorProc); reintroduce; + end; + + TCefDownLoadItemRef = class(TCefBaseRef, ICefDownLoadItem) + protected + function IsValid: Boolean; + function IsInProgress: Boolean; + function IsComplete: Boolean; + function IsCanceled: Boolean; + function GetCurrentSpeed: Int64; + function GetPercentComplete: Integer; + function GetTotalBytes: Int64; + function GetReceivedBytes: Int64; + function GetStartTime: TDateTime; + function GetEndTime: TDateTime; + function GetFullPath: ustring; + function GetId: Integer; + function GetUrl: ustring; + function GetSuggestedFileName: ustring; + function GetContentDisposition: ustring; + function GetMimeType: ustring; + public + class function UnWrap(data: Pointer): ICefDownLoadItem; + end; + + TCefBeforeDownloadCallbackRef = class(TCefBaseRef, ICefBeforeDownloadCallback) + protected + procedure Cont(const downloadPath: ustring; showDialog: Boolean); + public + class function UnWrap(data: Pointer): ICefBeforeDownloadCallback; + end; + + TCefDownloadItemCallbackRef = class(TCefBaseRef, ICefDownloadItemCallback) + protected + procedure cancel; + public + class function UnWrap(data: Pointer): ICefDownloadItemCallback; + end; + + TCefAuthCallbackRef = class(TCefBaseRef, ICefAuthCallback) + protected + procedure Cont(const username, password: ustring); + procedure Cancel; + public + class function UnWrap(data: Pointer): ICefAuthCallback; + end; + + TCefJsDialogCallbackRef = class(TCefBaseRef, ICefJsDialogCallback) + protected + procedure Cont(success: Boolean; const userInput: ustring); + public + class function UnWrap(data: Pointer): ICefJsDialogCallback; + end; + + TCefCommandLineRef = class(TCefBaseRef, ICefCommandLine) + protected + function IsValid: Boolean; + function IsReadOnly: Boolean; + function Copy: ICefCommandLine; + procedure InitFromArgv(argc: Integer; const argv: PPAnsiChar); + procedure InitFromString(const commandLine: ustring); + procedure Reset; + function GetCommandLineString: ustring; + procedure GetArgv(args: TStrings); + function GetProgram: ustring; + procedure SetProgram(const prog: ustring); + function HasSwitches: Boolean; + function HasSwitch(const name: ustring): Boolean; + function GetSwitchValue(const name: ustring): ustring; + procedure GetSwitches(switches: TStrings); + procedure AppendSwitch(const name: ustring); + procedure AppendSwitchWithValue(const name, value: ustring); + function HasArguments: Boolean; + procedure GetArguments(arguments: TStrings); + procedure AppendArgument(const argument: ustring); + procedure PrependWrapper(const wrapper: ustring); + public + class function UnWrap(data: Pointer): ICefCommandLine; + class function New: ICefCommandLine; + class function Global: ICefCommandLine; + end; + + TCefSchemeRegistrarRef = class(TCefBaseRef, ICefSchemeRegistrar) + protected + function AddCustomScheme(const schemeName: ustring; IsStandard, IsLocal, + IsDisplayIsolated: Boolean): Boolean; cdecl; + public + class function UnWrap(data: Pointer): ICefSchemeRegistrar; + end; + + TCefGeolocationCallbackRef = class(TCefBaseRef, ICefGeolocationCallback) + protected + procedure Cont(allow: Boolean); + public + class function UnWrap(data: Pointer): ICefGeolocationCallback; + end; + + TCefContextMenuParamsRef = class(TCefBaseRef, ICefContextMenuParams) + protected + function GetXCoord: Integer; + function GetYCoord: Integer; + function GetTypeFlags: TCefContextMenuTypeFlags; + function GetLinkUrl: ustring; + function GetUnfilteredLinkUrl: ustring; + function GetSourceUrl: ustring; + function IsImageBlocked: Boolean; + function GetPageUrl: ustring; + function GetFrameUrl: ustring; + function GetFrameCharset: ustring; + function GetMediaType: TCefContextMenuMediaType; + function GetMediaStateFlags: TCefContextMenuMediaStateFlags; + function GetSelectionText: ustring; + function IsEditable: Boolean; + function IsSpeechInputEnabled: Boolean; + function GetEditStateFlags: TCefContextMenuEditStateFlags; + public + class function UnWrap(data: Pointer): ICefContextMenuParams; + end; + + TCefMenuModelRef = class(TCefBaseRef, ICefMenuModel) + protected + function Clear: Boolean; + function GetCount: Integer; + function AddSeparator: Boolean; + function AddItem(commandId: Integer; const text: ustring): Boolean; + function AddCheckItem(commandId: Integer; const text: ustring): Boolean; + function AddRadioItem(commandId: Integer; const text: ustring; groupId: Integer): Boolean; + function AddSubMenu(commandId: Integer; const text: ustring): ICefMenuModel; + function InsertSeparatorAt(index: Integer): Boolean; + function InsertItemAt(index, commandId: Integer; const text: ustring): Boolean; + function InsertCheckItemAt(index, commandId: Integer; const text: ustring): Boolean; + function InsertRadioItemAt(index, commandId: Integer; const text: ustring; groupId: Integer): Boolean; + function InsertSubMenuAt(index, commandId: Integer; const text: ustring): ICefMenuModel; + function Remove(commandId: Integer): Boolean; + function RemoveAt(index: Integer): Boolean; + function GetIndexOf(commandId: Integer): Integer; + function GetCommandIdAt(index: Integer): Integer; + function SetCommandIdAt(index, commandId: Integer): Boolean; + function GetLabel(commandId: Integer): ustring; + function GetLabelAt(index: Integer): ustring; + function SetLabel(commandId: Integer; const text: ustring): Boolean; + function SetLabelAt(index: Integer; const text: ustring): Boolean; + function GetType(commandId: Integer): TCefMenuItemType; + function GetTypeAt(index: Integer): TCefMenuItemType; + function GetGroupId(commandId: Integer): Integer; + function GetGroupIdAt(index: Integer): Integer; + function SetGroupId(commandId, groupId: Integer): Boolean; + function SetGroupIdAt(index, groupId: Integer): Boolean; + function GetSubMenu(commandId: Integer): ICefMenuModel; + function GetSubMenuAt(index: Integer): ICefMenuModel; + function IsVisible(commandId: Integer): Boolean; + function isVisibleAt(index: Integer): Boolean; + function SetVisible(commandId: Integer; visible: Boolean): Boolean; + function SetVisibleAt(index: Integer; visible: Boolean): Boolean; + function IsEnabled(commandId: Integer): Boolean; + function IsEnabledAt(index: Integer): Boolean; + function SetEnabled(commandId: Integer; enabled: Boolean): Boolean; + function SetEnabledAt(index: Integer; enabled: Boolean): Boolean; + function IsChecked(commandId: Integer): Boolean; + function IsCheckedAt(index: Integer): Boolean; + function setChecked(commandId: Integer; checked: Boolean): Boolean; + function setCheckedAt(index: Integer; checked: Boolean): Boolean; + function HasAccelerator(commandId: Integer): Boolean; + function HasAcceleratorAt(index: Integer): Boolean; + function SetAccelerator(commandId, keyCode: Integer; shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + function SetAcceleratorAt(index, keyCode: Integer; shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + function RemoveAccelerator(commandId: Integer): Boolean; + function RemoveAcceleratorAt(index: Integer): Boolean; + function GetAccelerator(commandId: Integer; out keyCode: Integer; out shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + function GetAcceleratorAt(index: Integer; out keyCode: Integer; out shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + public + class function UnWrap(data: Pointer): ICefMenuModel; + end; + + TCefListValueRef = class(TCefBaseRef, ICefListValue) + protected + function IsValid: Boolean; + function IsOwned: Boolean; + function IsReadOnly: Boolean; + function Copy: ICefListValue; + function SetSize(size: Cardinal): Boolean; + function GetSize: Cardinal; + function Clear: Boolean; + function Remove(index: Integer): Boolean; + function GetType(index: Integer): TCefValueType; + function GetBool(index: Integer): Boolean; + function GetInt(index: Integer): Integer; + function GetDouble(index: Integer): Double; + function GetString(index: Integer): ustring; + function GetBinary(index: Integer): ICefBinaryValue; + function GetDictionary(index: Integer): ICefDictionaryValue; + function GetList(index: Integer): ICefListValue; + function SetNull(index: Integer): Boolean; + function SetBool(index: Integer; value: Boolean): Boolean; + function SetInt(index, value: Integer): Boolean; + function SetDouble(index: Integer; value: Double): Boolean; + function SetString(index: Integer; const value: ustring): Boolean; + function SetBinary(index: Integer; const value: ICefBinaryValue): Boolean; + function SetDictionary(index: Integer; const value: ICefDictionaryValue): Boolean; + function SetList(index: Integer; const value: ICefListValue): Boolean; + public + class function UnWrap(data: Pointer): ICefListValue; + class function New: ICefListValue; + end; + + TCefBinaryValueRef = class(TCefBaseRef, ICefBinaryValue) + protected + function IsValid: Boolean; + function IsOwned: Boolean; + function Copy: ICefBinaryValue; + function GetSize: Cardinal; + function GetData(buffer: Pointer; bufferSize, dataOffset: Cardinal): Cardinal; + public + class function UnWrap(data: Pointer): ICefBinaryValue; + class function New(const data: Pointer; dataSize: Cardinal): ICefBinaryValue; + end; + + TCefDictionaryValueRef = class(TCefBaseRef, ICefDictionaryValue) + protected + function IsValid: Boolean; + function isOwned: Boolean; + function IsReadOnly: Boolean; + function Copy(excludeEmptyChildren: Boolean): ICefDictionaryValue; + function GetSize: Cardinal; + function Clear: Boolean; + function HasKey(const key: ustring): Boolean; + function GetKeys(const keys: TStrings): Boolean; + function Remove(const key: ustring): Boolean; + function GetType(const key: ustring): TCefValueType; + function GetBool(const key: ustring): Boolean; + function GetInt(const key: ustring): Integer; + function GetDouble(const key: ustring): Double; + function GetString(const key: ustring): ustring; + function GetBinary(const key: ustring): ICefBinaryValue; + function GetDictionary(const key: ustring): ICefDictionaryValue; + function GetList(const key: ustring): ICefListValue; + function SetNull(const key: ustring): Boolean; + function SetBool(const key: ustring; value: Boolean): Boolean; + function SetInt(const key: ustring; value: Integer): Boolean; + function SetDouble(const key: ustring; value: Double): Boolean; + function SetString(const key, value: ustring): Boolean; + function SetBinary(const key: ustring; const value: ICefBinaryValue): Boolean; + function SetDictionary(const key: ustring; const value: ICefDictionaryValue): Boolean; + function SetList(const key: ustring; const value: ICefListValue): Boolean; + public + class function UnWrap(data: Pointer): ICefDictionaryValue; + class function New: ICefDictionaryValue; + end; + + TCefBrowserProcessHandlerOwn = class(TCefBaseOwn, ICefBrowserProcessHandler) + protected + //function GetProxyHandler: ICefProxyHandler; virtual; + procedure OnContextInitialized; virtual; + procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); virtual; + procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue); virtual; + public + constructor Create; virtual; + end; + + TCefRenderProcessHandlerOwn = class(TCefBaseOwn, ICefRenderProcessHandler) + protected + procedure OnRenderThreadCreated(const extraInfo: ICefListValue); virtual; + procedure OnWebKitInitialized; virtual; + procedure OnBrowserCreated(const browser: ICefBrowser); virtual; + procedure OnBrowserDestroyed(const browser: ICefBrowser); virtual; + function OnBeforeNavigation(const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; navigationType: TCefNavigationType; + isRedirect: Boolean): Boolean; virtual; + procedure OnContextCreated(const browser: ICefBrowser; + const frame: ICefFrame; const context: ICefv8Context); virtual; + procedure OnContextReleased(const browser: ICefBrowser; + const frame: ICefFrame; const context: ICefv8Context); virtual; + procedure OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; + const context: ICefv8Context; const exception: ICefV8Exception; + const stackTrace: ICefV8StackTrace); virtual; + procedure OnWorkerContextCreated(workerId: Integer; const url: ustring; + const context: ICefv8Context); virtual; + procedure OnWorkerContextReleased(workerId: Integer; const url: ustring; + const context: ICefv8Context); virtual; + procedure OnWorkerUncaughtException(workerId: Integer; const url: ustring; + const context: ICefv8Context; const exception: ICefV8Exception; + const stackTrace: ICefV8StackTrace); virtual; + procedure OnFocusedNodeChanged(const browser: ICefBrowser; + const frame: ICefFrame; const node: ICefDomNode); virtual; + function OnProcessMessageReceived(const browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefUrlrequestClientOwn = class(TCefBaseOwn, ICefUrlrequestClient) + protected + procedure OnRequestComplete(const request: ICefUrlRequest); + procedure OnUploadProgress(const request: ICefUrlRequest; current, total: UInt64); + procedure OnDownloadProgress(const request: ICefUrlRequest; current, total: UInt64); + procedure OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: Cardinal); + public + constructor Create; virtual; + end; + + TCefUrlRequestRef = class(TCefBaseRef, ICefUrlRequest) + protected + function GetRequest: ICefRequest; + function GetRequestStatus: TCefUrlRequestStatus; + function GetRequestError: Integer; + function GetResponse: ICefResponse; + procedure Cancel; + public + class function UnWrap(data: Pointer): ICefUrlRequest; + class function New(const request: ICefRequest; const client: ICefUrlRequestClient): ICefUrlRequest; + end; + + TCefWebPluginInfoVisitorOwn = class(TCefBaseOwn, ICefWebPluginInfoVisitor) + protected + function Visit(const info: ICefWebPluginInfo; count, total: Integer): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCefWebPluginInfoVisitorProc = function(const info: ICefWebPluginInfo; count, total: Integer): Boolean; + TCefWebPluginIsUnstableProc = procedure(const path: ustring; unstable: Boolean); + + TCefFastWebPluginInfoVisitor = class(TCefWebPluginInfoVisitorOwn) + private + FProc: TCefWebPluginInfoVisitorProc; + protected + function Visit(const info: ICefWebPluginInfo; count, total: Integer): Boolean; override; + public + constructor Create(const proc: TCefWebPluginInfoVisitorProc); reintroduce; + end; + + TCefWebPluginUnstableCallbackOwn = class(TCefBaseOwn, ICefWebPluginUnstableCallback) + protected + procedure IsUnstable(const path: ustring; unstable: Boolean); virtual; + public + constructor Create; virtual; + end; + + TCefFastWebPluginUnstableCallback = class(TCefWebPluginUnstableCallbackOwn) + private + FCallback: TCefWebPluginIsUnstableProc; + protected + procedure IsUnstable(const path: ustring; unstable: Boolean); override; + public + constructor Create(const callback: TCefWebPluginIsUnstableProc); reintroduce; + end; + + TCefTraceClientOwn = class(TCefBaseOwn, ICefTraceClient) + protected + procedure OnTraceDataCollected(const fragment: PAnsiChar; fragmentSize: Cardinal); virtual; + procedure OnTraceBufferPercentFullReply(percentFull: Single); virtual; + procedure OnEndTracingComplete; virtual; + public + constructor Create; virtual; + end; + + TCefGetGeolocationCallbackOwn = class(TCefBaseOwn, ICefGetGeolocationCallback) + protected + procedure OnLocationUpdate(const position: PCefGeoposition); virtual; + public + constructor Create; virtual; + end; + + TOnLocationUpdate = procedure(const position: PCefGeoposition); + + TCefFastGetGeolocationCallback = class(TCefGetGeolocationCallbackOwn) + private + FCallback: TOnLocationUpdate; + protected + procedure OnLocationUpdate(const position: PCefGeoposition); override; + public + constructor Create(const callback: TOnLocationUpdate); reintroduce; + end; + + TCefFileDialogCallbackRef = class(TCefBaseRef, ICefFileDialogCallback) + protected + procedure Cont(filePaths: TStrings); + procedure Cancel; + public + class function UnWrap(data: Pointer): ICefFileDialogCallback; + end; + + TCefRenderHandlerOwn = class(TCefBaseOwn, ICefRenderHandler) + protected + function GetRootScreenRect(const browser: ICefBrowser; rect: PCefRect): Boolean; virtual; + function GetViewRect(const browser: ICefBrowser; rect: PCefRect): Boolean; virtual; + function GetScreenPoint(const browser: ICefBrowser; viewX, viewY: Integer; + screenX, screenY: PInteger): Boolean; virtual; + procedure OnPopupShow(const browser: ICefBrowser; show: Boolean); virtual; + procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect); virtual; + procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType; + dirtyRectsCount: Cardinal; const dirtyRects: PCefRectArray; + const buffer: Pointer; width, height: Integer); virtual; + procedure OnCursorChange(const browser: ICefBrowser; cursor: TCefCursorHandle); virtual; + public + constructor Create; virtual; + end; + + ECefException = class(Exception) + end; + +function CefInitDefault: Boolean; + +function CefInitialize(const Cache: ustring = ''; const UserAgent: ustring = ''; + const ProductVersion: ustring = ''; const Locale: ustring = ''; const LogFile: ustring = ''; + const BrowserSubprocessPath: ustring = ''; + LogSeverity: TCefLogSeverity = LOGSEVERITY_DISABLE; + JavaScriptFlags: ustring = ''; ResourcesDirPath: ustring = ''; LocalesDirPath: ustring = ''; + SingleProcess: Boolean = False; CommandLineArgsDisabled: Boolean = False; PackLoadingDisabled: Boolean = False; + RemoteDebuggingPort: Integer = 0; ReleaseDCheck: Boolean = False; + UncaughtExceptionStackSize: Integer = 0; ContextSafetyImplementation: Integer = 0): Boolean; + +function CefGetObject(ptr: Pointer): TObject; +function CefStringAlloc(const str: ustring): TCefString; + +function CefString(const str: String) : TCefString; overload; +//function CefString(const str: ustring) : TCefString; overload; +function CefString(const str: PCefString) : ustring; overload; +function CefUserFreeString(const str: ustring): PCefStringUserFree; + +function CefStringClearAndGet(var str: TCefString): ustring; +procedure CefStringFree(const str: PCefString); +function CefStringFreeAndGet(const str: PCefStringUserFree): ustring; +procedure CefStringSet(const str: PCefString; const value: ustring); +function CefBrowserHostCreate(windowInfo: PCefWindowInfo; const client: ICefClient; + const url: ustring; const settings: PCefBrowserSettings): Boolean; +function CefBrowserHostCreateSync(windowInfo: PCefWindowInfo; const client: ICefClient; + const url: ustring; const settings: PCefBrowserSettings): ICefBrowser; + +{$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} +procedure CefDoMessageLoopWork; +procedure CefRunMessageLoop; +procedure CefQuitMessageLoop; +{$ENDIF} + +procedure CefShutDown; + +function CefRegisterSchemeHandlerFactory(const SchemeName, HostName: ustring; + SyncMainThread: Boolean; const handler: TCefResourceHandlerClass): Boolean; +function CefClearSchemeHandlerFactories: Boolean; + +function CefAddCrossOriginWhitelistEntry(const SourceOrigin, TargetProtocol, + TargetDomain: ustring; AllowTargetSubdomains: Boolean): Boolean; +function CefRemoveCrossOriginWhitelistEntry( + const SourceOrigin, TargetProtocol, TargetDomain: ustring; + AllowTargetSubdomains: Boolean): Boolean; +function CefClearCrossOriginWhitelist: Boolean; + +function CefRegisterExtension(const name, code: ustring; const Handler: ICefv8Handler): Boolean; +function CefCurrentlyOn(ThreadId: TCefThreadId): Boolean; +procedure CefPostTask(ThreadId: TCefThreadId; const task: ICefTask); +procedure CefPostDelayedTask(ThreadId: TCefThreadId; const task: ICefTask; delayMs: Int64); +function CefGetData(const i: ICefBase): Pointer; +function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean; +function CefCreateUrl(var parts: TUrlParts): string; + +procedure CefVisitWebPluginInfo(const visitor: ICefWebPluginInfoVisitor); +procedure CefVisitWebPluginInfoProc(const visitor: TCefWebPluginInfoVisitorProc); +procedure CefRefreshWebPlugins; +procedure CefAddWebPluginPath(const path: ustring); +procedure CefAddWebPluginDirectory(const dir: ustring); +procedure CefRemoveWebPluginPath(const path: ustring); +procedure CefUnregisterInternalWebPlugin(const path: ustring); +procedure CefForceWebPluginShutdown(const path: ustring); +procedure CefRegisterWebPluginCrash(const path: ustring); +procedure CefIsWebPluginUnstable(const path: ustring; const callback: ICefWebPluginUnstableCallback); +procedure CefIsWebPluginUnstableProc(const path: ustring; const callback: TCefWebPluginIsUnstableProc); + +function CefGetPath(key: TCefPathKey; out path: ustring): Boolean; + +function CefBeginTracing(const client: ICefTraceClient; const categories: ustring): Boolean; +function CefGetTraceBufferPercentFullAsync: Integer; +function CefEndTracingAsync: Boolean; + +function CefGetGeolocation(const callback: ICefGetGeolocationCallback): Boolean; + +Var + CefCache: ustring = ''; + CefUserAgent: ustring = ''; + CefProductVersion: ustring = ''; + CefLocale: ustring = ''; + CefLogFile: ustring = ''; + CefLogSeverity: TCefLogSeverity = LOGSEVERITY_DISABLE; + CefLocalStorageQuota: Cardinal = 0; + CefSessionStorageQuota: Cardinal = 0; + CefJavaScriptFlags: ustring = ''; + CefResourcesDirPath: ustring = ''; + CefLocalesDirPath: ustring = ''; + CefPackLoadingDisabled: Boolean = False; + CefSingleProcess: Boolean = False; + CefBrowserSubprocessPath: ustring = ''; + CefCommandLineArgsDisabled: Boolean = False; + CefRemoteDebuggingPort: Integer = 0; + CefGetDataResource: TGetDataResource = nil; + CefGetLocalizedString: TGetLocalizedString = nil; + CefReleaseDCheck: Boolean = False; + CefUncaughtExceptionStackSize: Integer = 0; + CefContextSafetyImplementation: Integer = 0; + + CefResourceBundleHandler: ICefResourceBundleHandler = nil; + CefBrowserProcessHandler: ICefBrowserProcessHandler = nil; + CefRenderProcessHandler: ICefRenderProcessHandler = nil; + CefOnBeforeCommandLineProcessing: TOnBeforeCommandLineProcessing = nil; + CefOnRegisterCustomSchemes: TOnRegisterCustomSchemes = nil; + +Implementation + +Type + TInternalApp = class(TCefAppOwn) + protected + procedure OnBeforeCommandLineProcessing(const processType: ustring; + const commandLine: ICefCommandLine); override; + procedure OnRegisterCustomSchemes(const registrar: ICefSchemeRegistrar); override; + function GetResourceBundleHandler: ICefResourceBundleHandler; override; + function GetBrowserProcessHandler: ICefBrowserProcessHandler; override; + function GetRenderProcessHandler: ICefRenderProcessHandler; override; + end; + + +procedure TInternalApp.OnBeforeCommandLineProcessing(const processType: ustring; + const commandLine: ICefCommandLine); +begin + If Assigned(CefOnBeforeCommandLineProcessing) then CefOnBeforeCommandLineProcessing(processType, commandLine); +end; + +procedure TInternalApp.OnRegisterCustomSchemes(const registrar: ICefSchemeRegistrar); +begin + If Assigned(CefOnRegisterCustomSchemes) then CefOnRegisterCustomSchemes(registrar); +end; + +function TInternalApp.GetResourceBundleHandler: ICefResourceBundleHandler; +begin + Result := CefResourceBundleHandler; +end; + +function TInternalApp.GetBrowserProcessHandler: ICefBrowserProcessHandler; +begin + result := CefBrowserProcessHandler; +end; + +function TInternalApp.GetRenderProcessHandler: ICefRenderProcessHandler; +begin + Result := CefRenderProcessHandler; +end; + + +{$IFDEF MSWINDOWS} +function TzSpecificLocalTimeToSystemTime( + lpTimeZoneInformation: PTimeZoneInformation; + lpLocalTime, lpUniversalTime: PSystemTime): BOOL; cdecl; external 'kernel32.dll'; + +function SystemTimeToTzSpecificLocalTime( + lpTimeZoneInformation: PTimeZoneInformation; + lpUniversalTime, lpLocalTime: PSystemTime): BOOL; cdecl; external 'kernel32.dll'; +{$ENDIF} + +Var + CefIsMainProcess: Boolean = False; + +function CefInitDefault: Boolean; +begin + WriteLn('CefInitDefault'); + + Result := CefInitialize(CefCache, CefUserAgent, CefProductVersion, CefLocale, CefLogFile, + CefBrowserSubprocessPath, CefLogSeverity, + CefJavaScriptFlags, CefResourcesDirPath, CefLocalesDirPath, CefSingleProcess, + CefCommandLineArgsDisabled, CefPackLoadingDisabled, CefRemoteDebuggingPort, + CefReleaseDCheck, CefUncaughtExceptionStackSize, CefContextSafetyImplementation); +end; + +function CefInitialize(const Cache, UserAgent, ProductVersion, Locale, LogFile, BrowserSubprocessPath: ustring; + LogSeverity: TCefLogSeverity; JavaScriptFlags, ResourcesDirPath, LocalesDirPath: ustring; + SingleProcess, CommandLineArgsDisabled, PackLoadingDisabled: Boolean; RemoteDebuggingPort: Integer; + ReleaseDCheck: Boolean; UncaughtExceptionStackSize: Integer; ContextSafetyImplementation: Integer): Boolean; +Var + Settings: TCefSettings; + App: ICefApp; + ErrCode: Integer; + + Args : TCefMainArgs; +begin + WriteLn('CefInitialize'); + + If CefIsMainProcess then Exit; + + CefLoadLibrary; + + FillChar(settings, SizeOf(settings), 0); + + settings.size := SizeOf(settings); + settings.single_process := SingleProcess; +{$IFDEF CEF_MULTI_THREADED_MESSAGE_LOOP} + settings.multi_threaded_message_loop := True; +{$ELSE} + settings.multi_threaded_message_loop := False; +{$ENDIF} + settings.cache_path := CefString(Cache); + settings.browser_subprocess_path := CefString(BrowserSubprocessPath); + settings.command_line_args_disabled := CommandLineArgsDisabled; + settings.user_agent := cefstring(UserAgent); + settings.product_version := CefString(ProductVersion); + settings.locale := CefString(Locale); + settings.log_file := CefString(LogFile); + settings.log_severity := LogSeverity; + settings.release_dcheck_enabled := ReleaseDCheck; + settings.javascript_flags := CefString(JavaScriptFlags); + settings.resources_dir_path := CefString(ResourcesDirPath); + settings.locales_dir_path := CefString(LocalesDirPath); + settings.pack_loading_disabled := PackLoadingDisabled; + settings.remote_debugging_port := RemoteDebuggingPort; + settings.uncaught_exception_stack_size := UncaughtExceptionStackSize; + settings.context_safety_implementation := ContextSafetyImplementation; + + app := TInternalApp.Create; + + {$IFDEF LINUX} + Args.argc := argc; + Args.argv := argv; + + errcode := cef_execute_process(@Args, CefGetData(app)); + {$ENDIF} + {$IFDEF MSWINDOWS} + errcode := cef_execute_process(@HInstance, CefGetData(app)); + {$ENDIF} + If errcode >= 0 then + begin + Assert(False, 'cef_execute_process went wrong'); + + Result := False; + Exit; + end; + + ErrCode := cef_initialize(@Args, @settings, CefGetData(app)); + If ErrCode <> 1 then + begin + WriteLn(errcode); + Assert(False, 'cef_initialize went wrong'); + + Result := False; + Exit; + end; + + CefIsMainProcess := True; + Result := True; +end; + +{$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP} +procedure CefDoMessageLoopWork; +begin + //If LibHandle > 0 then + cef_do_message_loop_work; +end; + +procedure CefRunMessageLoop; +begin + //If LibHandle > 0 then + cef_run_message_loop; +end; + +procedure CefQuitMessageLoop; +begin + cef_quit_message_loop; +end; +{$ENDIF} + +procedure CefShutDown; +begin + If CefIsMainProcess then + begin + cef_shutdown; + + //CefCloseLibrary; + end; +end; + +function CefString(const str : String) : TCefString; +begin + FillChar(Result, SizeOf(Result), 0); + + If str <> '' then + cef_string_ascii_to_utf16(PChar(str), Length(str), @Result); +end; + +{ +function CefString(const str : ustring): TCefString; +begin + Result.str := PChar16(PWideChar(str)); + Result.length := Length(str); + Result.dtor := nil; +end; +} + +function CefString(const str: PCefString): ustring; +begin + If str <> nil then SetString(Result, str^.str, str^.length) + Else Result := ''; +end; + +procedure _free_string(str: PChar16); cdecl; +begin + If str <> nil then FreeMem(str); +end; + +function CefUserFreeString(const str: ustring): PCefStringUserFree; +begin + Result := cef_string_userfree_alloc(); + Result^.length := Length(str); + Result^.dtor := @_free_string; + + GetMem(Result^.str, Result^.length * SizeOf(TCefChar)); + Move(PCefChar(str)^, Result^.str^, Result^.length * SizeOf(TCefChar)); +end; + +function CefStringAlloc(const str: ustring): TCefString; +begin + FillChar(Result, SizeOf(Result), 0); + If str <> '' then cef_string_from_wide(PWideChar(str), Length(str), @Result); +end; + +procedure CefStringSet(const str: PCefString; const value: ustring); +begin + If str <> nil then cef_string_set(PWideChar(value), Length(value), str, 1); +end; + +function CefStringClearAndGet(var str: TCefString): ustring; +begin + Result := CefString(@str); + cef_string_clear(@str); +end; + +function CefStringFreeAndGet(const str: PCefStringUserFree): ustring; +begin + If str <> nil then + begin + Result := CefString(PCefString(str)); + cef_string_userfree_free(str); + end + Else Result := ''; +end; + +procedure CefStringFree(const str: PCefString); +begin + If str <> nil then cef_string_clear(str); +end; + +function CefRegisterSchemeHandlerFactory(const SchemeName, HostName: ustring; + SyncMainThread: Boolean; const handler: TCefResourceHandlerClass): Boolean; +Var + s, h: TCefString; +begin + CefInitDefault; + s := CefString(SchemeName); + h := CefString(HostName); + Result := cef_register_scheme_handler_factory( + @s, + @h, + //CefGetData(TCefSchemeHandlerFactoryOwn.Create(handler, SyncMainThread) as ICefBase)) <> 0; + CefGetData(TCefSchemeHandlerFactoryOwn.Create(handler, SyncMainThread))) <> 0; +end; + +function CefClearSchemeHandlerFactories: Boolean; +begin + CefInitDefault; + Result := cef_clear_scheme_handler_factories() <> 0; +end; + +function CefAddCrossOriginWhitelistEntry(const SourceOrigin, TargetProtocol, + TargetDomain: ustring; AllowTargetSubdomains: Boolean): Boolean; +Var + so, tp, td: TCefString; +begin + CefInitDefault; + so := CefString(SourceOrigin); + tp := CefString(TargetProtocol); + td := CefString(TargetDomain); + Result := cef_add_cross_origin_whitelist_entry(@so, @tp, @td, Ord(AllowTargetSubdomains)) <> 0; +end; + +function CefRemoveCrossOriginWhitelistEntry( + const SourceOrigin, TargetProtocol, TargetDomain: ustring; + AllowTargetSubdomains: Boolean): Boolean; +Var + so, tp, td: TCefString; +begin + CefInitDefault; + so := CefString(SourceOrigin); + tp := CefString(TargetProtocol); + td := CefString(TargetDomain); + Result := cef_remove_cross_origin_whitelist_entry(@so, @tp, @td, Ord(AllowTargetSubdomains)) <> 0; +end; + +function CefClearCrossOriginWhitelist: Boolean; +begin + CefInitDefault; + Result := cef_clear_cross_origin_whitelist() <> 0; +end; + +function CefRegisterExtension(const name, code: ustring; + const Handler: ICefv8Handler): Boolean; +Var + n, c: TCefString; +begin + CefInitDefault; + n := CefString(name); + c := CefString(code); + Result := cef_register_extension(@n, @c, CefGetData(handler)) <> 0; +end; + +function CefCurrentlyOn(ThreadId: TCefThreadId): Boolean; +begin + Result := cef_currently_on(ThreadId) <> 0; +end; + +procedure CefPostTask(ThreadId: TCefThreadId; const task: ICefTask); +begin + cef_post_task(ThreadId, CefGetData(task)); +end; + +procedure CefPostDelayedTask(ThreadId: TCefThreadId; const task: ICefTask; delayMs: Int64); +begin + cef_post_delayed_task(ThreadId, CefGetData(task), delayMs); +end; + +function CefGetData(const i: ICefBase): Pointer; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} +begin + If i <> nil then Result := i.Wrap + Else Result := nil; +end; + +function CefGetObject(ptr: Pointer): TObject; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} +begin + //Dec(ptr, SizeOf(Pointer)); + Dec(PByte(ptr), SizeOf(Pointer)); + + Result := TObject(PPointer(ptr)^); +end; + +function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean; +Var + u: TCefString; + p: TCefUrlParts; +begin + FillChar(p, sizeof(p), 0); + u := CefString(url); + Result := cef_parse_url(@u, p) <> 0; + if Result then + begin + //parts.spec := CefString(@p.spec); + parts.scheme := CefString(@p.scheme); + parts.username := CefString(@p.username); + parts.password := CefString(@p.password); + parts.host := CefString(@p.host); + parts.port := CefString(@p.port); + parts.path := CefString(@p.path); + parts.query := CefString(@p.query); + end; +end; + +function CefCreateUrl(var parts: TUrlParts): string; +Var + p: TCefUrlParts; + u: TCefString; +begin + FillChar(p, sizeof(p), 0); + p.spec := CefString(parts.spec); + p.scheme := CefString(parts.scheme); + p.username := CefString(parts.username); + p.password := CefString(parts.password); + p.host := CefString(parts.host); + p.port := CefString(parts.port); + p.path := CefString(parts.path); + p.query := CefString(parts.query); + FillChar(u, SizeOf(u), 0); + If cef_create_url(@p, @u) <> 0 then Result := CefString(@u) + Else Result := ''; +end; + +function CefBrowserHostCreate(windowInfo: PCefWindowInfo; const client: ICefClient; + const url: ustring; const settings: PCefBrowserSettings): Boolean; +Var + u: TCefString; +begin + CefInitDefault; + u := CefString(url); + Result := cef_browser_host_create_browser(windowInfo, CefGetData(client), @u, settings) <> 0; +end; + +function CefBrowserHostCreateSync(windowInfo: PCefWindowInfo; const client: ICefClient; + const url: ustring; const settings: PCefBrowserSettings): ICefBrowser; +Var + u: TCefString; +begin + CefInitDefault; + u := CefString(url); + Result := TCefBrowserRef.UnWrap(cef_browser_host_create_browser_sync(windowInfo, CefGetData(client), @u, settings)); +end; + +procedure CefVisitWebPluginInfo(const visitor: ICefWebPluginInfoVisitor); +begin + cef_visit_web_plugin_info(CefGetData(visitor)); +end; + +procedure CefVisitWebPluginInfoProc(const visitor: TCefWebPluginInfoVisitorProc); +begin + CefVisitWebPluginInfo(TCefFastWebPluginInfoVisitor.Create(visitor)); +end; + +procedure CefRefreshWebPlugins; +begin + cef_refresh_web_plugins(); +end; + +procedure CefAddWebPluginPath(const path: ustring); +Var + p: TCefString; +begin + p := CefString(path); + cef_add_web_plugin_path(@p); +end; + +procedure CefAddWebPluginDirectory(const dir: ustring); +Var + d: TCefString; +begin + d := CefString(dir); + cef_add_web_plugin_directory(@d); +end; + +procedure CefRemoveWebPluginPath(const path: ustring); +Var + p: TCefString; +begin + p := CefString(path); + cef_remove_web_plugin_path(@p); +end; + +procedure CefUnregisterInternalWebPlugin(const path: ustring); +Var + p: TCefString; +begin + p := CefString(path); + cef_unregister_internal_web_plugin(@p); +end; + +procedure CefForceWebPluginShutdown(const path: ustring); +Var + p: TCefString; +begin + p := CefString(path); + cef_force_web_plugin_shutdown(@p); +end; + +procedure CefRegisterWebPluginCrash(const path: ustring); +Var + p: TCefString; +begin + p := CefString(path); + cef_register_web_plugin_crash(@p); +end; + +procedure CefIsWebPluginUnstable(const path: ustring; const callback: ICefWebPluginUnstableCallback); +Var + p: TCefString; +begin + p := CefString(path); + cef_is_web_plugin_unstable(@p, CefGetData(callback)); +end; + +procedure CefIsWebPluginUnstableProc(const path: ustring; const callback: TCefWebPluginIsUnstableProc); +begin + CefIsWebPluginUnstable(path, TCefFastWebPluginUnstableCallback.Create(callback)); +end; + +function CefGetPath(key: TCefPathKey; out path: ustring): Boolean; +Var + p: TCefString; +begin + p := CefString(''); + Result := cef_get_path(key, @p) <> 0; + path := CefStringClearAndGet(p); +end; + +function CefBeginTracing(const client: ICefTraceClient; const categories: ustring): Boolean; +Var + c: TCefString; +begin + c := CefString(categories); + Result := cef_begin_tracing(CefGetData(client), @c) <> 0; +end; + +function CefGetTraceBufferPercentFullAsync: Integer; +begin + Result := cef_get_trace_buffer_percent_full_async(); +end; + +function CefEndTracingAsync: Boolean; +begin + Result := cef_end_tracing_async() <> 0; +end; + +function CefGetGeolocation(const callback: ICefGetGeolocationCallback): Boolean; +begin + Result := cef_get_geolocation(CefGetData(callback)) <> 0; +end; + +{$IFDEF WINDOWS} +function CefTimeToSystemTime(const dt: TCefTime): TSystemTime; +begin + With Result do + begin + wYear := dt.year; + wMonth := dt.month; + wDayOfWeek := dt.day_of_week; + wDay := dt.day_of_month; + wHour := dt.hour; + wMinute := dt.minute; + wSecond := dt.second; + wMilliseconds := dt.millisecond; + end; +end; + +function SystemTimeToCefTime(const dt: TSystemTime): TCefTime; +begin + With Result do + begin + year := dt.wYear; + month := dt.wMonth; + day_of_week := dt.wDayOfWeek; + day_of_month := dt.wDay; + hour := dt.wHour; + minute := dt.wMinute; + second := dt.wSecond; + millisecond := dt.wMilliseconds; + end; +end; + +function CefTimeToDateTime(const dt: TCefTime): TDateTime; +Var + st: TSystemTime; +begin + st := CefTimeToSystemTime(dt); + SystemTimeToTzSpecificLocalTime(nil, @st, @st); + Result := SystemTimeToDateTime(st); +end; + +function DateTimeToCefTime(dt: TDateTime): TCefTime; +Var + st: TSystemTime; +begin + DateTimeToSystemTime(dt, st); + TzSpecificLocalTimeToSystemTime(nil, @st, @st); + Result := SystemTimeToCefTime(st); +end; + +{$ELSE} + +function CefTimeToDateTime(const dt: TCefTime): TDateTime; +begin + Result := EncodeDate(dt.year, dt.month, dt.day_of_month) + EncodeTime(dt.hour, dt.minute, dt.second, dt.millisecond); +end; + +function DateTimeToCefTime(dt: TDateTime): TCefTime; +Var + Year, Month, Day, Hour, Min, Sec, MSec: Word; +begin + DecodeDate(dt, Year, Month, Day); + DecodeTime(dt, Hour, Min, Sec, MSec); + + With Result do + begin + year := Year; + month := Month; + day_of_week := DayOfWeek(dt); + day_of_month := Month; + hour := Hour; + minute := Min; + second := Sec; + millisecond := MSec; + end; +end; + +{$ENDIF} + + +{ cef_base } + +function cef_base_add_ref(self: PCefBase): Integer; cdecl; +begin + //WriteLn('AddRef'); + Result := TCefBaseOwn(CefGetObject(self))._AddRef; +end; + +function cef_base_release(self: PCefBase): Integer; cdecl; +begin + //WriteLn('Release'); + Result := TCefBaseOwn(CefGetObject(self))._Release; +end; + +function cef_base_get_refct(self: PCefBase): Integer; cdecl; +begin + Result := TCefBaseOwn(CefGetObject(self)).FRefCount; +end; + +function cef_base_add_ref_owned(self: PCefBase): Integer; cdecl; +begin + Result := 1; +end; + +function cef_base_release_owned(self: PCefBase): Integer; cdecl; +begin + Result := 1; +end; + +function cef_base_get_refct_owned(self: PCefBase): Integer; cdecl; +begin + Result := 1; +end; + +{ cef_client } + +function cef_client_get_context_menu_handler(self: PCefClient): PCefContextMenuHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetContextMenuHandler); +end; + +function cef_client_get_dialog_handler(self: PCefClient): PCefDialogHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetDialogHandler); +end; + +function cef_client_get_display_handler(self: PCefClient): PCefDisplayHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetDisplayHandler); +end; + +function cef_client_get_download_handler(self: PCefClient): PCefDownloadHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetDownloadHandler); +end; + +function cef_client_get_focus_handler(self: PCefClient): PCefFocusHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetFocusHandler); +end; + +function cef_client_get_geolocation_handler(self: PCefClient): PCefGeolocationHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetGeolocationHandler); +end; + +function cef_client_get_jsdialog_handler(self: PCefClient): PCefJsDialogHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetJsdialogHandler); +end; + +function cef_client_get_keyboard_handler(self: PCefClient): PCefKeyboardHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetKeyboardHandler); +end; + +function cef_client_get_life_span_handler(self: PCefClient): PCefLifeSpanHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetLifeSpanHandler); +end; + +function cef_client_get_load_handler(self: PCefClient): PCefLoadHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetLoadHandler); +end; + +function cef_client_get_get_render_handler(self: PCefClient): PCefRenderHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetRenderHandler); +end; + +function cef_client_get_request_handler(self: PCefClient): PCefRequestHandler; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := CefGetData(GetRequestHandler); +end; + +function cef_client_on_process_message_received(self: PCefClient; browser: PCefBrowser; + source_process: TCefProcessId; message: PCefProcessMessage): Integer; cdecl; +begin + With TCefClientOwn(CefGetObject(self)) do + Result := Ord(OnProcessMessageReceived(TCefBrowserRef.UnWrap(browser), source_process, + TCefProcessMessageRef.UnWrap(message))); +end; + +{ cef_geolocation_handler } + +procedure cef_geolocation_handler_on_request_geolocation_permission(self: PCefGeolocationHandler; + browser: PCefBrowser; const requesting_url: PCefString; request_id: Integer; + callback: PCefGeolocationCallback); cdecl; +begin + With TCefGeolocationHandlerOwn(CefGetObject(self)) do + OnRequestGeolocationPermission(TCefBrowserRef.UnWrap(browser), CefString(requesting_url), + request_id, TCefGeolocationCallbackRef.UnWrap(callback)); +end; + +procedure cef_geolocation_handler_on_cancel_geolocation_permission(self: PCefGeolocationHandler; + browser: PCefBrowser; const requesting_url: PCefString; request_id: Integer); cdecl; +begin + With TCefGeolocationHandlerOwn(CefGetObject(self)) do + OnCancelGeolocationPermission(TCefBrowserRef.UnWrap(browser), CefString(requesting_url), request_id); +end; + +{ cef_life_span_handler } + +//function cef_life_span_handler_on_before_popup(self: PCefLifeSpanHandler; parentBrowser: PCefBrowser; +// const popupFeatures: PCefPopupFeatures; windowInfo: PCefWindowInfo; const url: PCefString; +// var client: PCefClient; settings: PCefBrowserSettings): Integer; cdecl; +function cef_life_span_handler_on_before_popup(self: PCefLifeSpanHandler; + browser: PCefBrowser; frame: PCefFrame; const target_url, target_frame_name: PCefString; + const popupFeatures: PCefPopupFeatures; windowInfo: PCefWindowInfo; var client: PCefClient; + settings: PCefBrowserSettings; no_javascript_access: PInteger): Integer; cdecl; +Var + _url, _frame: ustring; + _client: ICefClient; + _nojs: Boolean; +begin + _url := CefString(target_url); + _frame := CefString(target_frame_name); + _client := TCefClientOwn(CefGetObject(client));// as ICefClient; + _nojs := no_javascript_access^ <> 0; + With TCefLifeSpanHandlerOwn(CefGetObject(self)) do + Result := Ord(OnBeforePopup( + TCefBrowserRef.UnWrap(browser), + TCefFrameRef.UnWrap(frame), + _url, + _frame, + popupFeatures^, + windowInfo^, + _client, + settings^, + _nojs + )); + CefStringSet(target_url, _url); + CefStringSet(target_frame_name, _frame); + client := CefGetData(_client); + no_javascript_access^ := Ord(_nojs); + _client := nil; +end; + +procedure cef_life_span_handler_on_after_created(self: PCefLifeSpanHandler; browser: PCefBrowser); cdecl; +begin + TCefLifeSpanHandlerOwn(CefGetObject(self)).OnAfterCreated(TCefBrowserRef.UnWrap(browser)); +end; + +procedure cef_life_span_handler_on_before_close(self: PCefLifeSpanHandler; browser: PCefBrowser); cdecl; +begin + with TCefLifeSpanHandlerOwn(CefGetObject(self)) do + OnBeforeClose(TCefBrowserRef.UnWrap(browser)); +end; + +function cef_life_span_handler_run_modal(self: PCefLifeSpanHandler; browser: PCefBrowser): Integer; cdecl; +begin + with TCefLifeSpanHandlerOwn(CefGetObject(self)) do + Result := Ord(RunModal(TCefBrowserRef.UnWrap(browser))); +end; + +function cef_life_span_handler_do_close(self: PCefLifeSpanHandler; browser: PCefBrowser): Integer; cdecl; +begin + + with TCefLifeSpanHandlerOwn(CefGetObject(self)) do + Result := Ord(DoClose(TCefBrowserRef.UnWrap(browser))); +end; + + +{ cef_load_handler } + +procedure cef_load_handler_on_load_start(self: PCefLoadHandler; + browser: PCefBrowser; frame: PCefFrame); cdecl; +begin + with TCefLoadHandlerOwn(CefGetObject(self)) do + OnLoadStart(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame)); +end; + +procedure cef_load_handler_on_load_end(self: PCefLoadHandler; + browser: PCefBrowser; frame: PCefFrame; httpStatusCode: Integer); cdecl; +begin + with TCefLoadHandlerOwn(CefGetObject(self)) do + OnLoadEnd(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), httpStatusCode); +end; + +procedure cef_load_handler_on_load_error(self: PCefLoadHandler; browser: PCefBrowser; + frame: PCefFrame; errorCode: Integer; const errorText, failedUrl: PCefString); cdecl; +begin + with TCefLoadHandlerOwn(CefGetObject(self)) do + OnLoadError(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), + errorCode, CefString(errorText), CefString(failedUrl)); +end; + +procedure cef_load_handler_on_render_process_terminated(self: PCefLoadHandler; + browser: PCefBrowser; status: TCefTerminationStatus); cdecl; +begin + with TCefLoadHandlerOwn(CefGetObject(self)) do + OnRenderProcessTerminated(TCefBrowserRef.UnWrap(browser), status); +end; + +procedure cef_load_handler_on_plugin_crashed(self: PCefLoadHandler; + browser: PCefBrowser; const plugin_path: PCefString); cdecl; +begin + with TCefLoadHandlerOwn(CefGetObject(self)) do + OnPluginCrashed(TCefBrowserRef.UnWrap(browser), CefString(plugin_path)); +end; + +{ cef_request_handler } + +function cef_request_handler_on_before_resource_load(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; request: PCefRequest): Integer; cdecl; +begin + with TCefRequestHandlerOwn(CefGetObject(self)) do + Result := Ord(OnBeforeResourceLoad( + TCefBrowserRef.UnWrap(browser), + TCefFrameRef.UnWrap(frame), + TCefRequestRef.UnWrap(request))); +end; + +function cef_request_handler_get_resource_handler(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; request: PCefRequest): PCefResourceHandler; cdecl; +begin + with TCefRequestHandlerOwn(CefGetObject(self)) do + Result := CefGetData(GetResourceHandler(TCefBrowserRef.UnWrap(browser), + TCefFrameRef.UnWrap(frame), TCefRequestRef.UnWrap(request))); +end; + +procedure cef_request_handler_on_resource_redirect(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; const old_url: PCefString; new_url: PCefString); cdecl; +var + url: ustring; +begin + url := CefString(new_url); + with TCefRequestHandlerOwn(CefGetObject(self)) do + OnResourceRedirect(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), + CefString(old_url), url); + if url <> '' then + CefStringSet(new_url, url); +end; + +function cef_request_handler_get_auth_credentials(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; isProxy: Integer; const host: PCefString; + port: Integer; const realm, scheme: PCefString; callback: PCefAuthCallback): Integer; cdecl; +begin + with TCefRequestHandlerOwn(CefGetObject(self)) do + Result := Ord(GetAuthCredentials( + TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), isProxy <> 0, + CefString(host), port, CefString(realm), CefString(scheme), TCefAuthCallbackRef.UnWrap(callback))); +end; + +function cef_request_handler_on_quota_request(self: PCefRequestHandler; browser: PCefBrowser; + const origin_url: PCefString; new_size: Int64; callback: PCefQuotaCallback): Integer; cdecl; +begin + with TCefRequestHandlerOwn(CefGetObject(self)) do + Result := Ord(OnQuotaRequest(TCefBrowserRef.UnWrap(browser), + CefString(origin_url), new_size, TCefQuotaCallbackRef.UnWrap(callback))); +end; + +function cef_request_handler_get_cookie_manager(self: PCefRequestHandler; + browser: PCefBrowser; const main_url: PCefString): PCefCookieManager; cdecl; +begin + with TCefRequestHandlerOwn(CefGetObject(self)) do + Result := CefGetData(GetCookieManager(TCefBrowserRef.UnWrap(browser), CefString(main_url))); +end; + +procedure cef_request_handler_on_protocol_execution(self: PCefRequestHandler; + browser: PCefBrowser; const url: PCefString; allow_os_execution: PInteger); cdecl; +var + allow: Boolean; +begin + allow := allow_os_execution^ <> 0; + with TCefRequestHandlerOwn(CefGetObject(self)) do + OnProtocolExecution( + TCefBrowserRef.UnWrap(browser), + CefString(url), allow); + allow_os_execution^ := Ord(allow); +end; + +function cef_request_handler_on_before_plugin_load(self: PCefRequestHandler; browser: PCefBrowser; + const url, policy_url: PCefString; info: PCefWebPluginInfo): Integer; cdecl; +begin + with TCefRequestHandlerOwn(CefGetObject(self)) do + Result := Ord(OnBeforePluginLoad(TCefBrowserRef.UnWrap(browser), + CefString(url), CefString(policy_url), TCefWebPluginInfoRef.UnWrap(info))); +end; + +{ cef_display_handler } + +procedure cef_display_handler_on_loading_state_change(self: PCefDisplayHandler; + browser: PCefBrowser; isLoading, canGoBack, canGoForward: Integer); cdecl; +begin + with TCefDisplayHandlerOwn(CefGetObject(self)) do + OnLoadingStateChange(TCefBrowserRef.UnWrap(browser), isLoading <> 0, + canGoBack <> 0, canGoForward <> 0); +end; + +procedure cef_display_handler_on_address_change(self: PCefDisplayHandler; + browser: PCefBrowser; frame: PCefFrame; const url: PCefString); cdecl; +begin + with TCefDisplayHandlerOwn(CefGetObject(self)) do + OnAddressChange( + TCefBrowserRef.UnWrap(browser), + TCefFrameRef.UnWrap(frame), + cefstring(url)) +end; + +procedure cef_display_handler_on_title_change(self: PCefDisplayHandler; + browser: PCefBrowser; const title: PCefString); cdecl; +begin + with TCefDisplayHandlerOwn(CefGetObject(self)) do + OnTitleChange(TCefBrowserRef.UnWrap(browser), CefString(title)); +end; + +function cef_display_handler_on_tooltip(self: PCefDisplayHandler; + browser: PCefBrowser; text: PCefString): Integer; cdecl; +var + t: ustring; +begin + t := CefStringClearAndGet(text^); + with TCefDisplayHandlerOwn(CefGetObject(self)) do + Result := Ord(OnTooltip( + TCefBrowserRef.UnWrap(browser), t)); + text^ := CefStringAlloc(t); +end; + +procedure cef_display_handler_on_status_message(self: PCefDisplayHandler; + browser: PCefBrowser; const value: PCefString); cdecl; +begin + with TCefDisplayHandlerOwn(CefGetObject(self)) do + OnStatusMessage(TCefBrowserRef.UnWrap(browser), CefString(value)); +end; + +function cef_display_handler_on_console_message(self: PCefDisplayHandler; + browser: PCefBrowser; const message: PCefString; + const source: PCefString; line: Integer): Integer; cdecl; +begin + with TCefDisplayHandlerOwn(CefGetObject(self)) do + Result := Ord(OnConsoleMessage(TCefBrowserRef.UnWrap(browser), + CefString(message), CefString(source), line)); +end; + +{ cef_focus_handler } + +procedure cef_focus_handler_on_take_focus(self: PCefFocusHandler; + browser: PCefBrowser; next: Integer); cdecl; +begin + with TCefFocusHandlerOwn(CefGetObject(self)) do + OnTakeFocus(TCefBrowserRef.UnWrap(browser), next <> 0); +end; + +function cef_focus_handler_on_set_focus(self: PCefFocusHandler; + browser: PCefBrowser; source: TCefFocusSource): Integer; cdecl; +begin + with TCefFocusHandlerOwn(CefGetObject(self)) do + Result := Ord(OnSetFocus(TCefBrowserRef.UnWrap(browser), source)) +end; + +procedure cef_focus_handler_on_got_focus(self: PCefFocusHandler; browser: PCefBrowser); cdecl; +begin + with TCefFocusHandlerOwn(CefGetObject(self)) do + OnGotFocus(TCefBrowserRef.UnWrap(browser)); +end; + +{ cef_keyboard_handler } + +function cef_keyboard_handler_on_pre_key_event(self: PCefKeyboardHandler; + browser: PCefBrowser; const event: PCefKeyEvent; + os_event: TCefEventHandle; is_keyboard_shortcut: PInteger): Integer; cdecl; +var + ks: Boolean; +begin + ks := is_keyboard_shortcut^ <> 0; + with TCefKeyboardHandlerOwn(CefGetObject(self)) do + Result := Ord(OnPreKeyEvent(TCefBrowserRef.UnWrap(browser), event, os_event, ks)); + is_keyboard_shortcut^ := Ord(ks); +end; + +function cef_keyboard_handler_on_key_event(self: PCefKeyboardHandler; + browser: PCefBrowser; const event: PCefKeyEvent; os_event: TCefEventHandle): Integer; cdecl; +begin + with TCefKeyboardHandlerOwn(CefGetObject(self)) do + Result := Ord(OnKeyEvent(TCefBrowserRef.UnWrap(browser), event, os_event)); +end; + +{ cef_jsdialog_handler } + +function cef_jsdialog_handler_on_jsdialog(self: PCefJsDialogHandler; + browser: PCefBrowser; const origin_url, accept_lang: PCefString; + dialog_type: TCefJsDialogType; const message_text, default_prompt_text: PCefString; + callback: PCefJsDialogCallback; suppress_message: PInteger): Integer; cdecl; +var + sm: Boolean; +begin + sm := suppress_message^ <> 0; + with TCefJsDialogHandlerOwn(CefGetObject(self)) do + Result := Ord(OnJsdialog(TCefBrowserRef.UnWrap(browser), CefString(origin_url), + CefString(accept_lang), dialog_type, CefString(message_text), + CefString(default_prompt_text), TCefJsDialogCallbackRef.UnWrap(callback), sm)); + suppress_message^ := Ord(sm); +end; + +function cef_jsdialog_handler_on_before_unload_dialog(self: PCefJsDialogHandler; + browser: PCefBrowser; const message_text: PCefString; is_reload: Integer; + callback: PCefJsDialogCallback): Integer; cdecl; +begin + with TCefJsDialogHandlerOwn(CefGetObject(self)) do + Result := Ord(OnBeforeUnloadDialog(TCefBrowserRef.UnWrap(browser), CefString(message_text), + is_reload <> 0, TCefJsDialogCallbackRef.UnWrap(callback))); +end; + +procedure cef_jsdialog_handler_on_reset_dialog_state(self: PCefJsDialogHandler; + browser: PCefBrowser); cdecl; +begin + with TCefJsDialogHandlerOwn(CefGetObject(self)) do + OnResetDialogState(TCefBrowserRef.UnWrap(browser)); +end; + +{ cef_context_menu_handler } + +procedure cef_context_menu_handler_on_before_context_menu(self: PCefContextMenuHandler; + browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; + model: PCefMenuModel); cdecl; +begin + with TCefContextMenuHandlerOwn(CefGetObject(self)) do + OnBeforeContextMenu(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), + TCefContextMenuParamsRef.UnWrap(params), TCefMenuModelRef.UnWrap(model)); +end; + +function cef_context_menu_handler_on_context_menu_command(self: PCefContextMenuHandler; + browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; + command_id: Integer; event_flags: Integer): Integer; cdecl; +begin + with TCefContextMenuHandlerOwn(CefGetObject(self)) do + Result := Ord(OnContextMenuCommand(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), + TCefContextMenuParamsRef.UnWrap(params), command_id, TCefEventFlags(Pointer(@event_flags)^))); +end; + +procedure cef_context_menu_handler_on_context_menu_dismissed(self: PCefContextMenuHandler; + browser: PCefBrowser; frame: PCefFrame); cdecl; +begin + with TCefContextMenuHandlerOwn(CefGetObject(self)) do + OnContextMenuDismissed(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame)); +end; + +{ cef_stream_reader } + +function cef_stream_reader_read(self: PCefReadHandler; ptr: Pointer; size, n: Cardinal): Cardinal; cdecl; +begin + with TCefCustomStreamReader(CefGetObject(self)) do + Result := Read(ptr, size, n); +end; + +function cef_stream_reader_seek(self: PCefReadHandler; offset: Int64; whence: Integer): Integer; cdecl; +begin + with TCefCustomStreamReader(CefGetObject(self)) do + Result := Seek(offset, whence); +end; + +function cef_stream_reader_tell(self: PCefReadHandler): Int64; cdecl; +begin + with TCefCustomStreamReader(CefGetObject(self)) do + Result := Tell; +end; + +function cef_stream_reader_eof(self: PCefReadHandler): Integer; cdecl; +begin + with TCefCustomStreamReader(CefGetObject(self)) do + Result := Ord(eof); +end; + +{ cef_post_data_element } + +function cef_post_data_element_is_read_only(self: PCefPostDataElement): Integer; cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + Result := Ord(IsReadOnly) +end; + +procedure cef_post_data_element_set_to_empty(self: PCefPostDataElement); cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + SetToEmpty; +end; + +procedure cef_post_data_element_set_to_file(self: PCefPostDataElement; const fileName: PCefString); cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + SetToFile(CefString(fileName)); +end; + +procedure cef_post_data_element_set_to_bytes(self: PCefPostDataElement; size: Cardinal; const bytes: Pointer); cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + SetToBytes(size, bytes); +end; + +function cef_post_data_element_get_type(self: PCefPostDataElement): TCefPostDataElementType; cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + Result := GetType; +end; + +function cef_post_data_element_get_file(self: PCefPostDataElement): PCefStringUserFree; cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + Result := CefUserFreeString(GetFile); +end; + +function cef_post_data_element_get_bytes_count(self: PCefPostDataElement): Cardinal; cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + Result := GetBytesCount; +end; + +function cef_post_data_element_get_bytes(self: PCefPostDataElement; size: Cardinal; bytes: Pointer): Cardinal; cdecl; +begin + with TCefPostDataElementOwn(CefGetObject(self)) do + Result := GetBytes(size, bytes) +end; + +{ cef_v8_handler } + +function cef_v8_handler_execute(self: PCefv8Handler; + const name: PCefString; obj: PCefv8Value; argumentsCount: Cardinal; + const arguments: PPCefV8Value; var retval: PCefV8Value; + var exception: TCefString): Integer; cdecl; +var + args: TCefv8ValueArray; + i: Integer; + ret: ICefv8Value; + exc: ustring; +begin + SetLength(args, argumentsCount); + For i := 0 to argumentsCount - 1 do + args[i] := TCefv8ValueRef.UnWrap(arguments^[i]); + + Result := -Ord(TCefv8HandlerOwn(CefGetObject(self)).Execute( + CefString(name), TCefv8ValueRef.UnWrap(obj), args, ret, exc)); + retval := CefGetData(ret); + ret := nil; + exception := CefString(exc); +end; + +{ cef_task } + +procedure cef_task_execute(self: PCefTask); cdecl; +begin + TCefTaskOwn(CefGetObject(self)).Execute(); +end; + +{ cef_download_handler } + +procedure cef_download_handler_on_before_download(self: PCefDownloadHandler; + browser: PCefBrowser; download_item: PCefDownloadItem; + const suggested_name: PCefString; callback: PCefBeforeDownloadCallback); cdecl; +begin + TCefDownloadHandlerOwn(CefGetObject(self)). + OnBeforeDownload(TCefBrowserRef.UnWrap(browser), + TCefDownLoadItemRef.UnWrap(download_item), CefString(suggested_name), + TCefBeforeDownloadCallbackRef.UnWrap(callback)); +end; + +procedure cef_download_handler_on_download_updated(self: PCefDownloadHandler; + browser: PCefBrowser; download_item: PCefDownloadItem; callback: PCefDownloadItemCallback); cdecl; +begin + TCefDownloadHandlerOwn(CefGetObject(self)). + OnDownloadUpdated(TCefBrowserRef.UnWrap(browser), + TCefDownLoadItemRef.UnWrap(download_item), + TCefDownloadItemCallbackRef.UnWrap(callback)); +end; + +{ cef_dom_visitor } + +procedure cef_dom_visitor_visite(self: PCefDomVisitor; document: PCefDomDocument); cdecl; +begin + TCefDomVisitorOwn(CefGetObject(self)).visit(TCefDomDocumentRef.UnWrap(document)); +end; + +{ cef_dom_event_listener } + +procedure cef_dom_event_listener_handle_event(self: PCefDomEventListener; event: PCefDomEvent); cdecl; +begin + TCefDomEventListenerOwn(CefGetObject(self)).HandleEvent(TCefDomEventRef.UnWrap(event)); +end; + +{ cef_v8_accessor } + +function cef_v8_accessor_get(self: PCefV8Accessor; const name: PCefString; + obj: PCefv8Value; out retval: PCefv8Value; exception: PCefString): Integer; cdecl; +var + ret: ICefv8Value; +begin + Result := Ord(TCefV8AccessorOwn(CefGetObject(self)).Get(CefString(name), + TCefv8ValueRef.UnWrap(obj), ret, CefString(exception))); + retval := CefGetData(ret); +end; + + +function cef_v8_accessor_put(self: PCefV8Accessor; const name: PCefString; + obj: PCefv8Value; value: PCefv8Value; exception: PCefString): Integer; cdecl; +begin + Result := Ord(TCefV8AccessorOwn(CefGetObject(self)).Put(CefString(name), + TCefv8ValueRef.UnWrap(obj), TCefv8ValueRef.UnWrap(value), CefString(exception))); +end; + +{ cef_cookie_visitor } + +function cef_cookie_visitor_visit(self: PCefCookieVisitor; const cookie: PCefCookie; + count, total: Integer; deleteCookie: PInteger): Integer; cdecl; +var + delete: Boolean; + exp: TDateTime; +begin + delete := False; + If cookie^.has_expires then exp := CefTimeToDateTime(cookie^.expires) + Else exp := 0; + + Result := Ord(TCefCookieVisitorOwn(CefGetObject(self)).visit(CefString(@cookie^.name), + CefString(@cookie^.value), CefString(@cookie^.domain), CefString(@cookie^.path), + cookie^.secure, cookie^.httponly, cookie^.has_expires, CefTimeToDateTime(cookie^.creation), + CefTimeToDateTime(cookie^.last_access), exp, count, total, delete)); + deleteCookie^ := Ord(delete); +end; + +{ cef_resource_bundle_handler } + +function cef_resource_bundle_handler_get_localized_string(self: PCefResourceBundleHandler; + message_id: Integer; string_val: PCefString): Integer; cdecl; +var + str: ustring; +begin + Result := Ord(TCefResourceBundleHandlerOwn(CefGetObject(self)). + GetLocalizedString(message_id, str)); + if Result <> 0 then + string_val^ := CefString(str); +end; + +function cef_resource_bundle_handler_get_data_resource(self: PCefResourceBundleHandler; + resource_id: Integer; var data: Pointer; var data_size: Cardinal): Integer; cdecl; +begin + Result := Ord(TCefResourceBundleHandlerOwn(CefGetObject(self)). + GetDataResource(resource_id, data, data_size)); +end; + +{ cef_app } + +procedure cef_app_on_before_command_line_processing(self: PCefApp; + const process_type: PCefString; command_line: PCefCommandLine); cdecl; +begin + With TCefAppOwn(CefGetObject(self)) do + OnBeforeCommandLineProcessing(CefString(process_type), TCefCommandLineRef.UnWrap(command_line)); +end; + +procedure cef_app_on_register_custom_schemes(self: PCefApp; registrar: PCefSchemeRegistrar); cdecl; +begin + With TCefAppOwn(CefGetObject(self)) do + OnRegisterCustomSchemes(TCefSchemeRegistrarRef.UnWrap(registrar)); +end; + +function cef_app_get_resource_bundle_handler(self: PCefApp): PCefResourceBundleHandler; cdecl; +begin + Result := CefGetData(TCefAppOwn(CefGetObject(self)).GetResourceBundleHandler()); +end; + +function cef_app_get_browser_process_handler(self: PCefApp): PCefBrowserProcessHandler; cdecl; +begin + Result := CefGetData(TCefAppOwn(CefGetObject(self)).GetBrowserProcessHandler()); +end; + +function cef_app_get_render_process_handler(self: PCefApp): PCefRenderProcessHandler; cdecl; +begin + Result := CefGetData(TCefAppOwn(CefGetObject(self)).GetRenderProcessHandler()); +end; + +{ cef_string_visitor_visit } + +procedure cef_string_visitor_visit(self: PCefStringVisitor; const str: PCefString); cdecl; +begin + TCefStringVisitorOwn(CefGetObject(self)).Visit(CefString(str)); +end; + +{ cef_browser_process_handler } + +procedure cef_browser_process_handler_on_context_initialized(self: PCefBrowserProcessHandler); cdecl; +begin + TCefBrowserProcessHandlerOwn(CefGetObject(self)).OnContextInitialized; +end; + +procedure cef_browser_process_handler_on_before_child_process_launch( + self: PCefBrowserProcessHandler; command_line: PCefCommandLine); cdecl; +begin + TCefBrowserProcessHandlerOwn(CefGetObject(self)).OnBeforeChildProcessLaunch(TCefCommandLineRef.UnWrap(command_line)); +end; + +procedure cef_browser_process_handler_on_render_process_thread_created( + self: PCefBrowserProcessHandler; extra_info: PCefListValue); cdecl; +begin + TCefBrowserProcessHandlerOwn(CefGetObject(self)).OnRenderProcessThreadCreated(TCefListValueRef.UnWrap(extra_info)); +end; + +{ cef_render_process_handler } + +procedure cef_render_process_handler_on_render_thread_created( + self: PCefRenderProcessHandler; extra_info: PCefListValue); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnRenderThreadCreated(TCefListValueRef.UnWrap(extra_info)); +end; + +procedure cef_render_process_handler_on_web_kit_initialized(self: PCefRenderProcessHandler); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnWebKitInitialized; +end; + +procedure cef_render_process_handler_on_browser_created(self: PCefRenderProcessHandler; + browser: PCefBrowser); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnBrowserCreated(TCefBrowserRef.UnWrap(browser)); +end; + +procedure cef_render_process_handler_on_browser_destroyed(self: PCefRenderProcessHandler; + browser: PCefBrowser); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnBrowserDestroyed(TCefBrowserRef.UnWrap(browser)); +end; + +function cef_render_process_handler_on_before_navigation(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; request: PCefRequest; + navigation_type: TCefNavigationType; is_redirect: Integer): Integer; cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + Result := Ord(OnBeforeNavigation(TCefBrowserRef.UnWrap(browser), + TCefFrameRef.UnWrap(frame), TCefRequestRef.UnWrap(request), + navigation_type, is_redirect <> 0)); +end; + +procedure cef_render_process_handler_on_context_created(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnContextCreated(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), TCefv8ContextRef.UnWrap(context)); +end; + +procedure cef_render_process_handler_on_context_released(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnContextReleased(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), TCefv8ContextRef.UnWrap(context)); +end; + +procedure cef_render_process_handler_on_uncaught_exception(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context; + exception: PCefV8Exception; stackTrace: PCefV8StackTrace); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnUncaughtException(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), + TCefv8ContextRef.UnWrap(context), TCefV8ExceptionRef.UnWrap(exception), + TCefV8StackTraceRef.UnWrap(stackTrace)); +end; + +procedure cef_render_process_handler_on_worker_context_created(self: PCefRenderProcessHandler; + worker_id: Integer; const url: PCefString; context: PCefv8Context); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnWorkerContextCreated(worker_id, CefString(url), TCefv8ContextRef.UnWrap(context)); +end; + +procedure cef_render_process_handler_on_worker_context_released(self: PCefRenderProcessHandler; + worker_id: Integer; const url: PCefString; context: PCefv8Context); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnWorkerContextReleased(worker_id, CefString(url), TCefv8ContextRef.UnWrap(context)); +end; + +procedure cef_render_process_handler_on_worker_uncaught_exception(self: PCefRenderProcessHandler; + worker_id: Integer; const url: PCefString; context: PCefv8Context; + exception: PCefV8Exception; stackTrace: PCefV8StackTrace); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnWorkerUncaughtException(worker_id, CefString(url), TCefv8ContextRef.UnWrap(context), + TCefV8ExceptionRef.UnWrap(exception), TCefV8StackTraceRef.UnWrap(stackTrace)); +end; + +procedure cef_render_process_handler_on_focused_node_changed(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; node: PCefDomNode); cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + OnFocusedNodeChanged(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), + TCefDomNodeRef.UnWrap(node)); +end; + +function cef_render_process_handler_on_process_message_received(self: PCefRenderProcessHandler; + browser: PCefBrowser; source_process: TCefProcessId; + message: PCefProcessMessage): Integer; cdecl; +begin + with TCefRenderProcessHandlerOwn(CefGetObject(Self)) do + Result := Ord(OnProcessMessageReceived(TCefBrowserRef.UnWrap(browser), source_process, + TCefProcessMessageRef.UnWrap(message))); +end; + +{ cef_url_request_client } + +procedure cef_url_request_client_on_request_complete(self: PCefUrlRequestClient; request: PCefUrlRequest); cdecl; +begin + with TCefUrlrequestClientOwn(CefGetObject(self)) do + OnRequestComplete(TCefUrlRequestRef.UnWrap(request)); +end; + +procedure cef_url_request_client_on_upload_progress(self: PCefUrlRequestClient; + request: PCefUrlRequest; current, total: UInt64); cdecl; +begin + with TCefUrlrequestClientOwn(CefGetObject(self)) do + OnUploadProgress(TCefUrlRequestRef.UnWrap(request), current, total); +end; + +procedure cef_url_request_client_on_download_progress(self: PCefUrlRequestClient; + request: PCefUrlRequest; current, total: UInt64); cdecl; +begin + with TCefUrlrequestClientOwn(CefGetObject(self)) do + OnDownloadProgress(TCefUrlRequestRef.UnWrap(request), current, total); +end; + +procedure cef_url_request_client_on_download_data(self: PCefUrlRequestClient; + request: PCefUrlRequest; const data: Pointer; data_length: Cardinal); cdecl; +begin + with TCefUrlrequestClientOwn(CefGetObject(self)) do + OnDownloadData(TCefUrlRequestRef.UnWrap(request), data, data_length); +end; + +{ cef_scheme_handler_factory } + +function cef_scheme_handler_factory_create(self: PCefSchemeHandlerFactory; + browser: PCefBrowser; frame: PCefFrame; const scheme_name: PCefString; + request: PCefRequest): PCefResourceHandler; cdecl; +begin + with TCefSchemeHandlerFactoryOwn(CefGetObject(self)) do + Result := CefGetData(New(TCefBrowserRef.UnWrap(browser), TCefFrameRef.UnWrap(frame), + CefString(scheme_name), TCefRequestRef.UnWrap(request))); +end; + +{ cef_resource_handler } + +function cef_resource_handler_process_request(self: PCefResourceHandler; + request: PCefRequest; callback: PCefCallback): Integer; cdecl; +begin + with TCefResourceHandlerOwn(CefGetObject(self)) do + Result := Ord(ProcessRequest(TCefRequestRef.UnWrap(request), TCefCallbackRef.UnWrap(callback))); +end; + +procedure cef_resource_handler_get_response_headers(self: PCefResourceHandler; + response: PCefResponse; response_length: PInt64; redirectUrl: PCefString); cdecl; +var + ru: ustring; +begin + ru := ''; + with TCefResourceHandlerOwn(CefGetObject(self)) do + GetResponseHeaders(TCefResponseRef.UnWrap(response), response_length^, ru); + if ru <> '' then + CefStringSet(redirectUrl, ru); +end; + +function cef_resource_handler_read_response(self: PCefResourceHandler; + data_out: Pointer; bytes_to_read: Integer; bytes_read: PInteger; + callback: PCefCallback): Integer; cdecl; +begin + with TCefResourceHandlerOwn(CefGetObject(self)) do + Result := Ord(ReadResponse(data_out, bytes_to_read, bytes_read^, TCefCallbackRef.UnWrap(callback))); +end; + +function cef_resource_handler_can_get_cookie(self: PCefResourceHandler; + const cookie: PCefCookie): Integer; cdecl; +begin + with TCefResourceHandlerOwn(CefGetObject(self)) do + Result := Ord(CanGetCookie(cookie)); +end; + +function cef_resource_handler_can_set_cookie(self: PCefResourceHandler; + const cookie: PCefCookie): Integer; cdecl; +begin + with TCefResourceHandlerOwn(CefGetObject(self)) do + Result := Ord(CanSetCookie(cookie)); +end; + +procedure cef_resource_handler_cancel(self: PCefResourceHandler); cdecl; +begin + with TCefResourceHandlerOwn(CefGetObject(self)) do + Cancel; +end; + +{ cef_web_plugin_info_visitor } + +function cef_web_plugin_info_visitor_visit(self: PCefWebPluginInfoVisitor; + info: PCefWebPluginInfo; count, total: Integer): Integer; cdecl; +begin + with TCefWebPluginInfoVisitorOwn(CefGetObject(self)) do + Result := Ord(Visit(TCefWebPluginInfoRef.UnWrap(info), count, total)); +end; + +{ cef_web_plugin_unstable_callback } + +procedure cef_web_plugin_unstable_callback_is_unstable( + self: PCefWebPluginUnstableCallback; const path: PCefString; unstable: Integer); cdecl; +begin + with TCefWebPluginUnstableCallbackOwn(CefGetObject(self)) do + IsUnstable(CefString(path), unstable <> 0); +end; + +{ cef_run_file_dialog_callback } + +procedure cef_run_file_dialog_callback_cont(self: PCefRunFileDialogCallback; + browser_host: PCefBrowserHost; file_paths: TCefStringList); cdecl; +var + list: TStringList; + i: Integer; + str: TCefString; +begin + list := TStringList.Create; + try + For i := 0 to cef_string_list_size(file_paths) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(file_paths, i, @str); + list.Add(CefStringClearAndGet(str)); + end; + With TCefRunFileDialogCallbackOwn(CefGetObject(self)) do + cont(TCefBrowserHostRef.UnWrap(browser_host), list); + finally + list.Free; + end; +end; + + +{ cef_trace_client } + +procedure cef_trace_client_on_trace_data_collected(self: PCefTraceClient; + const fragment: PAnsiChar; fragment_size: Cardinal); cdecl; +begin + TCefTraceClientOwn(CefGetObject(self)).OnTraceDataCollected(fragment, fragment_size); +end; + +procedure cef_trace_client_on_trace_buffer_percent_full_reply( + self: PCefTraceClient; percent_full: Single); cdecl; +begin + with TCefTraceClientOwn(CefGetObject(self)) do + OnTraceBufferPercentFullReply(percent_full); +end; + +procedure cef_trace_client_on_end_tracing_complete(self: PCefTraceClient); cdecl; +begin + with TCefTraceClientOwn(CefGetObject(self)) do + OnEndTracingComplete; +end; + +{ cef_get_geolocation_callback } + +procedure cef_get_geolocation_callback_on_location_update( + self: PCefGetGeolocationCallback; const position: PCefGeoposition); cdecl; +begin + with TCefGetGeolocationCallbackOwn(CefGetObject(self)) do + OnLocationUpdate(position); +end; + +{ cef_dialog_handler } + +function cef_dialog_handler_on_file_dialog(self: PCefDialogHandler; browser: PCefBrowser; + mode: TCefFileDialogMode; const title, default_file_name: PCefString; + accept_types: TCefStringList; callback: PCefFileDialogCallback): Integer; cdecl; +var + list: TStringList; + i: Integer; + str: TCefString; +begin + list := TStringList.Create; + try + for i := 0 to cef_string_list_size(accept_types) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(accept_types, i, @str); + list.Add(CefStringClearAndGet(str)); + end; + + with TCefDialogHandlerOwn(CefGetObject(self)) do + Result := Ord(OnFileDialog(TCefBrowserRef.UnWrap(browser), mode, CefString(title), + CefString(default_file_name), list, TCefFileDialogCallbackRef.UnWrap(callback))); + finally + list.Free; + end; +end; + +{ cef_render_handler } + +function cef_render_handler_get_root_screen_rect(self: PCefRenderHandler; + browser: PCefBrowser; rect: PCefRect): Integer; cdecl; +begin + with TCefRenderHandlerOwn(CefGetObject(self)) do + Result := Ord(GetRootScreenRect(TCefBrowserRef.UnWrap(browser), rect)); +end; + +function cef_render_handler_get_view_rect(self: PCefRenderHandler; + browser: PCefBrowser; rect: PCefRect): Integer; cdecl; +begin + with TCefRenderHandlerOwn(CefGetObject(self)) do + Result := Ord(GetViewRect(TCefBrowserRef.UnWrap(browser), rect)); +end; + +function cef_render_handler_get_screen_point(self: PCefRenderHandler; + browser: PCefBrowser; viewX, viewY: Integer; screenX, screenY: PInteger): Integer; cdecl; +begin + with TCefRenderHandlerOwn(CefGetObject(self)) do + Result := Ord(GetScreenPoint(TCefBrowserRef.UnWrap(browser), viewX, viewY, screenX, screenY)); +end; + +procedure cef_render_handler_on_popup_show(self: PCefRenderProcessHandler; + browser: PCefBrowser; show: Integer); cdecl; +begin + with TCefRenderHandlerOwn(CefGetObject(self)) do + OnPopupShow(TCefBrowserRef.UnWrap(browser), show <> 0); +end; + +procedure cef_render_handler_on_popup_size(self: PCefRenderProcessHandler; + browser: PCefBrowser; const rect: PCefRect); cdecl; +begin + with TCefRenderHandlerOwn(CefGetObject(self)) do + OnPopupSize(TCefBrowserRef.UnWrap(browser), rect); +end; + +procedure cef_render_handler_on_paint(self: PCefRenderProcessHandler; + browser: PCefBrowser; kind: TCefPaintElementType; dirtyRectsCount: Cardinal; + const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); cdecl; +begin + with TCefRenderHandlerOwn(CefGetObject(self)) do + OnPaint(TCefBrowserRef.UnWrap(browser), kind, dirtyRectsCount, dirtyRects, + buffer, width, height); +end; + +procedure cef_render_handler_on_cursor_change(self: PCefRenderProcessHandler; + browser: PCefBrowser; cursor: TCefCursorHandle); cdecl; +begin + with TCefRenderHandlerOwn(CefGetObject(self)) do + OnCursorChange(TCefBrowserRef.UnWrap(browser), cursor); +end; + +{ TCefBaseOwn } + +constructor TCefBaseOwn.CreateData(size: Cardinal; owned: Boolean); +begin + GetMem(FData, size + SizeOf(Pointer)); + PPointer(FData)^ := Self; + Inc(PByte(FData), SizeOf(Pointer)); + FillChar(FData^, size, 0); + PCefBase(FData)^.size := size; + + If owned then + begin + With PCefBaSE(FData)^ do + begin + add_ref := @cef_base_add_ref_owned; + release := @cef_base_release_owned; + get_refct := @cef_base_get_refct_owned; + end; + end + Else + begin + With PCefBase(FData)^ do + begin + add_ref := @cef_base_add_ref; + release := @cef_base_release; + get_refct := @cef_base_get_refct; + end; + end; +end; + +destructor TCefBaseOwn.Destroy; +begin + Dec(PByte(FData), SizeOf(Pointer)); + FreeMem(FData); + inherited; +end; + +function TCefBaseOwn.Wrap: Pointer; +begin + Result := FData; + If Assigned(PCefBase(FData)^.add_ref) then PCefBase(FData)^.add_ref(PCefBase(FData)); +end; + +{ TCefBaseRef } + +constructor TCefBaseRef.Create(data: Pointer); +begin + Assert(data <> nil); + FData := data; +end; + +destructor TCefBaseRef.Destroy; +begin + If Assigned(PCefBase(FData)^.release) then + PCefBase(FData)^.release(PCefBase(FData)); + inherited; +end; + +class function TCefBaseRef.UnWrap(data: Pointer): ICefBase; +begin + //If data <> nil then Result := Create(data) as ICefBase + If data <> nil then Result := ICefBase(Create(data)) + Else Result := nil; +end; + +function TCefBaseRef.Wrap: Pointer; +begin + Result := FData; + If Assigned(PCefBase(FData)^.add_ref) then PCefBase(FData)^.add_ref(PCefBase(FData)); +end; + +{ TCefBrowserRef } + +function TCefBrowserRef.GetHost: ICefBrowserHost; +begin + Result := TCefBrowserHostRef.UnWrap(PCefBrowser(FData)^.get_host(PCefBrowser(FData))); +end; + +function TCefBrowserRef.CanGoBack: Boolean; +begin + Result := PCefBrowser(FData)^.can_go_back(PCefBrowser(FData)) <> 0; +end; + +function TCefBrowserRef.CanGoForward: Boolean; +begin + Result := PCefBrowser(FData)^.can_go_forward(PCefBrowser(FData)) <> 0; +end; + +function TCefBrowserRef.GetFocusedFrame: ICefFrame; +begin + Result := TCefFrameRef.UnWrap(PCefBrowser(FData)^.get_focused_frame(PCefBrowser(FData))) +end; + +function TCefBrowserRef.GetFrameByident(identifier: Int64): ICefFrame; +begin + Result := TCefFrameRef.UnWrap(PCefBrowser(FData)^.get_frame_byident(PCefBrowser(FData), identifier)); +end; + +function TCefBrowserRef.GetFrame(const name: ustring): ICefFrame; +var + n: TCefString; +begin + n := CefString(name); + Result := TCefFrameRef.UnWrap(PCefBrowser(FData)^.get_frame(PCefBrowser(FData), @n)); +end; + +function TCefBrowserRef.GetFrameCount: Cardinal; +begin + Result := PCefBrowser(FData)^.get_frame_count(PCefBrowser(FData)); +end; + +procedure TCefBrowserRef.GetFrameIdentifiers(count: PCardinal; identifiers: PInt64); +begin + PCefBrowser(FData)^.get_frame_identifiers(PCefBrowser(FData), count, identifiers); +end; + +procedure TCefBrowserRef.GetFrameNames(names: TStrings); +var + list: TCefStringList; + i: Integer; + str: TCefString; +begin + list := cef_string_list_alloc; + try + PCefBrowser(FData)^.get_frame_names(PCefBrowser(FData), list); + FillChar(str, SizeOf(str), 0); + for i := 0 to cef_string_list_size(list) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(list, i, @str); + names.Add(CefStringClearAndGet(str)); + end; + finally + cef_string_list_free(list); + end; +end; + +function TCefBrowserRef.SendProcessMessage(targetProcess: TCefProcessId; message: ICefProcessMessage): Boolean; +begin + Result := PCefBrowser(FData)^.send_process_message(PCefBrowser(FData), targetProcess, CefGetData(message)) <> 0; +end; + +function TCefBrowserRef.GetMainFrame: ICefFrame; +begin + Result := TCefFrameRef.UnWrap(PCefBrowser(FData)^.get_main_frame(PCefBrowser(FData))) +end; + +procedure TCefBrowserRef.GoBack; +begin + PCefBrowser(FData)^.go_back(PCefBrowser(FData)); +end; + +procedure TCefBrowserRef.GoForward; +begin + PCefBrowser(FData)^.go_forward(PCefBrowser(FData)); +end; + +function TCefBrowserRef.IsLoading: Boolean; +begin + Result := PCefBrowser(FData)^.is_loading(PCefBrowser(FData)) <> 0; +end; + +function TCefBrowserRef.HasDocument: Boolean; +begin + Result := PCefBrowser(FData)^.has_document(PCefBrowser(FData)) <> 0; +end; + +function TCefBrowserRef.IsPopup: Boolean; +begin + Result := PCefBrowser(FData)^.is_popup(PCefBrowser(FData)) <> 0; +end; + +function TCefBrowserRef.IsSame(const that: ICefBrowser): Boolean; +begin + Result := PCefBrowser(FData)^.is_same(PCefBrowser(FData), CefGetData(that)) <> 0; +end; + +procedure TCefBrowserRef.Reload; +begin + PCefBrowser(FData)^.reload(PCefBrowser(FData)); +end; + +procedure TCefBrowserRef.ReloadIgnoreCache; +begin + PCefBrowser(FData)^.reload_ignore_cache(PCefBrowser(FData)); +end; + +procedure TCefBrowserRef.StopLoad; +begin + PCefBrowser(FData)^.stop_load(PCefBrowser(FData)); +end; + +function TCefBrowserRef.GetIdentifier: Integer; +begin + Result := PCefBrowser(FData)^.get_identifier(PCefBrowser(FData)); +end; + +class function TCefBrowserRef.UnWrap(data: Pointer): ICefBrowser; +begin + //If data <> nil then Result := Create(data) as ICefBrowser + If data <> nil then Result := ICefBrowser(Create(data)) + Else Result := nil; +end; + +{ TCefFrameRef } + +function TCefFrameRef.IsValid: Boolean; +begin + Result := PCefFrame(FData)^.is_valid(PCefFrame(FData)) <> 0; +end; + +procedure TCefFrameRef.Copy; +begin + PCefFrame(FData)^.copy(PCefFrame(FData)); +end; + +procedure TCefFrameRef.Cut; +begin + PCefFrame(FData)^.cut(PCefFrame(FData)); +end; + +procedure TCefFrameRef.Del; +begin + PCefFrame(FData)^.del(PCefFrame(FData)); +end; + +procedure TCefFrameRef.ExecuteJavaScript(const code, scriptUrl: ustring; startLine: Integer); +var + j, s: TCefString; +begin + j := CefString(code); + s := CefString(scriptUrl); + PCefFrame(FData)^.execute_java_script(PCefFrame(FData), @j, @s, startline); +end; + +function TCefFrameRef.GetBrowser: ICefBrowser; +begin + Result := TCefBrowserRef.UnWrap(PCefFrame(FData)^.get_browser(PCefFrame(FData))); +end; + +function TCefFrameRef.GetIdentifier: Int64; +begin + Result := PCefFrame(FData)^.get_identifier(PCefFrame(FData)); +end; + +function TCefFrameRef.GetName: ustring; +begin + Result := CefStringFreeAndGet(PCefFrame(FData)^.get_name(PCefFrame(FData))); +end; + +function TCefFrameRef.GetParent: ICefFrame; +begin + Result := TCefFrameRef.UnWrap(PCefFrame(FData)^.get_parent(PCefFrame(FData))); +end; + +procedure TCefFrameRef.GetSource(const visitor: ICefStringVisitor); +begin + PCefFrame(FData)^.get_source(PCefFrame(FData), CefGetData(visitor)); +end; + +procedure TCefFrameRef.GetSourceProc(const proc: TCefStringVisitorProc); +begin + GetSource(TCefFastStringVisitor.Create(proc)); +end; + +procedure TCefFrameRef.getText(const visitor: ICefStringVisitor); +begin + PCefFrame(FData)^.get_text(PCefFrame(FData), CefGetData(visitor)); +end; + +procedure TCefFrameRef.GetTextProc(const proc: TCefStringVisitorProc); +begin + GetText(TCefFastStringVisitor.Create(proc)); +end; + +function TCefFrameRef.GetUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefFrame(FData)^.get_url(PCefFrame(FData))); +end; + +function TCefFrameRef.GetV8Context: ICefv8Context; +begin + Result := TCefv8ContextRef.UnWrap(PCefFrame(FData)^.get_v8context(PCefFrame(FData))); +end; + +function TCefFrameRef.IsFocused: Boolean; +begin + Result := PCefFrame(FData)^.is_focused(PCefFrame(FData)) <> 0; +end; + +function TCefFrameRef.IsMain: Boolean; +begin + Result := PCefFrame(FData)^.is_main(PCefFrame(FData)) <> 0; +end; + +procedure TCefFrameRef.LoadRequest(const request: ICefRequest); +begin + PCefFrame(FData)^.load_request(PCefFrame(FData), CefGetData(request)); +end; + +procedure TCefFrameRef.LoadString(const str, url: ustring); +var + s, u: TCefString; +begin + s := CefString(str); + u := CefString(url); + PCefFrame(FData)^.load_string(PCefFrame(FData), @s, @u); +end; + +procedure TCefFrameRef.LoadUrl(const url: ustring); +var + u: TCefString; +begin + u := CefString(url); + PCefFrame(FData)^.load_url(PCefFrame(FData), @u); +end; + +procedure TCefFrameRef.Paste; +begin + PCefFrame(FData)^.paste(PCefFrame(FData)); +end; + +procedure TCefFrameRef.Redo; +begin + PCefFrame(FData)^.redo(PCefFrame(FData)); +end; + +procedure TCefFrameRef.SelectAll; +begin + PCefFrame(FData)^.select_all(PCefFrame(FData)); +end; + +procedure TCefFrameRef.Undo; +begin + PCefFrame(FData)^.undo(PCefFrame(FData)); +end; + +procedure TCefFrameRef.ViewSource; +begin + PCefFrame(FData)^.view_source(PCefFrame(FData)); +end; + +procedure TCefFrameRef.VisitDom(const visitor: ICefDomVisitor); +begin + PCefFrame(FData)^.visit_dom(PCefFrame(FData), CefGetData(visitor)); +end; + +procedure TCefFrameRef.VisitDomProc(const proc: TCefDomVisitorProc); +begin + //VisitDom(TCefFastDomVisitor.Create(proc) as ICefDomVisitor); + VisitDom(TCefFastDomVisitor.Create(proc)); +end; + +class function TCefFrameRef.UnWrap(data: Pointer): ICefFrame; +begin + //If data <> nil then Result := Create(data) as ICefFrame + If data <> nil then Result := Create(data) + Else Result := nil; +end; + +{ TCefCustomStreamReader } + +constructor TCefCustomStreamReader.Create(Stream: TStream; Owned: Boolean); +begin + inherited CreateData(SizeOf(TCefReadHandler)); + FStream := stream; + FOwned := Owned; + With PCefReadHandler(FData)^ do + begin + read := @cef_stream_reader_read; + seek := @cef_stream_reader_seek; + tell := @cef_stream_reader_tell; + eof := @cef_stream_reader_eof; + end; +end; + +constructor TCefCustomStreamReader.Create(const filename: string); +begin + Create(TFileStream.Create(filename, fmOpenRead or fmShareDenyWrite), True); +end; + +destructor TCefCustomStreamReader.Destroy; +begin + If FOwned then FStream.Free; + inherited; +end; + +function TCefCustomStreamReader.Eof: Boolean; +begin + Result := FStream.Position = FStream.size; +end; + +function TCefCustomStreamReader.Read(ptr: Pointer; size, n: Cardinal): Cardinal; +begin + result := Cardinal(FStream.Read(ptr^, n * size)) div size; +end; + +function TCefCustomStreamReader.Seek(offset: Int64; whence: Integer): Integer; +begin + Result := FStream.Seek(offset, whence); +end; + +function TCefCustomStreamReader.Tell: Int64; +begin + Result := FStream.Position; +end; + +{ TCefPostDataRef } + +function TCefPostDataRef.IsReadOnly: Boolean; +begin + Result := PCefPostData(FData)^.is_read_only(PCefPostData(FData)) <> 0; +end; + +function TCefPostDataRef.AddElement( + const element: ICefPostDataElement): Integer; +begin + Result := PCefPostData(FData)^.add_element(PCefPostData(FData), CefGetData(element)); +end; + +function TCefPostDataRef.GetCount: Cardinal; +begin + Result := PCefPostData(FData)^.get_element_count(PCefPostData(FData)) +end; + +function TCefPostDataRef.GetElements(Count: Cardinal): IInterfaceList; +var + items: PCefPostDataElementArray; + i: Integer; +begin + Result := TInterfaceList.Create; + GetMem(items, SizeOf(PCefPostDataElement) * Count); + FillChar(items^, SizeOf(PCefPostDataElement) * Count, 0); + try + PCefPostData(FData)^.get_elements(PCefPostData(FData), @Count, items); + For i := 0 to Count - 1 do + Result.Add(TCefPostDataElementRef.UnWrap(items^[i])); + finally + FreeMem(items); + end; +end; + +class function TCefPostDataRef.New: ICefPostData; +begin + Result := UnWrap(cef_post_data_create); +end; + +function TCefPostDataRef.RemoveElement( + const element: ICefPostDataElement): Integer; +begin + Result := PCefPostData(FData)^.remove_element(PCefPostData(FData), CefGetData(element)); +end; + +procedure TCefPostDataRef.RemoveElements; +begin + PCefPostData(FData)^.remove_elements(PCefPostData(FData)); +end; + +class function TCefPostDataRef.UnWrap(data: Pointer): ICefPostData; +begin + //If data <> nil then Result := Create(data) as ICefPostData + If data <> nil then Result := Create(data) + Else Result := nil; +end; + +{ TCefPostDataElementRef } + +function TCefPostDataElementRef.IsReadOnly: Boolean; +begin + Result := PCefPostDataElement(FData)^.is_read_only(PCefPostDataElement(FData)) <> 0; +end; + +function TCefPostDataElementRef.GetBytes(size: Cardinal; + bytes: Pointer): Cardinal; +begin + Result := PCefPostDataElement(FData)^.get_bytes(PCefPostDataElement(FData), size, bytes); +end; + +function TCefPostDataElementRef.GetBytesCount: Cardinal; +begin + Result := PCefPostDataElement(FData)^.get_bytes_count(PCefPostDataElement(FData)); +end; + +function TCefPostDataElementRef.GetFile: ustring; +begin + Result := CefStringFreeAndGet(PCefPostDataElement(FData)^.get_file(PCefPostDataElement(FData))); +end; + +function TCefPostDataElementRef.GetType: TCefPostDataElementType; +begin + Result := PCefPostDataElement(FData)^.get_type(PCefPostDataElement(FData)); +end; + +class function TCefPostDataElementRef.New: ICefPostDataElement; +begin + Result := UnWrap(cef_post_data_element_create); +end; + +procedure TCefPostDataElementRef.SetToBytes(size: Cardinal; bytes: Pointer); +begin + PCefPostDataElement(FData)^.set_to_bytes(PCefPostDataElement(FData), size, bytes); +end; + +procedure TCefPostDataElementRef.SetToEmpty; +begin + PCefPostDataElement(FData)^.set_to_empty(PCefPostDataElement(FData)); +end; + +procedure TCefPostDataElementRef.SetToFile(const fileName: ustring); +var + f: TCefString; +begin + f := CefString(fileName); + PCefPostDataElement(FData)^.set_to_file(PCefPostDataElement(FData), @f); +end; + +class function TCefPostDataElementRef.UnWrap(data: Pointer): ICefPostDataElement; +begin + If data <> nil then Result := Create(data) //as ICefPostDataElement + Else Result := nil; +end; + +{ TCefPostDataElementOwn } + +procedure TCefPostDataElementOwn.Clear; +begin + case FDataType of + PDE_TYPE_BYTES: + if (FValueByte <> nil) then + begin + FreeMem(FValueByte); + FValueByte := nil; + end; + PDE_TYPE_FILE: + CefStringFree(@FValueStr) + end; + FDataType := PDE_TYPE_EMPTY; + FSize := 0; +end; + +constructor TCefPostDataElementOwn.Create(readonly: Boolean); +begin + inherited CreateData(SizeOf(TCefPostDataElement)); + FReadOnly := readonly; + FDataType := PDE_TYPE_EMPTY; + FValueByte := nil; + FillChar(FValueStr, SizeOf(FValueStr), 0); + FSize := 0; + With PCefPostDataElement(FData)^ do + begin + is_read_only := @cef_post_data_element_is_read_only; + set_to_empty := @cef_post_data_element_set_to_empty; + set_to_file := @cef_post_data_element_set_to_file; + set_to_bytes := @cef_post_data_element_set_to_bytes; + get_type := @cef_post_data_element_get_type; + get_file := @cef_post_data_element_get_file; + get_bytes_count := @cef_post_data_element_get_bytes_count; + get_bytes := @cef_post_data_element_get_bytes; + end; +end; + +function TCefPostDataElementOwn.GetBytes(size: Cardinal; + bytes: Pointer): Cardinal; +begin + if (FDataType = PDE_TYPE_BYTES) and (FValueByte <> nil) then + begin + if size > FSize then + Result := FSize else + Result := size; + Move(FValueByte^, bytes^, Result); + end else + Result := 0; +end; + +function TCefPostDataElementOwn.GetBytesCount: Cardinal; +begin + if (FDataType = PDE_TYPE_BYTES) then + Result := FSize else + Result := 0; +end; + +function TCefPostDataElementOwn.GetFile: ustring; +begin + if (FDataType = PDE_TYPE_FILE) then + Result := CefString(@FValueStr) else + Result := ''; +end; + +function TCefPostDataElementOwn.GetType: TCefPostDataElementType; +begin + Result := FDataType; +end; + +function TCefPostDataElementOwn.IsReadOnly: Boolean; +begin + Result := FReadOnly; +end; + +procedure TCefPostDataElementOwn.SetToBytes(size: Cardinal; bytes: Pointer); +begin + Clear; + if (size > 0) and (bytes <> nil) then + begin + GetMem(FValueByte, size); + Move(bytes^, FValueByte, size); + FSize := size; + end else + begin + FValueByte := nil; + FSize := 0; + end; + FDataType := PDE_TYPE_BYTES; +end; + +procedure TCefPostDataElementOwn.SetToEmpty; +begin + Clear; +end; + +procedure TCefPostDataElementOwn.SetToFile(const fileName: ustring); +begin + Clear; + FSize := 0; + FValueStr := CefStringAlloc(fileName); + FDataType := PDE_TYPE_FILE; +end; + +{ TCefRequestRef } + +function TCefRequestRef.IsReadOnly: Boolean; +begin + Result := PCefRequest(FData)^.is_read_only(PCefRequest(FData)) <> 0; +end; + +procedure TCefRequestRef.Assign(const url, method: ustring; + const postData: ICefPostData; const headerMap: ICefStringMultimap); +var + u, m: TCefString; +begin + u := cefstring(url); + m := cefstring(method); + PCefRequest(FData)^.set_(PCefRequest(FData), @u, @m, CefGetData(postData), headerMap.Handle); +end; + +function TCefRequestRef.GetFirstPartyForCookies: ustring; +begin + Result := CefStringFreeAndGet(PCefRequest(FData)^.get_first_party_for_cookies(PCefRequest(FData))); +end; + +function TCefRequestRef.GetFlags: TCefUrlRequestFlags; +begin + Result := TCefUrlRequestFlags(PCefRequest(FData)^.get_flags(PCefRequest(FData))); +end; + +procedure TCefRequestRef.GetHeaderMap(const HeaderMap: ICefStringMultimap); +begin + PCefRequest(FData)^.get_header_map(PCefRequest(FData), HeaderMap.Handle); +end; + +function TCefRequestRef.GetMethod: ustring; +begin + Result := CefStringFreeAndGet(PCefRequest(FData)^.get_method(PCefRequest(FData))) +end; + +function TCefRequestRef.GetPostData: ICefPostData; +begin + Result := TCefPostDataRef.UnWrap(PCefRequest(FData)^.get_post_data(PCefRequest(FData))); +end; + +function TCefRequestRef.GetUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefRequest(FData)^.get_url(PCefRequest(FData))) +end; + +class function TCefRequestRef.New: ICefRequest; +begin + Result := UnWrap(cef_request_create); +end; + +procedure TCefRequestRef.SetFirstPartyForCookies(const url: ustring); +Var + str: TCefString; +begin + str := CefString(url); + PCefRequest(FData)^.set_first_party_for_cookies(PCefRequest(FData), @str); +end; + +procedure TCefRequestRef.SetFlags(flags: TCefUrlRequestFlags); +begin + PCefRequest(FData)^.set_flags(PCefRequest(FData), PByte(@flags)^); +end; + +procedure TCefRequestRef.SetHeaderMap(const HeaderMap: ICefStringMultimap); +begin + PCefRequest(FData)^.set_header_map(PCefRequest(FData), HeaderMap.Handle); +end; + +procedure TCefRequestRef.SetMethod(const value: ustring); +var + v: TCefString; +begin + v := CefString(value); + PCefRequest(FData)^.set_method(PCefRequest(FData), @v); +end; + +procedure TCefRequestRef.SetPostData(const value: ICefPostData); +begin + if value <> nil then + PCefRequest(FData)^.set_post_data(PCefRequest(FData), CefGetData(value)); +end; + +procedure TCefRequestRef.SetUrl(const value: ustring); +var + v: TCefString; +begin + v := CefString(value); + PCefRequest(FData)^.set_url(PCefRequest(FData), @v); +end; + +class function TCefRequestRef.UnWrap(data: Pointer): ICefRequest; +begin + If data <> nil then Result := Create(data) //as ICefRequest + Else Result := nil; +end; + +{ TCefStreamReaderRef } + +class function TCefStreamReaderRef.CreateForCustomStream( + const stream: ICefCustomStreamReader): ICefStreamReader; +begin + Result := UnWrap(cef_stream_reader_create_for_handler(CefGetData(stream))) +end; + +class function TCefStreamReaderRef.CreateForData(data: Pointer; size: Cardinal): ICefStreamReader; +begin + Result := UnWrap(cef_stream_reader_create_for_data(data, size)) +end; + +class function TCefStreamReaderRef.CreateForFile(const filename: ustring): ICefStreamReader; +var + f: TCefString; +begin + f := CefString(filename); + Result := UnWrap(cef_stream_reader_create_for_file(@f)) +end; + +class function TCefStreamReaderRef.CreateForStream(const stream: TSTream; + owned: Boolean): ICefStreamReader; +begin + //Result := CreateForCustomStream(TCefCustomStreamReader.Create(stream, owned) as ICefCustomStreamReader); + Result := CreateForCustomStream(TCefCustomStreamReader.Create(stream, owned)); +end; + +function TCefStreamReaderRef.Eof: Boolean; +begin + Result := PCefStreamReader(FData)^.eof(PCefStreamReader(FData)) <> 0; +end; + +function TCefStreamReaderRef.Read(ptr: Pointer; size, n: Cardinal): Cardinal; +begin + Result := PCefStreamReader(FData)^.read(PCefStreamReader(FData), ptr, size, n); +end; + +function TCefStreamReaderRef.Seek(offset: Int64; whence: Integer): Integer; +begin + Result := PCefStreamReader(FData)^.seek(PCefStreamReader(FData), offset, whence); +end; + +function TCefStreamReaderRef.Tell: Int64; +begin + Result := PCefStreamReader(FData)^.tell(PCefStreamReader(FData)); +end; + +class function TCefStreamReaderRef.UnWrap(data: Pointer): ICefStreamReader; +begin + If data <> nil then Result := Create(data) //as ICefStreamReader + Else Result := nil; +end; + +{ TCefv8ValueRef } + +function TCefv8ValueRef.AdjustExternallyAllocatedMemory(changeInBytes: Integer): Integer; +begin + Result := PCefV8Value(FData)^.adjust_externally_allocated_memory(PCefV8Value(FData), changeInBytes); +end; + +class function TCefv8ValueRef.NewArray(len: Integer): ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_array(len)); +end; + +class function TCefv8ValueRef.NewBool(value: Boolean): ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_bool(Ord(value))); +end; + +class function TCefv8ValueRef.NewDate(value: TDateTime): ICefv8Value; +Var + dt: TCefTime; +begin + dt := DateTimeToCefTime(value); + Result := UnWrap(cef_v8value_create_date(@dt)); +end; + +class function TCefv8ValueRef.NewDouble(value: Double): ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_double(value)); +end; + +class function TCefv8ValueRef.NewFunction(const name: ustring; const handler: ICefv8Handler): ICefv8Value; +Var + n: TCefString; +begin + n := CefString(name); + Result := UnWrap(cef_v8value_create_function(@n, CefGetData(handler))); +end; + +class function TCefv8ValueRef.NewInt(value: Integer): ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_int(value)); +end; + +class function TCefv8ValueRef.NewUInt(value: Cardinal): ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_uint(value)); +end; + +class function TCefv8ValueRef.NewNull: ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_null); +end; + +class function TCefv8ValueRef.NewObject(const Accessor: ICefV8Accessor): ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_object(CefGetData(Accessor))); +end; + +class function TCefv8ValueRef.NewObjectProc(const getter: TCefV8AccessorGetterProc; + const setter: TCefV8AccessorSetterProc): ICefv8Value; +begin + //Result := NewObject(TCefFastV8Accessor.Create(getter, setter) as ICefV8Accessor); + Result := NewObject(TCefFastV8Accessor.Create(getter, setter)); +end; + +class function TCefv8ValueRef.NewString(const str: ustring): ICefv8Value; +Var + s: TCefString; +begin + s := CefString(str); + Result := UnWrap(cef_v8value_create_string(@s)); +end; + +class function TCefv8ValueRef.NewUndefined: ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_undefined); +end; + +function TCefv8ValueRef.DeleteValueByIndex(index: Integer): Boolean; +begin + Result := PCefV8Value(FData)^.delete_value_byindex(PCefV8Value(FData), index) <> 0; +end; + +function TCefv8ValueRef.DeleteValueByKey(const key: ustring): Boolean; +Var + k: TCefString; +begin + k := CefString(key); + Result := PCefV8Value(FData)^.delete_value_bykey(PCefV8Value(FData), @k) <> 0; +end; + +function TCefv8ValueRef.ExecuteFunction(const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; +Var + args: PPCefV8Value; + i: Integer; +begin + GetMem(args, SizeOf(PCefV8Value) * Length(arguments)); + try + For i := 0 to Length(arguments) - 1 do args^[i] := CefGetData(arguments[i]); + + Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData)^.execute_function(PCefV8Value(FData), + CefGetData(obj), Length(arguments), args)); + finally + FreeMem(args); + end; +end; + +function TCefv8ValueRef.ExecuteFunctionWithContext(const context: ICefv8Context; + const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; +Var + args: PPCefV8Value; + i: Integer; +begin + GetMem(args, SizeOf(PCefV8Value) * Length(arguments)); + try + For i := 0 to Length(arguments) - 1 do args^[i] := CefGetData(arguments[i]); + + Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData)^.execute_function_with_context(PCefV8Value(FData), + CefGetData(context), CefGetData(obj), Length(arguments), args)); + finally + FreeMem(args); + end; +end; + +function TCefv8ValueRef.GetArrayLength: Integer; +begin + Result := PCefV8Value(FData)^.get_array_length(PCefV8Value(FData)); +end; + +function TCefv8ValueRef.GetBoolValue: Boolean; +begin + Result := PCefV8Value(FData)^.get_bool_value(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.GetDateValue: TDateTime; +begin + Result := CefTimeToDateTime(PCefV8Value(FData)^.get_date_value(PCefV8Value(FData))); +end; + +function TCefv8ValueRef.GetDoubleValue: Double; +begin + Result := PCefV8Value(FData)^.get_double_value(PCefV8Value(FData)); +end; + +function TCefv8ValueRef.GetExternallyAllocatedMemory: Integer; +begin + Result := PCefV8Value(FData)^.get_externally_allocated_memory(PCefV8Value(FData)); +end; + +function TCefv8ValueRef.GetFunctionHandler: ICefv8Handler; +begin + Result := TCefv8HandlerRef.UnWrap(PCefV8Value(FData)^.get_function_handler(PCefV8Value(FData))); +end; + +function TCefv8ValueRef.GetFunctionName: ustring; +begin + Result := CefStringFreeAndGet(PCefV8Value(FData)^.get_function_name(PCefV8Value(FData))) +end; + +function TCefv8ValueRef.GetIntValue: Integer; +begin + Result := PCefV8Value(FData)^.get_int_value(PCefV8Value(FData)) +end; + +function TCefv8ValueRef.GetUIntValue: Cardinal; +begin + Result := PCefV8Value(FData)^.get_uint_value(PCefV8Value(FData)) +end; + +function TCefv8ValueRef.GetKeys(const keys: TStrings): Integer; +Var + list: TCefStringList; + i: Integer; + str: TCefString; +begin + list := cef_string_list_alloc; + try + Result := PCefV8Value(FData)^.get_keys(PCefV8Value(FData), list); + FillChar(str, SizeOf(str), 0); + For i := 0 to cef_string_list_size(list) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(list, i, @str); + keys.Add(CefStringClearAndGet(str)); + end; + finally + cef_string_list_free(list); + end; +end; + +function TCefv8ValueRef.SetUserData(const data: ICefv8Value): Boolean; +begin + Result := PCefV8Value(FData)^.set_user_data(PCefV8Value(FData), CefGetData(data)) <> 0; +end; + +function TCefv8ValueRef.GetStringValue: ustring; +begin + Result := CefStringFreeAndGet(PCefV8Value(FData)^.get_string_value(PCefV8Value(FData))); +end; + +function TCefv8ValueRef.IsUserCreated: Boolean; +begin + Result := PCefV8Value(FData)^.is_user_created(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsValid: Boolean; +begin + Result := PCefV8Value(FData)^.is_valid(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.HasException: Boolean; +begin + Result := PCefV8Value(FData)^.has_exception(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.GetException: ICefV8Exception; +begin + Result := TCefV8ExceptionRef.UnWrap(PCefV8Value(FData)^.get_exception(PCefV8Value(FData))); +end; + +function TCefv8ValueRef.ClearException: Boolean; +begin + Result := PCefV8Value(FData)^.clear_exception(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.WillRethrowExceptions: Boolean; +begin + Result := PCefV8Value(FData)^.will_rethrow_exceptions(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.SetRethrowExceptions(rethrow: Boolean): Boolean; +begin + Result := PCefV8Value(FData)^.set_rethrow_exceptions(PCefV8Value(FData), Ord(rethrow)) <> 0; +end; + +function TCefv8ValueRef.GetUserData: ICefv8Value; +begin + Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData)^.get_user_data(PCefV8Value(FData))); +end; + +function TCefv8ValueRef.GetValueByIndex(index: Integer): ICefv8Value; +begin + Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData)^.get_value_byindex(PCefV8Value(FData), index)) +end; + +function TCefv8ValueRef.GetValueByKey(const key: ustring): ICefv8Value; +Var + k: TCefString; +begin + k := CefString(key); + Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData)^.get_value_bykey(PCefV8Value(FData), @k)) +end; + +function TCefv8ValueRef.HasValueByIndex(index: Integer): Boolean; +begin + Result := PCefV8Value(FData)^.has_value_byindex(PCefV8Value(FData), index) <> 0; +end; + +function TCefv8ValueRef.HasValueByKey(const key: ustring): Boolean; +Var + k: TCefString; +begin + k := CefString(key); + Result := PCefV8Value(FData)^.has_value_bykey(PCefV8Value(FData), @k) <> 0; +end; + +function TCefv8ValueRef.IsArray: Boolean; +begin + Result := PCefV8Value(FData)^.is_array(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsBool: Boolean; +begin + Result := PCefV8Value(FData)^.is_bool(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsDate: Boolean; +begin + Result := PCefV8Value(FData)^.is_date(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsDouble: Boolean; +begin + Result := PCefV8Value(FData)^.is_double(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsFunction: Boolean; +begin + Result := PCefV8Value(FData)^.is_function(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsInt: Boolean; +begin + Result := PCefV8Value(FData)^.is_int(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsUInt: Boolean; +begin + Result := PCefV8Value(FData)^.is_uint(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsNull: Boolean; +begin + Result := PCefV8Value(FData)^.is_null(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsObject: Boolean; +begin + Result := PCefV8Value(FData)^.is_object(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsSame(const that: ICefv8Value): Boolean; +begin + Result := PCefV8Value(FData)^.is_same(PCefV8Value(FData), CefGetData(that)) <> 0; +end; + +function TCefv8ValueRef.IsString: Boolean; +begin + Result := PCefV8Value(FData)^.is_string(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.IsUndefined: Boolean; +begin + Result := PCefV8Value(FData)^.is_undefined(PCefV8Value(FData)) <> 0; +end; + +function TCefv8ValueRef.SetValueByAccessor(const key: ustring; + settings: TCefV8AccessControls; attribute: TCefV8PropertyAttributes): Boolean; +Var + k: TCefString; +begin + k := CefString(key); + Result:= PCefV8Value(FData)^.set_value_byaccessor(PCefV8Value(FData), @k, + PByte(@settings)^, PByte(@attribute)^) <> 0; +end; + +function TCefv8ValueRef.SetValueByIndex(index: Integer; + const value: ICefv8Value): Boolean; +begin + Result:= PCefV8Value(FData)^.set_value_byindex(PCefV8Value(FData), index, CefGetData(value)) <> 0; +end; + +function TCefv8ValueRef.SetValueByKey(const key: ustring; + const value: ICefv8Value; attribute: TCefV8PropertyAttributes): Boolean; +Var + k: TCefString; +begin + k := CefString(key); + Result:= PCefV8Value(FData)^.set_value_bykey(PCefV8Value(FData), @k, + CefGetData(value), PByte(@attribute)^) <> 0; +end; + +class function TCefv8ValueRef.UnWrap(data: Pointer): ICefv8Value; +begin + //If data <> nil then Result := Create(data) as ICefv8Value + If data <> nil then Result := Create(data) + Else Result := nil; +end; + + +{ TCefv8HandlerRef } + +function TCefv8HandlerRef.Execute(const name: ustring; const obj: ICefv8Value; + const arguments: TCefv8ValueArray; var retval: ICefv8Value; + var exception: ustring): Boolean; +Var + args: array of PCefV8Value; + i: Integer; + ret: PCefV8Value; + exc: TCefString; + n: TCefString; +begin + SetLength(args, Length(arguments)); + For i := 0 to Length(arguments) - 1 do args[i] := CefGetData(arguments[i]); + ret := nil; + FillChar(exc, SizeOf(exc), 0); + n := CefString(name); + Result := PCefv8Handler(FData)^.execute(PCefv8Handler(FData), @n, + CefGetData(obj), Length(arguments), @args, ret, exc) <> 0; + retval := TCefv8ValueRef.UnWrap(ret); + exception := CefStringClearAndGet(exc); +end; + +class function TCefv8HandlerRef.UnWrap(data: Pointer): ICefv8Handler; +begin + //If data <> nil then Result := Create(data) as ICefv8Handler + If data <> nil then Result := Create(data) + Else Result := nil; +end; + +{ TCefv8HandlerOwn } + +constructor TCefv8HandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefv8Handler)); + PCefv8Handler(FData)^.execute := @cef_v8_handler_execute; +end; + +function TCefv8HandlerOwn.Execute(const name: ustring; const obj: ICefv8Value; + const arguments: TCefv8ValueArray; var retval: ICefv8Value; + var exception: ustring): Boolean; +begin + Result := False; +end; + +{ TCefTaskOwn } + +constructor TCefTaskOwn.Create; +begin + inherited CreateData(SizeOf(TCefTask)); + PCefTask(FData)^.execute := @cef_task_execute; +end; + +procedure TCefTaskOwn.Execute; +begin + +end; + +{ TCefStringMapOwn } + +procedure TCefStringMapOwn.Append(const key, value: ustring); +var + k, v: TCefString; +begin + k := CefString(key); + v := CefString(value); + cef_string_map_append(FStringMap, @k, @v); +end; + +procedure TCefStringMapOwn.Clear; +begin + cef_string_map_clear(FStringMap); +end; + +constructor TCefStringMapOwn.Create; +begin + FStringMap := cef_string_map_alloc; +end; + +destructor TCefStringMapOwn.Destroy; +begin + cef_string_map_free(FStringMap); +end; + +function TCefStringMapOwn.Find(const key: ustring): ustring; +var + str, k: TCefString; +begin + FillChar(str, SizeOf(str), 0); + k := CefString(key); + cef_string_map_find(FStringMap, @k, str); + Result := CefString(@str); +end; + +function TCefStringMapOwn.GetHandle: TCefStringMap; +begin + Result := FStringMap; +end; + +function TCefStringMapOwn.GetKey(index: Integer): ustring; +var + str: TCefString; +begin + FillChar(str, SizeOf(str), 0); + cef_string_map_key(FStringMap, index, str); + Result := CefString(@str); +end; + +function TCefStringMapOwn.GetSize: Integer; +begin + Result := cef_string_map_size(FStringMap); +end; + +function TCefStringMapOwn.GetValue(index: Integer): ustring; +var + str: TCefString; +begin + FillChar(str, SizeOf(str), 0); + cef_string_map_value(FStringMap, index, str); + Result := CefString(@str); +end; + +{ TCefStringMultimapOwn } + +procedure TCefStringMultimapOwn.Append(const Key, Value: ustring); +var + k, v: TCefString; +begin + k := CefString(key); + v := CefString(value); + cef_string_multimap_append(FStringMap, @k, @v); +end; + +procedure TCefStringMultimapOwn.Clear; +begin + cef_string_multimap_clear(FStringMap); +end; + +constructor TCefStringMultimapOwn.Create; +begin + FStringMap := cef_string_multimap_alloc; +end; + +destructor TCefStringMultimapOwn.Destroy; +begin + cef_string_multimap_free(FStringMap); + inherited; +end; + +function TCefStringMultimapOwn.FindCount(const Key: ustring): Integer; +var + k: TCefString; +begin + k := CefString(Key); + Result := cef_string_multimap_find_count(FStringMap, @k); +end; + +function TCefStringMultimapOwn.GetEnumerate(const Key: ustring; + ValueIndex: Integer): ustring; +var + k, v: TCefString; +begin + k := CefString(Key); + FillChar(v, SizeOf(v), 0); + cef_string_multimap_enumerate(FStringMap, @k, ValueIndex, v); + Result := CefString(@v); +end; + +function TCefStringMultimapOwn.GetHandle: TCefStringMultimap; +begin + Result := FStringMap; +end; + +function TCefStringMultimapOwn.GetKey(Index: Integer): ustring; +var + str: TCefString; +begin + FillChar(str, SizeOf(str), 0); + cef_string_multimap_key(FStringMap, index, str); + Result := CefString(@str); +end; + +function TCefStringMultimapOwn.GetSize: Integer; +begin + Result := cef_string_multimap_size(FStringMap); +end; + +function TCefStringMultimapOwn.GetValue(Index: Integer): ustring; +var + str: TCefString; +begin + FillChar(str, SizeOf(str), 0); + cef_string_multimap_value(FStringMap, index, str); + Result := CefString(@str); +end; + +{ TCefDownloadHandlerOwn } + +constructor TCefDownloadHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefDownloadHandler)); + With PCefDownloadHandler(FData)^ do + begin + on_before_download := @cef_download_handler_on_before_download; + on_download_updated := @cef_download_handler_on_download_updated; + end; +end; + +procedure TCefDownloadHandlerOwn.OnBeforeDownload(const browser: ICefBrowser; + const downloadItem: ICefDownloadItem; const suggestedName: ustring; + const callback: ICefBeforeDownloadCallback); +begin + +end; + +procedure TCefDownloadHandlerOwn.OnDownloadUpdated(const browser: ICefBrowser; + const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); +begin + +end; + +{ TCefXmlReaderRef } + +function TCefXmlReaderRef.Close: Boolean; +begin + Result := PCefXmlReader(FData)^.close(FData) <> 0; +end; + +class function TCefXmlReaderRef.New(const stream: ICefStreamReader; + encodingType: TCefXmlEncodingType; const URI: ustring): ICefXmlReader; +var + u: TCefString; +begin + u := CefString(URI); + Result := UnWrap(cef_xml_reader_create(CefGetData(stream), encodingType, @u)); +end; + +function TCefXmlReaderRef.GetAttributeByIndex(index: Integer): ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_attribute_byindex(FData, index)); +end; + +function TCefXmlReaderRef.GetAttributeByLName(const localName, + namespaceURI: ustring): ustring; +var + l, n: TCefString; +begin + l := CefString(localName); + n := CefString(namespaceURI); + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_attribute_bylname(FData, @l, @n)); +end; + +function TCefXmlReaderRef.GetAttributeByQName( + const qualifiedName: ustring): ustring; +var + q: TCefString; +begin + q := CefString(qualifiedName); + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_attribute_byqname(FData, @q)); +end; + +function TCefXmlReaderRef.GetAttributeCount: Cardinal; +begin + Result := PCefXmlReader(FData)^.get_attribute_count(FData); +end; + +function TCefXmlReaderRef.GetBaseUri: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_base_uri(FData)); +end; + +function TCefXmlReaderRef.GetDepth: Integer; +begin + Result := PCefXmlReader(FData)^.get_depth(FData); +end; + +function TCefXmlReaderRef.GetError: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_error(FData)); +end; + +function TCefXmlReaderRef.GetInnerXml: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_inner_xml(FData)); +end; + +function TCefXmlReaderRef.GetLineNumber: Integer; +begin + Result := PCefXmlReader(FData)^.get_line_number(FData); +end; + +function TCefXmlReaderRef.GetLocalName: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_local_name(FData)); +end; + +function TCefXmlReaderRef.GetNamespaceUri: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_namespace_uri(FData)); +end; + +function TCefXmlReaderRef.GetOuterXml: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_outer_xml(FData)); +end; + +function TCefXmlReaderRef.GetPrefix: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_prefix(FData)); +end; + +function TCefXmlReaderRef.GetQualifiedName: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_qualified_name(FData)); +end; + +function TCefXmlReaderRef.GetType: TCefXmlNodeType; +begin + Result := PCefXmlReader(FData)^.get_type(FData); +end; + +function TCefXmlReaderRef.GetValue: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_value(FData)); +end; + +function TCefXmlReaderRef.GetXmlLang: ustring; +begin + Result := CefStringFreeAndGet(PCefXmlReader(FData)^.get_xml_lang(FData)); +end; + +function TCefXmlReaderRef.HasAttributes: Boolean; +begin + Result := PCefXmlReader(FData)^.has_attributes(FData) <> 0; +end; + +function TCefXmlReaderRef.HasError: Boolean; +begin + Result := PCefXmlReader(FData)^.has_error(FData) <> 0; +end; + +function TCefXmlReaderRef.HasValue: Boolean; +begin + Result := PCefXmlReader(FData)^.has_value(FData) <> 0; +end; + +function TCefXmlReaderRef.IsEmptyElement: Boolean; +begin + Result := PCefXmlReader(FData)^.is_empty_element(FData) <> 0; +end; + +function TCefXmlReaderRef.MoveToAttributeByIndex(index: Integer): Boolean; +begin + Result := PCefXmlReader(FData)^.move_to_attribute_byindex(FData, index) <> 0; +end; + +function TCefXmlReaderRef.MoveToAttributeByLName(const localName, namespaceURI: ustring): Boolean; +Var + l, n: TCefString; +begin + l := CefString(localName); + n := CefString(namespaceURI); + Result := PCefXmlReader(FData)^.move_to_attribute_bylname(FData, @l, @n) <> 0; +end; + +function TCefXmlReaderRef.MoveToAttributeByQName(const qualifiedName: ustring): Boolean; +Var + q: TCefString; +begin + q := CefString(qualifiedName); + Result := PCefXmlReader(FData)^.move_to_attribute_byqname(FData, @q) <> 0; +end; + +function TCefXmlReaderRef.MoveToCarryingElement: Boolean; +begin + Result := PCefXmlReader(FData)^.move_to_carrying_element(FData) <> 0; +end; + +function TCefXmlReaderRef.MoveToFirstAttribute: Boolean; +begin + Result := PCefXmlReader(FData)^.move_to_first_attribute(FData) <> 0; +end; + +function TCefXmlReaderRef.MoveToNextAttribute: Boolean; +begin + Result := PCefXmlReader(FData)^.move_to_next_attribute(FData) <> 0; +end; + +function TCefXmlReaderRef.MoveToNextNode: Boolean; +begin + Result := PCefXmlReader(FData)^.move_to_next_node(FData) <> 0; +end; + +class function TCefXmlReaderRef.UnWrap(data: Pointer): ICefXmlReader; +begin + If data <> nil then Result := Create(data) //as ICefXmlReader + Else Result := nil; +end; + +{ TCefZipReaderRef } + +function TCefZipReaderRef.Close: Boolean; +begin + Result := PCefZipReader(FData)^.close(FData) <> 0; +end; + +function TCefZipReaderRef.CloseFile: Boolean; +begin + Result := PCefZipReader(FData)^.close_file(FData) <> 0; +end; + +class function TCefZipReaderRef.New(const stream: ICefStreamReader): ICefZipReader; +begin + Result := UnWrap(cef_zip_reader_create(CefGetData(stream))); +end; + +function TCefZipReaderRef.Eof: Boolean; +begin + Result := PCefZipReader(FData)^.eof(FData) <> 0; +end; + +function TCefZipReaderRef.GetFileLastModified: LongInt; +begin + Result := PCefZipReader(FData)^.get_file_last_modified(FData); +end; + +function TCefZipReaderRef.GetFileName: ustring; +begin + Result := CefStringFreeAndGet(PCefZipReader(FData)^.get_file_name(FData)); +end; + +function TCefZipReaderRef.GetFileSize: Int64; +begin + Result := PCefZipReader(FData)^.get_file_size(FData); +end; + +function TCefZipReaderRef.MoveToFile(const fileName: ustring; caseSensitive: Boolean): Boolean; +Var + f: TCefString; +begin + f := CefString(fileName); + Result := PCefZipReader(FData)^.move_to_file(FData, @f, Ord(caseSensitive)) <> 0; +end; + +function TCefZipReaderRef.MoveToFirstFile: Boolean; +begin + Result := PCefZipReader(FData)^.move_to_first_file(FData) <> 0; +end; + +function TCefZipReaderRef.MoveToNextFile: Boolean; +begin + Result := PCefZipReader(FData)^.move_to_next_file(FData) <> 0; +end; + +function TCefZipReaderRef.OpenFile(const password: ustring): Boolean; +var + p: TCefString; +begin + p := CefString(password); + Result := PCefZipReader(FData)^.open_file(FData, @p) <> 0; +end; + +function TCefZipReaderRef.ReadFile(buffer: Pointer; bufferSize: Cardinal): Integer; +begin + Result := PCefZipReader(FData)^.read_file(FData, buffer, buffersize); +end; + +function TCefZipReaderRef.Tell: Int64; +begin + Result := PCefZipReader(FData)^.tell(FData); +end; + +class function TCefZipReaderRef.UnWrap(data: Pointer): ICefZipReader; +begin + If data <> nil then Result := Create(data) //as ICefZipReader + Else Result := nil; +end; + +{ TCefFastTask } + +constructor TCefFastTask.Create(const method: TCefFastTaskProc); +begin + inherited Create; + FMethod := method; +end; + +procedure TCefFastTask.Execute; +begin + FMethod(); +end; + +class procedure TCefFastTask.New(threadId: TCefThreadId; const method: TCefFastTaskProc); +begin + CefPostTask(threadId, Create(method)); +end; + +class procedure TCefFastTask.NewDelayed(threadId: TCefThreadId; + Delay: Int64; const method: TCefFastTaskProc); +begin + CefPostDelayedTask(threadId, Create(method), Delay); +end; + +{ TCefv8ContextRef } + +class function TCefv8ContextRef.Current: ICefv8Context; +begin + Result := UnWrap(cef_v8context_get_current_context) +end; + +function TCefv8ContextRef.Enter: Boolean; +begin + Result := PCefv8Context(FData)^.enter(PCefv8Context(FData)) <> 0; +end; + +class function TCefv8ContextRef.Entered: ICefv8Context; +begin + Result := UnWrap(cef_v8context_get_entered_context) +end; + +function TCefv8ContextRef.Exit: Boolean; +begin + Result := PCefv8Context(FData)^.exit(PCefv8Context(FData)) <> 0; +end; + +function TCefv8ContextRef.GetBrowser: ICefBrowser; +begin + Result := TCefBrowserRef.UnWrap(PCefv8Context(FData)^.get_browser(PCefv8Context(FData))); +end; + +function TCefv8ContextRef.GetFrame: ICefFrame; +begin + Result := TCefFrameRef.UnWrap(PCefv8Context(FData)^.get_frame(PCefv8Context(FData))) +end; + +function TCefv8ContextRef.GetGlobal: ICefv8Value; +begin + Result := TCefv8ValueRef.UnWrap(PCefv8Context(FData)^.get_global(PCefv8Context(FData))); +end; + +function TCefv8ContextRef.GetTaskRunner: ICefTaskRunner; +begin + Result := TCefTaskRunnerRef.UnWrap(PCefv8Context(FData)^.get_task_runner(FData)); +end; + +function TCefv8ContextRef.IsSame(const that: ICefv8Context): Boolean; +begin + Result := PCefv8Context(FData)^.is_same(PCefv8Context(FData), CefGetData(that)) <> 0; +end; + +function TCefv8ContextRef.IsValid: Boolean; +begin + Result := PCefv8Context(FData)^.is_valid(FData) <> 0; +end; + +function TCefv8ContextRef.Eval(const code: ustring; var retval: ICefv8Value; var exception: ICefV8Exception): Boolean; +var + c: TCefString; + r: PCefv8Value; + e: PCefV8Exception; +begin + c := CefString(code); + r := nil; + e := nil; + Result := PCefv8Context(FData)^.eval(PCefv8Context(FData), @c, r, e) <> 0; + retval := TCefv8ValueRef.UnWrap(r); + exception := TCefV8ExceptionRef.UnWrap(e); +end; + +class function TCefv8ContextRef.UnWrap(data: Pointer): ICefv8Context; +begin + //If data <> nil then Result := Create(data) as ICefv8Context + If data <> nil then Result := Create(data) + Else Result := nil; +end; + +{ TCefDomVisitorOwn } + +constructor TCefDomVisitorOwn.Create; +begin + inherited CreateData(SizeOf(TCefDomVisitor)); + PCefDomVisitor(FData)^.visit := @cef_dom_visitor_visite; +end; + +procedure TCefDomVisitorOwn.visit(const document: ICefDomDocument); +begin + +end; + +{ TCefFastDomVisitor } + +constructor TCefFastDomVisitor.Create(const proc: TCefDomVisitorProc); +begin + inherited Create; + FProc := proc; +end; + +procedure TCefFastDomVisitor.visit(const document: ICefDomDocument); +begin + FProc(document); +end; + +{ TCefDomDocumentRef } + +function TCefDomDocumentRef.GetBaseUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefDomDocument(FData)^.get_base_url(PCefDomDocument(FData))) +end; + +function TCefDomDocumentRef.GetBody: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomDocument(FData)^.get_body(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetCompleteUrl(const partialURL: ustring): ustring; +var + p: TCefString; +begin + p := CefString(partialURL); + Result := CefStringFreeAndGet(PCefDomDocument(FData)^.get_complete_url(PCefDomDocument(FData), @p)); +end; + +function TCefDomDocumentRef.GetDocument: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomDocument(FData)^.get_document(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetElementById(const id: ustring): ICefDomNode; +var + i: TCefString; +begin + i := CefString(id); + Result := TCefDomNodeRef.UnWrap(PCefDomDocument(FData)^.get_element_by_id(PCefDomDocument(FData), @i)); +end; + +function TCefDomDocumentRef.GetFocusedNode: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomDocument(FData)^.get_focused_node(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetHead: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomDocument(FData)^.get_head(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetSelectionAsMarkup: ustring; +begin + Result := CefStringFreeAndGet(PCefDomDocument(FData)^.get_selection_as_markup(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetSelectionAsText: ustring; +begin + Result := CefStringFreeAndGet(PCefDomDocument(FData)^.get_selection_as_text(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetSelectionEndNode: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomDocument(FData)^.get_selection_end_node(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetSelectionEndOffset: Integer; +begin + Result := PCefDomDocument(FData)^.get_selection_end_offset(PCefDomDocument(FData)); +end; + +function TCefDomDocumentRef.GetSelectionStartNode: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomDocument(FData)^.get_selection_start_node(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetSelectionStartOffset: Integer; +begin + Result := PCefDomDocument(FData)^.get_selection_start_offset(PCefDomDocument(FData)); +end; + +function TCefDomDocumentRef.GetTitle: ustring; +begin + Result := CefStringFreeAndGet(PCefDomDocument(FData)^.get_title(PCefDomDocument(FData))); +end; + +function TCefDomDocumentRef.GetType: TCefDomDocumentType; +begin + Result := PCefDomDocument(FData)^.get_type(PCefDomDocument(FData)); +end; + +function TCefDomDocumentRef.HasSelection: Boolean; +begin + Result := PCefDomDocument(FData)^.has_selection(PCefDomDocument(FData)) <> 0; +end; + +class function TCefDomDocumentRef.UnWrap(data: Pointer): ICefDomDocument; +begin + If data <> nil then Result := Create(data) //as ICefDomDocument + Else Result := nil; +end; + +{ TCefDomNodeRef } + +procedure TCefDomNodeRef.AddEventListener(const eventType: ustring; + useCapture: Boolean; const listener: ICefDomEventListener); +Var + et: TCefString; +begin + et := CefString(eventType); + PCefDomNode(FData)^.add_event_listener(PCefDomNode(FData), @et, CefGetData(listener), Ord(useCapture)); +end; + +procedure TCefDomNodeRef.AddEventListenerProc(const eventType: ustring; useCapture: Boolean; + const proc: TCefDomEventListenerProc); +begin + //AddEventListener(eventType, useCapture, TCefFastDomEventListener.Create(proc) as ICefDomEventListener); + AddEventListener(eventType, useCapture, TCefFastDomEventListener.Create(proc)); +end; + +function TCefDomNodeRef.GetAsMarkup: ustring; +begin + Result := CefStringFreeAndGet(PCefDomNode(FData)^.get_as_markup(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetDocument: ICefDomDocument; +begin + Result := TCefDomDocumentRef.UnWrap(PCefDomNode(FData)^.get_document(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetElementAttribute(const attrName: ustring): ustring; +var + p: TCefString; +begin + p := CefString(attrName); + Result := CefStringFreeAndGet(PCefDomNode(FData)^.get_element_attribute(PCefDomNode(FData), @p)); +end; + +procedure TCefDomNodeRef.GetElementAttributes(const attrMap: ICefStringMap); +begin + PCefDomNode(FData)^.get_element_attributes(PCefDomNode(FData), attrMap.Handle); +end; + +function TCefDomNodeRef.GetElementInnerText: ustring; +begin + Result := CefStringFreeAndGet(PCefDomNode(FData)^.get_element_inner_text(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetElementTagName: ustring; +begin + Result := CefStringFreeAndGet(PCefDomNode(FData)^.get_element_tag_name(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetFirstChild: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomNode(FData)^.get_first_child(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetFormControlElementType: ustring; +begin + Result := CefStringFreeAndGet(PCefDomNode(FData)^.get_form_control_element_type(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetLastChild: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomNode(FData)^.get_last_child(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetName: ustring; +begin + Result := CefStringFreeAndGet(PCefDomNode(FData)^.get_name(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetNextSibling: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomNode(FData)^.get_next_sibling(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetParent: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomNode(FData)^.get_parent(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetPreviousSibling: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomNode(FData)^.get_previous_sibling(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.GetType: TCefDomNodeType; +begin + Result := PCefDomNode(FData)^.get_type(PCefDomNode(FData)); +end; + +function TCefDomNodeRef.GetValue: ustring; +begin + Result := CefStringFreeAndGet(PCefDomNode(FData)^.get_value(PCefDomNode(FData))); +end; + +function TCefDomNodeRef.HasChildren: Boolean; +begin + Result := PCefDomNode(FData)^.has_children(PCefDomNode(FData)) <> 0; +end; + +function TCefDomNodeRef.HasElementAttribute(const attrName: ustring): Boolean; +var + p: TCefString; +begin + p := CefString(attrName); + Result := PCefDomNode(FData)^.has_element_attribute(PCefDomNode(FData), @p) <> 0; +end; + +function TCefDomNodeRef.HasElementAttributes: Boolean; +begin + Result := PCefDomNode(FData)^.has_element_attributes(PCefDomNode(FData)) <> 0; +end; + +function TCefDomNodeRef.IsEditable: Boolean; +begin + Result := PCefDomNode(FData)^.is_editable(PCefDomNode(FData)) <> 0; +end; + +function TCefDomNodeRef.IsElement: Boolean; +begin + Result := PCefDomNode(FData)^.is_element(PCefDomNode(FData)) <> 0; +end; + +function TCefDomNodeRef.IsFormControlElement: Boolean; +begin + Result := PCefDomNode(FData)^.is_form_control_element(PCefDomNode(FData)) <> 0; +end; + +function TCefDomNodeRef.IsSame(const that: ICefDomNode): Boolean; +begin + Result := PCefDomNode(FData)^.is_same(PCefDomNode(FData), CefGetData(that)) <> 0; +end; + +function TCefDomNodeRef.IsText: Boolean; +begin + Result := PCefDomNode(FData)^.is_text(PCefDomNode(FData)) <> 0; +end; + +function TCefDomNodeRef.SetElementAttribute(const attrName, + value: ustring): Boolean; +var + p1, p2: TCefString; +begin + p1 := CefString(attrName); + p2 := CefString(value); + Result := PCefDomNode(FData)^.set_element_attribute(PCefDomNode(FData), @p1, @p2) <> 0; +end; + +function TCefDomNodeRef.SetValue(const value: ustring): Boolean; +var + p: TCefString; +begin + p := CefString(value); + Result := PCefDomNode(FData)^.set_value(PCefDomNode(FData), @p) <> 0; +end; + +class function TCefDomNodeRef.UnWrap(data: Pointer): ICefDomNode; +begin + If data <> nil then Result := Create(data) //as ICefDomNode + Else Result := nil; +end; + +{ TCefDomEventListenerOwn } + +constructor TCefDomEventListenerOwn.Create; +begin + inherited CreateData(SizeOf(TCefDomEventListener)); + PCefDomEventListener(FData)^.handle_event := @cef_dom_event_listener_handle_event; +end; + +procedure TCefDomEventListenerOwn.HandleEvent(const event: ICefDomEvent); +begin + +end; + +{ TCefDomEventRef } + +function TCefDomEventRef.CanBubble: Boolean; +begin + Result := PCefDomEvent(FData)^.can_bubble(PCefDomEvent(FData)) <> 0; +end; + +function TCefDomEventRef.CanCancel: Boolean; +begin + Result := PCefDomEvent(FData)^.can_cancel(PCefDomEvent(FData)) <> 0; +end; + +function TCefDomEventRef.GetCategory: TCefDomEventCategory; +begin + Result := PCefDomEvent(FData)^.get_category(PCefDomEvent(FData)); +end; + +function TCefDomEventRef.GetCurrentTarget: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomEvent(FData)^.get_current_target(PCefDomEvent(FData))); +end; + +function TCefDomEventRef.GetDocument: ICefDomDocument; +begin + Result := TCefDomDocumentRef.UnWrap(PCefDomEvent(FData)^.get_document(PCefDomEvent(FData))); +end; + +function TCefDomEventRef.GetPhase: TCefDomEventPhase; +begin + Result := PCefDomEvent(FData)^.get_phase(PCefDomEvent(FData)); +end; + +function TCefDomEventRef.GetTarget: ICefDomNode; +begin + Result := TCefDomNodeRef.UnWrap(PCefDomEvent(FData)^.get_target(PCefDomEvent(FData))); +end; + +function TCefDomEventRef.GetType: ustring; +begin + Result := CefStringFreeAndGet(PCefDomEvent(FData)^.get_type(PCefDomEvent(FData))); +end; + +class function TCefDomEventRef.UnWrap(data: Pointer): ICefDomEvent; +begin + If data <> nil then Result := Create(data) //as ICefDomEvent + Else Result := nil; +end; + +{ TCefFastDomEventListener } + +constructor TCefFastDomEventListener.Create( + const proc: TCefDomEventListenerProc); +begin + inherited Create; + FProc := proc; +end; + +procedure TCefFastDomEventListener.HandleEvent(const event: ICefDomEvent); +begin + inherited; + FProc(event); +end; + +{ TCefResponseRef } + +class function TCefResponseRef.New: ICefResponse; +begin + Result := UnWrap(cef_response_create); +end; + +function TCefResponseRef.GetHeader(const name: ustring): ustring; +var + n: TCefString; +begin + n := CefString(name); + Result := CefStringFreeAndGet(PCefResponse(FData)^.get_header(PCefResponse(FData), @n)); +end; + +procedure TCefResponseRef.GetHeaderMap(const headerMap: ICefStringMultimap); +begin + PCefResponse(FData)^.get_header_map(PCefResponse(FData), headermap.Handle); +end; + +function TCefResponseRef.GetMimeType: ustring; +begin + Result := CefStringFreeAndGet(PCefResponse(FData)^.get_mime_type(PCefResponse(FData))); +end; + +function TCefResponseRef.GetStatus: Integer; +begin + Result := PCefResponse(FData)^.get_status(PCefResponse(FData)); +end; + +function TCefResponseRef.GetStatusText: ustring; +begin + Result := CefStringFreeAndGet(PCefResponse(FData)^.get_status_text(PCefResponse(FData))); +end; + +function TCefResponseRef.IsReadOnly: Boolean; +begin + Result := PCefResponse(FData)^.is_read_only(PCefResponse(FData)) <> 0; +end; + +procedure TCefResponseRef.SetHeaderMap(const headerMap: ICefStringMultimap); +begin + PCefResponse(FData)^.set_header_map(PCefResponse(FData), headerMap.Handle); +end; + +procedure TCefResponseRef.SetMimeType(const mimetype: ustring); +var + txt: TCefString; +begin + txt := CefString(mimetype); + PCefResponse(FData)^.set_mime_type(PCefResponse(FData), @txt); +end; + +procedure TCefResponseRef.SetStatus(status: Integer); +begin + PCefResponse(FData)^.set_status(PCefResponse(FData), status); +end; + +procedure TCefResponseRef.SetStatusText(const StatusText: ustring); +var + txt: TCefString; +begin + txt := CefString(StatusText); + PCefResponse(FData)^.set_status_text(PCefResponse(FData), @txt); +end; + +class function TCefResponseRef.UnWrap(data: Pointer): ICefResponse; +begin + If data <> nil then Result := Create(data) //as ICefResponse + Else Result := nil; +end; + +{ TCefV8AccessorOwn } + +constructor TCefV8AccessorOwn.Create; +begin + inherited CreateData(SizeOf(TCefV8Accessor)); + PCefV8Accessor(FData)^.get := @cef_v8_accessor_get; + PCefV8Accessor(FData)^.put := @cef_v8_accessor_put; +end; + +function TCefV8AccessorOwn.Get(const name: ustring; const obj: ICefv8Value; + out value: ICefv8Value; const exception: string): Boolean; +begin + Result := False; +end; + +function TCefV8AccessorOwn.Put(const name: ustring; const obj, + value: ICefv8Value; const exception: string): Boolean; +begin + Result := False; +end; + +{ TCefFastV8Accessor } + +constructor TCefFastV8Accessor.Create( + const getter: TCefV8AccessorGetterProc; + const setter: TCefV8AccessorSetterProc); +begin + FGetter := getter; + FSetter := setter; +end; + +function TCefFastV8Accessor.Get(const name: ustring; const obj: ICefv8Value; + out value: ICefv8Value; const exception: string): Boolean; +begin + if Assigned(FGetter) then + Result := FGetter(name, obj, value, exception) else + Result := False; +end; + +function TCefFastV8Accessor.Put(const name: ustring; const obj, + value: ICefv8Value; const exception: string): Boolean; +begin + if Assigned(FSetter) then + Result := FSetter(name, obj, value, exception) else + Result := False; +end; + +{ TCefCookieVisitorOwn } + +constructor TCefCookieVisitorOwn.Create; +begin + inherited CreateData(SizeOf(TCefCookieVisitor)); + PCefCookieVisitor(FData)^.visit := @cef_cookie_visitor_visit; +end; + +function TCefCookieVisitorOwn.visit(const name, value, domain, path: ustring; + secure, httponly, hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; + count, total: Integer; out deleteCookie: Boolean): Boolean; +begin + Result := True; +end; + +{ TCefFastCookieVisitor } + +constructor TCefFastCookieVisitor.Create(const visitor: TCefCookieVisitorProc); +begin + inherited Create; + FVisitor := visitor; +end; + +function TCefFastCookieVisitor.visit(const name, value, domain, path: ustring; + secure, httponly, hasExpires: Boolean; const creation, lastAccess, + expires: TDateTime; count, total: Integer; out deleteCookie: Boolean): Boolean; +begin + Result := FVisitor(name, value, domain, path, secure, httponly, hasExpires, + creation, lastAccess, expires, count, total, deleteCookie); +end; + +{ TCefClientOwn } + +constructor TCefClientOwn.Create; +begin + inherited CreateData(SizeOf(TCefClient)); + With PCefClient(FData)^ do + begin + get_context_menu_handler := @cef_client_get_context_menu_handler; + get_dialog_handler := @cef_client_get_dialog_handler; + get_display_handler := @cef_client_get_display_handler; + get_download_handler := @cef_client_get_download_handler; + get_focus_handler := @cef_client_get_focus_handler; + get_geolocation_handler := @cef_client_get_geolocation_handler; + get_jsdialog_handler := @cef_client_get_jsdialog_handler; + get_keyboard_handler := @cef_client_get_keyboard_handler; + get_life_span_handler := @cef_client_get_life_span_handler; + get_load_handler := @cef_client_get_load_handler; + get_render_handler := @cef_client_get_get_render_handler; + get_request_handler := @cef_client_get_request_handler; + on_process_message_received := @cef_client_on_process_message_received; + end; +end; + +function TCefClientOwn.GetContextMenuHandler: ICefContextMenuHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetDialogHandler: ICefDialogHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetDisplayHandler: ICefDisplayHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetDownloadHandler: ICefDownloadHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetFocusHandler: ICefFocusHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetGeolocationHandler: ICefGeolocationHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetJsdialogHandler: ICefJsDialogHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetKeyboardHandler: ICefKeyboardHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetLifeSpanHandler: ICefLifeSpanHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetLoadHandler: ICefLoadHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetRenderHandler: ICefRenderHandler; +begin + Result := nil; +end; + +function TCefClientOwn.GetRequestHandler: ICefRequestHandler; +begin + Result := nil; +end; + +function TCefClientOwn.OnProcessMessageReceived(const browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; +begin + Result := False; +end; + +{ TCefGeolocationHandlerOwn } + +constructor TCefGeolocationHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefGeolocationHandler)); + With PCefGeolocationHandler(FData)^ do + begin + on_request_geolocation_permission := @cef_geolocation_handler_on_request_geolocation_permission; + on_cancel_geolocation_permission := @cef_geolocation_handler_on_cancel_geolocation_permission; + end; +end; + +procedure TCefGeolocationHandlerOwn.OnRequestGeolocationPermission( + const browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; + const callback: ICefGeolocationCallback); +begin + +end; + +procedure TCefGeolocationHandlerOwn.OnCancelGeolocationPermission( + const browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer); +begin + +end; + +{ TCefLifeSpanHandlerOwn } + +constructor TCefLifeSpanHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefLifeSpanHandler)); + with PCefLifeSpanHandler(FData)^ do + begin + on_before_popup := @cef_life_span_handler_on_before_popup; + on_after_created := @cef_life_span_handler_on_after_created; + on_before_close := @cef_life_span_handler_on_before_close; + run_modal := @cef_life_span_handler_run_modal; + do_close := @cef_life_span_handler_do_close; + end; +end; + +procedure TCefLifeSpanHandlerOwn.OnAfterCreated(const browser: ICefBrowser); +begin + +end; + +procedure TCefLifeSpanHandlerOwn.OnBeforeClose(const browser: ICefBrowser); +begin + +end; + +function TCefLifeSpanHandlerOwn.OnBeforePopup(const browser: ICefBrowser; + const frame: ICefFrame; const targetUrl, targetFrameName: ustring; + var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; + var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; +begin + Result := False; +end; + +function TCefLifeSpanHandlerOwn.DoClose(const browser: ICefBrowser): Boolean; +begin + Result := False; +end; + +function TCefLifeSpanHandlerOwn.RunModal(const browser: ICefBrowser): Boolean; +begin + Result := False; +end; + + +{ TCefLoadHandlerOwn } + +constructor TCefLoadHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefLoadHandler)); + With PCefLoadHandler(FData)^ do + begin + on_load_start := @cef_load_handler_on_load_start; + on_load_end := @cef_load_handler_on_load_end; + on_load_error := @cef_load_handler_on_load_error; + on_render_process_terminated := @cef_load_handler_on_render_process_terminated; + on_plugin_crashed := @cef_load_handler_on_plugin_crashed; + end; +end; + +procedure TCefLoadHandlerOwn.OnLoadEnd(const browser: ICefBrowser; + const frame: ICefFrame; httpStatusCode: Integer); +begin + +end; + +procedure TCefLoadHandlerOwn.OnRenderProcessTerminated(const browser: ICefBrowser; + status: TCefTerminationStatus); +begin + +end; + +procedure TCefLoadHandlerOwn.OnPluginCrashed(const browser: ICefBrowser; + const pluginPath: ustring); +begin + +end; + +procedure TCefLoadHandlerOwn.OnLoadError(const browser: ICefBrowser; + const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring); +begin + +end; + +procedure TCefLoadHandlerOwn.OnLoadStart(const browser: ICefBrowser; + const frame: ICefFrame); +begin + +end; + +{ TCefRequestHandlerOwn } + +constructor TCefRequestHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefRequestHandler)); + With PCefRequestHandler(FData)^ do + begin + on_before_resource_load := @cef_request_handler_on_before_resource_load; + get_resource_handler := @cef_request_handler_get_resource_handler; + on_resource_redirect := @cef_request_handler_on_resource_redirect; + get_auth_credentials := @cef_request_handler_get_auth_credentials; + on_quota_request := @cef_request_handler_on_quota_request; + get_cookie_manager := @cef_request_handler_get_cookie_manager; + on_protocol_execution := @cef_request_handler_on_protocol_execution; + on_before_plugin_load := @cef_request_handler_on_before_plugin_load; + end; +end; + +function TCefRequestHandlerOwn.GetAuthCredentials(const browser: ICefBrowser; const frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback): Boolean; +begin + Result := False; +end; + +function TCefRequestHandlerOwn.GetCookieManager(const browser: ICefBrowser; + const mainUrl: ustring): ICefCookieManager; +begin + Result := nil; +end; + +function TCefRequestHandlerOwn.OnBeforePluginLoad(const browser: ICefBrowser; + const url, policyUrl: ustring; const info: ICefWebPluginInfo): Boolean; +begin + Result := False; +end; + +function TCefRequestHandlerOwn.OnBeforeResourceLoad(const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest): Boolean; +begin + Result := False; +end; + +function TCefRequestHandlerOwn.GetResourceHandler(const browser: ICefBrowser; + const frame: ICefFrame; const request: ICefRequest): ICefResourceHandler; +begin + Result := nil; +end; + +procedure TCefRequestHandlerOwn.OnProtocolExecution(const browser: ICefBrowser; + const url: ustring; out allowOsExecution: Boolean); +begin + +end; + +function TCefRequestHandlerOwn.OnQuotaRequest(const browser: ICefBrowser; + const originUrl: ustring; newSize: Int64; + const callback: ICefQuotaCallback): Boolean; +begin + Result := False; +end; + +procedure TCefRequestHandlerOwn.OnResourceRedirect(const browser: ICefBrowser; + const frame: ICefFrame; const oldUrl: ustring; var newUrl: ustring); +begin + +end; + +{ TCefDisplayHandlerOwn } + +constructor TCefDisplayHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefDisplayHandler)); + With PCefDisplayHandler(FData)^ do + begin + on_loading_state_change := @cef_display_handler_on_loading_state_change; + on_address_change := @cef_display_handler_on_address_change; + on_title_change := @cef_display_handler_on_title_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; +end; + +procedure TCefDisplayHandlerOwn.OnLoadingStateChange(const browser: ICefBrowser; + isLoading, canGoBack, canGoForward: Boolean); +begin + +end; + +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; +begin + Result := False; +end; + +procedure TCefDisplayHandlerOwn.OnStatusMessage(const browser: ICefBrowser; + const value: ustring); +begin + +end; + +procedure TCefDisplayHandlerOwn.OnTitleChange(const browser: ICefBrowser; + const title: ustring); +begin + +end; + +function TCefDisplayHandlerOwn.OnTooltip(const browser: ICefBrowser; + var text: ustring): Boolean; +begin + Result := False; +end; + +{ TCefFocusHandlerOwn } + +constructor TCefFocusHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefFocusHandler)); + With PCefFocusHandler(FData)^ do + begin + on_take_focus := @cef_focus_handler_on_take_focus; + on_set_focus := @cef_focus_handler_on_set_focus; + on_got_focus := @cef_focus_handler_on_got_focus; + end; +end; + +function TCefFocusHandlerOwn.OnSetFocus(const browser: ICefBrowser; + source: TCefFocusSource): Boolean; +begin + Result := False; +end; + +procedure TCefFocusHandlerOwn.OnGotFocus(const browser: ICefBrowser); +begin + +end; + +procedure TCefFocusHandlerOwn.OnTakeFocus(const browser: ICefBrowser; + next: Boolean); +begin + +end; + +{ TCefKeyboardHandlerOwn } + +constructor TCefKeyboardHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefKeyboardHandler)); + With PCefKeyboardHandler(FData)^ do + begin + on_pre_key_event := @cef_keyboard_handler_on_pre_key_event; + on_key_event := @cef_keyboard_handler_on_key_event; + end; +end; + +function TCefKeyboardHandlerOwn.OnPreKeyEvent(const browser: ICefBrowser; + const event: PCefKeyEvent; osEvent: TCefEventHandle; + out isKeyboardShortcut: Boolean): Boolean; +begin + Result := False; +end; + +function TCefKeyboardHandlerOwn.OnKeyEvent(const browser: ICefBrowser; + const event: PCefKeyEvent; osEvent: TCefEventHandle): Boolean; +begin + Result := False; +end; + +{ TCefJsDialogHandlerOwn } + +constructor TCefJsDialogHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefJsDialogHandler)); + With PCefJsDialogHandler(FData)^ do + begin + on_jsdialog := @cef_jsdialog_handler_on_jsdialog; + on_before_unload_dialog := @cef_jsdialog_handler_on_before_unload_dialog; + on_reset_dialog_state := @cef_jsdialog_handler_on_reset_dialog_state; + end; +end; + +function TCefJsDialogHandlerOwn.OnJsdialog(const browser: ICefBrowser; + const originUrl, acceptLang: ustring; dialogType: TCefJsDialogType; + const messageText, defaultPromptText: ustring; callback: ICefJsDialogCallback; + out suppressMessage: Boolean): Boolean; +begin + Result := False; +end; + +function TCefJsDialogHandlerOwn.OnBeforeUnloadDialog(const browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; const callback: ICefJsDialogCallback): Boolean; +begin + Result := False; +end; + +procedure TCefJsDialogHandlerOwn.OnResetDialogState(const browser: ICefBrowser); +begin + +end; + +{ TCefContextMenuHandlerOwn } + +constructor TCefContextMenuHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefContextMenuHandler)); + With PCefContextMenuHandler(FData)^ do + begin + on_before_context_menu := @cef_context_menu_handler_on_before_context_menu; + on_context_menu_command := @cef_context_menu_handler_on_context_menu_command; + on_context_menu_dismissed := @cef_context_menu_handler_on_context_menu_dismissed; + end; +end; + +procedure TCefContextMenuHandlerOwn.OnBeforeContextMenu( + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + +end; + +function TCefContextMenuHandlerOwn.OnContextMenuCommand( + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags): Boolean; +begin + Result := False; +end; + +procedure TCefContextMenuHandlerOwn.OnContextMenuDismissed( + const browser: ICefBrowser; const frame: ICefFrame); +begin + +end; + +{ TCefV8ExceptionRef } + +function TCefV8ExceptionRef.GetEndColumn: Integer; +begin + Result := PCefV8Exception(FData)^.get_end_column(FData); +end; + +function TCefV8ExceptionRef.GetEndPosition: Integer; +begin + Result := PCefV8Exception(FData)^.get_end_position(FData); +end; + +function TCefV8ExceptionRef.GetLineNumber: Integer; +begin + Result := PCefV8Exception(FData)^.get_line_number(FData); +end; + +function TCefV8ExceptionRef.GetMessage: ustring; +begin + Result := CefStringFreeAndGet(PCefV8Exception(FData)^.get_message(FData)); +end; + +function TCefV8ExceptionRef.GetScriptResourceName: ustring; +begin + Result := CefStringFreeAndGet(PCefV8Exception(FData)^.get_script_resource_name(FData)); +end; + +function TCefV8ExceptionRef.GetSourceLine: ustring; +begin + Result := CefStringFreeAndGet(PCefV8Exception(FData)^.get_source_line(FData)); +end; + +function TCefV8ExceptionRef.GetStartColumn: Integer; +begin + Result := PCefV8Exception(FData)^.get_start_column(FData); +end; + +function TCefV8ExceptionRef.GetStartPosition: Integer; +begin + Result := PCefV8Exception(FData)^.get_start_position(FData); +end; + +class function TCefV8ExceptionRef.UnWrap(data: Pointer): ICefV8Exception; +begin + If data <> nil then Result := Create(data) //as ICefV8Exception + Else Result := nil; +end; + +{ TCefResourceBundleHandlerOwn } + +constructor TCefResourceBundleHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefResourceBundleHandler)); + With PCefResourceBundleHandler(FData)^ do + begin + get_localized_string := @cef_resource_bundle_handler_get_localized_string; + get_data_resource := @cef_resource_bundle_handler_get_data_resource; + end; +end; + +{ TCefFastResourceBundle } + +constructor TCefFastResourceBundle.Create(AGetDataResource: TGetDataResource; + AGetLocalizedString: TGetLocalizedString); +begin + inherited Create; + FGetDataResource := AGetDataResource; + FGetLocalizedString := AGetLocalizedString; +end; + +function TCefFastResourceBundle.GetDataResource(resourceId: Integer; + out data: Pointer; out dataSize: Cardinal): Boolean; +begin + if Assigned(FGetDataResource) then + Result := FGetDataResource(resourceId, data, dataSize) else + Result := False; +end; + +function TCefFastResourceBundle.GetLocalizedString(messageId: Integer; + out stringVal: ustring): Boolean; +begin + If Assigned(FGetLocalizedString) then Result := FGetLocalizedString(messageId, stringVal) + Else Result := False; +end; + +{ TCefAppOwn } + +constructor TCefAppOwn.Create; +begin + inherited CreateData(SizeOf(TCefApp)); + with PCefApp(FData)^ do + begin + on_before_command_line_processing := @cef_app_on_before_command_line_processing; + on_register_custom_schemes := @cef_app_on_register_custom_schemes; + get_resource_bundle_handler := @cef_app_get_resource_bundle_handler; + get_browser_process_handler := @cef_app_get_browser_process_handler; + get_render_process_handler := @cef_app_get_render_process_handler; + end; +end; + +{ TCefCookieManagerRef } + +class function TCefCookieManagerRef.New(const path: ustring): ICefCookieManager; +var + pth: TCefString; +begin + pth := CefString(path); + Result := UnWrap(cef_cookie_manager_create_manager(@pth)); +end; + +function TCefCookieManagerRef.DeleteCookies(const url, + cookieName: ustring): Boolean; +var + u, n: TCefString; +begin + u := CefString(url); + n := CefString(cookieName); + Result := PCefCookieManager(FData)^.delete_cookies( + PCefCookieManager(FData), @u, @n) <> 0; +end; + +class function TCefCookieManagerRef.Global: ICefCookieManager; +begin + Result := UnWrap(cef_cookie_manager_get_global_manager()); +end; + +function TCefCookieManagerRef.SetCookie(const url, name, value, domain, + path: ustring; secure, httponly, hasExpires: Boolean; const creation, + lastAccess, expires: TDateTime): Boolean; +var + str: TCefString; + cook: TCefCookie; +begin + str := CefString(url); + cook.name := CefString(name); + cook.value := CefString(value); + cook.domain := CefString(domain); + cook.path := CefString(path); + cook.secure := secure; + cook.httponly := httponly; + cook.creation := DateTimeToCefTime(creation); + cook.last_access := DateTimeToCefTime(lastAccess); + cook.has_expires := hasExpires; + If hasExpires then cook.expires := DateTimeToCefTime(expires) + Else FillChar(cook.expires, SizeOf(TCefTime), 0); + Result := PCefCookieManager(FData)^.set_cookie( + PCefCookieManager(FData), @str, @cook) <> 0; +end; + +function TCefCookieManagerRef.SetStoragePath(const path: ustring): Boolean; +var + p: TCefString; +begin + p := CefString(path); + Result := PCefCookieManager(FData)^.set_storage_path( + PCefCookieManager(FData), @p) <> 0; +end; + +procedure TCefCookieManagerRef.SetSupportedSchemes(schemes: TStrings); +var + list: TCefStringList; + i: Integer; + item: TCefString; +begin + list := cef_string_list_alloc(); + try + if (schemes <> nil) then + For i := 0 to schemes.Count - 1 do + begin + item := CefString(schemes[i]); + cef_string_list_append(list, @item); + end; + PCefCookieManager(FData)^.set_supported_schemes(PCefCookieManager(FData), list); + finally + cef_string_list_free(list); + end; +end; + +class function TCefCookieManagerRef.UnWrap(data: Pointer): ICefCookieManager; +begin + If data <> nil then Result := Create(data) //as ICefCookieManager + Else Result := nil; +end; + +function TCefCookieManagerRef.VisitAllCookies( + const visitor: ICefCookieVisitor): Boolean; +begin + Result := PCefCookieManager(FData)^.visit_all_cookies(PCefCookieManager(FData), CefGetData(visitor)) <> 0; +end; + +function TCefCookieManagerRef.VisitAllCookiesProc( + const visitor: TCefCookieVisitorProc): Boolean; +begin + //Result := VisitAllCookies(TCefFastCookieVisitor.Create(visitor) as ICefCookieVisitor); + Result := VisitAllCookies(TCefFastCookieVisitor.Create(visitor)); +end; + +function TCefCookieManagerRef.VisitUrlCookies(const url: ustring; + includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean; +var + str: TCefString; +begin + str := CefString(url); + Result := PCefCookieManager(FData)^.visit_url_cookies(PCefCookieManager(FData), @str, Ord(includeHttpOnly), CefGetData(visitor)) <> 0; +end; + +function TCefCookieManagerRef.VisitUrlCookiesProc(const url: ustring; + includeHttpOnly: Boolean; const visitor: TCefCookieVisitorProc): Boolean; +begin + //Result := VisitUrlCookies(url, includeHttpOnly,TCefFastCookieVisitor.Create(visitor) as ICefCookieVisitor); + Result := VisitUrlCookies(url, includeHttpOnly,TCefFastCookieVisitor.Create(visitor)); +end; + +{ TCefWebPluginInfoRef } + +function TCefWebPluginInfoRef.GetDescription: ustring; +begin + Result := CefStringFreeAndGet(PCefWebPluginInfo(FData)^.get_description(PCefWebPluginInfo(FData))); +end; + +function TCefWebPluginInfoRef.GetName: ustring; +begin + Result := CefStringFreeAndGet(PCefWebPluginInfo(FData)^.get_name(PCefWebPluginInfo(FData))); +end; + +function TCefWebPluginInfoRef.GetPath: ustring; +begin + Result := CefStringFreeAndGet(PCefWebPluginInfo(FData)^.get_path(PCefWebPluginInfo(FData))); +end; + +function TCefWebPluginInfoRef.GetVersion: ustring; +begin + Result := CefStringFreeAndGet(PCefWebPluginInfo(FData)^.get_version(PCefWebPluginInfo(FData))); +end; + +class function TCefWebPluginInfoRef.UnWrap(data: Pointer): ICefWebPluginInfo; +begin + If data <> nil then Result := Create(data) //as ICefWebPluginInfo + Else Result := nil; +end; + +{ TCefBrowserHostRef } + +function TCefBrowserHostRef.GetBrowser: ICefBrowser; +begin + Result := TCefBrowserRef.UnWrap(PCefBrowserHost(FData)^.get_browser(PCefBrowserHost(FData))); +end; + +procedure TCefBrowserHostRef.ParentWindowWillClose; +begin + PCefBrowserHost(FData)^.parent_window_will_close(PCefBrowserHost(FData)); +end; + +procedure TCefBrowserHostRef.RunFileDialog(mode: TCefFileDialogMode; + const title, defaultFileName: string; acceptTypes: TStrings; + const callback: ICefRunFileDialogCallback); +var + t, f: TCefString; + list: TCefStringList; + item: TCefString; + i: Integer; +begin + t := CefString(title); + f := CefString(defaultFileName); + list := cef_string_list_alloc(); + try + for i := 0 to acceptTypes.Count - 1 do + begin + item := CefString(acceptTypes[i]); + cef_string_list_append(list, @item); + end; + PCefBrowserHost(FData)^.run_file_dialog(PCefBrowserHost(FData), mode, @t, @f, + list, CefGetData(callback)); + finally + cef_string_list_free(list); + end; +end; + +procedure TCefBrowserHostRef.RunFileDialogProc(mode: TCefFileDialogMode; + const title, defaultFileName: string; acceptTypes: TStrings; + const callback: TCefRunFileDialogCallbackProc); +begin + RunFileDialog(mode, title, defaultFileName, acceptTypes, TCefFastRunFileDialogCallback.Create(callback)); +end; + +procedure TCefBrowserHostRef.CloseBrowser; +begin + PCefBrowserHost(FData)^.close_browser(PCefBrowserHost(FData)); +end; + +procedure TCefBrowserHostRef.SendCaptureLostEvent; +begin + PCefBrowserHost(FData)^.send_capture_lost_event(FData); +end; + +procedure TCefBrowserHostRef.SendFocusEvent(Focus: Boolean); +begin + PCefBrowserHost(FData)^.send_focus_event(FData, Ord(Focus)); +end; + +procedure TCefBrowserHostRef.SendKeyEvent(const event: PCefKeyEvent); +begin + PCefBrowserHost(FData)^.send_key_event(FData, event); +end; + +procedure TCefBrowserHostRef.SendMouseClickEvent(const event: PCefMouseEvent; + kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer); +begin + PCefBrowserHost(FData)^.send_mouse_click_event(FData, event, kind, Ord(mouseUp), clickCount); +end; + +procedure TCefBrowserHostRef.SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean); +begin + PCefBrowserHost(FData)^.send_mouse_move_event(FData, event, Ord(mouseLeave)); +end; + +procedure TCefBrowserHostRef.SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer); +begin + PCefBrowserHost(FData)^.send_mouse_wheel_event(FData, event, deltaX, deltaY); +end; + +procedure TCefBrowserHostRef.SetFocus(enable: Boolean); +begin + PCefBrowserHost(FData)^.set_focus(PCefBrowserHost(FData), Ord(enable)); +end; + +function TCefBrowserHostRef.GetWindowHandle: TCefWindowHandle; +begin + Result := PCefBrowserHost(FData)^.get_window_handle(PCefBrowserHost(FData)) +end; + +function TCefBrowserHostRef.GetOpenerWindowHandle: TCefWindowHandle; +begin + Result := PCefBrowserHost(FData)^.get_opener_window_handle(PCefBrowserHost(FData)); +end; + +function TCefBrowserHostRef.GetDevToolsUrl(httpScheme: Boolean): ustring; +begin + Result := CefStringFreeAndGet(PCefBrowserHost(FData)^.get_dev_tools_url(PCefBrowserHost(FData), Ord(httpScheme))); +end; + +function TCefBrowserHostRef.GetZoomLevel: Double; +begin + Result := PCefBrowserHost(FData)^.get_zoom_level(PCefBrowserHost(FData)); +end; + +procedure TCefBrowserHostRef.Invalidate(const dirtyRect: PCefRect; kind: TCefPaintElementType); +begin + PCefBrowserHost(FData)^.invalidate(FData, dirtyRect, kind); +end; + +function TCefBrowserHostRef.IsWindowRenderingDisabled: Boolean; +begin + Result := PCefBrowserHost(FData)^.is_window_rendering_disabled(FData) <> 0 +end; + +procedure TCefBrowserHostRef.SetZoomLevel(zoomLevel: Double); +begin + PCefBrowserHost(FData)^.set_zoom_level(PCefBrowserHost(FData), zoomLevel); +end; + +class function TCefBrowserHostRef.UnWrap(data: Pointer): ICefBrowserHost; +begin + //If data <> nil then Result := Create(data) as ICefBrowserHost + If data <> nil then Result := Create(data) + Else Result := nil; +end; + +procedure TCefBrowserHostRef.WasResized; +begin + PCefBrowserHost(FData)^.was_resized(FData); +end; + +{ TCefProcessMessageRef } + +function TCefProcessMessageRef.Copy: ICefProcessMessage; +begin + Result := UnWrap(PCefProcessMessage(FData)^.copy(PCefProcessMessage(FData))); +end; + +function TCefProcessMessageRef.GetArgumentList: ICefListValue; +begin + Result := TCefListValueRef.UnWrap(PCefProcessMessage(FData)^.get_argument_list(PCefProcessMessage(FData))); +end; + +function TCefProcessMessageRef.GetName: ustring; +begin + Result := CefStringFreeAndGet(PCefProcessMessage(FData)^.get_name(PCefProcessMessage(FData))); +end; + +function TCefProcessMessageRef.IsReadOnly: Boolean; +begin + Result := PCefProcessMessage(FData)^.is_read_only(PCefProcessMessage(FData)) <> 0; +end; + +function TCefProcessMessageRef.IsValid: Boolean; +begin + Result := PCefProcessMessage(FData)^.is_valid(PCefProcessMessage(FData)) <> 0; +end; + +class function TCefProcessMessageRef.New(const name: ustring): ICefProcessMessage; +Var + n: TCefString; +begin + n := CefString(name); + Result := UnWrap(cef_process_message_create(@n)); +end; + +class function TCefProcessMessageRef.UnWrap(data: Pointer): ICefProcessMessage; +begin + If data <> nil then Result := Create(data) //as ICefProcessMessage + Else Result := nil; +end; + +{ TCefStringVisitorOwn } + +constructor TCefStringVisitorOwn.Create; +begin + inherited CreateData(SizeOf(TCefStringVisitor)); + PCefStringVisitor(FData)^.visit := @cef_string_visitor_visit; +end; + +procedure TCefStringVisitorOwn.Visit(const str: ustring); +begin + +end; + +{ TCefFastStringVisitor } + +constructor TCefFastStringVisitor.Create( + const callback: TCefStringVisitorProc); +begin + inherited Create; + FVisit := callback; +end; + +procedure TCefFastStringVisitor.Visit(const str: ustring); +begin + FVisit(str); +end; + +{ TCefDownLoadItemRef } + +function TCefDownLoadItemRef.GetContentDisposition: ustring; +begin + Result := CefStringFreeAndGet(PCefDownloadItem(FData)^.get_content_disposition(PCefDownloadItem(FData))); +end; + +function TCefDownLoadItemRef.GetCurrentSpeed: Int64; +begin + Result := PCefDownloadItem(FData)^.get_current_speed(PCefDownloadItem(FData)); +end; + +function TCefDownLoadItemRef.GetEndTime: TDateTime; +begin + Result := CefTimeToDateTime(PCefDownloadItem(FData)^.get_end_time(PCefDownloadItem(FData))); +end; + +function TCefDownLoadItemRef.GetFullPath: ustring; +begin + Result := CefStringFreeAndGet(PCefDownloadItem(FData)^.get_full_path(PCefDownloadItem(FData))); +end; + +function TCefDownLoadItemRef.GetId: Integer; +begin + Result := PCefDownloadItem(FData)^.get_id(PCefDownloadItem(FData)); +end; + +function TCefDownLoadItemRef.GetMimeType: ustring; +begin + Result := CefStringFreeAndGet(PCefDownloadItem(FData)^.get_mime_type(PCefDownloadItem(FData))); +end; + +function TCefDownLoadItemRef.GetPercentComplete: Integer; +begin + Result := PCefDownloadItem(FData)^.get_percent_complete(PCefDownloadItem(FData)); +end; + +function TCefDownLoadItemRef.GetReceivedBytes: Int64; +begin + Result := PCefDownloadItem(FData)^.get_received_bytes(PCefDownloadItem(FData)); +end; + +function TCefDownLoadItemRef.GetStartTime: TDateTime; +begin + Result := CefTimeToDateTime(PCefDownloadItem(FData)^.get_start_time(PCefDownloadItem(FData))); +end; + +function TCefDownLoadItemRef.GetSuggestedFileName: ustring; +begin + Result := CefStringFreeAndGet(PCefDownloadItem(FData)^.get_suggested_file_name(PCefDownloadItem(FData))); +end; + +function TCefDownLoadItemRef.GetTotalBytes: Int64; +begin + Result := PCefDownloadItem(FData)^.get_total_bytes(PCefDownloadItem(FData)); +end; + +function TCefDownLoadItemRef.GetUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefDownloadItem(FData)^.get_url(PCefDownloadItem(FData))); +end; + +function TCefDownLoadItemRef.IsCanceled: Boolean; +begin + Result := PCefDownloadItem(FData)^.is_canceled(PCefDownloadItem(FData)) <> 0; +end; + +function TCefDownLoadItemRef.IsComplete: Boolean; +begin + Result := PCefDownloadItem(FData)^.is_complete(PCefDownloadItem(FData)) <> 0; +end; + +function TCefDownLoadItemRef.IsInProgress: Boolean; +begin + Result := PCefDownloadItem(FData)^.is_in_progress(PCefDownloadItem(FData)) <> 0; +end; + +function TCefDownLoadItemRef.IsValid: Boolean; +begin + Result := PCefDownloadItem(FData)^.is_valid(PCefDownloadItem(FData)) <> 0; +end; + +class function TCefDownLoadItemRef.UnWrap(data: Pointer): ICefDownLoadItem; +begin + If data <> nil then Result := Create(data) //as ICefDownLoadItem + Else Result := nil; +end; + +{ TCefBeforeDownloadCallbackRef } + +procedure TCefBeforeDownloadCallbackRef.Cont(const downloadPath: ustring; + showDialog: Boolean); +var + dp: TCefString; +begin + dp := CefString(downloadPath); + PCefBeforeDownloadCallback(FData)^.cont(PCefBeforeDownloadCallback(FData), @dp, Ord(showDialog)); +end; + +class function TCefBeforeDownloadCallbackRef.UnWrap(data: Pointer): ICefBeforeDownloadCallback; +begin + If data <> nil then Result := Create(data) //as ICefBeforeDownloadCallback + Else Result := nil; +end; + +{ TCefDownloadItemCallbackRef } + +procedure TCefDownloadItemCallbackRef.cancel; +begin + PCefDownloadItemCallback(FData)^.cancel(PCefDownloadItemCallback(FData)); +end; + +class function TCefDownloadItemCallbackRef.UnWrap(data: Pointer): ICefDownloadItemCallback; +begin + If data <> nil then Result := Create(data) //as ICefDownloadItemCallback + Else Result := nil; +end; + +{ TCefAuthCallbackRef } + +procedure TCefAuthCallbackRef.Cancel; +begin + PCefAuthCallback(FData)^.cancel(PCefAuthCallback(FData)); +end; + +procedure TCefAuthCallbackRef.Cont(const username, password: ustring); +var + u, p: TCefString; +begin + u := CefString(username); + p := CefString(password); + PCefAuthCallback(FData)^.cont(PCefAuthCallback(FData), @u, @p); +end; + +class function TCefAuthCallbackRef.UnWrap(data: Pointer): ICefAuthCallback; +begin + If data <> nil then Result := Create(data) //as ICefAuthCallback + Else Result := nil; +end; + +{ TCefJsDialogCallbackRef } + +procedure TCefJsDialogCallbackRef.Cont(success: Boolean; + const userInput: ustring); +var + ui: TCefString; +begin + ui := CefString(userInput); + PCefJsDialogCallback(FData)^.cont(PCefJsDialogCallback(FData), Ord(success), @ui); +end; + +class function TCefJsDialogCallbackRef.UnWrap(data: Pointer): ICefJsDialogCallback; +begin + If data <> nil then Result := Create(data) //as ICefJsDialogCallback + Else Result := nil; +end; + +{ TCefCommandLineRef } + +procedure TCefCommandLineRef.AppendArgument(const argument: ustring); +var + a: TCefString; +begin + a := CefString(argument); + PCefCommandLine(FData)^.append_argument(PCefCommandLine(FData), @a); +end; + +procedure TCefCommandLineRef.AppendSwitch(const name: ustring); +var + n: TCefString; +begin + n := CefString(name); + PCefCommandLine(FData)^.append_switch(PCefCommandLine(FData), @n); +end; + +procedure TCefCommandLineRef.AppendSwitchWithValue(const name, value: ustring); +var + n, v: TCefString; +begin + n := CefString(name); + v := CefString(value); + PCefCommandLine(FData)^.append_switch_with_value(PCefCommandLine(FData), @n, @v); +end; + +function TCefCommandLineRef.Copy: ICefCommandLine; +begin + Result := UnWrap(PCefCommandLine(FData)^.copy(PCefCommandLine(FData))); +end; + +procedure TCefCommandLineRef.GetArguments(arguments: TStrings); +var + list: TCefStringList; + i: Integer; + str: TCefString; +begin + list := cef_string_list_alloc; + try + PCefCommandLine(FData)^.get_arguments(PCefCommandLine(FData), list); + For i := 0 to cef_string_list_size(list) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(list, i, @str); + arguments.Add(CefStringClearAndGet(str)); + end; + finally + cef_string_list_free(list); + end; +end; + +procedure TCefCommandLineRef.GetArgv(args: TStrings); +var + list: TCefStringList; + i: Integer; + str: TCefString; +begin + list := cef_string_list_alloc; + try + PCefCommandLine(FData)^.get_argv(FData, list); + For i := 0 to cef_string_list_size(list) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(list, i, @str); + args.Add(CefStringClearAndGet(str)); + end; + finally + cef_string_list_free(list); + end; +end; + +function TCefCommandLineRef.GetCommandLineString: ustring; +begin + Result := CefStringFreeAndGet(PCefCommandLine(FData)^.get_command_line_string(PCefCommandLine(FData))); +end; + +function TCefCommandLineRef.GetProgram: ustring; +begin + Result := CefStringFreeAndGet(PCefCommandLine(FData)^.get_program(PCefCommandLine(FData))); +end; + +procedure TCefCommandLineRef.GetSwitches(switches: TStrings); +var + list: TCefStringList; + i: Integer; + str: TCefString; +begin + list := cef_string_list_alloc; + try + PCefCommandLine(FData)^.get_switches(PCefCommandLine(FData), list); + For i := 0 to cef_string_list_size(list) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(list, i, @str); + switches.Add(CefStringClearAndGet(str)); + end; + finally + cef_string_list_free(list); + end; +end; + +function TCefCommandLineRef.GetSwitchValue(const name: ustring): ustring; +var + n: TCefString; +begin + n := CefString(name); + Result := CefStringFreeAndGet(PCefCommandLine(FData)^.get_switch_value(PCefCommandLine(FData), @n)); +end; + +class function TCefCommandLineRef.Global: ICefCommandLine; +begin + Result := UnWrap(cef_command_line_get_global); +end; + +function TCefCommandLineRef.HasArguments: Boolean; +begin + Result := PCefCommandLine(FData)^.has_arguments(PCefCommandLine(FData)) <> 0; +end; + +function TCefCommandLineRef.HasSwitch(const name: ustring): Boolean; +var + n: TCefString; +begin + n := CefString(name); + Result := PCefCommandLine(FData)^.has_switch(PCefCommandLine(FData), @n) <> 0; +end; + +function TCefCommandLineRef.HasSwitches: Boolean; +begin + Result := PCefCommandLine(FData)^.has_switches(PCefCommandLine(FData)) <> 0; +end; + +procedure TCefCommandLineRef.InitFromArgv(argc: Integer; + const argv: PPAnsiChar); +begin + PCefCommandLine(FData)^.init_from_argv(PCefCommandLine(FData), argc, argv); +end; + +procedure TCefCommandLineRef.InitFromString(const commandLine: ustring); +var + cl: TCefString; +begin + cl := CefString(commandLine); + PCefCommandLine(FData)^.init_from_string(PCefCommandLine(FData), @cl); +end; + +function TCefCommandLineRef.IsReadOnly: Boolean; +begin + Result := PCefCommandLine(FData)^.is_read_only(PCefCommandLine(FData)) <> 0; +end; + +function TCefCommandLineRef.IsValid: Boolean; +begin + Result := PCefCommandLine(FData)^.is_valid(PCefCommandLine(FData)) <> 0; +end; + +class function TCefCommandLineRef.New: ICefCommandLine; +begin + Result := UnWrap(cef_command_line_create); +end; + +procedure TCefCommandLineRef.PrependWrapper(const wrapper: ustring); +var + w: TCefString; +begin + w := CefString(wrapper); + PCefCommandLine(FData)^.prepend_wrapper(PCefCommandLine(FData), @w); +end; + +procedure TCefCommandLineRef.Reset; +begin + PCefCommandLine(FData)^.reset(PCefCommandLine(FData)); +end; + +procedure TCefCommandLineRef.SetProgram(const prog: ustring); +var + p: TCefString; +begin + p := CefString(prog); + PCefCommandLine(FData)^.set_program(PCefCommandLine(FData), @p); +end; + +class function TCefCommandLineRef.UnWrap(data: Pointer): ICefCommandLine; +begin + If data <> nil then Result := Create(data) //as ICefCommandLine + Else Result := nil; +end; + +{ TCefSchemeRegistrarRef } + +function TCefSchemeRegistrarRef.AddCustomScheme(const schemeName: ustring; + IsStandard, IsLocal, IsDisplayIsolated: Boolean): Boolean; cdecl; +var + sn: TCefString; +begin + sn := CefString(schemeName); + Result := PCefSchemeRegistrar(FData)^.add_custom_scheme(PCefSchemeRegistrar(FData), + @sn, Ord(IsStandard), Ord(IsLocal), Ord(IsDisplayIsolated)) <> 0; +end; + +class function TCefSchemeRegistrarRef.UnWrap( + data: Pointer): ICefSchemeRegistrar; +begin + If data <> nil then Result := Create(data) //as ICefSchemeRegistrar + Else Result := nil; +end; + +{ TCefGeolocationCallbackRef } + +procedure TCefGeolocationCallbackRef.Cont(allow: Boolean); +begin + PCefGeolocationCallback(FData)^.cont(PCefGeolocationCallback(FData), Ord(allow)); +end; + +class function TCefGeolocationCallbackRef.UnWrap(data: Pointer): ICefGeolocationCallback; +begin + If data <> nil then Result := Create(data) //as ICefGeolocationCallback + Else Result := nil; +end; + +{ TCefContextMenuParamsRef } + +function TCefContextMenuParamsRef.GetEditStateFlags: TCefContextMenuEditStateFlags; +begin + //Byte(Result) := PCefContextMenuParams(FData)^.get_edit_state_flags(PCefContextMenuParams(FData)); + Result := TCefContextMenuEditStateFlags(PCefContextMenuParams(FData)^.get_edit_state_flags(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetFrameCharset: ustring; +begin + Result := CefStringFreeAndGet(PCefContextMenuParams(FData)^.get_frame_charset(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetFrameUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefContextMenuParams(FData)^.get_frame_url(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetLinkUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefContextMenuParams(FData)^.get_link_url(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetMediaStateFlags: TCefContextMenuMediaStateFlags; +begin + //Word(Result) := PCefContextMenuParams(FData)^.get_media_state_flags(PCefContextMenuParams(FData)); + Result := TCefContextMenuMediaStateFlags(PCefContextMenuParams(FData)^.get_media_state_flags(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetMediaType: TCefContextMenuMediaType; +begin + Result := PCefContextMenuParams(FData)^.get_media_type(PCefContextMenuParams(FData)); +end; + +function TCefContextMenuParamsRef.GetPageUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefContextMenuParams(FData)^.get_page_url(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetSelectionText: ustring; +begin + Result := CefStringFreeAndGet(PCefContextMenuParams(FData)^.get_selection_text(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetSourceUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefContextMenuParams(FData)^.get_source_url(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetTypeFlags: TCefContextMenuTypeFlags; +begin + //Byte(Result) := PCefContextMenuParams(FData)^.get_type_flags(PCefContextMenuParams(FData)); + Result := TCefContextMenuTypeFlags(PCefContextMenuParams(FData)^.get_type_flags(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetUnfilteredLinkUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefContextMenuParams(FData)^.get_unfiltered_link_url(PCefContextMenuParams(FData))); +end; + +function TCefContextMenuParamsRef.GetXCoord: Integer; +begin + Result := PCefContextMenuParams(FData)^.get_xcoord(PCefContextMenuParams(FData)); +end; + +function TCefContextMenuParamsRef.GetYCoord: Integer; +begin + Result := PCefContextMenuParams(FData)^.get_ycoord(PCefContextMenuParams(FData)); +end; + +function TCefContextMenuParamsRef.IsEditable: Boolean; +begin + Result := PCefContextMenuParams(FData)^.is_editable(PCefContextMenuParams(FData)) <> 0; +end; + +function TCefContextMenuParamsRef.IsImageBlocked: Boolean; +begin + Result := PCefContextMenuParams(FData)^.is_image_blocked(PCefContextMenuParams(FData)) <> 0; +end; + +function TCefContextMenuParamsRef.IsSpeechInputEnabled: Boolean; +begin + Result := PCefContextMenuParams(FData)^.is_speech_input_enabled(PCefContextMenuParams(FData)) <> 0; +end; + +class function TCefContextMenuParamsRef.UnWrap(data: Pointer): ICefContextMenuParams; +begin + If data <> nil then Result := Create(data) //as ICefContextMenuParams + Else Result := nil; +end; + +{ TCefMenuModelRef } + +function TCefMenuModelRef.AddCheckItem(commandId: Integer; const text: ustring): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.add_check_item(PCefMenuModel(FData), commandId, @t) <> 0; +end; + +function TCefMenuModelRef.AddItem(commandId: Integer; const text: ustring): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.add_item(PCefMenuModel(FData), commandId, @t) <> 0; +end; + +function TCefMenuModelRef.AddRadioItem(commandId: Integer; const text: ustring; + groupId: Integer): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.add_radio_item(PCefMenuModel(FData), commandId, @t, groupId) <> 0; +end; + +function TCefMenuModelRef.AddSeparator: Boolean; +begin + Result := PCefMenuModel(FData)^.add_separator(PCefMenuModel(FData)) <> 0; +end; + +function TCefMenuModelRef.AddSubMenu(commandId: Integer; const text: ustring): ICefMenuModel; +var + t: TCefString; +begin + t := CefString(text); + Result := TCefMenuModelRef.UnWrap(PCefMenuModel(FData)^.add_sub_menu(PCefMenuModel(FData), commandId, @t)); +end; + +function TCefMenuModelRef.Clear: Boolean; +begin + Result := PCefMenuModel(FData)^.clear(PCefMenuModel(FData)) <> 0; +end; + +function TCefMenuModelRef.GetAccelerator(commandId: Integer; + out keyCode: Integer; out shiftPressed, ctrlPressed, + altPressed: Boolean): Boolean; +var + sp, cp, ap: Integer; +begin + Result := PCefMenuModel(FData)^.get_accelerator(PCefMenuModel(FData), + commandId, @keyCode, @sp, @cp, @ap) <> 0; + shiftPressed := sp <> 0; + ctrlPressed := cp <> 0; + altPressed := ap <> 0; +end; + +function TCefMenuModelRef.GetAcceleratorAt(index: Integer; out keyCode: Integer; + out shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; +var + sp, cp, ap: Integer; +begin + Result := PCefMenuModel(FData)^.get_accelerator_at(PCefMenuModel(FData), + index, @keyCode, @sp, @cp, @ap) <> 0; + shiftPressed := sp <> 0; + ctrlPressed := cp <> 0; + altPressed := ap <> 0; +end; + +function TCefMenuModelRef.GetCommandIdAt(index: Integer): Integer; +begin + Result := PCefMenuModel(FData)^.get_command_id_at(PCefMenuModel(FData), index); +end; + +function TCefMenuModelRef.GetCount: Integer; +begin + Result := PCefMenuModel(FData)^.get_count(PCefMenuModel(FData)); +end; + +function TCefMenuModelRef.GetGroupId(commandId: Integer): Integer; +begin + Result := PCefMenuModel(FData)^.get_group_id(PCefMenuModel(FData), commandId); +end; + +function TCefMenuModelRef.GetGroupIdAt(index: Integer): Integer; +begin + Result := PCefMenuModel(FData)^.get_group_id(PCefMenuModel(FData), index); +end; + +function TCefMenuModelRef.GetIndexOf(commandId: Integer): Integer; +begin + Result := PCefMenuModel(FData)^.get_index_of(PCefMenuModel(FData), commandId); +end; + +function TCefMenuModelRef.GetLabel(commandId: Integer): ustring; +begin + Result := CefStringFreeAndGet(PCefMenuModel(FData)^.get_label(PCefMenuModel(FData), commandId)); +end; + +function TCefMenuModelRef.GetLabelAt(index: Integer): ustring; +begin + Result := CefStringFreeAndGet(PCefMenuModel(FData)^.get_label_at(PCefMenuModel(FData), index)); +end; + +function TCefMenuModelRef.GetSubMenu(commandId: Integer): ICefMenuModel; +begin + Result := TCefMenuModelRef.UnWrap(PCefMenuModel(FData)^.get_sub_menu(PCefMenuModel(FData), commandId)); +end; + +function TCefMenuModelRef.GetSubMenuAt(index: Integer): ICefMenuModel; +begin + Result := TCefMenuModelRef.UnWrap(PCefMenuModel(FData)^.get_sub_menu_at(PCefMenuModel(FData), index)); +end; + +function TCefMenuModelRef.GetType(commandId: Integer): TCefMenuItemType; +begin + Result := PCefMenuModel(FData)^.get_type(PCefMenuModel(FData), commandId); +end; + +function TCefMenuModelRef.GetTypeAt(index: Integer): TCefMenuItemType; +begin + Result := PCefMenuModel(FData)^.get_type_at(PCefMenuModel(FData), index); +end; + +function TCefMenuModelRef.HasAccelerator(commandId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.has_accelerator(PCefMenuModel(FData), commandId) <> 0; +end; + +function TCefMenuModelRef.HasAcceleratorAt(index: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.has_accelerator_at(PCefMenuModel(FData), index) <> 0; +end; + +function TCefMenuModelRef.InsertCheckItemAt(index, commandId: Integer; const text: ustring): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.insert_check_item_at(PCefMenuModel(FData), index, commandId, @t) <> 0; +end; + +function TCefMenuModelRef.InsertItemAt(index, commandId: Integer; const text: ustring): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.insert_item_at(PCefMenuModel(FData), index, commandId, @t) <> 0; +end; + +function TCefMenuModelRef.InsertRadioItemAt(index, commandId: Integer; const text: ustring; groupId: Integer): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.insert_radio_item_at(PCefMenuModel(FData), + index, commandId, @t, groupId) <> 0; +end; + +function TCefMenuModelRef.InsertSeparatorAt(index: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.insert_separator_at(PCefMenuModel(FData), index) <> 0; +end; + +function TCefMenuModelRef.InsertSubMenuAt(index, commandId: Integer; const text: ustring): ICefMenuModel; +var + t: TCefString; +begin + t := CefString(text); + Result := TCefMenuModelRef.UnWrap(PCefMenuModel(FData)^.insert_sub_menu_at( + PCefMenuModel(FData), index, commandId, @t)); +end; + +function TCefMenuModelRef.IsChecked(commandId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.is_checked(PCefMenuModel(FData), commandId) <> 0; +end; + +function TCefMenuModelRef.IsCheckedAt(index: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.is_checked_at(PCefMenuModel(FData), index) <> 0; +end; + +function TCefMenuModelRef.IsEnabled(commandId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.is_enabled(PCefMenuModel(FData), commandId) <> 0; +end; + +function TCefMenuModelRef.IsEnabledAt(index: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.is_enabled_at(PCefMenuModel(FData), index) <> 0; +end; + +function TCefMenuModelRef.IsVisible(commandId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.is_visible(PCefMenuModel(FData), commandId) <> 0; +end; + +function TCefMenuModelRef.isVisibleAt(index: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.is_visible_at(PCefMenuModel(FData), index) <> 0; +end; + +function TCefMenuModelRef.Remove(commandId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.remove(PCefMenuModel(FData), commandId) <> 0; +end; + +function TCefMenuModelRef.RemoveAccelerator(commandId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.remove_accelerator(PCefMenuModel(FData), commandId) <> 0; +end; + +function TCefMenuModelRef.RemoveAcceleratorAt(index: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.remove_accelerator_at(PCefMenuModel(FData), index) <> 0; +end; + +function TCefMenuModelRef.RemoveAt(index: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.remove_at(PCefMenuModel(FData), index) <> 0; +end; + +function TCefMenuModelRef.SetAccelerator(commandId, keyCode: Integer; + shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_accelerator(PCefMenuModel(FData), + commandId, keyCode, Ord(shiftPressed), Ord(ctrlPressed), Ord(altPressed)) <> 0; +end; + +function TCefMenuModelRef.SetAcceleratorAt(index, keyCode: Integer; + shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_accelerator_at(PCefMenuModel(FData), + index, keyCode, Ord(shiftPressed), Ord(ctrlPressed), Ord(altPressed)) <> 0; +end; + +function TCefMenuModelRef.setChecked(commandId: Integer; checked: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_checked(PCefMenuModel(FData), + commandId, Ord(checked)) <> 0; +end; + +function TCefMenuModelRef.setCheckedAt(index: Integer; checked: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_checked_at(PCefMenuModel(FData), index, Ord(checked)) <> 0; +end; + +function TCefMenuModelRef.SetCommandIdAt(index, commandId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.set_command_id_at(PCefMenuModel(FData), index, commandId) <> 0; +end; + +function TCefMenuModelRef.SetEnabled(commandId: Integer; enabled: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_enabled(PCefMenuModel(FData), commandId, Ord(enabled)) <> 0; +end; + +function TCefMenuModelRef.SetEnabledAt(index: Integer; enabled: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_enabled_at(PCefMenuModel(FData), index, Ord(enabled)) <> 0; +end; + +function TCefMenuModelRef.SetGroupId(commandId, groupId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.set_group_id(PCefMenuModel(FData), commandId, groupId) <> 0; +end; + +function TCefMenuModelRef.SetGroupIdAt(index, groupId: Integer): Boolean; +begin + Result := PCefMenuModel(FData)^.set_group_id_at(PCefMenuModel(FData), index, groupId) <> 0; +end; + +function TCefMenuModelRef.SetLabel(commandId: Integer; const text: ustring): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.set_label(PCefMenuModel(FData), commandId, @t) <> 0; +end; + +function TCefMenuModelRef.SetLabelAt(index: Integer; const text: ustring): Boolean; +var + t: TCefString; +begin + t := CefString(text); + Result := PCefMenuModel(FData)^.set_label_at(PCefMenuModel(FData), index, @t) <> 0; +end; + +function TCefMenuModelRef.SetVisible(commandId: Integer; visible: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_visible(PCefMenuModel(FData), commandId, Ord(visible)) <> 0; +end; + +function TCefMenuModelRef.SetVisibleAt(index: Integer; visible: Boolean): Boolean; +begin + Result := PCefMenuModel(FData)^.set_visible_at(PCefMenuModel(FData), index, Ord(visible)) <> 0; +end; + +class function TCefMenuModelRef.UnWrap(data: Pointer): ICefMenuModel; +begin + If data <> nil then Result := Create(data) //as ICefMenuModel + Else Result := nil; +end; + +{ TCefListValueRef } + +function TCefListValueRef.Clear: Boolean; +begin + Result := PCefListValue(FData)^.clear(PCefListValue(FData)) <> 0; +end; + +function TCefListValueRef.Copy: ICefListValue; +begin + Result := UnWrap(PCefListValue(FData)^.copy(PCefListValue(FData))); +end; + +class function TCefListValueRef.New: ICefListValue; +begin + UnWrap(cef_list_value_create); +end; + +function TCefListValueRef.GetBinary(index: Integer): ICefBinaryValue; +begin + Result := TCefBinaryValueRef.UnWrap(PCefListValue(FData)^.get_binary(PCefListValue(FData), index)); +end; + +function TCefListValueRef.GetBool(index: Integer): Boolean; +begin + Result := PCefListValue(FData)^.get_bool(PCefListValue(FData), index) <> 0; +end; + +function TCefListValueRef.GetDictionary(index: Integer): ICefDictionaryValue; +begin + Result := TCefDictionaryValueRef.UnWrap(PCefListValue(FData)^.get_dictionary(PCefListValue(FData), index)); +end; + +function TCefListValueRef.GetDouble(index: Integer): Double; +begin + Result := PCefListValue(FData)^.get_double(PCefListValue(FData), index); +end; + +function TCefListValueRef.GetInt(index: Integer): Integer; +begin + Result := PCefListValue(FData)^.get_int(PCefListValue(FData), index); +end; + +function TCefListValueRef.GetList(index: Integer): ICefListValue; +begin + Result := UnWrap(PCefListValue(FData)^.get_list(PCefListValue(FData), index)); +end; + +function TCefListValueRef.GetSize: Cardinal; +begin + Result := PCefListValue(FData)^.get_size(PCefListValue(FData)); +end; + +function TCefListValueRef.GetString(index: Integer): ustring; +begin + Result := CefStringFreeAndGet(PCefListValue(FData)^.get_string(PCefListValue(FData), index)); +end; + +function TCefListValueRef.GetType(index: Integer): TCefValueType; +begin + Result := PCefListValue(FData)^.get_type(PCefListValue(FData), index); +end; + +function TCefListValueRef.IsOwned: Boolean; +begin + Result := PCefListValue(FData)^.is_owned(PCefListValue(FData)) <> 0; +end; + +function TCefListValueRef.IsReadOnly: Boolean; +begin + Result := PCefListValue(FData)^.is_read_only(PCefListValue(FData)) <> 0; +end; + +function TCefListValueRef.IsValid: Boolean; +begin + Result := PCefListValue(FData)^.is_valid(PCefListValue(FData)) <> 0; +end; + +function TCefListValueRef.Remove(index: Integer): Boolean; +begin + Result := PCefListValue(FData)^.remove(PCefListValue(FData), index) <> 0; +end; + +function TCefListValueRef.SetBinary(index: Integer; const value: ICefBinaryValue): Boolean; +begin + Result := PCefListValue(FData)^.set_binary(PCefListValue(FData), index, CefGetData(value)) <> 0; +end; + +function TCefListValueRef.SetBool(index: Integer; value: Boolean): Boolean; +begin + Result := PCefListValue(FData)^.set_bool(PCefListValue(FData), index, Ord(value)) <> 0; +end; + +function TCefListValueRef.SetDictionary(index: Integer; const value: ICefDictionaryValue): Boolean; +begin + Result := PCefListValue(FData)^.set_dictionary(PCefListValue(FData), index, CefGetData(value)) <> 0; +end; + +function TCefListValueRef.SetDouble(index: Integer; value: Double): Boolean; +begin + Result := PCefListValue(FData)^.set_double(PCefListValue(FData), index, value) <> 0; +end; + +function TCefListValueRef.SetInt(index, value: Integer): Boolean; +begin + Result := PCefListValue(FData)^.set_int(PCefListValue(FData), index, value) <> 0; +end; + +function TCefListValueRef.SetList(index: Integer; const value: ICefListValue): Boolean; +begin + Result := PCefListValue(FData)^.set_list(PCefListValue(FData), index, CefGetData(value)) <> 0; +end; + +function TCefListValueRef.SetNull(index: Integer): Boolean; +begin + Result := PCefListValue(FData)^.set_null(PCefListValue(FData), index) <> 0; +end; + +function TCefListValueRef.SetSize(size: Cardinal): Boolean; +begin + Result := PCefListValue(FData)^.set_size(PCefListValue(FData), size) <> 0; +end; + +function TCefListValueRef.SetString(index: Integer; const value: ustring): Boolean; +var + v: TCefString; +begin + v := CefString(value); + Result := PCefListValue(FData)^.set_string(PCefListValue(FData), index, @v) <> 0; +end; + +class function TCefListValueRef.UnWrap(data: Pointer): ICefListValue; +begin + If data <> nil then Result := Create(data) //as ICefListValue + Else Result := nil; +end; + +{ TCefBinaryValueRef } + +function TCefBinaryValueRef.Copy: ICefBinaryValue; +begin + Result := UnWrap(PCefBinaryValue(FData)^.copy(PCefBinaryValue(FData))); +end; + +function TCefBinaryValueRef.GetData(buffer: Pointer; bufferSize, + dataOffset: Cardinal): Cardinal; +begin + Result := PCefBinaryValue(FData)^.get_data(PCefBinaryValue(FData), buffer, bufferSize, dataOffset); +end; + +function TCefBinaryValueRef.GetSize: Cardinal; +begin + Result := PCefBinaryValue(FData)^.get_size(PCefBinaryValue(FData)); +end; + +function TCefBinaryValueRef.IsOwned: Boolean; +begin + Result := PCefBinaryValue(FData)^.is_owned(PCefBinaryValue(FData)) <> 0; +end; + +function TCefBinaryValueRef.IsValid: Boolean; +begin + Result := PCefBinaryValue(FData)^.is_valid(PCefBinaryValue(FData)) <> 0; +end; + +class function TCefBinaryValueRef.New(const data: Pointer; dataSize: Cardinal): ICefBinaryValue; +begin + Result := UnWrap(cef_binary_value_create(data, dataSize)); +end; + +class function TCefBinaryValueRef.UnWrap(data: Pointer): ICefBinaryValue; +begin + If data <> nil then Result := Create(data) //as ICefBinaryValue + Else Result := nil; +end; + +{ TCefDictionaryValueRef } + +function TCefDictionaryValueRef.Clear: Boolean; +begin + Result := PCefDictionaryValue(FData)^.clear(PCefDictionaryValue(FData)) <> 0; +end; + +function TCefDictionaryValueRef.Copy( + excludeEmptyChildren: Boolean): ICefDictionaryValue; +begin + Result := UnWrap(PCefDictionaryValue(FData)^.copy(PCefDictionaryValue(FData), Ord(excludeEmptyChildren))); +end; + +function TCefDictionaryValueRef.GetBinary(const key: ustring): ICefBinaryValue; +var + k: TCefString; +begin + k := CefString(key); + Result := TCefBinaryValueRef.UnWrap(PCefDictionaryValue(FData)^.get_binary(PCefDictionaryValue(FData), @k)); +end; + +function TCefDictionaryValueRef.GetBool(const key: ustring): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.get_bool(PCefDictionaryValue(FData), @k) <> 0; +end; + +function TCefDictionaryValueRef.GetDictionary( + const key: ustring): ICefDictionaryValue; +var + k: TCefString; +begin + k := CefString(key); + Result := UnWrap(PCefDictionaryValue(FData)^.get_dictionary(PCefDictionaryValue(FData), @k)); +end; + +function TCefDictionaryValueRef.GetDouble(const key: ustring): Double; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.get_double(PCefDictionaryValue(FData), @k); +end; + +function TCefDictionaryValueRef.GetInt(const key: ustring): Integer; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.get_int(PCefDictionaryValue(FData), @k); +end; + +function TCefDictionaryValueRef.GetKeys(const keys: TStrings): Boolean; +var + list: TCefStringList; + i: Integer; + str: TCefString; +begin + list := cef_string_list_alloc; + try + Result := PCefDictionaryValue(FData)^.get_keys(PCefDictionaryValue(FData), list) <> 0; + FillChar(str, SizeOf(str), 0); + For i := 0 to cef_string_list_size(list) - 1 do + begin + FillChar(str, SizeOf(str), 0); + cef_string_list_value(list, i, @str); + keys.Add(CefStringClearAndGet(str)); + end; + finally + cef_string_list_free(list); + end; +end; + +function TCefDictionaryValueRef.GetList(const key: ustring): ICefListValue; +var + k: TCefString; +begin + k := CefString(key); + Result := TCefListValueRef.UnWrap(PCefDictionaryValue(FData)^.get_list(PCefDictionaryValue(FData), @k)); +end; + +function TCefDictionaryValueRef.GetSize: Cardinal; +begin + Result := PCefDictionaryValue(FData)^.get_size(PCefDictionaryValue(FData)); +end; + +function TCefDictionaryValueRef.GetString(const key: ustring): ustring; +var + k: TCefString; +begin + k := CefString(key); + Result := CefStringFreeAndGet(PCefDictionaryValue(FData)^.get_string(PCefDictionaryValue(FData), @k)); +end; + +function TCefDictionaryValueRef.GetType(const key: ustring): TCefValueType; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.get_type(PCefDictionaryValue(FData), @k); +end; + +function TCefDictionaryValueRef.HasKey(const key: ustring): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.has_key(PCefDictionaryValue(FData), @k) <> 0; +end; + +function TCefDictionaryValueRef.isOwned: Boolean; +begin + Result := PCefDictionaryValue(FData)^.is_owned(PCefDictionaryValue(FData)) <> 0; +end; + +function TCefDictionaryValueRef.IsReadOnly: Boolean; +begin + Result := PCefDictionaryValue(FData)^.is_read_only(PCefDictionaryValue(FData)) <> 0; +end; + +function TCefDictionaryValueRef.IsValid: Boolean; +begin + Result := PCefDictionaryValue(FData)^.is_valid(PCefDictionaryValue(FData)) <> 0; +end; + +class function TCefDictionaryValueRef.New: ICefDictionaryValue; +begin + Result := UnWrap(cef_dictionary_value_create); +end; + +function TCefDictionaryValueRef.Remove(const key: ustring): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.remove(PCefDictionaryValue(FData), @k) <> 0; +end; + +function TCefDictionaryValueRef.SetBinary(const key: ustring; const value: ICefBinaryValue): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.set_binary(PCefDictionaryValue(FData), @k, CefGetData(value)) <> 0; +end; + +function TCefDictionaryValueRef.SetBool(const key: ustring; value: Boolean): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.set_bool(PCefDictionaryValue(FData), @k, Ord(value)) <> 0; +end; + +function TCefDictionaryValueRef.SetDictionary(const key: ustring; const value: ICefDictionaryValue): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.set_dictionary(PCefDictionaryValue(FData), @k, CefGetData(value)) <> 0; +end; + +function TCefDictionaryValueRef.SetDouble(const key: ustring; value: Double): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.set_double(PCefDictionaryValue(FData), @k, value) <> 0; +end; + +function TCefDictionaryValueRef.SetInt(const key: ustring; value: Integer): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.set_int(PCefDictionaryValue(FData), @k, value) <> 0; +end; + +function TCefDictionaryValueRef.SetList(const key: ustring; const value: ICefListValue): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.set_list(PCefDictionaryValue(FData), @k, CefGetData(value)) <> 0; +end; + +function TCefDictionaryValueRef.SetNull(const key: ustring): Boolean; +var + k: TCefString; +begin + k := CefString(key); + Result := PCefDictionaryValue(FData)^.set_null(PCefDictionaryValue(FData), @k) <> 0; +end; + +function TCefDictionaryValueRef.SetString(const key, value: ustring): Boolean; +var + k, v: TCefString; +begin + k := CefString(key); + v := CefString(value); + Result := PCefDictionaryValue(FData)^.set_string(PCefDictionaryValue(FData), @k, @v) <> 0; +end; + +class function TCefDictionaryValueRef.UnWrap(data: Pointer): ICefDictionaryValue; +begin + If data <> nil then Result := Create(data) //as ICefDictionaryValue + Else Result := nil; +end; + +{ TCefBrowserProcessHandlerOwn } + +constructor TCefBrowserProcessHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefBrowserProcessHandler)); + With PCefBrowserProcessHandler(FData)^ do + begin + on_context_initialized := @cef_browser_process_handler_on_context_initialized; + on_before_child_process_launch := @cef_browser_process_handler_on_before_child_process_launch; + on_render_process_thread_created := @cef_browser_process_handler_on_render_process_thread_created; + end; +end; + +procedure TCefBrowserProcessHandlerOwn.OnBeforeChildProcessLaunch( + const commandLine: ICefCommandLine); +begin + +end; + +procedure TCefBrowserProcessHandlerOwn.OnContextInitialized; +begin + +end; + +procedure TCefBrowserProcessHandlerOwn.OnRenderProcessThreadCreated(const extraInfo: ICefListValue); +begin + +end; + +{ TCefRenderProcessHandlerOwn } + +constructor TCefRenderProcessHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefRenderProcessHandler)); + With PCefRenderProcessHandler(FData)^ do + begin + on_render_thread_created := @cef_render_process_handler_on_render_thread_created; + on_web_kit_initialized := @cef_render_process_handler_on_web_kit_initialized; + on_browser_created := @cef_render_process_handler_on_browser_created; + on_browser_destroyed := @cef_render_process_handler_on_browser_destroyed; + on_before_navigation := @cef_render_process_handler_on_before_navigation; + on_context_created := @cef_render_process_handler_on_context_created; + on_context_released := @cef_render_process_handler_on_context_released; + on_uncaught_exception := @cef_render_process_handler_on_uncaught_exception; + on_worker_context_created := @cef_render_process_handler_on_worker_context_created; + on_worker_context_released := @cef_render_process_handler_on_worker_context_released; + on_worker_uncaught_exception := @cef_render_process_handler_on_worker_uncaught_exception; + on_focused_node_changed := @cef_render_process_handler_on_focused_node_changed; + on_process_message_received := @cef_render_process_handler_on_process_message_received; + end; +end; + +function TCefRenderProcessHandlerOwn.OnBeforeNavigation( + const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; navigationType: TCefNavigationType; + isRedirect: Boolean): Boolean; +begin + Result := False; +end; + +procedure TCefRenderProcessHandlerOwn.OnBrowserCreated( const browser: ICefBrowser); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnBrowserDestroyed(const browser: ICefBrowser); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnContextCreated( + const browser: ICefBrowser; const frame: ICefFrame; + const context: ICefv8Context); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnContextReleased( + const browser: ICefBrowser; const frame: ICefFrame; + const context: ICefv8Context); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnFocusedNodeChanged( + const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode); +begin + +end; + +function TCefRenderProcessHandlerOwn.OnProcessMessageReceived( + const browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage): Boolean; +begin + Result := False; +end; + +procedure TCefRenderProcessHandlerOwn.OnRenderThreadCreated(const extraInfo: ICefListValue); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnUncaughtException( + const browser: ICefBrowser; const frame: ICefFrame; + const context: ICefv8Context; const exception: ICefV8Exception; + const stackTrace: ICefV8StackTrace); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnWebKitInitialized; +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnWorkerContextCreated(workerId: Integer; + const url: ustring; const context: ICefv8Context); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnWorkerContextReleased(workerId: Integer; + const url: ustring; const context: ICefv8Context); +begin + +end; + +procedure TCefRenderProcessHandlerOwn.OnWorkerUncaughtException( + workerId: Integer; const url: ustring; const context: ICefv8Context; + const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace); +begin + +end; + +{ TCefResourceHandlerOwn } + +procedure TCefResourceHandlerOwn.Cancel; +begin + +end; + +function TCefResourceHandlerOwn.CanGetCookie(const cookie: PCefCookie): Boolean; +begin + Result := False; +end; + +function TCefResourceHandlerOwn.CanSetCookie(const cookie: PCefCookie): Boolean; +begin + Result := False; +end; + +constructor TCefResourceHandlerOwn.Create(const browser: ICefBrowser; + const frame: ICefFrame; const schemeName: ustring; + const request: ICefRequest); +begin + inherited CreateData(SizeOf(TCefResourceHandler)); + With PCefResourceHandler(FData)^ do + begin + process_request := @cef_resource_handler_process_request; + get_response_headers := @cef_resource_handler_get_response_headers; + read_response := @cef_resource_handler_read_response; + can_get_cookie := @cef_resource_handler_can_get_cookie; + can_set_cookie := @cef_resource_handler_can_set_cookie; + cancel:= @cef_resource_handler_cancel; + end; +end; + +procedure TCefResourceHandlerOwn.GetResponseHeaders( + const response: ICefResponse; out responseLength: Int64; + out redirectUrl: ustring); +begin + +end; + +function TCefResourceHandlerOwn.ProcessRequest(const request: ICefRequest; + const callback: ICefCallback): Boolean; +begin + Result := False; +end; + +function TCefResourceHandlerOwn.ReadResponse(const dataOut: Pointer; + bytesToRead: Integer; var bytesRead: Integer; + const callback: ICefCallback): Boolean; +begin + Result := False; +end; + +{ TCefSchemeHandlerFactoryOwn } + +constructor TCefSchemeHandlerFactoryOwn.Create( + const AClass: TCefResourceHandlerClass; SyncMainThread: Boolean); +begin + inherited CreateData(SizeOf(TCefSchemeHandlerFactory)); + FClass := AClass; + PCefSchemeHandlerFactory(FData)^.create := @cef_scheme_handler_factory_create; +end; + +function TCefSchemeHandlerFactoryOwn.New(const browser: ICefBrowser; + const frame: ICefFrame; const schemeName: ustring; + const request: ICefRequest): ICefResourceHandler; +begin + Result := FClass.Create(browser, frame, schemeName, request); +end; + +{ TCefCallbackRef } + +procedure TCefCallbackRef.Cancel; +begin + PCefCallback(FData)^.cancel(PCefCallback(FData)); +end; + +procedure TCefCallbackRef.Cont; +begin + PCefCallback(FData)^.cont(PCefCallback(FData)); +end; + +class function TCefCallbackRef.UnWrap(data: Pointer): ICefCallback; +begin + If data <> nil then Result := Create(data) //as ICefCallback + Else Result := nil; +end; + + +{ TCefUrlrequestClientOwn } + +constructor TCefUrlrequestClientOwn.Create; +begin + inherited CreateData(SizeOf(TCefUrlrequestClient)); + With PCefUrlrequestClient(FData)^ do + begin + on_request_complete := @cef_url_request_client_on_request_complete; + on_upload_progress := @cef_url_request_client_on_upload_progress; + on_download_progress := @cef_url_request_client_on_download_progress; + on_download_data := @cef_url_request_client_on_download_data; + end; +end; + +procedure TCefUrlrequestClientOwn.OnDownloadData(const request: ICefUrlRequest; + data: Pointer; dataLength: Cardinal); +begin + +end; + +procedure TCefUrlrequestClientOwn.OnDownloadProgress( + const request: ICefUrlRequest; current, total: UInt64); +begin + +end; + +procedure TCefUrlrequestClientOwn.OnRequestComplete( + const request: ICefUrlRequest); +begin + +end; + +procedure TCefUrlrequestClientOwn.OnUploadProgress( + const request: ICefUrlRequest; current, total: UInt64); +begin + +end; + +{ TCefUrlRequestRef } + +procedure TCefUrlRequestRef.Cancel; +begin + PCefUrlRequest(FData)^.cancel(PCefUrlRequest(FData)); +end; + +class function TCefUrlRequestRef.New(const request: ICefRequest; + const client: ICefUrlRequestClient): ICefUrlRequest; +begin + Result := UnWrap(cef_urlrequest_create(CefGetData(request), CefGetData(client))); +end; + +function TCefUrlRequestRef.GetRequest: ICefRequest; +begin + Result := TCefRequestRef.UnWrap(PCefUrlRequest(FData)^.get_request(PCefUrlRequest(FData))); +end; + +function TCefUrlRequestRef.GetRequestError: Integer; +begin + Result := PCefUrlRequest(FData)^.get_request_error(PCefUrlRequest(FData)); +end; + +function TCefUrlRequestRef.GetRequestStatus: TCefUrlRequestStatus; +begin + Result := PCefUrlRequest(FData)^.get_request_status(PCefUrlRequest(FData)); +end; + +function TCefUrlRequestRef.GetResponse: ICefResponse; +begin + Result := TCefResponseRef.UnWrap(PCefUrlRequest(FData)^.get_response(PCefUrlRequest(FData))); +end; + +class function TCefUrlRequestRef.UnWrap(data: Pointer): ICefUrlRequest; +begin + If data <> nil then Result := Create(data) //as ICefUrlRequest + Else Result := nil; +end; + + +{ TCefWebPluginInfoVisitorOwn } + +constructor TCefWebPluginInfoVisitorOwn.Create; +begin + inherited CreateData(SizeOf(TCefWebPluginInfoVisitor)); + PCefWebPluginInfoVisitor(FData)^.visit := @cef_web_plugin_info_visitor_visit; +end; + +function TCefWebPluginInfoVisitorOwn.Visit(const info: ICefWebPluginInfo; count, total: Integer): Boolean; +begin + Result := False; +end; + +{ TCefFastWebPluginInfoVisitor } + +constructor TCefFastWebPluginInfoVisitor.Create(const proc: TCefWebPluginInfoVisitorProc); +begin + inherited Create; + FProc := proc; +end; + +function TCefFastWebPluginInfoVisitor.Visit(const info: ICefWebPluginInfo; + count, total: Integer): Boolean; +begin + Result := FProc(info, count, total); +end; + +{ TCefQuotaCallbackRef } + +procedure TCefQuotaCallbackRef.Cancel; +begin + PCefQuotaCallback(FData)^.cancel(FData); +end; + +procedure TCefQuotaCallbackRef.Cont(allow: Boolean); +begin + PCefQuotaCallback(FData)^.cont(FData, Ord(allow)); +end; + +class function TCefQuotaCallbackRef.UnWrap(data: Pointer): ICefQuotaCallback; +begin + If data <> nil then Result := Create(data) //as ICefQuotaCallback + Else Result := nil; +end; + +{ TCefV8StackFrameRef } + +function TCefV8StackFrameRef.GetColumn: Integer; +begin + Result := PCefV8StackFrame(FData)^.get_column(FData); +end; + +function TCefV8StackFrameRef.GetFunctionName: ustring; +begin + Result := CefStringFreeAndGet(PCefV8StackFrame(FData)^.get_function_name(FData)); +end; + +function TCefV8StackFrameRef.GetLineNumber: Integer; +begin + Result := PCefV8StackFrame(FData)^.get_line_number(FData); +end; + +function TCefV8StackFrameRef.GetScriptName: ustring; +begin + Result := CefStringFreeAndGet(PCefV8StackFrame(FData)^.get_script_name(FData)); +end; + +function TCefV8StackFrameRef.GetScriptNameOrSourceUrl: ustring; +begin + Result := CefStringFreeAndGet(PCefV8StackFrame(FData)^.get_script_name_or_source_url(FData)); +end; + +function TCefV8StackFrameRef.IsConstructor: Boolean; +begin + Result := PCefV8StackFrame(FData)^.is_constructor(FData) <> 0; +end; + +function TCefV8StackFrameRef.IsEval: Boolean; +begin + Result := PCefV8StackFrame(FData)^.is_eval(FData) <> 0; +end; + +function TCefV8StackFrameRef.IsValid: Boolean; +begin + Result := PCefV8StackFrame(FData)^.is_valid(FData) <> 0; +end; + +class function TCefV8StackFrameRef.UnWrap(data: Pointer): ICefV8StackFrame; +begin + If data <> nil then Result := Create(data) //as ICefV8StackFrame + Else Result := nil; +end; + +{ TCefV8StackTraceRef } + +class function TCefV8StackTraceRef.Current(frameLimit: Integer): ICefV8StackTrace; +begin + Result := UnWrap(cef_v8stack_trace_get_current(frameLimit)); +end; + +function TCefV8StackTraceRef.GetFrame(index: Integer): ICefV8StackFrame; +begin + Result := TCefV8StackFrameRef.UnWrap(PCefV8StackTrace(FData)^.get_frame(FData, index)); +end; + +function TCefV8StackTraceRef.GetFrameCount: Integer; +begin + Result := PCefV8StackTrace(FData)^.get_frame_count(FData); +end; + +function TCefV8StackTraceRef.IsValid: Boolean; +begin + Result := PCefV8StackTrace(FData)^.is_valid(FData) <> 0; +end; + +class function TCefV8StackTraceRef.UnWrap(data: Pointer): ICefV8StackTrace; +begin + If data <> nil then Result := Create(data) //as ICefV8StackTrace + Else Result := nil; +end; + +{ TCefWebPluginUnstableCallbackOwn } + +constructor TCefWebPluginUnstableCallbackOwn.Create; +begin + inherited CreateData(SizeOf(TCefWebPluginUnstableCallback)); + PCefWebPluginUnstableCallback(FData)^.is_unstable := @cef_web_plugin_unstable_callback_is_unstable; +end; + +procedure TCefWebPluginUnstableCallbackOwn.IsUnstable(const path: ustring; + unstable: Boolean); +begin + +end; + +{ TCefFastWebPluginUnstableCallback } + +constructor TCefFastWebPluginUnstableCallback.Create( + const callback: TCefWebPluginIsUnstableProc); +begin + FCallback := callback; +end; + +procedure TCefFastWebPluginUnstableCallback.IsUnstable(const path: ustring; unstable: Boolean); +begin + FCallback(path, unstable); +end; + +{ TCefRunFileDialogCallbackOwn } + +procedure TCefRunFileDialogCallbackOwn.Cont(const browserHost: ICefBrowserHost; filePaths: TStrings); +begin + +end; + +constructor TCefRunFileDialogCallbackOwn.Create; +begin + inherited CreateData(SizeOf(TCefRunFileDialogCallback)); + + PCefRunFileDialogCallback(FData)^.cont := @cef_run_file_dialog_callback_cont; +end; + +{ TCefFastRunFileDialogCallback } + +procedure TCefFastRunFileDialogCallback.Cont(const browserHost: ICefBrowserHost; filePaths: TStrings); +begin + FCallback(browserHost, filePaths); +end; + +constructor TCefFastRunFileDialogCallback.Create( callback: TCefRunFileDialogCallbackProc); +begin + inherited Create; + FCallback := callback; +end; + +{ TCefTaskRef } + +procedure TCefTaskRef.Execute; +begin + PCefTask(FData)^.execute(FData); +end; + +class function TCefTaskRef.UnWrap(data: Pointer): ICefTask; +begin + If data <> nil then Result := Create(data) //as ICefTask + Else Result := nil; +end; + +{ TCefTaskRunnerRef } + +function TCefTaskRunnerRef.BelongsToCurrentThread: Boolean; +begin + Result := PCefTaskRunner(FData)^.belongs_to_current_thread(FData) <> 0; +end; + +function TCefTaskRunnerRef.BelongsToThread(threadId: TCefThreadId): Boolean; +begin + Result := PCefTaskRunner(FData)^.belongs_to_thread(FData, threadId) <> 0; +end; + +class function TCefTaskRunnerRef.GetForCurrentThread: ICefTaskRunner; +begin + Result := UnWrap(cef_task_runner_get_for_current_thread()); +end; + +class function TCefTaskRunnerRef.GetForThread(threadId: TCefThreadId): ICefTaskRunner; +begin + Result := UnWrap(cef_task_runner_get_for_thread(threadId)); +end; + +function TCefTaskRunnerRef.IsSame(const that: ICefTaskRunner): Boolean; +begin + Result := PCefTaskRunner(FData)^.is_same(FData, CefGetData(that)) <> 0; +end; + +function TCefTaskRunnerRef.PostDelayedTask(const task: ICefTask; delayMs: Int64): Boolean; +begin + Result := PCefTaskRunner(FData)^.post_delayed_task(FData, CefGetData(task), delayMs) <> 0; +end; + +function TCefTaskRunnerRef.PostTask(const task: ICefTask): Boolean; cdecl; +begin + Result := PCefTaskRunner(FData)^.post_task(FData, CefGetData(task)) <> 0; +end; + +class function TCefTaskRunnerRef.UnWrap(data: Pointer): ICefTaskRunner; +begin + //If data <> nil then Result := Create(data) as ICefTaskRunner + If data <> nil then Result := Create(data) + Else Result := nil; +end; + +{ TCefTraceClientOwn } + +constructor TCefTraceClientOwn.Create; +begin + inherited CreateData(SizeOf(TCefTraceClient)); + With PCefTraceClient(FData)^ do + begin + on_trace_data_collected := @cef_trace_client_on_trace_data_collected; + on_trace_buffer_percent_full_reply := @cef_trace_client_on_trace_buffer_percent_full_reply; + on_end_tracing_complete := @cef_trace_client_on_end_tracing_complete; + end; +end; + +procedure TCefTraceClientOwn.OnEndTracingComplete; +begin + +end; + +procedure TCefTraceClientOwn.OnTraceBufferPercentFullReply(percentFull: Single); +begin + +end; + +procedure TCefTraceClientOwn.OnTraceDataCollected(const fragment: PAnsiChar; fragmentSize: Cardinal); +begin + +end; + +{ TCefGetGeolocationCallbackOwn } + +constructor TCefGetGeolocationCallbackOwn.Create; +begin + inherited CreateData(SizeOf(TCefGetGeolocationCallback)); + PCefGetGeolocationCallback(FData)^.on_location_update := @cef_get_geolocation_callback_on_location_update; +end; + +procedure TCefGetGeolocationCallbackOwn.OnLocationUpdate(const position: PCefGeoposition); +begin + +end; + +{ TCefFastGetGeolocationCallback } + +constructor TCefFastGetGeolocationCallback.Create(const callback: TOnLocationUpdate); +begin + inherited Create; + FCallback := callback; +end; + +procedure TCefFastGetGeolocationCallback.OnLocationUpdate(const position: PCefGeoposition); +begin + FCallback(position); +end; + +{ TCefFileDialogCallbackRef } + +procedure TCefFileDialogCallbackRef.Cancel; +begin + PCefFileDialogCallback(FData)^.cancel(FData); +end; + +procedure TCefFileDialogCallbackRef.Cont(filePaths: TStrings); +Var + list: TCefStringList; + i: Integer; + str: TCefString; +begin + list := cef_string_list_alloc; + try + For i := 0 to filePaths.Count - 1 do + begin + str := CefString(filePaths[i]); + cef_string_list_append(list, @str); + end; + PCefFileDialogCallback(FData)^.cont(FData, list); + finally + cef_string_list_free(list); + end; +end; + +class function TCefFileDialogCallbackRef.UnWrap(data: Pointer): ICefFileDialogCallback; +begin + //If data <> nil then Result := Create(data) as ICefFileDialogCallback + If data <> nil then Result := Create(data) + Else Result := nil; +end; + +{ TCefDialogHandlerOwn } + +constructor TCefDialogHandlerOwn.Create; +begin + CreateData(SizeOf(TCefDialogHandler)); + PCefDialogHandler(FData)^.on_file_dialog := @cef_dialog_handler_on_file_dialog; +end; + +function TCefDialogHandlerOwn.OnFileDialog(const browser: ICefBrowser; + mode: TCefFileDialogMode; const title, defaultFileName: ustring; + acceptTypes: TStrings; const callback: ICefFileDialogCallback): Boolean; +begin + Result := False; +end; + +{ TCefRenderHandlerOwn } + +constructor TCefRenderHandlerOwn.Create; +begin + CreateData(SizeOf(TCefRenderHandler), False); + With PCefRenderHandler(FData)^ do + begin + get_root_screen_rect := @cef_render_handler_get_root_screen_rect; + get_view_rect := @cef_render_handler_get_view_rect; + get_screen_point := @cef_render_handler_get_screen_point; + on_popup_show := @cef_render_handler_on_popup_show; + on_popup_size := @cef_render_handler_on_popup_size; + on_paint := @cef_render_handler_on_paint; + on_cursor_change := @cef_render_handler_on_cursor_change; + end; +end; + +function TCefRenderHandlerOwn.GetRootScreenRect(const browser: ICefBrowser; rect: PCefRect): Boolean; +begin + Result := False; +end; + +function TCefRenderHandlerOwn.GetScreenPoint(const browser: ICefBrowser; viewX, viewY: Integer; screenX, screenY: PInteger): Boolean; +begin + Result := False; +end; + +function TCefRenderHandlerOwn.GetViewRect(const browser: ICefBrowser; rect: PCefRect): Boolean; +begin + Result := False; +end; + +procedure TCefRenderHandlerOwn.OnCursorChange(const browser: ICefBrowser; cursor: TCefCursorHandle); +begin + +end; + +procedure TCefRenderHandlerOwn.OnPaint(const browser: ICefBrowser; + kind: TCefPaintElementType; dirtyRectsCount: Cardinal; + const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); +begin + +end; + +procedure TCefRenderHandlerOwn.OnPopupShow(const browser: ICefBrowser; show: Boolean); +begin + +end; + +procedure TCefRenderHandlerOwn.OnPopupSize(const browser: ICefBrowser; const rect: PCefRect); +begin + +end; + +Finalization + CefShutDown; + +end. diff --git a/cef3gui.pas b/cef3gui.pas new file mode 100644 index 0000000..7862de7 --- /dev/null +++ b/cef3gui.pas @@ -0,0 +1,1043 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Ported to Free Pascal and Linux by d.l.i.w <dev.dliw@gmail.com> + * based on 'Delphi Chromium Embedded' + * + * Repository: http://github.com/dliw/fpCEF3 + * + * + * Originally created for Delphi by: Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + +Unit cef3gui; + +{$I cef.inc} + +Interface + +Uses + Classes, + cef3lib, cef3intf, cef3class; + +Type + TOnProcessMessageReceived = procedure(Sender: TObject; const Browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean) of object; + + TOnLoadStart = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame) of object; + TOnLoadEnd = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; httpStatusCode: Integer) of object; + TOnLoadError = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring) of object; + TOnRenderProcessTerminated = procedure(Sender: TObject; const Browser: ICefBrowser; status: TCefTerminationStatus) of object; + TOnPluginCrashed = procedure(Sender: TObject; const Browser: ICefBrowser; const pluginPath: ustring) of object; + + TOnTakeFocus = procedure(Sender: TObject; const Browser: ICefBrowser; next: Boolean) of object; + TOnSetFocus = procedure(Sender: TObject; const Browser: ICefBrowser; Source: TCefFocusSource; out Result: Boolean) of object; + TOnGotFocus = procedure(Sender: TObject; const Browser: ICefBrowser) of object; + + TOnBeforeContextMenu = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel) of object; + TOnContextMenuCommand = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags; out Result: Boolean) of object; + TOnContextMenuDismissed = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame) of object; + + TOnPreKeyEvent = procedure(Sender: TObject; const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean; out Result: Boolean) of object; + TOnKeyEvent = procedure(Sender: TObject; const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out Result: Boolean) of object; + + TOnLoadingStateChange = procedure(Sender: TObject; const Browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean) of object; + TOnAddressChange = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; const url: ustring) of object; + TOnTitleChange = procedure(Sender: TObject; const Browser: ICefBrowser; const title: ustring) 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; + TOnConsoleMessage = procedure(Sender: TObject; const Browser: ICefBrowser; const message, Source: ustring; line: Integer; 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) of object; + TOnCancelGeolocationPermission = procedure(Sender: TObject; const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer) of object; + + TOnJsdialog = procedure(Sender: TObject; const Browser: ICefBrowser; const originUrl, acceptLang: ustring; + dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; + callback: ICefJsDialogCallback; out suppressMessage: Boolean; out Result: Boolean) of object; + TOnBeforeUnloadDialog = procedure(Sender: TObject; const Browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback; out Result: Boolean) of object; + TOnResetDialogState = procedure(Sender: TObject; const Browser: ICefBrowser) of object; + + TOnBeforePopup = procedure(Sender: TObject; const Browser: ICefBrowser; + const Frame: ICefFrame; const targetUrl, targetFrameName: ustring; + var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; + var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean; out Result: Boolean) of object; + + TOnAfterCreated = procedure(Sender: TObject; const Browser: ICefBrowser) of object; + TOnBeforeClose = procedure(Sender: TObject; const Browser: ICefBrowser) of object; + TOnRunModal = procedure(Sender: TObject; const Browser: ICefBrowser; out Result: Boolean) of object; + TOnClose = procedure(Sender: TObject; const Browser: ICefBrowser; out Result: Boolean) of object; + + TOnBeforeResourceLoad = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest; out Result: Boolean) of object; + TOnGetResourceHandler = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest; out Result: ICefResourceHandler) of object; + TOnResourceRedirect = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; + const oldUrl: ustring; var newUrl: ustring) of object; + TOnGetAuthCredentials = procedure(Sender: TObject; const Browser: ICefBrowser; const Frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback; out Result: Boolean) of object; + TOnQuotaRequest = procedure(Sender: TObject; const Browser: ICefBrowser; + const originUrl: ustring; newSize: Int64; const callback: ICefQuotaCallback; + out Result: Boolean) of object; + TOnGetCookieManager = procedure(Sender: TObject; const Browser: ICefBrowser; + const mainUrl: ustring; out Result: ICefCookieManager) of object; + TOnProtocolExecution = procedure(Sender: TObject; const Browser: ICefBrowser; + const url: ustring; out allowOsExecution: Boolean) of object; + + TOnBeforePluginLoad = procedure(Sender: TObject; const Browser: ICefBrowser; + const url, policyUrl: ustring; const info: ICefWebPluginInfo; out Result: Boolean) of Object; + + TOnFileDialog = procedure(Sender: TObject; const Browser: ICefBrowser; + mode: TCefFileDialogMode; const title, defaultFileName: ustring; + acceptTypes: TStrings; const callback: ICefFileDialogCallback; + out Result: Boolean) of Object; + + TOnGetRootScreenRect = procedure(Sender: TObject; const Browser: ICefBrowser; + rect: PCefRect; out Result: Boolean) of Object; + TOnGetViewRect = procedure(Sender: TObject; const Browser: ICefBrowser; + rect: PCefRect; out Result: Boolean) of Object; + TOnGetScreenPoint = procedure(Sender: TObject; const Browser: ICefBrowser; + viewX, viewY: Integer; screenX, screenY: PInteger; out Result: Boolean) of Object; + TOnPopupShow = procedure(Sender: TObject; const Browser: ICefBrowser; + show: Boolean) of Object; + TOnPopupSize = procedure(Sender: TObject; const Browser: ICefBrowser; + const rect: PCefRect) of Object; + TOnPaint = procedure(Sender: TObject; const Browser: ICefBrowser; + kind: TCefPaintElementType; dirtyRectsCount: Cardinal; const dirtyRects: PCefRectArray; + const buffer: Pointer; width, height: Integer) of Object; + TOnCursorChange = procedure(Sender: TObject; const Browser: ICefBrowser; + cursor: TCefCursorHandle) of Object; + + TChromiumOptions = class(TPersistent) + private + FJavascript: TCefState; + FJavascriptOpenWindows: TCefState; + FJavascriptCloseWindows: TCefState; + FJavascriptAccessClipboard: TCefState; + FJavascriptDomPaste: TCefState; + FCaretBrowsing: TCefState; + FJava: TCefState; + FPlugins: TCefState; + FUniversalAccessFromFileUrls: TCefState; + FFileAccessFromFileUrls: TCefState; + FWebSecurity: TCefState; + FImageLoading: TCefState; + FImageShrinkStandaloneToFit: TCefState; + FTextAreaResize: TCefState; + FPageCache: TCefState; + FTabToLinks: TCefState; + FAuthorAndUserStyles: TCefState; + FLocalStorage: TCefState; + FDatabases: TCefState; + FApplicationCache: TCefState; + FWebgl: TCefState; + FAcceleratedCompositing: TCefState; + FDeveloperTools: TCefState; + published + property Javascript: TCefState read FJavascript write FJavascript default STATE_DEFAULT; + property JavascriptOpenWindows: TCefState read FJavascriptOpenWindows write FJavascriptOpenWindows default STATE_DEFAULT; + property JavascriptCloseWindows: TCefState read FJavascriptCloseWindows write FJavascriptCloseWindows default STATE_DEFAULT; + property JavascriptAccessClipboard: TCefState read FJavascriptAccessClipboard write FJavascriptAccessClipboard default STATE_DEFAULT; + property JavascriptDomPaste: TCefState read FJavascriptDomPaste write FJavascriptDomPaste default STATE_DEFAULT; + property CaretBrowsing: TCefState read FCaretBrowsing write FCaretBrowsing default STATE_DEFAULT; + property Java: TCefState read FJava write FJava default STATE_DEFAULT; + property Plugins: TCefState read FPlugins write FPlugins default STATE_DEFAULT; + property UniversalAccessFromFileUrls: TCefState read FUniversalAccessFromFileUrls write FUniversalAccessFromFileUrls default STATE_DEFAULT; + property FileAccessFromFileUrls: TCefState read FFileAccessFromFileUrls write FFileAccessFromFileUrls default STATE_DEFAULT; + property WebSecurity: TCefState read FWebSecurity write FWebSecurity default STATE_DEFAULT; + property ImageLoading: TCefState read FImageLoading write FImageLoading default STATE_DEFAULT; + property ImageShrinkStandaloneToFit: TCefState read FImageShrinkStandaloneToFit write FImageShrinkStandaloneToFit default STATE_DEFAULT; + property TextAreaResize: TCefState read FTextAreaResize write FTextAreaResize default STATE_DEFAULT; + property PageCache: TCefState read FPageCache write FPageCache default STATE_DEFAULT; + property TabToLinks: TCefState read FTabToLinks write FTabToLinks default STATE_DEFAULT; + property AuthorAndUserStyles: TCefState read FAuthorAndUserStyles write FAuthorAndUserStyles default STATE_DEFAULT; + property LocalStorage: TCefState read FLocalStorage write FLocalStorage default STATE_DEFAULT; + property Databases: TCefState read FDatabases write FDatabases default STATE_DEFAULT; + property ApplicationCache: TCefState read FApplicationCache write FApplicationCache default STATE_DEFAULT; + property Webgl: TCefState read FWebgl write FWebgl default STATE_DEFAULT; + property AcceleratedCompositing: TCefState read FAcceleratedCompositing write FAcceleratedCompositing default STATE_DEFAULT; + property DeveloperTools: TCefState read FDeveloperTools write FDeveloperTools default STATE_DEFAULT; + end; + + TChromiumFontOptions = class(TPersistent) + private + FStandardFontFamily: ustring; + FCursiveFontFamily: ustring; + FSansSerifFontFamily: ustring; + FMinimumLogicalFontSize: Integer; + FFantasyFontFamily: ustring; + FSerifFontFamily: ustring; + FDefaultFixedFontSize: Integer; + FDefaultFontSize: Integer; + FRemoteFontsDisabled: TCefState; + FFixedFontFamily: ustring; + FMinimumFontSize: Integer; + public + constructor Create; virtual; + published + property StandardFontFamily: ustring read FStandardFontFamily; + property FixedFontFamily: ustring read FFixedFontFamily write FFixedFontFamily; + property SerifFontFamily: ustring read FSerifFontFamily write FSerifFontFamily; + property SansSerifFontFamily: ustring read FSansSerifFontFamily write FSansSerifFontFamily; + property CursiveFontFamily: ustring read FCursiveFontFamily write FCursiveFontFamily; + property FantasyFontFamily: ustring read FFantasyFontFamily write FFantasyFontFamily; + property DefaultFontSize: Integer read FDefaultFontSize write FDefaultFontSize default 0; + property DefaultFixedFontSize: Integer read FDefaultFixedFontSize write FDefaultFixedFontSize default 0; + property MinimumFontSize: Integer read FMinimumFontSize write FMinimumFontSize default 0; + property MinimumLogicalFontSize: Integer read FMinimumLogicalFontSize write FMinimumLogicalFontSize default 0; + property RemoteFonts: TCefState read FRemoteFontsDisabled write FRemoteFontsDisabled default STATE_DEFAULT; + end; + + IChromiumEvents = interface + //['{0C139DB1-0349-4D7F-8155-76FEA6A0126D}'] + procedure GetSettings(var settings: TCefBrowserSettings); + function doOnProcessMessageReceived(const Browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; + + procedure doOnLoadStart(const Browser: ICefBrowser; const Frame: ICefFrame); + procedure doOnLoadEnd(const Browser: ICefBrowser; const Frame: ICefFrame; httpStatusCode: Integer); + procedure doOnLoadError(const Browser: ICefBrowser; const Frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring); + procedure doOnRenderProcessTerminated(const Browser: ICefBrowser; status: TCefTerminationStatus); + procedure doOnPluginCrashed(const Browser: ICefBrowser; const pluginPath: ustring); + + procedure doOnTakeFocus(const Browser: ICefBrowser; next: Boolean); + function doOnSetFocus(const Browser: ICefBrowser; Source: TCefFocusSource): Boolean; + procedure doOnGotFocus(const Browser: ICefBrowser); + + procedure doOnBeforeContextMenu(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + function doOnContextMenuCommand(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags): Boolean; + procedure doOnContextMenuDismissed(const Browser: ICefBrowser; const Frame: ICefFrame); + + function doOnPreKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; + function doOnKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle): Boolean; + + procedure doOnLoadingStateChange(const Browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); + procedure doOnAddressChange(const Browser: ICefBrowser; const Frame: ICefFrame; const url: ustring); + procedure doOnTitleChange(const Browser: ICefBrowser; const title: ustring); + 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; + + procedure doOnRequestGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback); + procedure doOnCancelGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer); + + procedure doOnBeforeDownload(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); + procedure doOnDownloadUpdated(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); + + function doOnJsdialog(const Browser: ICefBrowser; const originUrl, acceptLang: ustring; + dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; + callback: ICefJsDialogCallback; out suppressMessage: Boolean): Boolean; + function doOnBeforeUnloadDialog(const Browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback): Boolean; + procedure doOnResetDialogState(const Browser: ICefBrowser); + + function doOnBeforePopup(const Browser: ICefBrowser; + const Frame: ICefFrame; const targetUrl, targetFrameName: ustring; + var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; + var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; + procedure doOnAfterCreated(const Browser: ICefBrowser); + procedure doOnBeforeClose(const Browser: ICefBrowser); + function doOnRunModal(const Browser: ICefBrowser): Boolean; + function doOnClose(const Browser: ICefBrowser): Boolean; + + function doOnBeforeResourceLoad(const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest): Boolean; + function doOnGetResourceHandler(const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest): ICefResourceHandler; + procedure doOnResourceRedirect(const Browser: ICefBrowser; const Frame: ICefFrame; + const oldUrl: ustring; var newUrl: ustring); + function doOnGetAuthCredentials(const Browser: ICefBrowser; const Frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback): Boolean; + function doOnQuotaRequest(const Browser: ICefBrowser; const originUrl: ustring; + newSize: Int64; const callback: ICefQuotaCallback): Boolean; + function doOnGetCookieManager(const Browser: ICefBrowser; const mainUrl: ustring): ICefCookieManager; + procedure doOnProtocolExecution(const Browser: ICefBrowser; const url: ustring; out allowOsExecution: Boolean); + function doOnBeforePluginLoad(const Browser: ICefBrowser; const url, policyUrl: ustring; + const info: ICefWebPluginInfo): Boolean; + + function doOnFileDialog(const Browser: ICefBrowser; mode: TCefFileDialogMode; + const title, defaultFileName: ustring; acceptTypes: TStrings; + const callback: ICefFileDialogCallback): Boolean; + + function doOnGetRootScreenRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; + function doOnGetViewRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; + function doOnGetScreenPoint(const Browser: ICefBrowser; viewX, viewY: Integer; + screenX, screenY: PInteger): Boolean; + procedure doOnPopupShow(const Browser: ICefBrowser; show: Boolean); + procedure doOnPopupSize(const Browser: ICefBrowser; const rect: PCefRect); + procedure doOnPaint(const Browser: ICefBrowser; kind: TCefPaintElementType; + dirtyRectsCount: Cardinal; const dirtyRects: PCefRectArray; + const buffer: Pointer; width, height: Integer); + procedure doOnCursorChange(const Browser: ICefBrowser; cursor: TCefCursorHandle); + end; + + ICefClientHandler = interface ['{E76F6888-D9C3-4FCE-9C23-E89659820A36}'] + procedure Disconnect; + end; + + TCustomClientHandler = class(TCefClientOwn, ICefClientHandler) + private + FEvents: IChromiumEvents; + FLoadHandler: ICefLoadHandler; + FFocusHandler: ICefFocusHandler; + FContextMenuHandler: ICefContextMenuHandler; + FDialogHandler: ICefDialogHandler; + FKeyboardHandler: ICefKeyboardHandler; + FDisplayHandler: ICefDisplayHandler; + FDownloadHandler: ICefDownloadHandler; + FGeolocationHandler: ICefGeolocationHandler; + FJsDialogHandler: ICefJsDialogHandler; + FLifeSpanHandler: ICefLifeSpanHandler; + FRenderHandler: ICefRenderHandler; + FRequestHandler: ICefRequestHandler; + protected + function GetContextMenuHandler: ICefContextMenuHandler; override; + function GetDialogHandler: ICefDialogHandler; override; + function GetDisplayHandler: ICefDisplayHandler; override; + function GetDownloadHandler: ICefDownloadHandler; override; + function GetFocusHandler: ICefFocusHandler; override; + function GetGeolocationHandler: ICefGeolocationHandler; override; + function GetJsdialogHandler: ICefJsdialogHandler; override; + function GetKeyboardHandler: ICefKeyboardHandler; override; + function GetLifeSpanHandler: ICefLifeSpanHandler; override; + function GetRenderHandler: ICefRenderHandler; override; + function GetLoadHandler: ICefLoadHandler; override; + function GetRequestHandler: ICefRequestHandler; override; + function OnProcessMessageReceived(const Browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; override; + procedure Disconnect; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomClientHandlerClass = class of TCustomClientHandler; + + TCustomLoadHandler = class(TCefLoadHandlerOwn) + private + FEvent: IChromiumEvents; + protected + procedure OnLoadStart(const Browser: ICefBrowser; const Frame: ICefFrame); override; + procedure OnLoadEnd(const Browser: ICefBrowser; const Frame: ICefFrame; httpStatusCode: Integer); override; + procedure OnLoadError(const Browser: ICefBrowser; const Frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring); override; + procedure OnRenderProcessTerminated(const Browser: ICefBrowser; status: TCefTerminationStatus); override; + procedure OnPluginCrashed(const Browser: ICefBrowser; const pluginPath: ustring); override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomFocusHandler = class(TCefFocusHandlerOwn) + private + FEvent: IChromiumEvents; + protected + procedure OnTakeFocus(const Browser: ICefBrowser; next: Boolean); override; + function OnSetFocus(const Browser: ICefBrowser; Source: TCefFocusSource): Boolean; override; + procedure OnGotFocus(const Browser: ICefBrowser); override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomContextMenuHandler = class(TCefContextMenuHandlerOwn) + private + FEvent: IChromiumEvents; + protected + procedure OnBeforeContextMenu(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); override; + function OnContextMenuCommand(const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags): Boolean; override; + procedure OnContextMenuDismissed(const Browser: ICefBrowser; const Frame: ICefFrame); override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomDialogHandler = class(TCefDialogHandlerOwn) + private + FEvent: IChromiumEvents; + protected + function OnFileDialog(const Browser: ICefBrowser; mode: TCefFileDialogMode; + const title: ustring; const defaultFileName: ustring; + acceptTypes: TStrings; const callback: ICefFileDialogCallback): Boolean; override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomKeyboardHandler = class(TCefKeyboardHandlerOwn) + private + FEvent: IChromiumEvents; + protected + function OnPreKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; override; + function OnKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle): Boolean; override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomDisplayHandler = class(TCefDisplayHandlerOwn) + private + FEvent: IChromiumEvents; + protected + procedure OnLoadingStateChange(const Browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); override; + procedure OnAddressChange(const Browser: ICefBrowser; const Frame: ICefFrame; const url: ustring); override; + procedure OnTitleChange(const Browser: ICefBrowser; const title: ustring); override; + 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; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomDownloadHandler = class(TCefDownloadHandlerOwn) + private + FEvent: IChromiumEvents; + protected + procedure OnBeforeDownload(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); override; + procedure OnDownloadUpdated(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomGeolocationHandler = class(TCefGeolocationHandlerOwn) + private + FEvent: IChromiumEvents; + protected + procedure OnRequestGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback); override; + procedure OnCancelGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer); override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomJsDialogHandler = class(TCefJsDialogHandlerOwn) + private + FEvent: IChromiumEvents; + protected + function OnJsdialog(const Browser: ICefBrowser; const originUrl, acceptLang: ustring; + dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; + callback: ICefJsDialogCallback; out suppressMessage: Boolean): Boolean; override; + function OnBeforeUnloadDialog(const Browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback): Boolean; override; + procedure OnResetDialogState(const Browser: ICefBrowser); override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomLifeSpanHandler = class(TCefLifeSpanHandlerOwn) + private + FEvent: IChromiumEvents; + protected + function OnBeforePopup(const Browser: ICefBrowser; const Frame: ICefFrame; + const targetUrl, targetFrameName: ustring; var popupFeatures: TCefPopupFeatures; + var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; override; + procedure OnAfterCreated(const Browser: ICefBrowser); override; + procedure OnBeforeClose(const Browser: ICefBrowser); override; + function RunModal(const Browser: ICefBrowser): Boolean; override; + function DoClose(const Browser: ICefBrowser): Boolean; override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomRequestHandler = class(TCefRequestHandlerOwn) + private + FEvent: IChromiumEvents; + protected + function OnBeforeResourceLoad(const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest): Boolean; override; + function GetResourceHandler(const Browser: ICefBrowser; const Frame: ICefFrame; + const request: ICefRequest): ICefResourceHandler; override; + procedure OnResourceRedirect(const Browser: ICefBrowser; const Frame: ICefFrame; + const oldUrl: ustring; var newUrl: ustring); override; + function GetAuthCredentials(const Browser: ICefBrowser; const Frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback): Boolean; override; + function OnQuotaRequest(const Browser: ICefBrowser; const originUrl: ustring; + newSize: Int64; const callback: ICefQuotaCallback): Boolean; override; + function GetCookieManager(const Browser: ICefBrowser; const mainUrl: ustring): ICefCookieManager; override; + procedure OnProtocolExecution(const Browser: ICefBrowser; const url: ustring; out allowOsExecution: Boolean); override; + function OnBeforePluginLoad(const Browser: ICefBrowser; const url: ustring; + const policyUrl: ustring; const info: ICefWebPluginInfo): Boolean; override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + + TCustomRenderHandler = class(TCefRenderHandlerOwn) + private + FEvent: IChromiumEvents; + protected + function GetRootScreenRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; override; + function GetViewRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; override; + function GetScreenPoint(const Browser: ICefBrowser; viewX, viewY: Integer; + screenX, screenY: PInteger): Boolean; override; + procedure OnPopupShow(const Browser: ICefBrowser; show: Boolean); override; + procedure OnPopupSize(const Browser: ICefBrowser; const rect: PCefRect); override; + procedure OnPaint(const Browser: ICefBrowser; kind: TCefPaintElementType; + dirtyRectsCount: Cardinal; const dirtyRects: PCefRectArray; + const buffer: Pointer; width, height: Integer); override; + procedure OnCursorChange(const Browser: ICefBrowser; cursor: TCefCursorHandle); override; + public + constructor Create(const events: IChromiumEvents); reintroduce; virtual; + end; + +Implementation + +{ TChromiumFontOptions } + +constructor TChromiumFontOptions.Create; +begin + FStandardFontFamily := ''; + FCursiveFontFamily := ''; + FSansSerifFontFamily := ''; + FMinimumLogicalFontSize := 0; + FFantasyFontFamily := ''; + FSerifFontFamily := ''; + FDefaultFixedFontSize := 0; + FDefaultFontSize := 0; + FRemoteFontsDisabled := STATE_DEFAULT; + FFixedFontFamily := ''; + FMinimumFontSize := 0; +end; + +{ TCefCustomHandler } + +constructor TCustomClientHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvents := events; + FLoadHandler := TCustomLoadHandler.Create(events); + FFocusHandler := TCustomFocusHandler.Create(events); + FContextMenuHandler := TCustomContextMenuHandler.Create(events); + FDialogHandler := TCustomDialogHandler.Create(events); + FKeyboardHandler := TCustomKeyboardHandler.Create(events); + FDisplayHandler := TCustomDisplayHandler.Create(events); + FDownloadHandler := TCustomDownloadHandler.Create(events); + FGeolocationHandler := TCustomGeolocationHandler.Create(events); + FJsDialogHandler := TCustomJsDialogHandler.Create(events); + FLifeSpanHandler := TCustomLifeSpanHandler.Create(events); + FRequestHandler := TCustomRequestHandler.Create(events); + FRenderHandler := TCustomRenderHandler.Create(events); +end; + +procedure TCustomClientHandler.Disconnect; +begin + FEvents := nil; + FLoadHandler := nil; + FFocusHandler := nil; + FContextMenuHandler := nil; + FDialogHandler := nil; + FKeyboardHandler := nil; + FDisplayHandler := nil; + FDownloadHandler := nil; + FGeolocationHandler := nil; + FJsDialogHandler := nil; + FLifeSpanHandler := nil; + FRequestHandler := nil; + FRenderHandler := nil; +end; + +function TCustomClientHandler.GetContextMenuHandler: ICefContextMenuHandler; +begin + Result := FContextMenuHandler; +end; + +function TCustomClientHandler.GetDialogHandler: ICefDialogHandler; +begin + Result := FDialogHandler; +end; + +function TCustomClientHandler.GetDisplayHandler: ICefDisplayHandler; +begin + Result := FDisplayHandler; +end; + +function TCustomClientHandler.GetDownloadHandler: ICefDownloadHandler; +begin + Result := FDownloadHandler; +end; + +function TCustomClientHandler.GetFocusHandler: ICefFocusHandler; +begin + Result := FFocusHandler; +end; + +function TCustomClientHandler.GetGeolocationHandler: ICefGeolocationHandler; +begin + Result := FGeolocationHandler; +end; + +function TCustomClientHandler.GetJsdialogHandler: ICefJsDialogHandler; +begin + Result := FJsDialogHandler; +end; + +function TCustomClientHandler.GetKeyboardHandler: ICefKeyboardHandler; +begin + Result := FKeyboardHandler; +end; + +function TCustomClientHandler.GetLifeSpanHandler: ICefLifeSpanHandler; +begin + Result := FLifeSpanHandler; +end; + +function TCustomClientHandler.GetLoadHandler: ICefLoadHandler; +begin + Result := FLoadHandler; +end; + +function TCustomClientHandler.GetRenderHandler: ICefRenderHandler; +begin + Result := FRenderHandler; +end; + +function TCustomClientHandler.GetRequestHandler: ICefRequestHandler; +begin + Result := FRequestHandler; +end; + +function TCustomClientHandler.OnProcessMessageReceived( + const Browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage): Boolean; +begin + Result := FEvents.doOnProcessMessageReceived(Browser, sourceProcess, message); +end; + +{ TCustomLoadHandler } + +constructor TCustomLoadHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +procedure TCustomLoadHandler.OnLoadEnd(const Browser: ICefBrowser; + const Frame: ICefFrame; httpStatusCode: Integer); +begin + FEvent.doOnLoadEnd(Browser, Frame, httpStatusCode); +end; + +procedure TCustomLoadHandler.OnLoadError(const Browser: ICefBrowser; + const Frame: ICefFrame; errorCode: Integer; const errorText, + failedUrl: ustring); +begin + FEvent.doOnLoadError(Browser, Frame, errorCode, errorText, failedUrl); +end; + +procedure TCustomLoadHandler.OnLoadStart(const Browser: ICefBrowser; const Frame: ICefFrame); +begin + FEvent.doOnLoadStart(Browser, Frame); +end; + +procedure TCustomLoadHandler.OnPluginCrashed(const Browser: ICefBrowser; const pluginPath: ustring); +begin + FEvent.doOnPluginCrashed(Browser, pluginPath); +end; + +procedure TCustomLoadHandler.OnRenderProcessTerminated( +const Browser: ICefBrowser; status: TCefTerminationStatus); +begin + FEvent.doOnRenderProcessTerminated(Browser, status); +end; + +{ TCustomFocusHandler } + +constructor TCustomFocusHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +procedure TCustomFocusHandler.OnGotFocus(const Browser: ICefBrowser); +begin + FEvent.doOnGotFocus(Browser); +end; + +function TCustomFocusHandler.OnSetFocus(const Browser: ICefBrowser; Source: TCefFocusSource): Boolean; +begin + Result := FEvent.doOnSetFocus(Browser, Source); +end; + +procedure TCustomFocusHandler.OnTakeFocus(const Browser: ICefBrowser; + next: Boolean); +begin + FEvent.doOnTakeFocus(Browser, next); +end; + +{ TCustomContextMenuHandler } + +constructor TCustomContextMenuHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +procedure TCustomContextMenuHandler.OnBeforeContextMenu( + const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + FEvent.doOnBeforeContextMenu(Browser, Frame, params, model); +end; + +function TCustomContextMenuHandler.OnContextMenuCommand( + const Browser: ICefBrowser; const Frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags): Boolean; +begin + Result := FEvent.doOnContextMenuCommand(Browser, Frame, params, commandId, + eventFlags); +end; + +procedure TCustomContextMenuHandler.OnContextMenuDismissed( + const Browser: ICefBrowser; const Frame: ICefFrame); +begin + FEvent.doOnContextMenuDismissed(Browser, Frame); +end; + +{ TCustomKeyboardHandler } + +constructor TCustomKeyboardHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +function TCustomKeyboardHandler.OnKeyEvent(const Browser: ICefBrowser; + const event: PCefKeyEvent; osEvent: TCefEventHandle): Boolean; +begin + Result := FEvent.doOnKeyEvent(Browser, event, osEvent); +end; + +function TCustomKeyboardHandler.OnPreKeyEvent(const Browser: ICefBrowser; + const event: PCefKeyEvent; osEvent: TCefEventHandle; + out isKeyboardShortcut: Boolean): Boolean; +begin + Result := FEvent.doOnPreKeyEvent(Browser, event, osEvent, isKeyboardShortcut); +end; + +{ TCustomDisplayHandler } + +constructor TCustomDisplayHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +procedure TCustomDisplayHandler.OnAddressChange(const Browser: ICefBrowser; + const Frame: ICefFrame; const url: ustring); +begin + FEvent.doOnAddressChange(Browser, Frame, url); +end; + +function TCustomDisplayHandler.OnConsoleMessage(const Browser: ICefBrowser; + const message, Source: ustring; line: Integer): Boolean; +begin + Result := FEvent.doOnConsoleMessage(Browser, message, Source, line); +end; + +procedure TCustomDisplayHandler.OnLoadingStateChange(const Browser: ICefBrowser; + isLoading, canGoBack, canGoForward: Boolean); +begin + FEvent.doOnLoadingStateChange(Browser, isLoading, canGoBack, canGoForward); +end; + +procedure TCustomDisplayHandler.OnStatusMessage(const Browser: ICefBrowser; + const value: ustring); +begin + FEvent.doOnStatusMessage(Browser, value); +end; + +procedure TCustomDisplayHandler.OnTitleChange(const Browser: ICefBrowser; const title: ustring); +begin + FEvent.doOnTitleChange(Browser, title); +end; + +function TCustomDisplayHandler.OnTooltip(const Browser: ICefBrowser; var text: ustring): Boolean; +begin + Result := FEvent.doOnTooltip(Browser, text); +end; + +{ TCustomDownloadHandler } + +constructor TCustomDownloadHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +procedure TCustomDownloadHandler.OnBeforeDownload(const Browser: ICefBrowser; + const downloadItem: ICefDownloadItem; const suggestedName: ustring; + const callback: ICefBeforeDownloadCallback); +begin + FEvent.doOnBeforeDownload(Browser, downloadItem, suggestedName, callback); +end; + +procedure TCustomDownloadHandler.OnDownloadUpdated(const Browser: ICefBrowser; + const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); +begin + FEvent.doOnDownloadUpdated(Browser, downloadItem, callback); +end; + +{ TCustomGeolocationHandler } + +constructor TCustomGeolocationHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +procedure TCustomGeolocationHandler.OnCancelGeolocationPermission( + const Browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer); +begin + FEvent.doOnCancelGeolocationPermission(Browser, requestingUrl, requestId); +end; + +procedure TCustomGeolocationHandler.OnRequestGeolocationPermission( + const Browser: ICefBrowser; const requestingUrl: ustring; requestId: Integer; + const callback: ICefGeolocationCallback); +begin + FEvent.doOnRequestGeolocationPermission(Browser, requestingUrl, requestId, callback); +end; + +{ TCustomJsDialogHandler } + +constructor TCustomJsDialogHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +function TCustomJsDialogHandler.OnBeforeUnloadDialog(const Browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback): Boolean; +begin + Result := FEvent.doOnBeforeUnloadDialog(Browser, messageText, isReload, callback); +end; + +function TCustomJsDialogHandler.OnJsdialog(const Browser: ICefBrowser; + const originUrl, acceptLang: ustring; dialogType: TCefJsDialogType; + const messageText, defaultPromptText: ustring; callback: ICefJsDialogCallback; + out suppressMessage: Boolean): Boolean; +begin + Result := FEvent.doOnJsdialog(Browser, originUrl, acceptLang, dialogType, + messageText, defaultPromptText, callback, suppressMessage); +end; + +procedure TCustomJsDialogHandler.OnResetDialogState(const Browser: ICefBrowser); +begin + FEvent.doOnResetDialogState(Browser); +end; + +{ TCustomLifeSpanHandler } + +constructor TCustomLifeSpanHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +function TCustomLifeSpanHandler.DoClose(const Browser: ICefBrowser): Boolean; +begin + Result := FEvent.doOnClose(Browser); +end; + +procedure TCustomLifeSpanHandler.OnAfterCreated(const Browser: ICefBrowser); +begin + FEvent.doOnAfterCreated(Browser); +end; + +procedure TCustomLifeSpanHandler.OnBeforeClose(const Browser: ICefBrowser); +begin + FEvent.doOnBeforeClose(Browser); +end; + + +function TCustomLifeSpanHandler.OnBeforePopup(const Browser: ICefBrowser; + const Frame: ICefFrame; const targetUrl, targetFrameName: ustring; + var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; + var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; +begin + Result := FEvent.doOnBeforePopup(Browser, Frame, targetUrl, targetFrameName, + popupFeatures, windowInfo, client, settings, noJavascriptAccess); +end; + +function TCustomLifeSpanHandler.RunModal(const Browser: ICefBrowser): Boolean; +begin + Result := FEvent.doOnRunModal(Browser); +end; + +{ TCustomRequestHandler } + +constructor TCustomRequestHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +function TCustomRequestHandler.GetAuthCredentials(const Browser: ICefBrowser; + const Frame: ICefFrame; isProxy: Boolean; const host: ustring; port: Integer; + const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; +begin + Result := FEvent.doOnGetAuthCredentials(Browser, Frame, isProxy, host, port, + realm, scheme, callback); +end; + +function TCustomRequestHandler.GetCookieManager(const Browser: ICefBrowser; + const mainUrl: ustring): ICefCookieManager; +begin + Result := FEvent.doOnGetCookieManager(Browser, mainUrl); +end; + +function TCustomRequestHandler.GetResourceHandler(const Browser: ICefBrowser; + const Frame: ICefFrame; const request: ICefRequest): ICefResourceHandler; +begin + Result := FEvent.doOnGetResourceHandler(Browser, Frame, request); +end; + +function TCustomRequestHandler.OnBeforePluginLoad(const Browser: ICefBrowser; + const url, policyUrl: ustring; const info: ICefWebPluginInfo): Boolean; +begin + Result := FEvent.doOnBeforePluginLoad(Browser, url, policyUrl, info); +end; + +function TCustomRequestHandler.OnBeforeResourceLoad(const Browser: ICefBrowser; + const Frame: ICefFrame; const request: ICefRequest): Boolean; +begin + Result := FEvent.doOnBeforeResourceLoad(Browser, Frame, request); +end; + +procedure TCustomRequestHandler.OnProtocolExecution(const Browser: ICefBrowser; + const url: ustring; out allowOsExecution: Boolean); +begin + FEvent.doOnProtocolExecution(Browser, url, allowOsExecution); +end; + +function TCustomRequestHandler.OnQuotaRequest(const Browser: ICefBrowser; + const originUrl: ustring; newSize: Int64; + const callback: ICefQuotaCallback): Boolean; +begin + Result := FEvent.doOnQuotaRequest(Browser, originUrl, newSize, callback); +end; + +procedure TCustomRequestHandler.OnResourceRedirect(const Browser: ICefBrowser; + const Frame: ICefFrame; const oldUrl: ustring; var newUrl: ustring); +begin + FEvent.doOnResourceRedirect(Browser, Frame, oldUrl, newUrl); +end; + +{ TCustomDialogHandler } + +constructor TCustomDialogHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +function TCustomDialogHandler.OnFileDialog(const Browser: ICefBrowser; + mode: TCefFileDialogMode; const title, defaultFileName: ustring; + acceptTypes: TStrings; const callback: ICefFileDialogCallback): Boolean; +begin + Result := FEvent.doOnFileDialog(Browser, mode, title, + defaultFileName, acceptTypes, callback) +end; + +{ TCustomRenderHandler } + +constructor TCustomRenderHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + FEvent := events; +end; + +function TCustomRenderHandler.GetRootScreenRect(const Browser: ICefBrowser; + rect: PCefRect): Boolean; +begin + Result := FEvent.doOnGetRootScreenRect(Browser, rect); +end; + +function TCustomRenderHandler.GetScreenPoint(const Browser: ICefBrowser; viewX, + viewY: Integer; screenX, screenY: PInteger): Boolean; +begin + Result := FEvent.doOnGetScreenPoint(Browser, viewX, viewY, screenX, screenY); +end; + +function TCustomRenderHandler.GetViewRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; +begin + Result := FEvent.doOnGetViewRect(Browser, rect); +end; + +procedure TCustomRenderHandler.OnCursorChange(const Browser: ICefBrowser; cursor: TCefCursorHandle); +begin + FEvent.doOnCursorChange(Browser, cursor); +end; + +procedure TCustomRenderHandler.OnPaint(const Browser: ICefBrowser; + kind: TCefPaintElementType; dirtyRectsCount: Cardinal; + const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); +begin + FEvent.doOnPaint(Browser, kind, dirtyRectsCount, dirtyRects, buffer, width, height); +end; + +procedure TCustomRenderHandler.OnPopupShow(const Browser: ICefBrowser; show: Boolean); +begin + FEvent.doOnPopupShow(Browser, show); +end; + +procedure TCustomRenderHandler.OnPopupSize(const Browser: ICefBrowser; const rect: PCefRect); +begin + FEvent.doOnPopupSize(Browser, rect); +end; + + + +end. diff --git a/cef3intf.pas b/cef3intf.pas new file mode 100644 index 0000000..4da1faf --- /dev/null +++ b/cef3intf.pas @@ -0,0 +1,1157 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Ported to Free Pascal and Linux by d.l.i.w <dev.dliw@gmail.com> + * based on 'Delphi Chromium Embedded' + * + * Repository: http://github.com/dliw/fpCEF3 + * + * + * Originally created for Delphi by: Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +Unit cef3intf; + +{$mode objfpc}{$H+} + +Interface + +Uses + Classes, + cef3lib, cef3api; + +Type + ICefBrowser = interface; + ICefFrame = interface; + ICefRequest = interface; + ICefv8Value = interface; + ICefDomVisitor = interface; + ICefDomDocument = interface; + ICefDomNode = interface; + ICefv8Context = interface; + ICefListValue = interface; + ICefClient = interface; + ICefUrlrequestClient = interface; + ICefBrowserHost = interface; + ICefTask = interface; + ICefTaskRunner = interface; + ICefFileDialogCallback = interface; + + ICefBase = interface + //['{1F9A7B44-DCDC-4477-9180-3ADD44BDEB7B}'] + function Wrap: Pointer; + end; + + ICefRunFileDialogCallback = interface(ICefBase) + //['{59FCECC6-E897-45BA-873B-F09586C4BE47}'] + procedure cont(const browserHost: ICefBrowserHost; filePaths: TStrings); + end; + + TCefRunFileDialogCallbackProc = procedure(const browserHost: ICefBrowserHost; filePaths: TStrings); + + ICefBrowserHost = interface(ICefBase) + //['{53AE02FF-EF5D-48C3-A43E-069DA9535424}'] + function GetBrowser: ICefBrowser; + procedure ParentWindowWillClose; + procedure CloseBrowser; + procedure SetFocus(enable: Boolean); + function GetWindowHandle: TCefWindowHandle; + function GetOpenerWindowHandle: TCefWindowHandle; + function GetDevToolsUrl(httpScheme: Boolean): ustring; + function GetZoomLevel: Double; + procedure SetZoomLevel(zoomLevel: Double); + procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFileName: string; + acceptTypes: TStrings; const callback: ICefRunFileDialogCallback); + procedure RunFileDialogProc(mode: TCefFileDialogMode; const title, defaultFileName: string; + acceptTypes: TStrings; const callback: TCefRunFileDialogCallbackProc); + function IsWindowRenderingDisabled: Boolean; + procedure WasResized; + procedure Invalidate(const dirtyRect: PCefRect; kind: TCefPaintElementType); + procedure SendKeyEvent(const event: PCefKeyEvent); + procedure SendMouseClickEvent(const event: PCefMouseEvent; + kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer); + procedure SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean); + procedure SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer); + procedure SendFocusEvent({set}Focus: Boolean); + procedure SendCaptureLostEvent; + + property Browser: ICefBrowser read GetBrowser; + property WindowHandle: TCefWindowHandle read GetWindowHandle; + property OpenerWindowHandle: TCefWindowHandle read GetOpenerWindowHandle; + property ZoomLevel: Double read GetZoomLevel write SetZoomLevel; + end; + + ICefProcessMessage = interface(ICefBase) + //['{E0B1001A-8777-425A-869B-29D40B8B93B1}'] + function IsValid: Boolean; + function IsReadOnly: Boolean; + function Copy: ICefProcessMessage; + function GetName: ustring; + function GetArgumentList: ICefListValue; + property Name: ustring read GetName; + property ArgumentList: ICefListValue read GetArgumentList; + end; + + ICefBrowser = interface(ICefBase) + //['{BA003C2E-CF15-458F-9D4A-FE3CEFCF3EEF}'] + function GetHost: ICefBrowserHost; + function CanGoBack: Boolean; + procedure GoBack; + function CanGoForward: Boolean; + procedure GoForward; + function IsLoading: Boolean; + procedure Reload; + procedure ReloadIgnoreCache; + procedure StopLoad; + function GetIdentifier: Integer; + function IsSame(const that: ICefBrowser): Boolean; + function IsPopup: Boolean; + function HasDocument: Boolean; + function GetMainFrame: ICefFrame; + function GetFocusedFrame: ICefFrame; + function GetFrameByident(identifier: Int64): ICefFrame; + function GetFrame(const name: ustring): ICefFrame; + function GetFrameCount: Cardinal; + procedure GetFrameIdentifiers(count: PCardinal; identifiers: PInt64); + procedure GetFrameNames(names: TStrings); + function SendProcessMessage(targetProcess: TCefProcessId; + message: ICefProcessMessage): Boolean; + property MainFrame: ICefFrame read GetMainFrame; + property FocusedFrame: ICefFrame read GetFocusedFrame; + property FrameCount: Cardinal read GetFrameCount; + property Host: ICefBrowserHost read GetHost; + property Identifier: Integer read GetIdentifier; + end; + + ICefPostDataElement = interface(ICefBase) + //['{3353D1B8-0300-4ADC-8D74-4FF31C77D13C}'] + function IsReadOnly: Boolean; + procedure SetToEmpty; + procedure SetToFile(const fileName: ustring); + procedure SetToBytes(size: Cardinal; bytes: Pointer); + function GetType: TCefPostDataElementType; + function GetFile: ustring; + function GetBytesCount: Cardinal; + function GetBytes(size: Cardinal; bytes: Pointer): Cardinal; + end; + + ICefPostData = interface(ICefBase) + //['{1E677630-9339-4732-BB99-D6FE4DE4AEC0}'] + function IsReadOnly: Boolean; + function GetCount: Cardinal; + function GetElements(Count: Cardinal): IInterfaceList; // ICefPostDataElement + function RemoveElement(const element: ICefPostDataElement): Integer; + function AddElement(const element: ICefPostDataElement): Integer; + procedure RemoveElements; + end; + + ICefStringMap = interface + //['{A33EBC01-B23A-4918-86A4-E24A243B342F}'] + function GetHandle: TCefStringMap; + function GetSize: Integer; + function Find(const Key: ustring): ustring; + function GetKey(Index: Integer): ustring; + function GetValue(Index: Integer): ustring; + procedure Append(const Key, Value: ustring); + procedure Clear; + + property Handle: TCefStringMap read GetHandle; + property Size: Integer read GetSize; + property Key[index: Integer]: ustring read GetKey; + property Value[index: Integer]: ustring read GetValue; + end; + + ICefStringMultimap = interface + //['{583ED0C2-A9D6-4034-A7C9-20EC7E47F0C7}'] + function GetHandle: TCefStringMultimap; + function GetSize: Integer; + function FindCount(const Key: ustring): Integer; + function GetEnumerate(const Key: ustring; ValueIndex: Integer): ustring; + function GetKey(Index: Integer): ustring; + function GetValue(Index: Integer): ustring; + procedure Append(const Key, Value: ustring); + procedure Clear; + + property Handle: TCefStringMap read GetHandle; + property Size: Integer read GetSize; + property Key[index: Integer]: ustring read GetKey; + property Value[index: Integer]: ustring read GetValue; + property Enumerate[const aKey: ustring; aValueIndex: Integer]: ustring read GetEnumerate; + end; + + ICefRequest = interface(ICefBase) + //['{FB4718D3-7D13-4979-9F4C-D7F6C0EC592A}'] + function IsReadOnly: Boolean; + function GetUrl: ustring; + function GetMethod: ustring; + function GetPostData: ICefPostData; + procedure GetHeaderMap(const HeaderMap: ICefStringMultimap); + procedure SetUrl(const value: ustring); + procedure SetMethod(const value: ustring); + procedure SetPostData(const value: ICefPostData); + procedure SetHeaderMap(const HeaderMap: ICefStringMultimap); + function GetFlags: TCefUrlRequestFlags; + procedure SetFlags(flags: TCefUrlRequestFlags); + function GetFirstPartyForCookies: ustring; + procedure SetFirstPartyForCookies(const url: ustring); + procedure Assign(const url, method: ustring; + const postData: ICefPostData; const headerMap: ICefStringMultimap); + property Url: ustring read GetUrl write SetUrl; + property Method: ustring read GetMethod write SetMethod; + property PostData: ICefPostData read GetPostData write SetPostData; + property Flags: TCefUrlRequestFlags read GetFlags write SetFlags; + property FirstPartyForCookies: ustring read GetFirstPartyForCookies write SetFirstPartyForCookies; + end; + + TCefDomVisitorProc = procedure(const document: ICefDomDocument); + + TCefStringVisitorProc = procedure(const str: ustring); + + ICefStringVisitor = interface(ICefBase) + //['{63ED4D6C-2FC8-4537-964B-B84C008F6158}'] + procedure Visit(const str: ustring); + end; + + ICefFrame = interface(ICefBase) + //['{8FD3D3A6-EA3A-4A72-8501-0276BD5C3D1D}'] + function IsValid: Boolean; + procedure Undo; + procedure Redo; + procedure Cut; + procedure Copy; + procedure Paste; + procedure Del; + procedure SelectAll; + procedure ViewSource; + procedure GetSource(const visitor: ICefStringVisitor); + procedure GetSourceProc(const proc: TCefStringVisitorProc); + procedure GetText(const visitor: ICefStringVisitor); + procedure GetTextProc(const proc: TCefStringVisitorProc); + procedure LoadRequest(const request: ICefRequest); + procedure LoadUrl(const url: ustring); + procedure LoadString(const str, url: ustring); + procedure ExecuteJavaScript(const code, scriptUrl: ustring; startLine: Integer); + function IsMain: Boolean; + function IsFocused: Boolean; + function GetName: ustring; + function GetIdentifier: Int64; + function GetParent: ICefFrame; + function GetUrl: ustring; + function GetBrowser: ICefBrowser; + function GetV8Context: ICefv8Context; + procedure VisitDom(const visitor: ICefDomVisitor); + procedure VisitDomProc(const proc: TCefDomVisitorProc); + property Name: ustring read GetName; + property Url: ustring read GetUrl; + property Browser: ICefBrowser read GetBrowser; + property Parent: ICefFrame read GetParent; + end; + + ICefCustomStreamReader = interface(ICefBase) + //['{BBCFF23A-6FE7-4C28-B13E-6D2ACA5C83B7}'] + function Read(ptr: Pointer; size, n: Cardinal): Cardinal; + function Seek(offset: Int64; whence: Integer): Integer; + function Tell: Int64; + function Eof: Boolean; + end; + + ICefStreamReader = interface(ICefBase) + //['{DD5361CB-E558-49C5-A4BD-D1CE84ADB277}'] + function Read(ptr: Pointer; size, n: Cardinal): Cardinal; + function Seek(offset: Int64; whence: Integer): Integer; + function Tell: Int64; + function Eof: Boolean; + end; + + ICefResponse = interface(ICefBase) + //['{E9C896E4-59A8-4B96-AB5E-6EA3A498B7F1}'] + function IsReadOnly: Boolean; + function GetStatus: Integer; + procedure SetStatus(status: Integer); + function GetStatusText: ustring; + procedure SetStatusText(const StatusText: ustring); + function GetMimeType: ustring; + procedure SetMimeType(const mimetype: ustring); + function GetHeader(const name: ustring): ustring; + procedure GetHeaderMap(const headerMap: ICefStringMultimap); + procedure SetHeaderMap(const headerMap: ICefStringMultimap); + property Status: Integer read GetStatus write SetStatus; + property StatusText: ustring read GetStatusText write SetStatusText; + property MimeType: ustring read GetMimeType write SetMimeType; + end; + + ICefDownloadItem = interface(ICefBase) + //['{B34BD320-A82E-4185-8E84-B98E5EEC803F}'] + function IsValid: Boolean; + function IsInProgress: Boolean; + function IsComplete: Boolean; + function IsCanceled: Boolean; + function GetCurrentSpeed: Int64; + function GetPercentComplete: Integer; + function GetTotalBytes: Int64; + function GetReceivedBytes: Int64; + function GetStartTime: TDateTime; + function GetEndTime: TDateTime; + function GetFullPath: ustring; + function GetId: Integer; + function GetUrl: ustring; + function GetSuggestedFileName: ustring; + function GetContentDisposition: ustring; + function GetMimeType: ustring; + + property CurrentSpeed: Int64 read GetCurrentSpeed; + property PercentComplete: Integer read GetPercentComplete; + property TotalBytes: Int64 read GetTotalBytes; + property ReceivedBytes: Int64 read GetReceivedBytes; + property StartTime: TDateTime read GetStartTime; + property EndTime: TDateTime read GetEndTime; + property FullPath: ustring read GetFullPath; + property Id: Integer read GetId; + property Url: ustring read GetUrl; + property SuggestedFileName: ustring read GetSuggestedFileName; + property ContentDisposition: ustring read GetContentDisposition; + property MimeType: ustring read GetMimeType; + end; + + ICefBeforeDownloadCallback = interface(ICefBase) + //['{5A81AF75-CBA2-444D-AD8E-522160F36433}'] + procedure Cont(const downloadPath: ustring; showDialog: Boolean); + end; + + ICefDownloadItemCallback = interface(ICefBase) + //['{498F103F-BE64-4D5F-86B7-B37EC69E1735}'] + procedure cancel; + end; + + ICefDownloadHandler = interface(ICefBase) + //['{3137F90A-5DC5-43C1-858D-A269F28EF4F1}'] + procedure OnBeforeDownload(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const suggestedName: ustring; const callback: ICefBeforeDownloadCallback); + procedure OnDownloadUpdated(const Browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); + end; + + ICefV8Exception = interface(ICefBase) + //['{7E422CF0-05AC-4A60-A029-F45105DCE6A4}'] + function GetMessage: ustring; + function GetSourceLine: ustring; + function GetScriptResourceName: ustring; + function GetLineNumber: Integer; + function GetStartPosition: Integer; + function GetEndPosition: Integer; + function GetStartColumn: Integer; + function GetEndColumn: Integer; + + property Message: ustring read GetMessage; + property SourceLine: ustring read GetSourceLine; + property ScriptResourceName: ustring read GetScriptResourceName; + property LineNumber: Integer read GetLineNumber; + property StartPosition: Integer read GetStartPosition; + property EndPosition: Integer read GetEndPosition; + property StartColumn: Integer read GetStartColumn; + property EndColumn: Integer read GetEndColumn; + end; + + ICefv8Context = interface(ICefBase) + //['{2295A11A-8773-41F2-AD42-308C215062D9}'] + function GetTaskRunner: ICefTaskRunner; + function IsValid: Boolean; + function GetBrowser: ICefBrowser; + function GetFrame: ICefFrame; + function GetGlobal: ICefv8Value; + function Enter: Boolean; + function Exit: Boolean; + function IsSame(const that: ICefv8Context): Boolean; + function Eval(const code: ustring; var retval: ICefv8Value; var exception: ICefV8Exception): Boolean; + property Browser: ICefBrowser read GetBrowser; + property Frame: ICefFrame read GetFrame; + property Global: ICefv8Value read GetGlobal; + end; + + TCefv8ValueArray = array of ICefv8Value; + + ICefv8Handler = interface(ICefBase) + //['{F94CDC60-FDCB-422D-96D5-D2A775BD5D73}'] + function Execute(const name: ustring; const obj: ICefv8Value; + const arguments: TCefv8ValueArray; var retval: ICefv8Value; + var exception: ustring): Boolean; + end; + + ICefV8Accessor = interface(ICefBase) + //['{DCA6D4A2-726A-4E24-AA64-5E8C731D868A}'] + function Get(const name: ustring; const obj: ICefv8Value; + out value: ICefv8Value; const exception: string): Boolean; + function Put(const name: ustring; const obj: ICefv8Value; + const value: ICefv8Value; const exception: string): Boolean; + end; + + ICefTask = interface(ICefBase) + //['{0D965470-4A86-47CE-BD39-A8770021AD7E}'] + procedure Execute; + end; + + ICefTaskRunner = interface(ICefBase) + //['{6A500FA3-77B7-4418-8EA8-6337EED1337B}'] + function IsSame(const that: ICefTaskRunner): Boolean; + function BelongsToCurrentThread: Boolean; + function BelongsToThread(threadId: TCefThreadId): Boolean; + function PostTask(const task: ICefTask): Boolean; cdecl; + function PostDelayedTask(const task: ICefTask; delayMs: Int64): Boolean; + end; + + ICefv8Value = interface(ICefBase) + //['{52319B8D-75A8-422C-BD4B-16FA08CC7F42}'] + function IsValid: Boolean; + function IsUndefined: Boolean; + function IsNull: Boolean; + function IsBool: Boolean; + function IsInt: Boolean; + function IsUInt: Boolean; + function IsDouble: Boolean; + function IsDate: Boolean; + function IsString: Boolean; + function IsObject: Boolean; + function IsArray: Boolean; + function IsFunction: Boolean; + function IsSame(const that: ICefv8Value): Boolean; + function GetBoolValue: Boolean; + function GetIntValue: Integer; + function GetUIntValue: Cardinal; + function GetDoubleValue: Double; + function GetDateValue: TDateTime; + function GetStringValue: ustring; + function IsUserCreated: Boolean; + function HasException: Boolean; + function GetException: ICefV8Exception; + function ClearException: Boolean; + function WillRethrowExceptions: Boolean; + function SetRethrowExceptions(rethrow: Boolean): Boolean; + function HasValueByKey(const key: ustring): Boolean; + function HasValueByIndex(index: Integer): Boolean; + function DeleteValueByKey(const key: ustring): Boolean; + function DeleteValueByIndex(index: Integer): Boolean; + function GetValueByKey(const key: ustring): ICefv8Value; + function GetValueByIndex(index: Integer): ICefv8Value; + function SetValueByKey(const key: ustring; const value: ICefv8Value; + attribute: TCefV8PropertyAttributes): Boolean; + function SetValueByIndex(index: Integer; const value: ICefv8Value): Boolean; + function SetValueByAccessor(const key: ustring; settings: TCefV8AccessControls; + attribute: TCefV8PropertyAttributes): Boolean; + function GetKeys(const keys: TStrings): Integer; + function SetUserData(const data: ICefv8Value): Boolean; + function GetUserData: ICefv8Value; + function GetExternallyAllocatedMemory: Integer; + function AdjustExternallyAllocatedMemory(changeInBytes: Integer): Integer; + function GetArrayLength: Integer; + function GetFunctionName: ustring; + function GetFunctionHandler: ICefv8Handler; + function ExecuteFunction(const obj: ICefv8Value; + const arguments: TCefv8ValueArray): ICefv8Value; + function ExecuteFunctionWithContext(const context: ICefv8Context; + const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; + end; + + ICefV8StackFrame = interface(ICefBase) + //['{BA1FFBF4-E9F2-4842-A827-DC220F324286}'] + function IsValid: Boolean; + function GetScriptName: ustring; + function GetScriptNameOrSourceUrl: ustring; + function GetFunctionName: ustring; + function GetLineNumber: Integer; + function GetColumn: Integer; + function IsEval: Boolean; + function IsConstructor: Boolean; + + property ScriptName: ustring read GetScriptName; + property ScriptNameOrSourceUrl: ustring read GetScriptNameOrSourceUrl; + property FunctionName: ustring read GetFunctionName; + property LineNumber: Integer read GetLineNumber; + property Column: Integer read GetColumn; + end; + + ICefV8StackTrace = interface(ICefBase) + //['{32111C84-B7F7-4E3A-92B9-7CA1D0ADB613}'] + function IsValid: Boolean; + function GetFrameCount: Integer; + function GetFrame(index: Integer): ICefV8StackFrame; + property FrameCount: Integer read GetFrameCount; + property Frame[index: Integer]: ICefV8StackFrame read GetFrame; + end; + + ICefXmlReader = interface(ICefBase) + //['{0DE686C3-A8D7-45D2-82FD-92F7F4E62A90}'] + function MoveToNextNode: Boolean; + function Close: Boolean; + function HasError: Boolean; + function GetError: ustring; + function GetType: TCefXmlNodeType; + function GetDepth: Integer; + function GetLocalName: ustring; + function GetPrefix: ustring; + function GetQualifiedName: ustring; + function GetNamespaceUri: ustring; + function GetBaseUri: ustring; + function GetXmlLang: ustring; + function IsEmptyElement: Boolean; + function HasValue: Boolean; + function GetValue: ustring; + function HasAttributes: Boolean; + function GetAttributeCount: Cardinal; + function GetAttributeByIndex(index: Integer): ustring; + function GetAttributeByQName(const qualifiedName: ustring): ustring; + function GetAttributeByLName(const localName, namespaceURI: ustring): ustring; + function GetInnerXml: ustring; + function GetOuterXml: ustring; + function GetLineNumber: Integer; + function MoveToAttributeByIndex(index: Integer): Boolean; + function MoveToAttributeByQName(const qualifiedName: ustring): Boolean; + function MoveToAttributeByLName(const localName, namespaceURI: ustring): Boolean; + function MoveToFirstAttribute: Boolean; + function MoveToNextAttribute: Boolean; + function MoveToCarryingElement: Boolean; + end; + + ICefZipReader = interface(ICefBase) + //['{3B6C591F-9877-42B3-8892-AA7B27DA34A8}'] + function MoveToFirstFile: Boolean; + function MoveToNextFile: Boolean; + function MoveToFile(const fileName: ustring; caseSensitive: Boolean): Boolean; + function Close: Boolean; + function GetFileName: ustring; + function GetFileSize: Int64; + function GetFileLastModified: LongInt; + function OpenFile(const password: ustring): Boolean; + function CloseFile: Boolean; + function ReadFile(buffer: Pointer; bufferSize: Cardinal): Integer; + function Tell: Int64; + function Eof: Boolean; + end; + + ICefDomEvent = interface(ICefBase) + //['{2CBD2259-ADC6-4187-9008-A666B57695CE}'] + function GetType: ustring; + function GetCategory: TCefDomEventCategory; + function GetPhase: TCefDomEventPhase; + function CanBubble: Boolean; + function CanCancel: Boolean; + function GetDocument: ICefDomDocument; + function GetTarget: ICefDomNode; + function GetCurrentTarget: ICefDomNode; + + property EventType: ustring read GetType; + property Category: TCefDomEventCategory read GetCategory; + property Phase: TCefDomEventPhase read GetPhase; + property Bubble: Boolean read CanBubble; + property Cancel: Boolean read CanCancel; + property Document: ICefDomDocument read GetDocument; + property Target: ICefDomNode read GetTarget; + property CurrentTarget: ICefDomNode read GetCurrentTarget; + end; + + ICefDomEventListener = interface(ICefBase) + //['{68BABB49-1824-42D0-ACCC-FDE9F8D39B88}'] + procedure HandleEvent(const event: ICefDomEvent); + end; + + TCefDomEventListenerProc = procedure(const event: ICefDomEvent); + + ICefDomNode = interface(ICefBase) + //['{96C03C9E-9C98-491A-8DAD-1947332232D6}'] + function GetType: TCefDomNodeType; + function IsText: Boolean; + function IsElement: Boolean; + function IsEditable: Boolean; + function IsFormControlElement: Boolean; + function GetFormControlElementType: ustring; + function IsSame(const that: ICefDomNode): Boolean; + function GetName: ustring; + function GetValue: ustring; + function SetValue(const value: ustring): Boolean; + function GetAsMarkup: ustring; + function GetDocument: ICefDomDocument; + function GetParent: ICefDomNode; + function GetPreviousSibling: ICefDomNode; + function GetNextSibling: ICefDomNode; + function HasChildren: Boolean; + function GetFirstChild: ICefDomNode; + function GetLastChild: ICefDomNode; + procedure AddEventListener(const eventType: ustring; useCapture: Boolean; + const listener: ICefDomEventListener); + procedure AddEventListenerProc(const eventType: ustring; useCapture: Boolean; + const proc: TCefDomEventListenerProc); + function GetElementTagName: ustring; + function HasElementAttributes: Boolean; + function HasElementAttribute(const attrName: ustring): Boolean; + function GetElementAttribute(const attrName: ustring): ustring; + procedure GetElementAttributes(const attrMap: ICefStringMap); + function SetElementAttribute(const attrName, value: ustring): Boolean; + function GetElementInnerText: ustring; + + property NodeType: TCefDomNodeType read GetType; + property Name: ustring read GetName; + property AsMarkup: ustring read GetAsMarkup; + property Document: ICefDomDocument read GetDocument; + property Parent: ICefDomNode read GetParent; + property PreviousSibling: ICefDomNode read GetPreviousSibling; + property NextSibling: ICefDomNode read GetNextSibling; + property FirstChild: ICefDomNode read GetFirstChild; + property LastChild: ICefDomNode read GetLastChild; + property ElementTagName: ustring read GetElementTagName; + property ElementInnerText: ustring read GetElementInnerText; + end; + + ICefDomDocument = interface(ICefBase) + //['{08E74052-45AF-4F69-A578-98A5C3959426}'] + function GetType: TCefDomDocumentType; + function GetDocument: ICefDomNode; + function GetBody: ICefDomNode; + function GetHead: ICefDomNode; + function GetTitle: ustring; + function GetElementById(const id: ustring): ICefDomNode; + function GetFocusedNode: ICefDomNode; + function HasSelection: Boolean; + function GetSelectionStartNode: ICefDomNode; + function GetSelectionStartOffset: Integer; + function GetSelectionEndNode: ICefDomNode; + function GetSelectionEndOffset: Integer; + function GetSelectionAsMarkup: ustring; + function GetSelectionAsText: ustring; + function GetBaseUrl: ustring; + function GetCompleteUrl(const partialURL: ustring): ustring; + property DocType: TCefDomDocumentType read GetType; + property Document: ICefDomNode read GetDocument; + property Body: ICefDomNode read GetBody; + property Head: ICefDomNode read GetHead; + property Title: ustring read GetTitle; + property FocusedNode: ICefDomNode read GetFocusedNode; + property SelectionStartNode: ICefDomNode read GetSelectionStartNode; + property SelectionStartOffset: Integer read GetSelectionStartOffset; + property SelectionEndNode: ICefDomNode read GetSelectionEndNode; + property SelectionEndOffset: Integer read GetSelectionEndOffset; + property SelectionAsMarkup: ustring read GetSelectionAsMarkup; + property SelectionAsText: ustring read GetSelectionAsText; + property BaseUrl: ustring read GetBaseUrl; + end; + + ICefDomVisitor = interface(ICefBase) + //['{30398428-3196-4531-B968-2DDBED36F6B0}'] + procedure visit(const document: ICefDomDocument); + end; + + ICefCookieVisitor = interface(ICefBase) + //['{8378CF1B-84AB-4FDB-9B86-34DDABCCC402}'] + function visit(const name, value, domain, path: ustring; secure, httponly, + hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; + count, total: Integer; out deleteCookie: Boolean): Boolean; + end; + + ICefResourceBundleHandler = interface(ICefBase) + //['{09C264FD-7E03-41E3-87B3-4234E82B5EA2}'] + function GetLocalizedString(messageId: Integer; out stringVal: ustring): Boolean; + function GetDataResource(resourceId: Integer; out data: Pointer; out dataSize: Cardinal): Boolean; + end; + + ICefCommandLine = interface(ICefBase) + //['{6B43D21B-0F2C-4B94-B4E6-4AF0D7669D8E}'] + function IsValid: Boolean; + function IsReadOnly: Boolean; + function Copy: ICefCommandLine; + procedure InitFromArgv(argc: Integer; const argv: PPAnsiChar); + procedure InitFromString(const commandLine: ustring); + procedure Reset; + function GetCommandLineString: ustring; + procedure GetArgv(args: TStrings); + function GetProgram: ustring; + procedure SetProgram(const prog: ustring); + function HasSwitches: Boolean; + function HasSwitch(const name: ustring): Boolean; + function GetSwitchValue(const name: ustring): ustring; + procedure GetSwitches(switches: TStrings); + procedure AppendSwitch(const name: ustring); + procedure AppendSwitchWithValue(const name, value: ustring); + function HasArguments: Boolean; + procedure GetArguments(arguments: TStrings); + procedure AppendArgument(const argument: ustring); + procedure PrependWrapper(const wrapper: ustring); + property CommandLineString: ustring read GetCommandLineString; + end; + + ICefBrowserProcessHandler = interface(ICefBase) + //['{27291B7A-C0AE-4EE0-9115-15C810E22F6C}'] + procedure OnContextInitialized; + procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); + procedure OnRenderProcessThreadCreated(const extraInfo: ICefListValue); + end; + + ICefSchemeRegistrar = interface(ICefBase) + //['{1832FF6E-100B-4E8B-B996-AD633168BEE7}'] + function AddCustomScheme(const schemeName: ustring; IsStandard, IsLocal, + IsDisplayIsolated: Boolean): Boolean; cdecl; + end; + + ICefRenderProcessHandler = interface(IcefBase) + //['{FADEE3BC-BF66-430A-BA5D-1EE3782ECC58}'] + procedure OnRenderThreadCreated(const extraInfo: ICefListValue) ; + procedure OnWebKitInitialized; + procedure OnBrowserCreated(const Browser: ICefBrowser); + procedure OnBrowserDestroyed(const Browser: ICefBrowser); + procedure OnContextCreated(const Browser: ICefBrowser; + const frame: ICefFrame; const context: ICefv8Context); + procedure OnContextReleased(const Browser: ICefBrowser; + const frame: ICefFrame; const context: ICefv8Context); + procedure OnUncaughtException(const Browser: ICefBrowser; const frame: ICefFrame; + const context: ICefv8Context; const exception: ICefV8Exception; + const stackTrace: ICefV8StackTrace); + procedure OnWorkerContextCreated(workerId: Integer; const url: ustring; + const context: ICefv8Context); + procedure OnWorkerContextReleased(workerId: Integer; const url: ustring; + const context: ICefv8Context); + procedure OnWorkerUncaughtException(workerId: Integer; const url: ustring; + const context: ICefv8Context; const exception: ICefV8Exception; + const stackTrace: ICefV8StackTrace); + procedure OnFocusedNodeChanged(const Browser: ICefBrowser; + const frame: ICefFrame; const node: ICefDomNode); + function OnProcessMessageReceived(const Browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; + end; + + TOnRegisterCustomSchemes = procedure(const registrar: ICefSchemeRegistrar); + TOnBeforeCommandLineProcessing = procedure(const processType: ustring; const commandLine: ICefCommandLine); + + ICefApp = interface(ICefBase) + //['{970CA670-9070-4642-B188-7D8A22DAEED4}'] + procedure OnBeforeCommandLineProcessing(const processType: ustring; + const commandLine: ICefCommandLine); + procedure OnRegisterCustomSchemes(const registrar: ICefSchemeRegistrar); + function GetResourceBundleHandler: ICefResourceBundleHandler; + function GetBrowserProcessHandler: ICefBrowserProcessHandler; + function GetRenderProcessHandler: ICefRenderProcessHandler; + end; + + TCefCookieVisitorProc = function( + const name, value, domain, path: ustring; secure, httponly, + hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; + count, total: Integer; out deleteCookie: Boolean): Boolean; + + ICefCookieManager = Interface(ICefBase) + //['{CC1749E6-9AD3-4283-8430-AF6CBF3E8785}'] + procedure SetSupportedSchemes(schemes: TStrings); + function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean; + function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean; + function VisitUrlCookies(const url: ustring; + includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean; + function VisitUrlCookiesProc(const url: ustring; + includeHttpOnly: Boolean; const visitor: TCefCookieVisitorProc): Boolean; + function SetCookie(const url: ustring; const name, value, domain, path: ustring; secure, httponly, + hasExpires: Boolean; const creation, lastAccess, expires: TDateTime): Boolean; + function DeleteCookies(const url, cookieName: ustring): Boolean; + function SetStoragePath(const path: ustring): Boolean; + end; + + ICefWebPluginInfo = interface(ICefBase) + //['{AA879E58-F649-44B1-AF9C-655FF5B79A02}'] + function GetName: ustring; + function GetPath: ustring; + function GetVersion: ustring; + function GetDescription: ustring; + + property Name: ustring read GetName; + property Path: ustring read GetPath; + property Version: ustring read GetVersion; + property Description: ustring read GetDescription; + end; + + ICefCallback = interface(ICefBase) + //['{1B8C449F-E2D6-4B78-9BBA-6F47E8BCDF37}'] + procedure Cont; + procedure Cancel; + end; + + ICefResourceHandler = interface(ICefBase) + //['{BD3EA208-AAAD-488C-BFF2-76993022F2B5}'] + function ProcessRequest(const request: ICefRequest; const callback: ICefCallback): Boolean; + procedure GetResponseHeaders(const response: ICefResponse; + out responseLength: Int64; out redirectUrl: ustring); + function ReadResponse(const dataOut: Pointer; bytesToRead: Integer; + var bytesRead: Integer; const callback: ICefCallback): Boolean; + function CanGetCookie(const cookie: PCefCookie): Boolean; + function CanSetCookie(const cookie: PCefCookie): Boolean; + procedure Cancel; + end; + + ICefSchemeHandlerFactory = interface(ICefBase) + //['{4D9B7960-B73B-4EBD-9ABE-6C1C43C245EB}'] + function New(const Browser: ICefBrowser; const frame: ICefFrame; + const schemeName: ustring; const request: ICefRequest): ICefResourceHandler; + end; + + ICefAuthCallback = interface(ICefBase) + //['{500C2023-BF4D-4FF7-9C04-165E5C389131}'] + procedure Cont(const username, password: ustring); + procedure Cancel; + end; + + ICefJsDialogCallback = interface(ICefBase) + //['{187B2156-9947-4108-87AB-32E559E1B026}'] + procedure Cont(success: Boolean; const userInput: ustring); + end; + + ICefContextMenuParams = interface(ICefBase) + //['{E31BFA9E-D4E2-49B7-A05D-20018C8794EB}'] + function GetXCoord: Integer; + function GetYCoord: Integer; + function GetTypeFlags: TCefContextMenuTypeFlags; + function GetLinkUrl: ustring; + function GetUnfilteredLinkUrl: ustring; + function GetSourceUrl: ustring; + function IsImageBlocked: Boolean; + function GetPageUrl: ustring; + function GetFrameUrl: ustring; + function GetFrameCharset: ustring; + function GetMediaType: TCefContextMenuMediaType; + function GetMediaStateFlags: TCefContextMenuMediaStateFlags; + function GetSelectionText: ustring; + function IsEditable: Boolean; + function IsSpeechInputEnabled: Boolean; + function GetEditStateFlags: TCefContextMenuEditStateFlags; + property XCoord: Integer read GetXCoord; + property YCoord: Integer read GetYCoord; + property TypeFlags: TCefContextMenuTypeFlags read GetTypeFlags; + property LinkUrl: ustring read GetLinkUrl; + property UnfilteredLinkUrl: ustring read GetUnfilteredLinkUrl; + property SourceUrl: ustring read GetSourceUrl; + property PageUrl: ustring read GetPageUrl; + property FrameUrl: ustring read GetFrameUrl; + property FrameCharset: ustring read GetFrameCharset; + property MediaType: TCefContextMenuMediaType read GetMediaType; + property MediaStateFlags: TCefContextMenuMediaStateFlags read GetMediaStateFlags; + property SelectionText: ustring read GetSelectionText; + property EditStateFlags: TCefContextMenuEditStateFlags read GetEditStateFlags; + end; + + ICefMenuModel = interface(ICefBase) + //['{40AF19D3-8B4E-44B8-8F89-DEB5907FC495}'] + function Clear: Boolean; + function GetCount: Integer; + function AddSeparator: Boolean; + function AddItem(commandId: Integer; const text: ustring): Boolean; + function AddCheckItem(commandId: Integer; const text: ustring): Boolean; + function AddRadioItem(commandId: Integer; const text: ustring; groupId: Integer): Boolean; + function AddSubMenu(commandId: Integer; const text: ustring): ICefMenuModel; + function InsertSeparatorAt(index: Integer): Boolean; + function InsertItemAt(index, commandId: Integer; const text: ustring): Boolean; + function InsertCheckItemAt(index, commandId: Integer; const text: ustring): Boolean; + function InsertRadioItemAt(index, commandId: Integer; const text: ustring; groupId: Integer): Boolean; + function InsertSubMenuAt(index, commandId: Integer; const text: ustring): ICefMenuModel; + function Remove(commandId: Integer): Boolean; + function RemoveAt(index: Integer): Boolean; + function GetIndexOf(commandId: Integer): Integer; + function GetCommandIdAt(index: Integer): Integer; + function SetCommandIdAt(index, commandId: Integer): Boolean; + function GetLabel(commandId: Integer): ustring; + function GetLabelAt(index: Integer): ustring; + function SetLabel(commandId: Integer; const text: ustring): Boolean; + function SetLabelAt(index: Integer; const text: ustring): Boolean; + function GetType(commandId: Integer): TCefMenuItemType; + function GetTypeAt(index: Integer): TCefMenuItemType; + function GetGroupId(commandId: Integer): Integer; + function GetGroupIdAt(index: Integer): Integer; + function SetGroupId(commandId, groupId: Integer): Boolean; + function SetGroupIdAt(index, groupId: Integer): Boolean; + function GetSubMenu(commandId: Integer): ICefMenuModel; + function GetSubMenuAt(index: Integer): ICefMenuModel; + function IsVisible(commandId: Integer): Boolean; + function isVisibleAt(index: Integer): Boolean; + function SetVisible(commandId: Integer; visible: Boolean): Boolean; + function SetVisibleAt(index: Integer; visible: Boolean): Boolean; + function IsEnabled(commandId: Integer): Boolean; + function IsEnabledAt(index: Integer): Boolean; + function SetEnabled(commandId: Integer; enabled: Boolean): Boolean; + function SetEnabledAt(index: Integer; enabled: Boolean): Boolean; + function IsChecked(commandId: Integer): Boolean; + function IsCheckedAt(index: Integer): Boolean; + function setChecked(commandId: Integer; checked: Boolean): Boolean; + function setCheckedAt(index: Integer; checked: Boolean): Boolean; + function HasAccelerator(commandId: Integer): Boolean; + function HasAcceleratorAt(index: Integer): Boolean; + function SetAccelerator(commandId, keyCode: Integer; shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + function SetAcceleratorAt(index, keyCode: Integer; shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + function RemoveAccelerator(commandId: Integer): Boolean; + function RemoveAcceleratorAt(index: Integer): Boolean; + function GetAccelerator(commandId: Integer; out keyCode: Integer; out shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + function GetAcceleratorAt(index: Integer; out keyCode: Integer; out shiftPressed, ctrlPressed, altPressed: Boolean): Boolean; + end; + + ICefBinaryValue = interface(ICefBase) + //['{974AA40A-9C5C-4726-81F0-9F0D46D7C5B3}'] + function IsValid: Boolean; + function IsOwned: Boolean; + function Copy: ICefBinaryValue; + function GetSize: Cardinal; + function GetData(buffer: Pointer; bufferSize, dataOffset: Cardinal): Cardinal; + end; + + ICefDictionaryValue = interface(ICefBase) + //['{B9638559-54DC-498C-8185-233EEF12BC69}'] + function IsValid: Boolean; + function isOwned: Boolean; + function IsReadOnly: Boolean; + function Copy(excludeEmptyChildren: Boolean): ICefDictionaryValue; + function GetSize: Cardinal; + function Clear: Boolean; + function HasKey(const key: ustring): Boolean; + function GetKeys(const keys: TStrings): Boolean; + function Remove(const key: ustring): Boolean; + function GetType(const key: ustring): TCefValueType; + function GetBool(const key: ustring): Boolean; + function GetInt(const key: ustring): Integer; + function GetDouble(const key: ustring): Double; + function GetString(const key: ustring): ustring; + function GetBinary(const key: ustring): ICefBinaryValue; + function GetDictionary(const key: ustring): ICefDictionaryValue; + function GetList(const key: ustring): ICefListValue; + function SetNull(const key: ustring): Boolean; + function SetBool(const key: ustring; value: Boolean): Boolean; + function SetInt(const key: ustring; value: Integer): Boolean; + function SetDouble(const key: ustring; value: Double): Boolean; + function SetString(const key, value: ustring): Boolean; + function SetBinary(const key: ustring; const value: ICefBinaryValue): Boolean; + function SetDictionary(const key: ustring; const value: ICefDictionaryValue): Boolean; + function SetList(const key: ustring; const value: ICefListValue): Boolean; + end; + + ICefListValue = interface(ICefBase) + //['{09174B9D-0CC6-4360-BBB0-3CC0117F70F6}'] + function IsValid: Boolean; + function IsOwned: Boolean; + function IsReadOnly: Boolean; + function Copy: ICefListValue; + function SetSize(size: Cardinal): Boolean; + function GetSize: Cardinal; + function Clear: Boolean; + function Remove(index: Integer): Boolean; + function GetType(index: Integer): TCefValueType; + function GetBool(index: Integer): Boolean; + function GetInt(index: Integer): Integer; + function GetDouble(index: Integer): Double; + function GetString(index: Integer): ustring; + function GetBinary(index: Integer): ICefBinaryValue; + function GetDictionary(index: Integer): ICefDictionaryValue; + function GetList(index: Integer): ICefListValue; + function SetNull(index: Integer): Boolean; + function SetBool(index: Integer; value: Boolean): Boolean; + function SetInt(index, value: Integer): Boolean; + function SetDouble(index: Integer; value: Double): Boolean; + function SetString(index: Integer; const value: ustring): Boolean; + function SetBinary(index: Integer; const value: ICefBinaryValue): Boolean; + function SetDictionary(index: Integer; const value: ICefDictionaryValue): Boolean; + function SetList(index: Integer; const value: ICefListValue): Boolean; + end; + + ICefLifeSpanHandler = interface(ICefBase) + //['{0A3EB782-A319-4C35-9B46-09B2834D7169}'] + function OnBeforePopup(const Browser: ICefBrowser; const frame: ICefFrame; + const targetUrl, targetFrameName: ustring; var popupFeatures: TCefPopupFeatures; + var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; + var noJavascriptAccess: Boolean): Boolean; + procedure OnAfterCreated(const Browser: ICefBrowser); + procedure OnBeforeClose(const Browser: ICefBrowser); + function RunModal(const Browser: ICefBrowser): Boolean; + function DoClose(const Browser: ICefBrowser): Boolean; + end; + + ICefLoadHandler = interface(ICefBase) + //['{2C63FB82-345D-4A5B-9858-5AE7A85C9F49}'] + procedure OnLoadStart(const Browser: ICefBrowser; const frame: ICefFrame); + 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 OnRenderProcessTerminated(const Browser: ICefBrowser; status: TCefTerminationStatus); + procedure OnPluginCrashed(const Browser: ICefBrowser; const pluginPath: ustring); + end; + + ICefQuotaCallback = interface(ICefBase) + //['{F163D612-CC9C-49CC-ADEA-FB6A32A25485}'] + procedure cont(allow: Boolean); + procedure cancel; + end; + + ICefRequestHandler = interface(ICefBase) + //['{050877A9-D1F8-4EB3-B58E-50DC3E3D39FD}'] + function OnBeforeResourceLoad(const Browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest): Boolean; + function GetResourceHandler(const Browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest): ICefResourceHandler; + procedure OnResourceRedirect(const Browser: ICefBrowser; const frame: ICefFrame; + const oldUrl: ustring; var newUrl: ustring); + function GetAuthCredentials(const Browser: ICefBrowser; const frame: ICefFrame; + isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; + const callback: ICefAuthCallback): Boolean; + function OnQuotaRequest(const Browser: ICefBrowser; + const originUrl: ustring; newSize: Int64; const callback: ICefQuotaCallback): Boolean; + function GetCookieManager(const Browser: ICefBrowser; const mainUrl: ustring): ICefCookieManager; + procedure OnProtocolExecution(const Browser: ICefBrowser; const url: ustring; out allowOsExecution: Boolean); + function OnBeforePluginLoad(const Browser: ICefBrowser; const url, policyUrl: ustring; + const info: ICefWebPluginInfo): Boolean; + end; + + ICefDisplayHandler = interface(ICefBase) + //['{1EC7C76D-6969-41D1-B26D-079BCFF054C4}'] + procedure OnLoadingStateChange(const Browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); + procedure OnAddressChange(const Browser: ICefBrowser; const frame: ICefFrame; const url: ustring); + procedure OnTitleChange(const Browser: ICefBrowser; const title: ustring); + 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; + end; + + ICefFocusHandler = interface(ICefBase) + //['{BB7FA3FA-7B1A-4ADC-8E50-12A24018DD90}'] + procedure OnTakeFocus(const Browser: ICefBrowser; next: Boolean); + function OnSetFocus(const Browser: ICefBrowser; source: TCefFocusSource): Boolean; + procedure OnGotFocus(const Browser: ICefBrowser); + end; + + ICefKeyboardHandler = interface(ICefBase) + //['{0512F4EC-ED88-44C9-90D3-5C6D03D3B146}'] + function OnPreKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; + function OnKeyEvent(const Browser: ICefBrowser; const event: PCefKeyEvent; + osEvent: TCefEventHandle): Boolean; + end; + + ICefJsDialogHandler = interface(ICefBase) + //['{64E18F86-DAC5-4ED1-8589-44DE45B9DB56}'] + function OnJsdialog(const Browser: ICefBrowser; const originUrl, acceptLang: ustring; + dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; + callback: ICefJsDialogCallback; out suppressMessage: Boolean): Boolean; + function OnBeforeUnloadDialog(const Browser: ICefBrowser; + const messageText: ustring; isReload: Boolean; + const callback: ICefJsDialogCallback): Boolean; + procedure OnResetDialogState(const Browser: ICefBrowser); + end; + + ICefContextMenuHandler = interface(ICefBase) + //['{C2951895-4087-49D5-BA18-4D9BA4F5EDD7}'] + procedure OnBeforeContextMenu(const Browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + function OnContextMenuCommand(const Browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: TCefEventFlags): Boolean; + procedure OnContextMenuDismissed(const Browser: ICefBrowser; const frame: ICefFrame); + end; + + ICefDialogHandler = interface(ICefBase) + //['{7763F4B2-8BE1-4E80-AC43-8B825850DC67}'] + function OnFileDialog(const Browser: ICefBrowser; mode: TCefFileDialogMode; + const title, defaultFileName: ustring; acceptTypes: TStrings; + const callback: ICefFileDialogCallback): Boolean; + end; + + ICefGeolocationCallback = interface(ICefBase) + //['{272B8E4F-4AE4-4F14-BC4E-5924FA0C149D}'] + procedure Cont(allow: Boolean); + end; + + ICefGeolocationHandler = interface(ICefBase) + //['{1178EE62-BAE7-4E44-932B-EAAC7A18191C}'] + procedure OnRequestGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer; const callback: ICefGeolocationCallback); + procedure OnCancelGeolocationPermission(const Browser: ICefBrowser; + const requestingUrl: ustring; requestId: Integer); + end; + + ICefRenderHandler = interface(ICefBase) + //['{1FC1C22B-085A-4741-9366-5249B88EC410}'] + function GetRootScreenRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; + function GetViewRect(const Browser: ICefBrowser; rect: PCefRect): Boolean; + function GetScreenPoint(const Browser: ICefBrowser; viewX, viewY: Integer; + screenX, screenY: PInteger): Boolean; + procedure OnPopupShow(const Browser: ICefBrowser; show: Boolean); + procedure OnPopupSize(const Browser: ICefBrowser; const rect: PCefRect); + procedure OnPaint(const Browser: ICefBrowser; kind: TCefPaintElementType; + dirtyRectsCount: Cardinal; const dirtyRects: PCefRectArray; + const buffer: Pointer; width, height: Integer); + procedure OnCursorChange(const Browser: ICefBrowser; cursor: TCefCursorHandle); + end; + + ICefClient = interface(ICefBase) + // ['{1D502075-2FF0-4E13-A112-9E541CD811F4}'] + function GetContextMenuHandler: ICefContextMenuHandler; + function GetDisplayHandler: ICefDisplayHandler; + function GetDownloadHandler: ICefDownloadHandler; + function GetFocusHandler: ICefFocusHandler; + function GetGeolocationHandler: ICefGeolocationHandler; + function GetJsdialogHandler: ICefJsdialogHandler; + function GetKeyboardHandler: ICefKeyboardHandler; + function GetLifeSpanHandler: ICefLifeSpanHandler; + function GetLoadHandler: ICefLoadHandler; + function GetRenderHandler: ICefRenderHandler; + function GetRequestHandler: ICefRequestHandler; + function OnProcessMessageReceived(const Browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage): Boolean; + end; + + ICefUrlRequest = interface(ICefBase) + //['{59226AC1-A0FA-4D59-9DF4-A65C42391A67}'] + function GetRequest: ICefRequest; + function GetRequestStatus: TCefUrlRequestStatus; + function GetRequestError: Integer; + function GetResponse: ICefResponse; + procedure Cancel; + end; + + ICefUrlrequestClient = interface(ICefBase) + //['{114155BD-C248-4651-9A4F-26F3F9A4F737}'] + procedure OnRequestComplete(const request: ICefUrlRequest); + procedure OnUploadProgress(const request: ICefUrlRequest; current, total: UInt64); + procedure OnDownloadProgress(const request: ICefUrlRequest; current, total: UInt64); + procedure OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: Cardinal); + end; + + ICefWebPluginInfoVisitor = interface(ICefBase) + //['{7523D432-4424-4804-ACAD-E67D2313436E}'] + function Visit(const info: ICefWebPluginInfo; count, total: Integer): Boolean; + end; + + ICefWebPluginUnstableCallback = interface(ICefBase) + //['{67459829-EB47-4B7E-9D69-2EE77DF0E71E}'] + procedure IsUnstable(const path: ustring; unstable: Boolean); + end; + + ICefTraceClient = interface(ICefBase) + //['{B6995953-A56A-46AC-B3D1-D644AEC480A5}'] + procedure OnTraceDataCollected(const fragment: PAnsiChar; fragmentSize: Cardinal); + procedure OnTraceBufferPercentFullReply(percentFull: Single); + procedure OnEndTracingComplete; + end; + + ICefGetGeolocationCallback = interface(ICefBase) + //['{ACB82FD9-3FFD-43F9-BF1A-A4849BF5B814}'] + procedure OnLocationUpdate(const position: PCefGeoposition); + end; + + ICefFileDialogCallback = interface(ICefBase) + //['{1AF659AB-4522-4E39-9C52-184000D8E3C7}'] + procedure Cont(filePaths: TStrings); + procedure Cancel; + end; + +Implementation + +end. + diff --git a/cef3lib.pas b/cef3lib.pas new file mode 100644 index 0000000..93ece2e --- /dev/null +++ b/cef3lib.pas @@ -0,0 +1,4550 @@ +(* + * Free Pascal Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Ported to Free Pascal and Linux by d.l.i.w <dev.dliw@gmail.com> + * based on 'Delphi Chromium Embedded' + * + * Repository: http://github.com/dliw/fpCEF3 + * + * + * Originally created for Delphi by: Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +Unit cef3lib; + +{$MODE objfpc}{$H+} + +(* +{$ALIGN ON} +{$MINENUMSIZE 4} +*) + + +{$I cef.inc} + +Interface + +Uses + {$IFDEF CEF_MULTI_THREADED_MESSAGE_LOOP}Messages,{$ENDIF} + SysUtils, Classes, SyncObjs + {$IFDEF MSWINDOWS}, Windows{$ENDIF} + ; + +Type + //ustring = WideString; + ustring = AnsiString; + rbstring = AnsiString; +(* +{$IFDEF UNICODE} + ustring = type String; + rbstring = type RawByteString; +{$ELSE} + {$IFDEF FPC} + {$IF declared(unicodestring)} + ustring = type UnicodeString; + {$ELSE} + ustring = type WideString; + {$IFEND} + {$ELSE} + ustring = type WideString; + {$ENDIF} + rbstring = type AnsiString; +{$ENDIF} +*) + +(* + +{$if not defined(UInt64)} + UInt64 = Int64; +{$ifend} + +*) + + TCefWindowHandle = {$IFDEF LINUX}Pointer {PGTKWidget}{$ELSE}HWND{$ENDIF}; + TCefCursorHandle = {$IFDEF LINUX}Pointer{$ELSE}HCURSOR{$ENDIF}; + TCefEventHandle = {$IFDEF LINUX}Pointer {PGDKEvent}{$ELSE}PMsg{$ENDIF}; + + // CEF provides functions for converting between UTF-8, -16 and -32 strings. + // CEF string types are safe for reading from multiple threads but not for + // modification. It is the user's responsibility to provide synchronization if + // modifying CEF strings from multiple threads. + + // CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on + // most other platforms. + + Char16 = WideChar; + PChar16 = PWideChar; + + + // CEF string type definitions. Whomever allocates |str| is responsible for + // providing an appropriate |dtor| implementation that will free the string in + // the same memory space. When reusing an existing string structure make sure + // to call |dtor| for the old value before assigning new |str| and |dtor| + // values. Static strings will have a NULL |dtor| value. Using the below + // functions if you want this managed for you. + + + PCefStringWide = ^TCefStringWide; + TCefStringWide = record + str: PWideChar; + length: Cardinal; + dtor: procedure(str: PWideChar); cdecl; + end; + + PCefStringUtf8 = ^TCefStringUtf8; + TCefStringUtf8 = record + str: PAnsiChar; + length: Cardinal; + dtor: procedure(str: PAnsiChar); cdecl; + end; + + PCefStringUtf16 = ^TCefStringUtf16; + TCefStringUtf16 = record + str: PChar16; + length: Cardinal; + dtor: procedure(str: PChar16); cdecl; + end; + + + // It is sometimes necessary for the system to allocate string structures with + // the expectation that the user will free them. The userfree types act as a + // hint that the user is responsible for freeing the structure. + + PCefStringUserFreeWide = ^TCefStringUserFreeWide; + TCefStringUserFreeWide = type TCefStringWide; + + PCefStringUserFreeUtf8 = ^TCefStringUserFreeUtf8; + TCefStringUserFreeUtf8 = type TCefStringUtf8; + + PCefStringUserFreeUtf16 = ^TCefStringUserFreeUtf16; + TCefStringUserFreeUtf16 = type TCefStringUtf16; + +(* +{$IFDEF CEF_STRING_TYPE_UTF8} + TCefChar = AnsiChar; + PCefChar = PAnsiChar; + TCefStringUserFree = TCefStringUserFreeUtf8; + PCefStringUserFree = PCefStringUserFreeUtf8; + TCefString = TCefStringUtf8; + PCefString = PCefStringUtf8; +{$ENDIF} +*) + +{$IFDEF CEF_STRING_TYPE_UTF16} + TCefChar = Char16; + PCefChar = PChar16; + TCefStringUserFree = TCefStringUserFreeUtf16; + PCefStringUserFree = PCefStringUserFreeUtf16; + TCefString = TCefStringUtf16; + PCefString = PCefStringUtf16; +{$ENDIF} + +(* + +{$IFDEF CEF_STRING_TYPE_WIDE} + TCefChar = WideChar; + PCefChar = PWideChar; + TCefStringUserFree = TCefStringUserFreeWide; + PCefStringUserFree = PCefStringUserFreeWide; + TCefString = TCefStringWide; + PCefString = PCefStringWide; +{$ENDIF} + +*) + + // CEF strings are NUL-terminated wide character strings prefixed with a size + // value, similar to the Microsoft BSTR type. Use the below API functions for + // allocating, managing and freeing CEF strings. + + // CEF string maps are a set of key/value string pairs. + TCefStringMap = Pointer; + + // CEF string multimaps are a set of key/value string pairs. + // More than one value can be assigned to a single key. + TCefStringMultimap = Pointer; + + // CEF string maps are a set of key/value string pairs. + TCefStringList = Pointer; + +//--------------------------------------------------------------------- + + // Structure representing CefExecuteProcess arguments. + PCefMainArgs = ^TCefMainArgs; + TCefMainArgs = record + {$IFDEF LINUX} + argc : Integer; + argv : PPChar; + {$ELSE} + instance: HINST; + {$ENDIF} + end; + + // Structure representing window information. + PCefWindowInfo = ^TCefWindowInfo; + + {$IFDEF LINUX} + TCefWindowInfo = record + + // Pointer for the parent GtkBox widget. + parent_widget: TCefWindowHandle; + + // Pointer for the new browser widget. + widget: TCefWindowHandle; + end; + {$ENDIF} + +(* + +{$IFDEF MACOS} + TCefWindowInfo = record + m_windowName: TCefString; + m_x: Integer; + m_y: Integer; + m_nWidth: Integer; + m_nHeight: Integer; + m_bHidden: Integer; + + // NSView pointer for the parent view. + m_ParentView: TCefWindowHandle; + + // NSView pointer for the new browser view. + m_View: TCefWindowHandle; + end; +{$ENDIF} + +{$IFDEF MSWINDOWS} + TCefWindowInfo = record + // Standard parameters required by CreateWindowEx() + ex_style: DWORD; + window_name: TCefString; + style: DWORD; + x: Integer; + y: Integer; + width: Integer; + height: Integer; + parent_window: HWND; + menu: HMENU; + // If window rendering is disabled no browser window will be created. Set + // |parent_window| to be used for identifying monitor info + // (MonitorFromWindow). If |parent_window| is not provided the main screen + // monitor will be used. + window_rendering_disabled: BOOL; + + // Set to true to enable transparent painting. + // If window rendering is disabled and |transparent_painting| is set to true + // WebKit rendering will draw on a transparent background (RGBA=0x00000000). + // When this value is false the background will be white and opaque. + transparent_painting: BOOL; + + // Handle for the new browser window. + window: HWND ; + end; +{$ENDIF} + +*) + + // Log severity levels. + TCefLogSeverity = ( + // Default logging (currently INFO logging). + LOGSEVERITY_DEFAULT, + // Verbose logging. + LOGSEVERITY_VERBOSE, + // INFO logging. + LOGSEVERITY_INFO, + // WARNING logging. + LOGSEVERITY_WARNING, + // ERROR logging. + LOGSEVERITY_ERROR, + // ERROR_REPORT logging. + LOGSEVERITY_ERROR_REPORT, + // Disables logging completely. + LOGSEVERITY_DISABLE = 99 + ); + + // Represents the state of a setting. + TCefState = ( + // Use the default state for the setting. + STATE_DEFAULT = 0, + + // Enable or allow the setting. + STATE_ENABLED, + + // Disable or disallow the setting. + STATE_DISABLED + ); + + // Initialization settings. Specify NULL or 0 to get the recommended default + // values. Many of these and other settings can also configured using command- + // line switches. + PCefSettings = ^TCefSettings; + TCefSettings = record + // Size of this structure. + size: Cardinal; + + // Set to true (1) to use a single process for the browser and renderer. This + // run mode is not officially supported by Chromium and is less stable than + // the multi-process default. Also configurable using the "single-process" + // command-line switch. + single_process: Boolean; + + // The path to a separate executable that will be launched for sub-processes. + // By default the browser process executable is used. See the comments on + // CefExecuteProcess() for details. Also configurable using the + // "browser-subprocess-path" command-line switch. + browser_subprocess_path: TCefString; + + // Set to true (1) to have the browser process message loop run in a separate + // thread. If false (0) than the CefDoMessageLoopWork() function must be + // called from your application message loop. + multi_threaded_message_loop: Boolean; + + // Set to true (1) to disable configuration of browser process features using + // standard CEF and Chromium command-line arguments. Configuration can still + // be specified using CEF data structures or via the + // CefApp::OnBeforeCommandLineProcessing() method. + command_line_args_disabled: Boolean; + + // The location where cache data will be stored on disk. If empty an in-memory + // cache will be used. HTML5 databases such as localStorage will only persist + // across sessions if a cache path is specified. + cache_path: TCefString; + + // Value that will be returned as the User-Agent HTTP header. If empty the + // default User-Agent string will be used. Also configurable using the + // "user-agent" command-line switch. + user_agent: TCefString; + + // Value that will be inserted as the product portion of the default + // User-Agent string. If empty the Chromium product version will be used. If + // |userAgent| is specified this value will be ignored. Also configurable + // using the "product-version" command-line switch. + product_version: TCefString; + + // The locale string that will be passed to WebKit. If empty the default + // locale of "en-US" will be used. This value is ignored on Linux where locale + // is determined using environment variable parsing with the precedence order: + // LANGUAGE, LC_ALL, LC_MESSAGES and LANG. Also configurable using the "lang" + // command-line switch. + locale: TCefString; + + // The directory and file name to use for the debug log. If empty, the + // default name of "debug.log" will be used and the file will be written + // to the application directory. Also configurable using the "log-file" + // command-line switch. + log_file: TCefString; + + // The log severity. Only messages of this severity level or higher will be + // logged. + log_severity: TCefLogSeverity; + + // Enable DCHECK in release mode to ease debugging. Also configurable using the + // "enable-release-dcheck" command-line switch. + release_dcheck_enabled: Boolean; + + // Custom flags that will be used when initializing the V8 JavaScript engine. + // The consequences of using custom flags may not be well tested. Also + // configurable using the "js-flags" command-line switch. + javascript_flags: TCefString; + + // The fully qualified path for the resources directory. If this value is + // empty the cef.pak and/or devtools_resources.pak files must be located in + // the module directory on Windows/Linux or the app bundle Resources directory + // on Mac OS X. Also configurable using the "resources-dir-path" command-line + // switch. + resources_dir_path: TCefString; + + // The fully qualified path for the locales directory. If this value is empty + // the locales directory must be located in the module directory. This value + // is ignored on Mac OS X where pack files are always loaded from the app + // bundle Resources directory. Also configurable using the "locales-dir-path" + // command-line switch. + locales_dir_path: TCefString; + + // Set to true (1) to disable loading of pack files for resources and locales. + // A resource bundle handler must be provided for the browser and render + // processes via CefApp::GetResourceBundleHandler() if loading of pack files + // is disabled. Also configurable using the "disable-pack-loading" command- + // line switch. + pack_loading_disabled: Boolean; + + // Set to a value between 1024 and 65535 to enable remote debugging on the + // specified port. For example, if 8080 is specified the remote debugging URL + // will be http://localhost:8080. CEF can be remotely debugged from any CEF or + // Chrome browser window. Also configurable using the "remote-debugging-port" + // command-line switch. + remote_debugging_port: Integer; + + // The number of stack trace frames to capture for uncaught exceptions. + // Specify a positive value to enable the CefV8ContextHandler:: + // OnUncaughtException() callback. Specify 0 (default value) and + // OnUncaughtException() will not be called. Also configurable using the + // "uncaught-exception-stack-size" command-line switch. + + uncaught_exception_stack_size: Integer; + + // By default CEF V8 references will be invalidated (the IsValid() method will + // return false) after the owning context has been released. This reduces the + // need for external record keeping and avoids crashes due to the use of V8 + // references after the associated context has been released. + // + // CEF currently offers two context safety implementations with different + // performance characteristics. The default implementation (value of 0) uses a + // map of hash values and should provide better performance in situations with + // a small number contexts. The alternate implementation (value of 1) uses a + // hidden value attached to each context and should provide better performance + // in situations with a large number of contexts. + // + // If you need better performance in the creation of V8 references and you + // plan to manually track context lifespan you can disable context safety by + // specifying a value of -1. + // + // Also configurable using the "context-safety-implementation" command-line + // switch. + + context_safety_implementation: Integer; + end; + + // Browser initialization settings. Specify NULL or 0 to get the recommended + // default values. The consequences of using custom values may not be well + // tested. Many of these and other settings can also configured using command- + // line switches. + PCefBrowserSettings = ^TCefBrowserSettings; + TCefBrowserSettings = record + // Size of this structure. + size: Cardinal; + + // The below values map to WebPreferences settings. + + // Font settings. + standard_font_family: TCefString; + fixed_font_family: TCefString; + serif_font_family: TCefString; + sans_serif_font_family: TCefString; + cursive_font_family: TCefString; + fantasy_font_family: TCefString; + default_font_size: Integer; + default_fixed_font_size: Integer; + minimum_font_size: Integer; + minimum_logical_font_size: Integer; + + // Default encoding for Web content. If empty "ISO-8859-1" will be used. Also + // configurable using the "default-encoding" command-line switch. + default_encoding: TCefString; + + // Location of the user style sheet that will be used for all pages. This must + // be a data URL of the form "data:text/css;charset=utf-8;base64,csscontent" + // where "csscontent" is the base64 encoded contents of the CSS file. Also + // configurable using the "user-style-sheet-location" command-line switch. + user_style_sheet_location: TCefString; + + // Controls the loading of fonts from remote sources. Also configurable using + // the "disable-remote-fonts" command-line switch. + remote_fonts: TCefState; + + // Controls whether JavaScript can be executed. Also configurable using the + // "disable-javascript" command-line switch. + javascript: TCefState; + + + // Controls whether JavaScript can be used for opening windows. Also + // configurable using the "disable-javascript-open-windows" command-line + // switch. + javascript_open_windows: TCefState; + + // Controls whether JavaScript can be used to close windows that were not + // opened via JavaScript. JavaScript can still be used to close windows that + // were opened via JavaScript. Also configurable using the + // "disable-javascript-close-windows" command-line switch. + javascript_close_windows: TCefState; + + // Controls whether JavaScript can access the clipboard. Also configurable + // using the "disable-javascript-access-clipboard" command-line switch. + javascript_access_clipboard: TCefState; + + // Controls whether DOM pasting is supported in the editor via + // execCommand("paste"). The |javascript_access_clipboard| setting must also + // be enabled. Also configurable using the "disable-javascript-dom-paste" + // command-line switch. + javascript_dom_paste: TCefState; + + // Controls whether the caret position will be drawn. Also configurable using + // the "enable-caret-browsing" command-line switch. + caret_browsing: TCefState; + + // Controls whether the Java plugin will be loaded. Also configurable using + // the "disable-java" command-line switch. + java: TCefState; + + // Controls whether any plugins will be loaded. Also configurable using the + // "disable-plugins" command-line switch. + plugins: TCefState; + + // Controls whether file URLs will have access to all URLs. Also configurable + // using the "allow-universal-access-from-files" command-line switch. + universal_access_from_file_urls: TCefState; + + // Controls whether file URLs will have access to other file URLs. Also + // configurable using the "allow-access-from-files" command-line switch. + file_access_from_file_urls: TCefState; + + // Controls whether web security restrictions (same-origin policy) will be + // enforced. Disabling this setting is not recommend as it will allow risky + // security behavior such as cross-site scripting (XSS). Also configurable + // using the "disable-web-security" command-line switch. + web_security: TCefState; + + // Controls whether image URLs will be loaded from the network. A cached image + // will still be rendered if requested. Also configurable using the + // "disable-image-loading" command-line switch. + image_loading: TCefState; + + // Controls whether standalone images will be shrunk to fit the page. Also + // configurable using the "image-shrink-standalone-to-fit" command-line + // switch. + image_shrink_standalone_to_fit: TCefState; + + // Controls whether text areas can be resized. Also configurable using the + // "disable-text-area-resize" command-line switch. + text_area_resize: TCefState; + + // Controls whether the fastback (back/forward) page cache will be used. Also + // configurable using the "enable-fastback" command-line switch. + page_cache: TCefState; + + // Controls whether the tab key can advance focus to links. Also configurable + // using the "disable-tab-to-links" command-line switch. + tab_to_links: TCefState; + + // Controls whether style sheets can be used. Also configurable using the + // "disable-author-and-user-styles" command-line switch. + author_and_user_styles: TCefState; + + // Controls whether local storage can be used. Also configurable using the + // "disable-local-storage" command-line switch. + local_storage: TCefState; + + // Controls whether databases can be used. Also configurable using the + // "disable-databases" command-line switch. + databases: TCefState; + + // Controls whether the application cache can be used. Also configurable using + // the "disable-application-cache" command-line switch. + application_cache: TCefState; + + // Controls whether WebGL can be used. Note that WebGL requires hardware + // support and may not work on all systems even when enabled. Also + // configurable using the "disable-webgl" command-line switch. + webgl: TCefState; + + // Controls whether content that depends on accelerated compositing can be + // used. Note that accelerated compositing requires hardware support and may + // not work on all systems even when enabled. Also configurable using the + // "disable-accelerated-compositing" command-line switch. + accelerated_compositing: TCefState; + + // Controls whether developer tools (WebKit inspector) can be used. Also + // configurable using the "disable-developer-tools" command-line switch. + developer_tools: TCefState; + end; + + // URL component parts. + PCefUrlParts = ^TCefUrlParts; + TCefUrlParts = record + // The complete URL specification. + spec: TCefString; + + // Scheme component not including the colon (e.g., "http"). + scheme: TCefString; + + // User name component. + username: TCefString; + + // Password component. + password: TCefString; + + // Host component. This may be a hostname, an IPv4 address or an IPv6 literal + // surrounded by square brackets (e.g., "[2001:db8::1]"). + host: TCefString; + + // Port number component. + port: TCefString; + + // Path component including the first slash following the host. + path: TCefString; + + // Query string component (i.e., everything following the '?'). + query: TCefString; + end; + + TUrlParts = record + spec: ustring; + scheme: ustring; + username: ustring; + password: ustring; + host: ustring; + port: ustring; + path: ustring; + query: ustring; + end; + + // Time information. Values should always be in UTC. + PCefTime = ^TCefTime; + TCefTime = record + year: Integer; // Four digit year "2007" + month: Integer; // 1-based month (values 1 = January, etc.) + day_of_week: Integer; // 0-based day of week (0 = Sunday, etc.) + day_of_month: Integer; // 1-based day of month (1-31) + hour: Integer; // Hour within the current day (0-23) + minute: Integer; // Minute within the current hour (0-59) + second: Integer; // Second within the current minute (0-59 plus leap + // seconds which may take it up to 60). + millisecond: Integer; // Milliseconds within the current second (0-999) + end; + + // Cookie information. + TCefCookie = record + // The cookie name. + name: TCefString; + + // The cookie value. + value: TCefString; + + // If |domain| is empty a host cookie will be created instead of a domain + // cookie. Domain cookies are stored with a leading "." and are visible to + // sub-domains whereas host cookies are not. + domain: TCefString; + + // If |path| is non-empty only URLs at or below the path will get the cookie + // value. + path: TCefString; + + // If |secure| is true the cookie will only be sent for HTTPS requests. + secure: Boolean; + + // If |httponly| is true the cookie will only be sent for HTTP requests. + httponly: Boolean; + + // The cookie creation date. This is automatically populated by the system on + // cookie creation. + creation: TCefTime; + + // The cookie last access date. This is automatically populated by the system + // on access. + last_access: TCefTime; + + // The cookie expiration date is only valid if |has_expires| is true. + has_expires: Boolean; + expires: TCefTime; + end; + + // Process termination status values. + TCefTerminationStatus = ( + // Non-zero exit status. + TS_ABNORMAL_TERMINATION, + // SIGKILL or task manager kill. + TS_PROCESS_WAS_KILLED, + // Segmentation fault. + TS_PROCESS_CRASHED + ); + + // Path key values. + TCefPathKey = ( + // Current directory. + PK_DIR_CURRENT, + // Directory containing PK_FILE_EXE. + PK_DIR_EXE, + // Directory containing PK_FILE_MODULE. + PK_DIR_MODULE, + // Temporary directory. + PK_DIR_TEMP, + // Path and filename of the current executable. + PK_FILE_EXE, + // Path and filename of the module containing the CEF code (usually the libcef + // module). + PK_FILE_MODULE + ); + + // Storage types. + TCefStorageType = ( + ST_LOCALSTORAGE = 0, + ST_SESSIONSTORAGE + ); + + // Supported error code values. See net\base\net_error_list.h for complete + // descriptions of the error codes. + TCefHandlerErrorcode = Integer; + +Const + ERR_NONE = 0; + ERR_FAILED = -2; + ERR_ABORTED = -3; + ERR_INVALID_ARGUMENT = -4; + ERR_INVALID_HANDLE = -5; + ERR_FILE_NOT_FOUND = -6; + ERR_TIMED_OUT = -7; + ERR_FILE_TOO_BIG = -8; + ERR_UNEXPECTED = -9; + ERR_ACCESS_DENIED = -10; + ERR_NOT_IMPLEMENTED = -11; + ERR_CONNECTION_CLOSED = -100; + ERR_CONNECTION_RESET = -101; + ERR_CONNECTION_REFUSED = -102; + ERR_CONNECTION_ABORTED = -103; + ERR_CONNECTION_FAILED = -104; + ERR_NAME_NOT_RESOLVED = -105; + ERR_INTERNET_DISCONNECTED = -106; + ERR_SSL_PROTOCOL_ERROR = -107; + ERR_ADDRESS_INVALID = -108; + ERR_ADDRESS_UNREACHABLE = -109; + ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110; + ERR_TUNNEL_CONNECTION_FAILED = -111; + ERR_NO_SSL_VERSIONS_ENABLED = -112; + ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113; + ERR_SSL_RENEGOTIATION_REQUESTED = -114; + ERR_CERT_COMMON_NAME_INVALID = -200; + ERR_CERT_DATE_INVALID = -201; + ERR_CERT_AUTHORITY_INVALID = -202; + ERR_CERT_CONTAINS_ERRORS = -203; + ERR_CERT_NO_REVOCATION_MECHANISM = -204; + ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205; + ERR_CERT_REVOKED = -206; + ERR_CERT_INVALID = -207; + ERR_CERT_END = -208; + ERR_INVALID_URL = -300; + ERR_DISALLOWED_URL_SCHEME = -301; + ERR_UNKNOWN_URL_SCHEME = -302; + ERR_TOO_MANY_REDIRECTS = -310; + ERR_UNSAFE_REDIRECT = -311; + ERR_UNSAFE_PORT = -312; + ERR_INVALID_RESPONSE = -320; + ERR_INVALID_CHUNKED_ENCODING = -321; + ERR_METHOD_NOT_SUPPORTED = -322; + ERR_UNEXPECTED_PROXY_AUTH = -323; + ERR_EMPTY_RESPONSE = -324; + ERR_RESPONSE_HEADERS_TOO_BIG = -325; + ERR_CACHE_MISS = -400; + ERR_INSECURE_RESPONSE = -501; + +Type + // V8 access control values. + TCefV8AccessControl = ( + //V8_ACCESS_CONTROL_DEFAULT = 0; + V8_ACCESS_CONTROL_ALL_CAN_READ, + V8_ACCESS_CONTROL_ALL_CAN_WRITE, + V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING + ); + TCefV8AccessControls = set of TCefV8AccessControl; + + // V8 property attribute values. + TCefV8PropertyAttribute = ( + //V8_PROPERTY_ATTRIBUTE_NONE = 0; // Writeable, Enumerable, Configurable + V8_PROPERTY_ATTRIBUTE_READONLY, // Not writeable + V8_PROPERTY_ATTRIBUTE_DONTENUM, // Not enumerable + V8_PROPERTY_ATTRIBUTE_DONTDELETE // Not configurable + ); + TCefV8PropertyAttributes = set of TCefV8PropertyAttribute; + + +Type + // Post data elements may represent either bytes or files. + TCefPostDataElementType = ( + PDE_TYPE_EMPTY = 0, + PDE_TYPE_BYTES, + PDE_TYPE_FILE + ); + + // Flags used to customize the behavior of CefURLRequest. + TCefUrlRequestFlag = ( + // Default behavior. + //UR_FLAG_NONE = 0, + // If set the cache will be skipped when handling the request. + UR_FLAG_SKIP_CACHE, + // If set user name, password, and cookies may be sent with the request. + UR_FLAG_ALLOW_CACHED_CREDENTIALS, + // If set cookies may be sent with the request and saved from the response. + // UR_FLAG_ALLOW_CACHED_CREDENTIALS must also be set. + UR_FLAG_ALLOW_COOKIES, + // If set upload progress events will be generated when a request has a body. + UR_FLAG_REPORT_UPLOAD_PROGRESS, + // If set load timing info will be collected for the request. + UR_FLAG_REPORT_LOAD_TIMING, + // If set the headers sent and received for the request will be recorded. + UR_FLAG_REPORT_RAW_HEADERS, + // If set the CefURLRequestClient::OnDownloadData method will not be called. + UR_FLAG_NO_DOWNLOAD_DATA, + // If set 5XX redirect errors will be propagated to the observer instead of + // automatically re-tried. This currently only applies for requests + // originated in the browser process. + UR_FLAG_NO_RETRY_ON_5XX + ); + TCefUrlRequestFlags = set of TCefUrlRequestFlag; + + // Flags that represent CefURLRequest status. + TCefUrlRequestStatus = ( + // Unknown status. + UR_UNKNOWN = 0, + // Request succeeded. + UR_SUCCESS, + // An IO request is pending, and the caller will be informed when it is + // completed. + UR_IO_PENDING, + // Request was canceled programatically. + UR_CANCELED, + // Request failed for some reason. + UR_FAILED + ); + + // Structure representing a rectangle. + PCefRect = ^TCefRect; + TCefRect = record + x: Integer; + y: Integer; + width: Integer; + height: Integer; + end; + + TCefRectArray = array[0..(High(Integer) div SizeOf(TCefRect))-1] of TCefRect; + PCefRectArray = ^TCefRectArray; + + // Existing process IDs. + TCefProcessId = ( + // Browser process. + PID_BROWSER, + // Renderer process. + PID_RENDERER + ); + + // Existing thread IDs. + TCefThreadId = ( + // BROWSER PROCESS THREADS -- Only available in the browser process. + // The main thread in the browser. This will be the same as the main + // application thread if CefInitialize() is called with a + // CefSettings.multi_threaded_message_loop value of false. + /// + TID_UI, + + // Used to interact with the database. + TID_DB, + + // Used to interact with the file system. + TID_FILE, + + // Used for file system operations that block user interactions. + // Responsiveness of this thread affects users. + TID_FILE_USER_BLOCKING, + + // Used to launch and terminate browser processes. + TID_PROCESS_LAUNCHER, + + // Used to handle slow HTTP cache operations. + TID_CACHE, + + // Used to process IPC and network messages. + TID_IO, + + // RENDER PROCESS THREADS -- Only available in the render process. + + // The main thread in the renderer. Used for all WebKit and V8 interaction. + TID_RENDERER + ); + + // Supported value types. + TCefValueType = ( + VTYPE_INVALID = 0, + VTYPE_NULL, + VTYPE_BOOL, + VTYPE_INT, + VTYPE_DOUBLE, + VTYPE_STRING, + VTYPE_BINARY, + VTYPE_DICTIONARY, + VTYPE_LIST + ); + + // Supported JavaScript dialog types. + TCefJsDialogType = ( + JSDIALOGTYPE_ALERT = 0, + JSDIALOGTYPE_CONFIRM, + JSDIALOGTYPE_PROMPT + ); + + // Supported menu IDs. Non-English translations can be provided for the + // IDS_MENU_* strings in CefResourceBundleHandler::GetLocalizedString(). + TCefMenuId = ( + // Navigation. + MENU_ID_BACK = 100, + MENU_ID_FORWARD = 101, + MENU_ID_RELOAD = 102, + MENU_ID_RELOAD_NOCACHE = 103, + MENU_ID_STOPLOAD = 104, + + // Editing. + MENU_ID_UNDO = 110, + MENU_ID_REDO = 111, + MENU_ID_CUT = 112, + MENU_ID_COPY = 113, + MENU_ID_PASTE = 114, + MENU_ID_DELETE = 115, + MENU_ID_SELECT_ALL = 116, + + // Miscellaneous. + MENU_ID_FIND = 130, + MENU_ID_PRINT = 131, + MENU_ID_VIEW_SOURCE = 132, + + // All user-defined menu IDs should come between MENU_ID_USER_FIRST and + // MENU_ID_USER_LAST to avoid overlapping the Chromium and CEF ID ranges + // defined in the tools/gritsettings/resource_ids file. + MENU_ID_USER_FIRST = 26500, + MENU_ID_USER_LAST = 28500 + ); + + // Mouse button types. + TCefMouseButtonType = ( + MBT_LEFT, + MBT_MIDDLE, + MBT_RIGHT + ); + + // Paint element types. + TCefPaintElementType = ( + PET_VIEW, + PET_POPUP + ); + + // Supported event bit flags. + TCefEventFlag = ( + //EVENTFLAG_NONE = 0, + EVENTFLAG_CAPS_LOCK_ON, + EVENTFLAG_SHIFT_DOWN, + EVENTFLAG_CONTROL_DOWN, + EVENTFLAG_ALT_DOWN, + EVENTFLAG_LEFT_MOUSE_BUTTON, + EVENTFLAG_MIDDLE_MOUSE_BUTTON, + EVENTFLAG_RIGHT_MOUSE_BUTTON, + // Mac OS-X command key. + EVENTFLAG_COMMAND_DOWN, + EVENTFLAG_NUM_LOCK_ON, + EVENTFLAG_IS_KEY_PAD, + EVENTFLAG_IS_LEFT, + EVENTFLAG_IS_RIGHT + ); + TCefEventFlags = set of TCefEventFlag; + + // Structure representing mouse event information. + PCefMouseEvent = ^TCefMouseEvent; + TCefMouseEvent = record + // X coordinate relative to the left side of the view. + x: Integer; + + // Y coordinate relative to the top side of the view. + y: Integer; + + // Bit flags describing any pressed modifier keys. See + // cef_event_flags_t for values. + modifiers: TCefEventFlags; + end; + + // Supported menu item types. + TCefMenuItemType = ( + MENUITEMTYPE_NONE, + MENUITEMTYPE_COMMAND, + MENUITEMTYPE_CHECK, + MENUITEMTYPE_RADIO, + MENUITEMTYPE_SEPARATOR, + MENUITEMTYPE_SUBMENU + ); + + // Supported context menu type flags. + TCefContextMenuTypeFlag = ( + // No node is selected. + //CM_TYPEFLAG_NONE = 0, + // The top page is selected. + CM_TYPEFLAG_PAGE, + // A subframe page is selected. + CM_TYPEFLAG_FRAME, + // A link is selected. + CM_TYPEFLAG_LINK, + // A media node is selected. + CM_TYPEFLAG_MEDIA, + // There is a textual or mixed selection that is selected. + CM_TYPEFLAG_SELECTION, + // An editable element is selected. + CM_TYPEFLAG_EDITABLE + ); + TCefContextMenuTypeFlags = set of TCefContextMenuTypeFlag; + + // Supported context menu media types. + TCefContextMenuMediaType = ( + // No special node is in context. + CM_MEDIATYPE_NONE, + // An image node is selected. + CM_MEDIATYPE_IMAGE, + // A video node is selected. + CM_MEDIATYPE_VIDEO, + // An audio node is selected. + CM_MEDIATYPE_AUDIO, + // A file node is selected. + CM_MEDIATYPE_FILE, + // A plugin node is selected. + CM_MEDIATYPE_PLUGIN + ); + + // Supported context menu media state bit flags. + TCefContextMenuMediaStateFlag = ( + //CM_MEDIAFLAG_NONE = 0, + CM_MEDIAFLAG_ERROR, + CM_MEDIAFLAG_PAUSED, + CM_MEDIAFLAG_MUTED, + CM_MEDIAFLAG_LOOP, + CM_MEDIAFLAG_CAN_SAVE, + CM_MEDIAFLAG_HAS_AUDIO, + CM_MEDIAFLAG_HAS_VIDEO, + CM_MEDIAFLAG_CONTROL_ROOT_ELEMENT, + CM_MEDIAFLAG_CAN_PRINT, + CM_MEDIAFLAG_CAN_ROTATE + ); + TCefContextMenuMediaStateFlags = set of TCefContextMenuMediaStateFlag; + + // Supported context menu edit state bit flags. + TCefContextMenuEditStateFlag = ( + //CM_EDITFLAG_NONE = 0, + CM_EDITFLAG_CAN_UNDO, + CM_EDITFLAG_CAN_REDO, + CM_EDITFLAG_CAN_CUT, + CM_EDITFLAG_CAN_COPY, + CM_EDITFLAG_CAN_PASTE, + CM_EDITFLAG_CAN_DELETE, + CM_EDITFLAG_CAN_SELECT_ALL, + CM_EDITFLAG_CAN_TRANSLATE + ); + TCefContextMenuEditStateFlags = set of TCefContextMenuEditStateFlag; + + // Key event types. + TCefKeyEventType = ( + KEYEVENT_RAWKEYDOWN = 0, + KEYEVENT_KEYDOWN, + KEYEVENT_KEYUP, + KEYEVENT_CHAR + ); + + // Structure representing keyboard event information. + PCefKeyEvent = ^TCefKeyEvent; + TCefKeyEvent = record + // The type of keyboard event. + kind: TCefKeyEventType; + + // Bit flags describing any pressed modifier keys. See + // cef_event_flags_t for values. + modifiers: TCefEventFlags; + + // The Windows key code for the key event. This value is used by the DOM + // specification. Sometimes it comes directly from the event (i.e. on + // Windows) and sometimes it's determined using a mapping function. See + // WebCore/platform/chromium/KeyboardCodes.h for the list of values. + windows_key_code: Integer; + + // The actual key code genenerated by the platform. + native_key_code: Integer; + + // Indicates whether the event is considered a "system key" event (see + // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details). + // This value will always be false on non-Windows platforms. + is_system_key: Boolean; + + // The character generated by the keystroke. + character: WideChar; + + // Same as |character| but unmodified by any concurrently-held modifiers + // (except shift). This is useful for working out shortcut keys. + unmodified_character: WideChar; + + // True if the focus is currently on an editable field on the page. This is + // useful for determining if standard key events should be intercepted. + focus_on_editable_field: Boolean; + end; + + // Focus sources. + TCefFocusSource = ( + // The source is explicit navigation via the API (LoadURL(), etc). + FOCUS_SOURCE_NAVIGATION = 0, + // The source is a system-generated focus event. + FOCUS_SOURCE_SYSTEM + ); + + // Navigation types. + TCefNavigationType = ( + NAVIGATION_LINK_CLICKED, + NAVIGATION_FORM_SUBMITTED, + NAVIGATION_BACK_FORWARD, + NAVIGATION_RELOAD, + NAVIGATION_FORM_RESUBMITTED, + NAVIGATION_OTHER + ); + + // Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and + // UTF16 (LE and BE) by default. All other types must be translated to UTF8 + // before being passed to the parser. If a BOM is detected and the correct + // decoder is available then that decoder will be used automatically. + TCefXmlEncodingType = ( + XML_ENCODING_NONE = 0, + XML_ENCODING_UTF8, + XML_ENCODING_UTF16LE, + XML_ENCODING_UTF16BE, + XML_ENCODING_ASCII + ); + + // XML node types. + TCefXmlNodeType = ( + XML_NODE_UNSUPPORTED = 0, + XML_NODE_PROCESSING_INSTRUCTION, + XML_NODE_DOCUMENT_TYPE, + XML_NODE_ELEMENT_START, + XML_NODE_ELEMENT_END, + XML_NODE_ATTRIBUTE, + XML_NODE_TEXT, + XML_NODE_CDATA, + XML_NODE_ENTITY_REFERENCE, + XML_NODE_WHITESPACE, + XML_NODE_COMMENT + ); + + // Popup window features. + PCefPopupFeatures = ^TCefPopupFeatures; + TCefPopupFeatures = record + x: Integer; + xSet: Boolean; + y: Integer; + ySet: Boolean; + width: Integer; + widthSet: Boolean; + height: Integer; + heightSet: Boolean; + + menuBarVisible: Boolean; + statusBarVisible: Boolean; + toolBarVisible: Boolean; + locationBarVisible: Boolean; + scrollbarsVisible: Boolean; + resizable: Boolean; + + fullscreen: Boolean; + dialog: Boolean; + additionalFeatures: TCefStringList; + end; + + // DOM document types. + TCefDomDocumentType = ( + DOM_DOCUMENT_TYPE_UNKNOWN = 0, + DOM_DOCUMENT_TYPE_HTML, + DOM_DOCUMENT_TYPE_XHTML, + DOM_DOCUMENT_TYPE_PLUGIN + ); + + // DOM event category flags. + TCefDomEventCategory = Integer; +const + DOM_EVENT_CATEGORY_UNKNOWN = $0; + DOM_EVENT_CATEGORY_UI = $1; + DOM_EVENT_CATEGORY_MOUSE = $2; + DOM_EVENT_CATEGORY_MUTATION = $4; + DOM_EVENT_CATEGORY_KEYBOARD = $8; + DOM_EVENT_CATEGORY_TEXT = $10; + DOM_EVENT_CATEGORY_COMPOSITION = $20; + DOM_EVENT_CATEGORY_DRAG = $40; + DOM_EVENT_CATEGORY_CLIPBOARD = $80; + DOM_EVENT_CATEGORY_MESSAGE = $100; + DOM_EVENT_CATEGORY_WHEEL = $200; + DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED = $400; + DOM_EVENT_CATEGORY_OVERFLOW = $800; + DOM_EVENT_CATEGORY_PAGE_TRANSITION = $1000; + DOM_EVENT_CATEGORY_POPSTATE = $2000; + DOM_EVENT_CATEGORY_PROGRESS = $4000; + DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS = $8000; + DOM_EVENT_CATEGORY_WEBKIT_ANIMATION = $10000; + DOM_EVENT_CATEGORY_WEBKIT_TRANSITION = $20000; + DOM_EVENT_CATEGORY_BEFORE_LOAD = $40000; + +type + // DOM event processing phases. + TCefDomEventPhase = ( + DOM_EVENT_PHASE_UNKNOWN = 0, + DOM_EVENT_PHASE_CAPTURING, + DOM_EVENT_PHASE_AT_TARGET, + DOM_EVENT_PHASE_BUBBLING + ); + + // DOM node types. + TCefDomNodeType = ( + DOM_NODE_TYPE_UNSUPPORTED = 0, + DOM_NODE_TYPE_ELEMENT, + DOM_NODE_TYPE_ATTRIBUTE, + DOM_NODE_TYPE_TEXT, + DOM_NODE_TYPE_CDATA_SECTION, + DOM_NODE_TYPE_ENTITY_REFERENCE, + DOM_NODE_TYPE_ENTITY, + DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS, + DOM_NODE_TYPE_COMMENT, + DOM_NODE_TYPE_DOCUMENT, + DOM_NODE_TYPE_DOCUMENT_TYPE, + DOM_NODE_TYPE_DOCUMENT_FRAGMENT, + DOM_NODE_TYPE_NOTATION, + DOM_NODE_TYPE_XPATH_NAMESPACE + ); + + // Supported file dialog modes. + TCefFileDialogMode = ( + // Requires that the file exists before allowing the user to pick it. + FILE_DIALOG_OPEN, + + // Like Open, but allows picking multiple files to open. + FILE_DIALOG_OPEN_MULTIPLE, + + // Allows picking a nonexistent file, and prompts to overwrite if the file + // already exists. + FILE_DIALOG_SAVE + ); + + // Geoposition error codes. + TCefGeopositionErrorCode = ( + GEOPOSITON_ERROR_NONE, + GEOPOSITON_ERROR_PERMISSION_DENIED, + GEOPOSITON_ERROR_POSITION_UNAVAILABLE, + GEOPOSITON_ERROR_TIMEOUT + ); + + // Structure representing geoposition information. The properties of this + // structure correspond to those of the JavaScript Position object although + // their types may differ. + PCefGeoposition = ^TCefGeoposition; + TCefGeoposition = record + // Latitude in decimal degrees north (WGS84 coordinate frame). + latitude: Double; + + // Longitude in decimal degrees west (WGS84 coordinate frame). + longitude: Double; + + // Altitude in meters (above WGS84 datum). + altitude: Double; + + // Accuracy of horizontal position in meters. + accuracy: Double; + + // Accuracy of altitude in meters. + altitude_accuracy: Double; + + // Heading in decimal degrees clockwise from true north. + heading: Double; + + // Horizontal component of device velocity in meters per second. + speed: Double; + + // Time of position measurement in miliseconds since Epoch in UTC time. This + // is taken from the host computer's system clock. + timestamp: TCefTime; + + // Error code, see enum above. + error_code: TCefGeopositionErrorCode; + + // Human-readable error message. + error_message: TCefString; + end; + + +(******************************************************************************* + capi + *******************************************************************************) + +Type + PCefv8Handler = ^TCefv8Handler; + PCefV8Accessor = ^TCefV8Accessor; + PCefv8Value = ^TCefv8Value; + PCefV8StackTrace = ^TCefV8StackTrace; + PCefV8StackFrame = ^TCefV8StackFrame; + PCefV8ValueArray = array[0..(High(Integer) div SizeOf(Integer)) - 1] of PCefV8Value; + PPCefV8Value = ^PCefV8ValueArray; + PCefSchemeHandlerFactory = ^TCefSchemeHandlerFactory; + PCefSchemeRegistrar = ^TCefSchemeRegistrar; + PCefFrame = ^TCefFrame; + PCefRequest = ^TCefRequest; + PCefStreamReader = ^TCefStreamReader; + PCefPostData = ^TCefPostData; + PCefPostDataElement = ^TCefPostDataElement; + PPCefPostDataElement = ^PCefPostDataElement; + PCefReadHandler = ^TCefReadHandler; + PCefWriteHandler = ^TCefWriteHandler; + PCefStreamWriter = ^TCefStreamWriter; + PCefBase = ^TCefBase; + PCefBrowser = ^TCefBrowser; + PCefRunFileDialogCallback = ^TCefRunFileDialogCallback; + PCefBrowserHost = ^TCefBrowserHost; + PCefTask = ^TCefTask; + PCefTaskRunner = ^TCefTaskRunner; + PCefDownloadHandler = ^TCefDownloadHandler; + PCefXmlReader = ^TCefXmlReader; + PCefZipReader = ^TCefZipReader; + PCefDomVisitor = ^TCefDomVisitor; + PCefDomDocument = ^TCefDomDocument; + PCefDomNode = ^TCefDomNode; + PCefDomEventListener = ^TCefDomEventListener; + PCefDomEvent = ^TCefDomEvent; + PCefResponse = ^TCefResponse; + PCefv8Context = ^TCefv8Context; + PCefCookieVisitor = ^TCefCookieVisitor; + PCefCookie = ^TCefCookie; + PCefClient = ^TCefClient; + PCefLifeSpanHandler = ^TCefLifeSpanHandler; + PCefLoadHandler = ^TCefLoadHandler; + PCefRequestHandler = ^TCefRequestHandler; + PCefDisplayHandler = ^TCefDisplayHandler; + PCefFocusHandler = ^TCefFocusHandler; + PCefKeyboardHandler = ^TCefKeyboardHandler; + PCefJsDialogHandler = ^TCefJsDialogHandler; + PCefApp = ^TCefApp; + PCefV8Exception = ^TCefV8Exception; + PCefResourceBundleHandler = ^TCefResourceBundleHandler; + PCefCookieManager = ^TCefCookieManager; + PCefWebPluginInfo = ^TCefWebPluginInfo; + PCefCommandLine = ^TCefCommandLine; + PCefProcessMessage = ^TCefProcessMessage; + PCefBinaryValue = ^TCefBinaryValue; + PCefDictionaryValue = ^TCefDictionaryValue; + PCefListValue = ^TCefListValue; + PCefBrowserProcessHandler = ^TCefBrowserProcessHandler; + PCefRenderProcessHandler = ^TCefRenderProcessHandler; + PCefAuthCallback = ^TCefAuthCallback; + PCefQuotaCallback = ^TCefQuotaCallback; + PCefResourceHandler = ^TCefResourceHandler; + PCefCallback = ^TCefCallback; + PCefContextMenuHandler = ^TCefContextMenuHandler; + PCefContextMenuParams = ^TCefContextMenuParams; + PCefMenuModel = ^TCefMenuModel; + PCefGeolocationCallback = ^TCefGeolocationCallback; + PCefGeolocationHandler = ^TCefGeolocationHandler; + PCefBeforeDownloadCallback = ^TCefBeforeDownloadCallback; + PCefDownloadItemCallback = ^TCefDownloadItemCallback; + PCefDownloadItem = ^TCefDownloadItem; + PCefStringVisitor = ^TCefStringVisitor; + PCefJsDialogCallback = ^TCefJsDialogCallback; + PCefUrlRequest = ^TCefUrlRequest; + PCefUrlRequestClient = ^TCefUrlRequestClient; + PCefWebPluginInfoVisitor = ^TCefWebPluginInfoVisitor; + PCefWebPluginUnstableCallback = ^TCefWebPluginUnstableCallback; + PCefFileDialogCallback = ^TCefFileDialogCallback; + PCefDialogHandler = ^TCefDialogHandler; + PCefRenderHandler = ^TCefRenderHandler; + PCefGetGeolocationCallback = ^TCefGetGeolocationCallback; + PCefTraceClient = ^TCefTraceClient; + + // Structure defining the reference count implementation functions. All + // framework structures must include the cef_base_t structure first. + TCefBase = record + // Size of the data structure. + size: Cardinal; + + // Increment the reference count. + add_ref: function(self: PCefBase): Integer; cdecl; + // Decrement the reference count. Delete this object when no references + // remain. + release: function(self: PCefBase): Integer; cdecl; + // Returns the current number of references. + get_refct: function(self: PCefBase): Integer; cdecl; + end; + + // Structure representing a binary value. Can be used on any process and thread. + TCefBinaryValue = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + is_valid: function(self: PCefBinaryValue): Integer; cdecl; + + // Returns true (1) if this object is currently owned by another object. + is_owned: function(self: PCefBinaryValue): Integer; cdecl; + + // Returns a copy of this object. The data in this object will also be copied. + copy: function(self: PCefBinaryValue): PCefBinaryValue; cdecl; + + // Returns the data size. + get_size: function(self: PCefBinaryValue): Cardinal; cdecl; + + // Read up to |buffer_size| number of bytes into |buffer|. Reading begins at + // the specified byte |data_offset|. Returns the number of bytes read. + get_data: function(self: PCefBinaryValue; buffer: Pointer; buffer_size, data_offset: Cardinal): Cardinal; cdecl; + end; + + // Structure representing a dictionary value. Can be used on any process and + // thread. + TCefDictionaryValue = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + is_valid: function(self: PCefDictionaryValue): Integer; cdecl; + + // Returns true (1) if this object is currently owned by another object. + is_owned: function(self: PCefDictionaryValue): Integer; cdecl; + + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + is_read_only: function(self: PCefDictionaryValue): Integer; cdecl; + + // Returns a writable copy of this object. If |exclude_NULL_children| is true + // (1) any NULL dictionaries or lists will be excluded from the copy. + copy: function(self: PCefDictionaryValue; exclude_empty_children: Integer): PCefDictionaryValue; cdecl; + + // Returns the number of values. + get_size: function(self: PCefDictionaryValue): Cardinal; cdecl; + + // Removes all values. Returns true (1) on success. + clear: function(self: PCefDictionaryValue): Integer; cdecl; + + // Returns true (1) if the current dictionary has a value for the given key. + has_key: function(self: PCefDictionaryValue; const key: PCefString): Integer; cdecl; + + // Reads all keys for this dictionary into the specified vector. + get_keys: function(self: PCefDictionaryValue; const keys: TCefStringList): Integer; cdecl; + + // Removes the value at the specified key. Returns true (1) is the value was + // removed successfully. + remove: function(self: PCefDictionaryValue; const key: PCefString): Integer; cdecl; + + // Returns the value type for the specified key. + get_type: function(self: PCefDictionaryValue; const key: PCefString): TCefValueType; cdecl; + + // Returns the value at the specified key as type bool. + get_bool: function(self: PCefDictionaryValue; const key: PCefString): Integer; cdecl; + + // Returns the value at the specified key as type int. + get_int: function(self: PCefDictionaryValue; const key: PCefString): Integer; cdecl; + + // Returns the value at the specified key as type double. + get_double: function(self: PCefDictionaryValue; const key: PCefString): Double; cdecl; + + // Returns the value at the specified key as type string. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_string: function(self: PCefDictionaryValue; const key: PCefString): PCefStringUserFree; cdecl; + + // Returns the value at the specified key as type binary. + get_binary: function(self: PCefDictionaryValue; const key: PCefString): PCefBinaryValue; cdecl; + + // Returns the value at the specified key as type dictionary. + get_dictionary: function(self: PCefDictionaryValue; const key: PCefString): PCefDictionaryValue; cdecl; + + // Returns the value at the specified key as type list. + get_list: function(self: PCefDictionaryValue; const key: PCefString): PCefListValue; cdecl; + + // Sets the value at the specified key as type null. Returns true (1) if the + // value was set successfully. + set_null: function(self: PCefDictionaryValue; const key: PCefString): Integer; cdecl; + + // Sets the value at the specified key as type bool. Returns true (1) if the + // value was set successfully. + set_bool: function(self: PCefDictionaryValue; const key: PCefString; value: Integer): Integer; cdecl; + + // Sets the value at the specified key as type int. Returns true (1) if the + // value was set successfully. + set_int: function(self: PCefDictionaryValue; const key: PCefString; value: Integer): Integer; cdecl; + + // Sets the value at the specified key as type double. Returns true (1) if the + // value was set successfully. + set_double: function(self: PCefDictionaryValue; const key: PCefString; value: Double): Integer; cdecl; + + // Sets the value at the specified key as type string. Returns true (1) if the + // value was set successfully. + set_string: function(self: PCefDictionaryValue; const key: PCefString; value: PCefString): Integer; cdecl; + + // Sets the value at the specified key as type binary. Returns true (1) if the + // value was set successfully. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + set_binary: function(self: PCefDictionaryValue; const key: PCefString; value: PCefBinaryValue): Integer; cdecl; + + // Sets the value at the specified key as type dict. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + set_dictionary: function(self: PCefDictionaryValue; const key: PCefString; value: PCefDictionaryValue): Integer; cdecl; + + // Sets the value at the specified key as type list. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + set_list: function(self: PCefDictionaryValue; const key: PCefString; value: PCefListValue): Integer; cdecl; + end; + + // Structure representing a list value. Can be used on any process and thread. + TCefListValue = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + is_valid: function(self: PCefListValue): Integer; cdecl; + + // Returns true (1) if this object is currently owned by another object. + is_owned: function(self: PCefListValue): Integer; cdecl; + + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + is_read_only: function(self: PCefListValue): Integer; cdecl; + + // Returns a writable copy of this object. + copy: function(self: PCefListValue): PCefListValue; cdecl; + + // Sets the number of values. If the number of values is expanded all new + // value slots will default to type null. Returns true (1) on success. + set_size: function(self: PCefListValue; size: Cardinal): Integer; cdecl; + + // Returns the number of values. + get_size: function(self: PCefListValue): Cardinal; cdecl; + + // Removes all values. Returns true (1) on success. + clear: function(self: PCefListValue): Integer; cdecl; + + // Removes the value at the specified index. + remove: function(self: PCefListValue; index: Integer): Integer; cdecl; + + // Returns the value type at the specified index. + get_type: function(self: PCefListValue; index: Integer): TCefValueType; cdecl; + + // Returns the value at the specified index as type bool. + get_bool: function(self: PCefListValue; index: Integer): Integer; cdecl; + + // Returns the value at the specified index as type int. + get_int: function(self: PCefListValue; index: Integer): Integer; cdecl; + + // Returns the value at the specified index as type double. + get_double: function(self: PCefListValue; index: Integer): Double; cdecl; + + // Returns the value at the specified index as type string. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_string: function(self: PCefListValue; index: Integer): PCefStringUserFree; cdecl; + + // Returns the value at the specified index as type binary. + get_binary: function(self: PCefListValue; index: Integer): PCefBinaryValue; cdecl; + + // Returns the value at the specified index as type dictionary. + get_dictionary: function(self: PCefListValue; index: Integer): PCefDictionaryValue; cdecl; + + // Returns the value at the specified index as type list. + get_list: function(self: PCefListValue; index: Integer): PCefListValue; cdecl; + + // Sets the value at the specified index as type null. Returns true (1) if the + // value was set successfully. + set_null: function(self: PCefListValue; index: Integer): Integer; cdecl; + + // Sets the value at the specified index as type bool. Returns true (1) if the + // value was set successfully. + set_bool: function(self: PCefListValue; index, value: Integer): Integer; cdecl; + + // Sets the value at the specified index as type int. Returns true (1) if the + // value was set successfully. + set_int: function(self: PCefListValue; index, value: Integer): Integer; cdecl; + + // Sets the value at the specified index as type double. Returns true (1) if + // the value was set successfully. + set_double: function(self: PCefListValue; index: Integer; value: Double): Integer; cdecl; + + // Sets the value at the specified index as type string. Returns true (1) if + // the value was set successfully. + set_string: function(self: PCefListValue; index: Integer; value: PCefString): Integer; cdecl; + + // Sets the value at the specified index as type binary. Returns true (1) if + // the value was set successfully. After calling this function the |value| + // object will no longer be valid. If |value| is currently owned by another + // object then the value will be copied and the |value| reference will not + // change. Otherwise, ownership will be transferred to this object and the + // |value| reference will be invalidated. + set_binary: function(self: PCefListValue; index: Integer; value: PCefBinaryValue): Integer; cdecl; + + // Sets the value at the specified index as type dict. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + set_dictionary: function(self: PCefListValue; index: Integer; value: PCefDictionaryValue): Integer; cdecl; + + // Sets the value at the specified index as type list. Returns true (1) if the + // value was set successfully. After calling this function the |value| object + // will no longer be valid. If |value| is currently owned by another object + // then the value will be copied and the |value| reference will not change. + // Otherwise, ownership will be transferred to this object and the |value| + // reference will be invalidated. + set_list: function(self: PCefListValue; index: Integer; value: PCefListValue): Integer; cdecl; + end; + + // Implement this structure for asynchronous task execution. If the task is + // posted successfully and if the associated message loop is still running then + // the execute() function will be called on the target thread. If the task fails + // to post then the task object may be destroyed on the source thread instead of + // the target thread. For this reason be cautious when performing work in the + // task object destructor. + TCefTask = record + // Base structure. + base: TCefBase; + // Method that will be executed on the target thread. + execute: procedure(self: PCefTask); cdecl; + end; + + // Structure that asynchronously executes tasks on the associated thread. It is + // safe to call the functions of this structure on any thread. + // + // CEF maintains multiple internal threads that are used for handling different + // types of tasks in different processes. The cef_thread_id_t definitions in + // cef_types.h list the common CEF threads. Task runners are also available for + // other CEF threads as appropriate (for example, V8 WebWorker threads). + TCefTaskRunner = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is pointing to the same task runner as + // |that| object. + is_same: function(self, that: PCefTaskRunner): Integer; cdecl; + + // Returns true (1) if this task runner belongs to the current thread. + belongs_to_current_thread: function(self: PCefTaskRunner): Integer; cdecl; + + // Returns true (1) if this task runner is for the specified CEF thread. + belongs_to_thread: function(self: PCefTaskRunner; threadId: TCefThreadId): Integer; cdecl; + + // Post a task for execution on the thread associated with this task runner. + // Execution will occur asynchronously. + post_task: function(self: PCefTaskRunner; task: PCefTask): Integer; cdecl; + + // Post a task for delayed execution on the thread associated with this task + // runner. Execution will occur asynchronously. Delayed tasks are not + // supported on V8 WebWorker threads and will be executed without the + // specified delay. + post_delayed_task: function(self: PCefTaskRunner; task: PCefTask; delay_ms: Int64): Integer; cdecl; + end; + + // Structure representing a message. Can be used on any process and thread. + TCefProcessMessage = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + is_valid: function(self: PCefProcessMessage): Integer; cdecl; + + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + is_read_only: function(self: PCefProcessMessage): Integer; cdecl; + + // Returns a writable copy of this object. + copy: function(self: PCefProcessMessage): PCefProcessMessage; cdecl; + + // Returns the message name. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_name: function(self: PCefProcessMessage): PCefStringUserFree; cdecl; + + // Returns the list of arguments. + get_argument_list: function(self: PCefProcessMessage): PCefListValue; cdecl; + end; + + // Class used to represent a browser window. When used in the browser process + // the methods of this class may be called on any thread unless otherwise + // indicated in the comments. When used in the render process the methods of + // this class may only be called on the main thread. + TCefBrowser = record + // Base structure. + base: TCefBase; + + // Returns the browser host object. This function can only be called in the + // browser process. + get_host: function(self: PCefBrowser): PCefBrowserHost; cdecl; + + // Returns true (1) if the browser can navigate backwards. + can_go_back: function(self: PCefBrowser): Integer; cdecl; + + // Navigate backwards. + go_back: procedure(self: PCefBrowser); cdecl; + + // Returns true (1) if the browser can navigate forwards. + can_go_forward: function(self: PCefBrowser): Integer; cdecl; + + // Navigate forwards. + go_forward: procedure(self: PCefBrowser); cdecl; + + // Returns true (1) if the browser is currently loading. + is_loading: function(self: PCefBrowser): Integer; cdecl; + + // Reload the current page. + reload: procedure(self: PCefBrowser); cdecl; + + // Reload the current page ignoring any cached data. + reload_ignore_cache: procedure(self: PCefBrowser); cdecl; + + // Stop loading the page. + stop_load: procedure(self: PCefBrowser); cdecl; + + // Returns the globally unique identifier for this browser. + get_identifier : function(self: PCefBrowser): Integer; cdecl; + + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + is_same: function(self, that: PCefBrowser): Integer; cdecl; + + // Returns true (1) if the window is a popup window. + is_popup: function(self: PCefBrowser): Integer; cdecl; + + // Returns true (1) if a document has been loaded in the browser. + has_document: function(self: PCefBrowser): Integer; cdecl; + + // Returns the main (top-level) frame for the browser window. + get_main_frame: function(self: PCefBrowser): PCefFrame; cdecl; + + // Returns the focused frame for the browser window. + get_focused_frame: function(self: PCefBrowser): PCefFrame; cdecl; + + // Returns the frame with the specified identifier, or NULL if not found. + get_frame_byident: function(self: PCefBrowser; identifier: Int64): PCefFrame; cdecl; + + // Returns the frame with the specified name, or NULL if not found. + get_frame: function(self: PCefBrowser; const name: PCefString): PCefFrame; cdecl; + + // Returns the number of frames that currently exist. + get_frame_count: function(self: PCefBrowser): Cardinal; cdecl; + + // Returns the identifiers of all existing frames. + get_frame_identifiers: procedure(self: PCefBrowser; identifiersCount: PCardinal; identifiers: PInt64); cdecl; + + // Returns the names of all existing frames. + get_frame_names: procedure(self: PCefBrowser; names: TCefStringList); cdecl; + + // Send a message to the specified |target_process|. Returns true (1) if the + // message was sent successfully. + send_process_message: function(self: PCefBrowser; target_process: TCefProcessId; + message: PCefProcessMessage): Integer; cdecl; + end; + + // Callback structure for cef_browser_host_t::RunFileDialog. The functions of + // this structure will be called on the browser process UI thread. + TCefRunFileDialogCallback = record + // Base structure. + base: TCefBase; + + // Called asynchronously after the file dialog is dismissed. If the selection + // was successful |file_paths| will be a single value or a list of values + // depending on the dialog mode. If the selection was cancelled |file_paths| + // will be NULL. + cont: procedure(self: PCefRunFileDialogCallback; browser_host: PCefBrowserHost; + file_paths: TCefStringList); cdecl; + end; + + // Structure used to represent the browser process aspects of a browser window. + // The functions of this structure can only be called in the browser process. + // They may be called on any thread in that process unless otherwise indicated + // in the comments. + TCefBrowserHost = record + // Base structure. + base: TCefBase; + + // Returns the hosted browser object. + get_browser: function(self: PCefBrowserHost): PCefBrowser; cdecl; + + // Call this function before destroying a contained browser window. This + // function performs any internal cleanup that may be needed before the + // browser window is destroyed. + parent_window_will_close: procedure(self: PCefBrowserHost); cdecl; + + // Closes this browser window. + close_browser: procedure(self: PCefBrowserHost); cdecl; + + // Set focus for the browser window. If |enable| is true (1) focus will be set + // to the window. Otherwise, focus will be removed. + set_focus: procedure(self: PCefBrowserHost; enable: Integer); cdecl; + + // Retrieve the window handle for this browser. + get_window_handle: function(self: PCefBrowserHost): TCefWindowHandle; cdecl; + + // Retrieve the window handle of the browser that opened this browser. Will + // return NULL for non-popup windows. This function can be used in combination + // with custom handling of modal windows. + get_opener_window_handle: function(self: PCefBrowserHost): TCefWindowHandle; cdecl; + + // Returns the client for this browser. + get_client: function(self: PCefBrowserHost): PCefClient; cdecl; + + // Returns the DevTools URL for this browser. If |http_scheme| is true (1) the + // returned URL will use the http scheme instead of the chrome-devtools + // scheme. Remote debugging can be enabled by specifying the "remote- + // debugging-port" command-line flag or by setting the + // CefSettings.remote_debugging_port value. If remote debugging is not enabled + // this function will return an NULL string. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_dev_tools_url: function(self: PCefBrowserHost; http_scheme: Integer): PCefStringUserFree; cdecl; + + // Get the current zoom level. The default zoom level is 0.0. This function + // can only be called on the UI thread. + get_zoom_level: function(self: PCefBrowserHost): Double; cdecl; + + // Change the zoom level to the specified value. Specify 0.0 to reset the zoom + // level. If called on the UI thread the change will be applied immediately. + // Otherwise, the change will be applied asynchronously on the UI thread. + set_zoom_level: procedure(self: PCefBrowserHost; zoomLevel: Double); cdecl; + + // Call to run a file chooser dialog. Only a single file chooser dialog may be + // pending at any given time. |mode| represents the type of dialog to display. + // |title| to the title to be used for the dialog and may be NULL to show the + // default title ("Open" or "Save" depending on the mode). |default_file_name| + // is the default file name to select in the dialog. |accept_types| is a list + // of valid lower-cased MIME types or file extensions specified in an input + // element and is used to restrict selectable files to such types. |callback| + // will be executed after the dialog is dismissed or immediately if another + // dialog is already pending. The dialog will be initiated asynchronously on + // the UI thread. + run_file_dialog: procedure(self: PCefBrowserHost; mode: TCefFileDialogMode; + const title, default_file_name: PCefString; accept_types: TCefStringList; + callback: PCefRunFileDialogCallback); cdecl; + + // Returns true (1) if window rendering is disabled. + is_window_rendering_disabled: function(self: PCefBrowserHost): Integer; cdecl; + + // Notify the browser that the widget has been resized. The browser will first + // call cef_render_handler_t::GetViewRect to get the new size and then call + // cef_render_handler_t::OnPaint asynchronously with the updated regions. This + // function is only used when window rendering is disabled. + was_resized: procedure(self: PCefBrowserHost); cdecl; + + /// + // Invalidate the |dirtyRect| region of the view. The browser will call + // cef_render_handler_t::OnPaint asynchronously with the updated regions. This + // function is only used when window rendering is disabled. + /// + invalidate: procedure(self: PCefBrowserHost; const dirtyRect: PCefRect; + kind: TCefPaintElementType); cdecl; + + // Send a key event to the browser. + send_key_event: procedure(self: PCefBrowserHost; const event: PCefKeyEvent); cdecl; + + // Send a mouse click event to the browser. The |x| and |y| coordinates are + // relative to the upper-left corner of the view. + send_mouse_click_event: procedure(self: PCefBrowserHost; + const event: PCefMouseEvent; kind: TCefMouseButtonType; + mouseUp, clickCount: Integer); cdecl; + + // Send a mouse move event to the browser. The |x| and |y| coordinates are + // relative to the upper-left corner of the view. + send_mouse_move_event: procedure(self: PCefBrowserHost; + const event: PCefMouseEvent; mouseLeave: Integer); cdecl; + + // Send a mouse wheel event to the browser. The |x| and |y| coordinates are + // relative to the upper-left corner of the view. The |deltaX| and |deltaY| + // values represent the movement delta in the X and Y directions respectively. + // In order to scroll inside select popups with window rendering disabled + // cef_render_handler_t::GetScreenPoint should be implemented properly. + send_mouse_wheel_event: procedure(self: PCefBrowserHost; + const event: PCefMouseEvent; deltaX, deltaY: Integer); cdecl; + + // Send a focus event to the browser. + send_focus_event: procedure(self: PCefBrowserHost; setFocus: Integer); cdecl; + + // Send a capture lost event to the browser. + send_capture_lost_event: procedure(self: PCefBrowserHost); + end; + + // Implement this structure to receive string values asynchronously. + TCefStringVisitor = record + // Base structure. + base: TCefBase; + + // Method that will be executed. + visit: procedure(self: PCefStringVisitor; const str: PCefString); cdecl; + end; + + // Structure used to represent a frame in the browser window. When used in the + // browser process the functions of this structure may be called on any thread + // unless otherwise indicated in the comments. When used in the render process + // the functions of this structure may only be called on the main thread. + TCefFrame = record + // Base structure. + base: TCefBase; + + // True if this object is currently attached to a valid frame. + is_valid: function(self: PCefFrame): Integer; cdecl; + + // Execute undo in this frame. + undo: procedure(self: PCefFrame); cdecl; + + // Execute redo in this frame. + redo: procedure(self: PCefFrame); cdecl; + + // Execute cut in this frame. + cut: procedure(self: PCefFrame); cdecl; + + // Execute copy in this frame. + copy: procedure(self: PCefFrame); cdecl; + + // Execute paste in this frame. + paste: procedure(self: PCefFrame); cdecl; + + // Execute delete in this frame. + del: procedure(self: PCefFrame); cdecl; + + // Execute select all in this frame. + select_all: procedure(self: PCefFrame); cdecl; + + // Save this frame's HTML source to a temporary file and open it in the + // default text viewing application. This function can only be called from the + // browser process. + view_source: procedure(self: PCefFrame); cdecl; + + // Retrieve this frame's HTML source as a string sent to the specified + // visitor. + get_source: procedure(self: PCefFrame; visitor: PCefStringVisitor); cdecl; + + // Retrieve this frame's display text as a string sent to the specified + // visitor. + get_text: procedure(self: PCefFrame; visitor: PCefStringVisitor); cdecl; + + // Load the request represented by the |request| object. + load_request: procedure(self: PCefFrame; request: PCefRequest); cdecl; + + // Load the specified |url|. + load_url: procedure(self: PCefFrame; const url: PCefString); cdecl; + + // Load the contents of |stringVal| with the optional dummy target |url|. + load_string: procedure(self: PCefFrame; const stringVal, url: PCefString); cdecl; + + // Execute a string of JavaScript code in this frame. The |script_url| + // parameter is the URL where the script in question can be found, if any. The + // renderer may request this URL to show the developer the source of the + // error. The |start_line| parameter is the base line number to use for error + // reporting. + execute_java_script: procedure(self: PCefFrame; const code, + script_url: PCefString; start_line: Integer); cdecl; + + // Returns true (1) if this is the main (top-level) frame. + is_main: function(self: PCefFrame): Integer; cdecl; + + // Returns true (1) if this is the focused frame. + is_focused: function(self: PCefFrame): Integer; cdecl; + + // Returns the name for this frame. If the frame has an assigned name (for + // example, set via the iframe "name" attribute) then that value will be + // returned. Otherwise a unique name will be constructed based on the frame + // parent hierarchy. The main (top-level) frame will always have an NULL name + // value. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_name: function(self: PCefFrame): PCefStringUserFree; cdecl; + + // Returns the globally unique identifier for this frame. + get_identifier: function(self: PCefFrame): Int64; cdecl; + + // Returns the parent of this frame or NULL if this is the main (top-level) + // frame. + get_parent: function(self: PCefFrame): PCefFrame; cdecl; + + // Returns the URL currently loaded in this frame. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_url: function(self: PCefFrame): PCefStringUserFree; cdecl; + + // Returns the browser that this frame belongs to. + get_browser: function(self: PCefFrame): PCefBrowser; cdecl; + + // Get the V8 context associated with the frame. This function can only be + // called from the render process. + get_v8context: function(self: PCefFrame): PCefv8Context; cdecl; + + // Visit the DOM document. This function can only be called from the render + // process. + visit_dom: procedure(self: PCefFrame; visitor: PCefDomVisitor); cdecl; + end; + + // Structure used to implement a custom resource bundle structure. The functions + // of this structure may be called on multiple threads. + TCefResourceBundleHandler = record + // Base structure. + base: TCefBase; + + // Called to retrieve a localized translation for the string specified by + // |message_id|. To provide the translation set |string| to the translation + // string and return true (1). To use the default translation return false + // (0). Supported message IDs are listed in cef_pack_strings.h. + get_localized_string: function(self: PCefResourceBundleHandler; + message_id: Integer; string_val: PCefString): Integer; cdecl; + + // Called to retrieve data for the resource specified by |resource_id|. To + // provide the resource data set |data| and |data_size| to the data pointer + // and size respectively and return true (1). To use the default resource data + // return false (0). The resource data will not be copied and must remain + // resident in memory. Supported resource IDs are listed in + // cef_pack_resources.h. + get_data_resource: function(self: PCefResourceBundleHandler; + resource_id: Integer; var data: Pointer; var data_size: Cardinal): Integer; cdecl; + end; + + // Structure used to create and/or parse command line arguments. Arguments with + // '--', '-' and, on Windows, '/' prefixes are considered switches. Switches + // will always precede any arguments without switch prefixes. Switches can + // optionally have a value specified using the '=' delimiter (e.g. + // "-switch=value"). An argument of "--" will terminate switch parsing with all + // subsequent tokens, regardless of prefix, being interpreted as non-switch + // arguments. Switch names are considered case-insensitive. This structure can + // be used before cef_initialize() is called. + TCefCommandLine = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + is_valid: function(self: PCefCommandLine): Integer; cdecl; + + // Returns true (1) if the values of this object are read-only. Some APIs may + // expose read-only objects. + is_read_only: function(self: PCefCommandLine): Integer; cdecl; + + // Returns a writable copy of this object. + copy: function(self: PCefCommandLine): PCefCommandLine; cdecl; + + // Initialize the command line with the specified |argc| and |argv| values. + // The first argument must be the name of the program. This function is only + // supported on non-Windows platforms. + init_from_argv: procedure(self: PCefCommandLine; argc: Integer; const argv: PPAnsiChar); cdecl; + + // Initialize the command line with the string returned by calling + // GetCommandLineW(). This function is only supported on Windows. + init_from_string: procedure(self: PCefCommandLine; command_line: PCefString); cdecl; + + // Reset the command-line switches and arguments but leave the program + // component unchanged. + reset: procedure(self: PCefCommandLine); cdecl; + + // Retrieve the original command line string as a vector of strings. The argv + // array: { program, [(--|-|/)switch[=value]]*, [--], [argument]* } + get_argv: procedure(self: PCefCommandLine; argv: TCefStringList); cdecl; + + // Constructs and returns the represented command line string. Use this + // function cautiously because quoting behavior is unclear. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_command_line_string: function(self: PCefCommandLine): PCefStringUserFree; cdecl; + + // Get the program part of the command line string (the first item). + // The resulting string must be freed by calling cef_string_userfree_free(). + get_program: function(self: PCefCommandLine): PCefStringUserFree; cdecl; + + // Set the program part of the command line string (the first item). + set_program: procedure(self: PCefCommandLine; program_: PCefString); cdecl; + + // Returns true (1) if the command line has switches. + has_switches: function(self: PCefCommandLine): Integer; cdecl; + + // Returns true (1) if the command line contains the given switch. + has_switch: function(self: PCefCommandLine; const name: PCefString): Integer; cdecl; + + // Returns the value associated with the given switch. If the switch has no + // value or isn't present this function returns the NULL string. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_switch_value: function(self: PCefCommandLine; const name: PCefString): PCefStringUserFree; cdecl; + + // Returns the map of switch names and values. If a switch has no value an + // NULL string is returned. + get_switches: procedure(self: PCefCommandLine; switches: TCefStringMap); cdecl; + + // Add a switch to the end of the command line. If the switch has no value + // pass an NULL value string. + append_switch: procedure(self: PCefCommandLine; const name: PCefString); cdecl; + + // Add a switch with the specified value to the end of the command line. + append_switch_with_value: procedure(self: PCefCommandLine; const name, value: PCefString); cdecl; + + // True if there are remaining command line arguments. + has_arguments: function(self: PCefCommandLine): Integer; cdecl; + + // Get the remaining command line arguments. + get_arguments: procedure(self: PCefCommandLine; arguments: TCefStringList); cdecl; + + // Add an argument to the end of the command line. + append_argument: procedure(self: PCefCommandLine; const argument: PCefString); cdecl; + + // Insert a command before the current command. Common for debuggers, like + // "valgrind" or "gdb --args". + prepend_wrapper: procedure(self: PCefCommandLine; const wrapper: PCefString); cdecl; + end; + + // Structure used to implement browser process callbacks. The functions of this + // structure will be called on the browser process main thread unless otherwise + // indicated. + TCefBrowserProcessHandler = record + // Base structure. + base: TCefBase; + + // Called on the browser process UI thread immediately after the CEF context + // has been initialized. + on_context_initialized: procedure(self: PCefBrowserProcessHandler); cdecl; + + // Called before a child process is launched. Will be called on the browser + // process UI thread when launching a render process and on the browser + // process IO thread when launching a GPU or plugin process. Provides an + // opportunity to modify the child process command line. Do not keep a + // reference to |command_line| outside of this function. + on_before_child_process_launch: procedure(self: PCefBrowserProcessHandler; + command_line: PCefCommandLine); cdecl; + + // Called on the browser process IO thread after the main thread has been + // created for a new render process. Provides an opportunity to specify extra + // information that will be passed to + // cef_render_process_handler_t::on_render_thread_created() in the render + // process. Do not keep a reference to |extra_info| outside of this function. + on_render_process_thread_created: procedure(self: PCefBrowserProcessHandler; + extra_info: PCefListValue); cdecl; + end; + + // Structure used to implement render process callbacks. The functions of this + // structure will be called on the render process main thread (TID_RENDERER) + // unless otherwise indicated. + TCefRenderProcessHandler = record + // Base structure. + base: TCefBase; + + // Called after the render process main thread has been created. |extra_info| + // is a read-only value originating from + // cef_browser_process_handler_t::on_render_process_thread_created(). Do not + // keep a reference to |extra_info| outside of this function. + on_render_thread_created: procedure(self: PCefRenderProcessHandler; + extra_info: PCefListValue); cdecl; + + // Called after WebKit has been initialized. + on_web_kit_initialized: procedure(self: PCefRenderProcessHandler); cdecl; + + // Called after a browser has been created. When browsing cross-origin a new + // browser will be created before the old browser with the same identifier is + // destroyed. + on_browser_created: procedure(self: PCefRenderProcessHandler; + browser: PCefBrowser); cdecl; + + // Called before a browser is destroyed. + on_browser_destroyed: procedure(self: PCefRenderProcessHandler; + browser: PCefBrowser); cdecl; + + // Called before browser navigation. Return true (1) to cancel the navigation + // or false (0) to allow the navigation to proceed. The |request| object + // cannot be modified in this callback. + on_before_navigation: function(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; request: PCefRequest; + navigation_type: TCefNavigationType; is_redirect: Integer): Integer; cdecl; + + // Called immediately after the V8 context for a frame has been created. To + // retrieve the JavaScript 'window' object use the + // cef_v8context_t::get_global() function. V8 handles can only be accessed + // from the thread on which they are created. A task runner for posting tasks + // on the associated thread can be retrieved via the + // cef_v8context_t::get_task_runner() function. + on_context_created: procedure(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); cdecl; + + // Called immediately before the V8 context for a frame is released. No + // references to the context should be kept after this function is called. + on_context_released: procedure(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context); cdecl; + + // Called for global uncaught exceptions in a frame. Execution of this + // callback is disabled by default. To enable set + // CefSettings.uncaught_exception_stack_size > 0. + on_uncaught_exception: procedure(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; context: PCefv8Context; + exception: PCefV8Exception; stackTrace: PCefV8StackTrace); cdecl; + + // Called on the WebWorker thread immediately after the V8 context for a new + // WebWorker has been created. To retrieve the JavaScript 'self' object use + // the cef_v8context_t::get_global() function. V8 handles can only be accessed + // from the thread on which they are created. A task runner for posting tasks + // on the associated thread can be retrieved via the + // cef_v8context_t::get_task_runner() function. + on_worker_context_created: procedure(self: PCefRenderProcessHandler; + worker_id: Integer; const url: PCefString; context: PCefv8Context); cdecl; + + // Called on the WebWorker thread immediately before the V8 context for a + // WebWorker is released. No references to the context should be kept after + // this function is called. Any tasks posted or pending on the WebWorker + // thread after this function is called may not be executed. + on_worker_context_released: procedure(self: PCefRenderProcessHandler; + worker_id: Integer; const url: PCefString; context: PCefv8Context); cdecl; + + // Called on the WebWorker thread for global uncaught exceptions in a + // WebWorker. Execution of this callback is disabled by default. To enable set + // CefSettings.uncaught_exception_stack_size > 0. + on_worker_uncaught_exception: procedure(self: PCefRenderProcessHandler; + worker_id: Integer; const url: PCefString; context: PCefv8Context; + exception: PCefV8Exception; stackTrace: PCefV8StackTrace); cdecl; + + // Called when a new node in the the browser gets focus. The |node| value may + // be NULL if no specific node has gained focus. The node object passed to + // this function represents a snapshot of the DOM at the time this function is + // executed. DOM objects are only valid for the scope of this function. Do not + // keep references to or attempt to access any DOM objects outside the scope + // of this function. + on_focused_node_changed: procedure(self: PCefRenderProcessHandler; + browser: PCefBrowser; frame: PCefFrame; node: PCefDomNode); cdecl; + + // Called when a new message is received from a different process. Return true + // (1) if the message was handled or false (0) otherwise. Do not keep a + // reference to or attempt to access the message outside of this callback. + on_process_message_received: function(self: PCefRenderProcessHandler; + browser: PCefBrowser; source_process: TCefProcessId; + message: PCefProcessMessage): Integer; cdecl; + end; + + // Implement this structure to provide handler implementations. Methods will be + // called by the process and/or thread indicated. + TCefApp = record + // Base structure. + base: TCefBase; + + // Provides an opportunity to view and/or modify command-line arguments before + // processing by CEF and Chromium. The |process_type| value will be NULL for + // the browser process. Do not keep a reference to the cef_command_line_t + // object passed to this function. The CefSettings.command_line_args_disabled + // value can be used to start with an NULL command-line object. Any values + // specified in CefSettings that equate to command-line arguments will be set + // before this function is called. Be cautious when using this function to + // modify command-line arguments for non-browser processes as this may result + // in undefined behavior including crashes. + on_before_command_line_processing: procedure(self: PCefApp; const process_type: PCefString; + command_line: PCefCommandLine); cdecl; + + // Provides an opportunity to register custom schemes. Do not keep a reference + // to the |registrar| object. This function is called on the main thread for + // each process and the registered schemes should be the same across all + // processes. + on_register_custom_schemes: procedure(self: PCefApp; registrar: PCefSchemeRegistrar); cdecl; + + // Return the handler for resource bundle events. If + // CefSettings.pack_loading_disabled is true (1) a handler must be returned. + // If no handler is returned resources will be loaded from pack files. This + // function is called by the browser and render processes on multiple threads. + get_resource_bundle_handler: function(self: PCefApp): PCefResourceBundleHandler; cdecl; + + // Return the handler for functionality specific to the browser process. This + // function is called on multiple threads in the browser process. + get_browser_process_handler: function(self: PCefApp): PCefBrowserProcessHandler; cdecl; + + // Return the handler for functionality specific to the render process. This + // function is called on the render process main thread. + get_render_process_handler: function(self: PCefApp): PCefRenderProcessHandler; cdecl; + end; + + // Implement this structure to handle events related to browser life span. The + // functions of this structure will be called on the UI thread unless otherwise + // indicated. + TCefLifeSpanHandler = record + // Base structure. + base: TCefBase; + + // Called on the IO thread before a new popup window is created. The |browser| + // and |frame| parameters represent the source of the popup request. The + // |target_url| and |target_frame_name| values may be NULL if none were + // specified with the request. The |popupFeatures| structure contains + // information about the requested popup window. To allow creation of the + // popup window optionally modify |windowInfo|, |client|, |settings| and + // |no_javascript_access| and return false (0). To cancel creation of the + // popup window return true (1). The |client| and |settings| values will + // default to the source browser's values. The |no_javascript_access| value + // indicates whether the new browser window should be scriptable and in the + // same process as the source browser. + + on_before_popup: function(self: PCefLifeSpanHandler; + browser: PCefBrowser; frame: PCefFrame; + const target_url, target_frame_name: PCefString; + const popupFeatures: PCefPopupFeatures; + windowInfo: PCefWindowInfo; var client: PCefClient; + settings: PCefBrowserSettings; no_javascript_access: PInteger): Integer; cdecl; + + // Called after a new window is created. + on_after_created: procedure(self: PCefLifeSpanHandler; browser: PCefBrowser); cdecl; + + // Called when a modal window is about to display and the modal loop should + // begin running. Return false (0) to use the default modal loop + // implementation or true (1) to use a custom implementation. + run_modal: function(self: PCefLifeSpanHandler; browser: PCefBrowser): Integer; cdecl; + + // Called when a window has recieved a request to close. Return false (0) to + // proceed with the window close or true (1) to cancel the window close. If + // this is a modal window and a custom modal loop implementation was provided + // in run_modal() this callback should be used to restore the opener window to + // a usable state. + do_close: function(self: PCefLifeSpanHandler; browser: PCefBrowser): Integer; cdecl; + + // Called just before a window is closed. If this is a modal window and a + // custom modal loop implementation was provided in run_modal() this callback + // should be used to exit the custom modal loop. + on_before_close: procedure(self: PCefLifeSpanHandler; browser: PCefBrowser); cdecl; + end; + + // Implement this structure to handle events related to browser load status. The + // functions of this structure will be called on the UI thread. + TCefLoadHandler = record + // Base structure. + base: TCefBase; + + // Called when the browser begins loading a frame. The |frame| value will + // never be NULL -- call the is_main() function to check if this frame is the + // main frame. Multiple frames may be loading at the same time. Sub-frames may + // start or continue loading after the main frame load has ended. This + // function may not be called for a particular frame if the load request for + // that frame fails. + on_load_start: procedure(self: PCefLoadHandler; + browser: PCefBrowser; frame: PCefFrame); cdecl; + + // Called when the browser is done loading a frame. The |frame| value will + // never be NULL -- call the is_main() function to check if this frame is the + // main frame. Multiple frames may be loading at the same time. Sub-frames may + // start or continue loading after the main frame load has ended. This + // function will always be called for all frames irrespective of whether the + // request completes successfully. + on_load_end: procedure(self: PCefLoadHandler; browser: PCefBrowser; + frame: PCefFrame; httpStatusCode: Integer); cdecl; + + // Called when the browser fails to load a resource. |errorCode| is the error + // code number, |errorText| is the error text and and |failedUrl| is the URL + // that failed to load. See net\base\net_error_list.h for complete + // descriptions of the error codes. + on_load_error: procedure(self: PCefLoadHandler; browser: PCefBrowser; + frame: PCefFrame; errorCode: Integer; const errorText, failedUrl: PCefString); cdecl; + + // Called when the render process terminates unexpectedly. |status| indicates + // how the process terminated. + on_render_process_terminated: procedure(self: PCefLoadHandler; browser: PCefBrowser; + status: TCefTerminationStatus); cdecl; + + // Called when a plugin has crashed. |plugin_path| is the path of the plugin + // that crashed. + on_plugin_crashed: procedure(self: PCefLoadHandler; browser: PCefBrowser; + const plugin_path: PCefString); cdecl; + end; + + // Generic callback structure used for asynchronous continuation. + TCefCallback = record + // Base structure. + base: TCefBase; + + // Continue processing. + cont: procedure(self: PCefCallback); cdecl; + + // Cancel processing. + cancel: procedure(self: PCefCallback); cdecl; + end; + + // Structure used to implement a custom request handler structure. The functions + // of this structure will always be called on the IO thread. + TCefResourceHandler = record + // Base structure. + base: TCefBase; + + // Begin processing the request. To handle the request return true (1) and + // call cef_callback_t::cont() once the response header information is + // available (cef_callback_t::cont() can also be called from inside this + // function if header information is available immediately). To cancel the + // request return false (0). + process_request: function(self: PCefResourceHandler; + request: PCefRequest; callback: PCefCallback): Integer; cdecl; + + // Retrieve response header information. If the response length is not known + // set |response_length| to -1 and read_response() will be called until it + // returns false (0). If the response length is known set |response_length| to + // a positive value and read_response() will be called until it returns false + // (0) or the specified number of bytes have been read. Use the |response| + // object to set the mime type, http status code and other optional header + // values. To redirect the request to a new URL set |redirectUrl| to the new + // URL. + get_response_headers: procedure(self: PCefResourceHandler; + response: PCefResponse; response_length: PInt64; redirectUrl: PCefString); cdecl; + + // Read response data. If data is available immediately copy up to + // |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of + // bytes copied, and return true (1). To read the data at a later time set + // |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the + // data is available. To indicate response completion return false (0). + read_response: function(self: PCefResourceHandler; + data_out: Pointer; bytes_to_read: Integer; bytes_read: PInteger; + callback: PCefCallback): Integer; cdecl; + + // Return true (1) if the specified cookie can be sent with the request or + // false (0) otherwise. If false (0) is returned for any cookie then no + // cookies will be sent with the request. + can_get_cookie: function(self: PCefResourceHandler; + const cookie: PCefCookie): Integer; cdecl; + + // Return true (1) if the specified cookie returned with the response can be + // set or false (0) otherwise. + can_set_cookie: function(self: PCefResourceHandler; + const cookie: PCefCookie): Integer; cdecl; + + // Request processing has been canceled. + cancel: procedure(self: PCefResourceHandler); cdecl; + end; + + // Callback structure used for asynchronous continuation of authentication + // requests. + TCefAuthCallback = record + // Base structure. + base: TCefBase; + + // Continue the authentication request. + cont: procedure(self: PCefAuthCallback; + const username, password: PCefString); cdecl; + + // Cancel the authentication request. + cancel: procedure(self: PCefAuthCallback); cdecl; + end; + + // Callback structure used for asynchronous continuation of quota requests. + TCefQuotaCallback = record + // Base structure. + base: TCefBase; + + // Continue the quota request. If |allow| is true (1) the request will be + // allowed. Otherwise, the request will be denied. + cont: procedure(self: PCefQuotaCallback; allow: Integer); cdecl; + // Cancel the quota request. + cancel: procedure(self: PCefQuotaCallback); cdecl; + end; + + // Implement this structure to handle events related to browser requests. The + // functions of this structure will be called on the thread indicated. + TCefRequestHandler = record + // Base structure. + base: TCefBase; + + // Called on the IO thread before a resource request is loaded. The |request| + // object may be modified. To cancel the request return true (1) otherwise + // return false (0). + on_before_resource_load: function(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; request: PCefRequest): Integer; cdecl; + + // Called on the IO thread before a resource is loaded. To allow the resource + // to load normally return NULL. To specify a handler for the resource return + // a cef_resource_handler_t object. The |request| object should not be + // modified in this callback. + get_resource_handler: function(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; request: PCefRequest): PCefResourceHandler; cdecl; + + // Called on the IO thread when a resource load is redirected. The |old_url| + // parameter will contain the old URL. The |new_url| parameter will contain + // the new URL and can be changed if desired. + on_resource_redirect: procedure(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; const old_url: PCefString; + new_url: PCefString); cdecl; + + // Called on the IO thread when the browser needs credentials from the user. + // |isProxy| indicates whether the host is a proxy server. |host| contains the + // hostname and |port| contains the port number. Return true (1) to continue + // the request and call cef_auth_callback_t::cont() when the authentication + // information is available. Return false (0) to cancel the request. + get_auth_credentials: function(self: PCefRequestHandler; + browser: PCefBrowser; frame: PCefFrame; isProxy: Integer; const host: PCefString; + port: Integer; const realm, scheme: PCefString; callback: PCefAuthCallback): Integer; cdecl; + + // Called on the IO thread when JavaScript requests a specific storage quota + // size via the webkitStorageInfo.requestQuota function. |origin_url| is the + // origin of the page making the request. |new_size| is the requested quota + // size in bytes. Return true (1) and call cef_quota_callback_t::cont() either + // in this function or at a later time to grant or deny the request. Return + // false (0) to cancel the request. + on_quota_request: function(self: PCefRequestHandler; browser: PCefBrowser; + const origin_url: PCefString; new_size: Int64; callback: PCefQuotaCallback): Integer; cdecl; + + // Called on the IO thread to retrieve the cookie manager. |main_url| is the + // URL of the top-level frame. Cookies managers can be unique per browser or + // shared across multiple browsers. The global cookie manager will be used if + // this function returns NULL. + get_cookie_manager: function(self: PCefRequestHandler; + browser: PCefBrowser; const main_url: PCefString): PCefCookieManager; cdecl; + + // Called on the UI thread to handle requests for URLs with an unknown + // protocol component. Set |allow_os_execution| to true (1) to attempt + // execution via the registered OS protocol handler, if any. SECURITY WARNING: + // YOU SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR + // OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION. + on_protocol_execution: procedure(self: PCefRequestHandler; + browser: PCefBrowser; const url: PCefString; allow_os_execution: PInteger); cdecl; + + // Called on the browser process IO thread before a plugin is loaded. Return + // true (1) to block loading of the plugin. + on_before_plugin_load: function(self: PCefRequestHandler; browser: PCefBrowser; + const url, policy_url: PCefString; info: PCefWebPluginInfo): Integer; cdecl; + end; + + + // Implement this structure to handle events related to browser display state. + // The functions of this structure will be called on the UI thread. + TCefDisplayHandler = record + // Base structure. + base: TCefBase; + + // Called when the loading state has changed. + on_loading_state_change: procedure(self: PCefDisplayHandler; + browser: PCefBrowser; isLoading, canGoBack, canGoForward: Integer); cdecl; + + // Called when a frame's address has changed. + on_address_change: procedure(self: PCefDisplayHandler; + browser: PCefBrowser; frame: PCefFrame; const url: PCefString); cdecl; + + // Called when the page title changes. + on_title_change: procedure(self: PCefDisplayHandler; + browser: PCefBrowser; const title: PCefString); cdecl; + + // Called when the browser is about to display a tooltip. |text| contains the + // text that will be displayed in the tooltip. To handle the display of the + // tooltip yourself return true (1). Otherwise, you can optionally modify + // |text| and then return false (0) to allow the browser to display the + // tooltip. When window rendering is disabled the application is responsible + // for drawing tooltips and the return value is ignored. + on_tooltip: function(self: PCefDisplayHandler; + browser: PCefBrowser; text: PCefString): Integer; cdecl; + + // Called when the browser receives a status message. |text| contains the text + // that will be displayed in the status message. + on_status_message: procedure(self: PCefDisplayHandler; + browser: PCefBrowser; const value: PCefString); cdecl; + + // Called to display a console message. Return true (1) to stop the message + // from being output to the console. + on_console_message: function(self: PCefDisplayHandler; + browser: PCefBrowser; const message: PCefString; + const source: PCefString; line: Integer): Integer; cdecl; + end; + + // Implement this structure to handle events related to focus. The functions of + // this structure will be called on the UI thread. + TCefFocusHandler = record + // Base structure. + base: TCefBase; + + // Called when the browser component is about to loose focus. For instance, if + // focus was on the last HTML element and the user pressed the TAB key. |next| + // will be true (1) if the browser is giving focus to the next component and + // false (0) if the browser is giving focus to the previous component. + on_take_focus: procedure(self: PCefFocusHandler; + browser: PCefBrowser; next: Integer); cdecl; + + // Called when the browser component is requesting focus. |source| indicates + // where the focus request is originating from. Return false (0) to allow the + // focus to be set or true (1) to cancel setting the focus. + on_set_focus: function(self: PCefFocusHandler; + browser: PCefBrowser; source: TCefFocusSource): Integer; cdecl; + + // Called when the browser component has received focus. + on_got_focus: procedure(self: PCefFocusHandler; browser: PCefBrowser); cdecl; + end; + + // Implement this structure to handle events related to keyboard input. The + // functions of this structure will be called on the UI thread. + TCefKeyboardHandler = record + // Base structure. + base: TCefBase; + + // Called before a keyboard event is sent to the renderer. |event| contains + // information about the keyboard event. |os_event| is the operating system + // event message, if any. Return true (1) if the event was handled or false + // (0) otherwise. If the event will be handled in on_key_event() as a keyboard + // shortcut set |is_keyboard_shortcut| to true (1) and return false (0). + on_pre_key_event: function(self: PCefKeyboardHandler; + browser: PCefBrowser; const event: PCefKeyEvent; + os_event: TCefEventHandle; is_keyboard_shortcut: PInteger): Integer; cdecl; + + // Called after the renderer and JavaScript in the page has had a chance to + // handle the event. |event| contains information about the keyboard event. + // |os_event| is the operating system event message, if any. Return true (1) + // if the keyboard event was handled or false (0) otherwise. + on_key_event: function(self: PCefKeyboardHandler; + browser: PCefBrowser; const event: PCefKeyEvent; + os_event: TCefEventHandle): Integer; cdecl; + end; + + // Callback structure used for asynchronous continuation of JavaScript dialog + // requests. + TCefJsDialogCallback = record + // Base structure. + base: TCefBase; + + // Continue the JS dialog request. Set |success| to true (1) if the OK button + // was pressed. The |user_input| value should be specified for prompt dialogs. + cont: procedure(self: PCefJsDialogCallback; success: Integer; const user_input: PCefString); cdecl; + end; + + // Implement this structure to handle events related to JavaScript dialogs. The + // functions of this structure will be called on the UI thread. + TCefJsDialogHandler = record + // Base structure. + base: TCefBase; + + // Called to run a JavaScript dialog. The |default_prompt_text| value will be + // specified for prompt dialogs only. Set |suppress_message| to true (1) and + // return false (0) to suppress the message (suppressing messages is + // preferable to immediately executing the callback as this is used to detect + // presumably malicious behavior like spamming alert messages in + // onbeforeunload). Set |suppress_message| to false (0) and return false (0) + // to use the default implementation (the default implementation will show one + // modal dialog at a time and suppress any additional dialog requests until + // the displayed dialog is dismissed). Return true (1) if the application will + // use a custom dialog or if the callback has been executed immediately. + // Custom dialogs may be either modal or modeless. If a custom dialog is used + // the application must execute |callback| once the custom dialog is + // dismissed. + on_jsdialog: function(self: PCefJsDialogHandler; + browser: PCefBrowser; const origin_url, accept_lang: PCefString; + dialog_type: TCefJsDialogType; const message_text, default_prompt_text: PCefString; + callback: PCefJsDialogCallback; suppress_message: PInteger): Integer; cdecl; + + // Called to run a dialog asking the user if they want to leave a page. Return + // false (0) to use the default dialog implementation. Return true (1) if the + // application will use a custom dialog or if the callback has been executed + // immediately. Custom dialogs may be either modal or modeless. If a custom + // dialog is used the application must execute |callback| once the custom + // dialog is dismissed. + on_before_unload_dialog: function(self: PCefJsDialogHandler; + browser: PCefBrowser; const message_text: PCefString; is_reload: Integer; + callback: PCefJsDialogCallback): Integer; cdecl; + + // Called to cancel any pending dialogs and reset any saved dialog state. Will + // be called due to events like page navigation irregardless of whether any + // dialogs are currently pending. + on_reset_dialog_state: procedure(self: PCefJsDialogHandler; browser: PCefBrowser); cdecl; + end; + + // Supports creation and modification of menus. See cef_menu_id_t for the + // command ids that have default implementations. All user-defined command ids + // should be between MENU_ID_USER_FIRST and MENU_ID_USER_LAST. The functions of + // this structure can only be accessed on the browser process the UI thread. + TCefMenuModel = record + // Base structure. + base: TCefBase; + + // Clears the menu. Returns true (1) on success. + clear: function(self: PCefMenuModel): Integer; cdecl; + + // Returns the number of items in this menu. + get_count: function(self: PCefMenuModel): Integer; cdecl; + + // Add a separator to the menu. Returns true (1) on success. + add_separator: function(self: PCefMenuModel): Integer; cdecl; + + // Add an item to the menu. Returns true (1) on success. + add_item: function(self: PCefMenuModel; command_id: Integer; + const text: PCefString): Integer; cdecl; + + // Add a check item to the menu. Returns true (1) on success. + add_check_item: function(self: PCefMenuModel; command_id: Integer; + const text: PCefString): Integer; cdecl; + + // Add a radio item to the menu. Only a single item with the specified + // |group_id| can be checked at a time. Returns true (1) on success. + add_radio_item: function(self: PCefMenuModel; command_id: Integer; + const text: PCefString; group_id: Integer): Integer; cdecl; + + // Add a sub-menu to the menu. The new sub-menu is returned. + add_sub_menu: function(self: PCefMenuModel; command_id: Integer; + const text: PCefString): PCefMenuModel; cdecl; + + // Insert a separator in the menu at the specified |index|. Returns true (1) + // on success. + insert_separator_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Insert an item in the menu at the specified |index|. Returns true (1) on + // success. + insert_item_at: function(self: PCefMenuModel; index, command_id: Integer; + const text: PCefString): Integer; cdecl; + + // Insert a check item in the menu at the specified |index|. Returns true (1) + // on success. + insert_check_item_at: function(self: PCefMenuModel; index, command_id: Integer; + const text: PCefString): Integer; cdecl; + + // Insert a radio item in the menu at the specified |index|. Only a single + // item with the specified |group_id| can be checked at a time. Returns true + // (1) on success. + insert_radio_item_at: function(self: PCefMenuModel; index, command_id: Integer; + const text: PCefString; group_id: Integer): Integer; cdecl; + + // Insert a sub-menu in the menu at the specified |index|. The new sub-menu is + // returned. + insert_sub_menu_at: function(self: PCefMenuModel; index, command_id: Integer; + const text: PCefString): PCefMenuModel; cdecl; + + // Removes the item with the specified |command_id|. Returns true (1) on + // success. + remove: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Removes the item at the specified |index|. Returns true (1) on success. + remove_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Returns the index associated with the specified |command_id| or -1 if not + // found due to the command id not existing in the menu. + get_index_of: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Returns the command id at the specified |index| or -1 if not found due to + // invalid range or the index being a separator. + get_command_id_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Sets the command id at the specified |index|. Returns true (1) on success. + set_command_id_at: function(self: PCefMenuModel; index, command_id: Integer): Integer; cdecl; + + // Returns the label for the specified |command_id| or NULL if not found. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_label: function(self: PCefMenuModel; command_id: Integer): PCefStringUserFree; cdecl; + + // Returns the label at the specified |index| or NULL if not found due to + // invalid range or the index being a separator. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_label_at: function(self: PCefMenuModel; index: Integer): PCefStringUserFree; cdecl; + + // Sets the label for the specified |command_id|. Returns true (1) on success. + set_label: function(self: PCefMenuModel; command_id: Integer; + const text: PCefString): Integer; cdecl; + + // Set the label at the specified |index|. Returns true (1) on success. + set_label_at: function(self: PCefMenuModel; index: Integer; + const text: PCefString): Integer; cdecl; + + // Returns the item type for the specified |command_id|. + get_type: function(self: PCefMenuModel; command_id: Integer): TCefMenuItemType; cdecl; + + // Returns the item type at the specified |index|. + get_type_at: function(self: PCefMenuModel; index: Integer): TCefMenuItemType; cdecl; + + // Returns the group id for the specified |command_id| or -1 if invalid. + get_group_id: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Returns the group id at the specified |index| or -1 if invalid. + get_group_id_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Sets the group id for the specified |command_id|. Returns true (1) on + // success. + set_group_id: function(self: PCefMenuModel; command_id, group_id: Integer): Integer; cdecl; + + // Sets the group id at the specified |index|. Returns true (1) on success. + set_group_id_at: function(self: PCefMenuModel; index, group_id: Integer): Integer; cdecl; + + // Returns the submenu for the specified |command_id| or NULL if invalid. + get_sub_menu: function(self: PCefMenuModel; command_id: Integer): PCefMenuModel; cdecl; + + // Returns the submenu at the specified |index| or NULL if invalid. + get_sub_menu_at: function(self: PCefMenuModel; index: Integer): PCefMenuModel; cdecl; + + // Returns true (1) if the specified |command_id| is visible. + is_visible: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Returns true (1) if the specified |index| is visible. + is_visible_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Change the visibility of the specified |command_id|. Returns true (1) on + // success. + set_visible: function(self: PCefMenuModel; command_id, visible: Integer): Integer; cdecl; + + // Change the visibility at the specified |index|. Returns true (1) on + // success. + set_visible_at: function(self: PCefMenuModel; index, visible: Integer): Integer; cdecl; + + // Returns true (1) if the specified |command_id| is enabled. + is_enabled: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Returns true (1) if the specified |index| is enabled. + is_enabled_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Change the enabled status of the specified |command_id|. Returns true (1) + // on success. + set_enabled: function(self: PCefMenuModel; command_id, enabled: Integer): Integer; cdecl; + + // Change the enabled status at the specified |index|. Returns true (1) on + // success. + set_enabled_at: function(self: PCefMenuModel; index, enabled: Integer): Integer; cdecl; + + // Returns true (1) if the specified |command_id| is checked. Only applies to + // check and radio items. + is_checked: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Returns true (1) if the specified |index| is checked. Only applies to check + // and radio items. + is_checked_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Check the specified |command_id|. Only applies to check and radio items. + // Returns true (1) on success. + set_checked: function(self: PCefMenuModel; command_id, checked: Integer): Integer; cdecl; + + // Check the specified |index|. Only applies to check and radio items. Returns + // true (1) on success. + set_checked_at: function(self: PCefMenuModel; index, checked: Integer): Integer; cdecl; + + // Returns true (1) if the specified |command_id| has a keyboard accelerator + // assigned. + has_accelerator: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Returns true (1) if the specified |index| has a keyboard accelerator + // assigned. + has_accelerator_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Set the keyboard accelerator for the specified |command_id|. |key_code| can + // be any virtual key or character value. Returns true (1) on success. + set_accelerator: function(self: PCefMenuModel; command_id, key_code, + shift_pressed, ctrl_pressed, alt_pressed: Integer): Integer; cdecl; + + // Set the keyboard accelerator at the specified |index|. |key_code| can be + // any virtual key or character value. Returns true (1) on success. + set_accelerator_at: function(self: PCefMenuModel; index, key_code, + shift_pressed, ctrl_pressed, alt_pressed: Integer): Integer; cdecl; + + // Remove the keyboard accelerator for the specified |command_id|. Returns + // true (1) on success. + remove_accelerator: function(self: PCefMenuModel; command_id: Integer): Integer; cdecl; + + // Remove the keyboard accelerator at the specified |index|. Returns true (1) + // on success. + remove_accelerator_at: function(self: PCefMenuModel; index: Integer): Integer; cdecl; + + // Retrieves the keyboard accelerator for the specified |command_id|. Returns + // true (1) on success. + get_accelerator: function(self: PCefMenuModel; command_id: Integer; key_code, + shift_pressed, ctrl_pressed, alt_pressed: PInteger): Integer; cdecl; + + // Retrieves the keyboard accelerator for the specified |index|. Returns true + // (1) on success. + get_accelerator_at: function(self: PCefMenuModel; index: Integer; key_code, + shift_pressed, ctrl_pressed, alt_pressed: PInteger): Integer; cdecl; + end; + + // Implement this structure to handle context menu events. The functions of this + // structure will be called on the UI thread. + TCefContextMenuHandler = record + // Base structure. + base: TCefBase; + + // Called before a context menu is displayed. |params| provides information + // about the context menu state. |model| initially contains the default + // context menu. The |model| can be cleared to show no context menu or + // modified to show a custom menu. Do not keep references to |params| or + // |model| outside of this callback. + on_before_context_menu: procedure(self: PCefContextMenuHandler; + browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; + model: PCefMenuModel); cdecl; + + // Called to execute a command selected from the context menu. Return true (1) + // if the command was handled or false (0) for the default implementation. See + // cef_menu_id_t for the command ids that have default implementations. All + // user-defined command ids should be between MENU_ID_USER_FIRST and + // MENU_ID_USER_LAST. |params| will have the same values as what was passed to + // on_before_context_menu(). Do not keep a reference to |params| outside of + // this callback. + on_context_menu_command: function(self: PCefContextMenuHandler; + browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; + command_id: Integer; event_flags: Integer): Integer; cdecl; + + // Called when the context menu is dismissed irregardless of whether the menu + // was NULL or a command was selected. + on_context_menu_dismissed: procedure(self: PCefContextMenuHandler; + browser: PCefBrowser; frame: PCefFrame); cdecl; + end; + + + // Provides information about the context menu state. The ethods of this + // structure can only be accessed on browser process the UI thread. + TCefContextMenuParams = record + // Base structure. + base: TCefBase; + + // Returns the X coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + get_xcoord: function(self: PCefContextMenuParams): Integer; cdecl; + + // Returns the Y coordinate of the mouse where the context menu was invoked. + // Coords are relative to the associated RenderView's origin. + get_ycoord: function(self: PCefContextMenuParams): Integer; cdecl; + + // Returns flags representing the type of node that the context menu was + // invoked on. + get_type_flags: function(self: PCefContextMenuParams): Integer; cdecl; + + // Returns the URL of the link, if any, that encloses the node that the + // context menu was invoked on. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_link_url: function(self: PCefContextMenuParams): PCefStringUserFree; cdecl; + + // Returns the link URL, if any, to be used ONLY for "copy link address". We + // don't validate this field in the frontend process. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_unfiltered_link_url: function(self: PCefContextMenuParams): PCefStringUserFree; cdecl; + + // Returns the source URL, if any, for the element that the context menu was + // invoked on. Example of elements with source URLs are img, audio, and video. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_source_url: function(self: PCefContextMenuParams): PCefStringUserFree; cdecl; + + // Returns true (1) if the context menu was invoked on a blocked image. + is_image_blocked: function(self: PCefContextMenuParams): Integer; cdecl; + + // Returns the URL of the top level page that the context menu was invoked on. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_page_url: function(self: PCefContextMenuParams): PCefStringUserFree; cdecl; + + // Returns the URL of the subframe that the context menu was invoked on. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_frame_url: function(self: PCefContextMenuParams): PCefStringUserFree; cdecl; + + // Returns the character encoding of the subframe that the context menu was + // invoked on. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_frame_charset: function(self: PCefContextMenuParams): PCefStringUserFree; cdecl; + + // Returns the type of context node that the context menu was invoked on. + get_media_type: function(self: PCefContextMenuParams): TCefContextMenuMediaType; cdecl; + + // Returns flags representing the actions supported by the media element, if + // any, that the context menu was invoked on. + get_media_state_flags: function(self: PCefContextMenuParams): Integer; cdecl; + + // Returns the text of the selection, if any, that the context menu was + // invoked on. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_selection_text: function(self: PCefContextMenuParams): PCefStringUserFree; cdecl; + + // Returns true (1) if the context menu was invoked on an editable node. + is_editable: function(self: PCefContextMenuParams): Integer; cdecl; + + // Returns true (1) if the context menu was invoked on an editable node where + // speech-input is enabled. + is_speech_input_enabled: function(self: PCefContextMenuParams): Integer; cdecl; + + // Returns flags representing the actions supported by the editable node, if + // any, that the context menu was invoked on. + get_edit_state_flags: function(self: PCefContextMenuParams): Integer; cdecl; + end; + + // Callback structure used for asynchronous continuation of geolocation + // permission requests. + TCefGeolocationCallback = record + // Base structure. + base: TCefBase; + + // Call to allow or deny geolocation access. + cont: procedure(self: PCefGeolocationCallback; allow: Integer); cdecl; + end; + + + // Implement this structure to handle events related to geolocation permission + // requests. The functions of this structure will be called on the browser + // process IO thread. + TCefGeolocationHandler = record + // Base structure. + base: TCefBase; + + // Called when a page requests permission to access geolocation information. + // |requesting_url| is the URL requesting permission and |request_id| is the + // unique ID for the permission request. Call + // cef_geolocation_callback_t::Continue to allow or deny the permission + // request. + on_request_geolocation_permission: procedure(self: PCefGeolocationHandler; + browser: PCefBrowser; const requesting_url: PCefString; request_id: Integer; + callback: PCefGeolocationCallback); cdecl; + + // Called when a geolocation access request is canceled. |requesting_url| is + // the URL that originally requested permission and |request_id| is the unique + // ID for the permission request. + on_cancel_geolocation_permission: procedure(self: PCefGeolocationHandler; + browser: PCefBrowser; const requesting_url: PCefString; request_id: Integer); cdecl; + end; + + // Implement this structure to provide handler implementations. + TCefClient = record + // Base structure. + base: TCefBase; + + // Return the handler for context menus. If no handler is provided the default + // implementation will be used. + get_context_menu_handler: function(self: PCefClient): PCefContextMenuHandler; cdecl; + + // Return the handler for dialogs. If no handler is provided the default + // implementation will be used. + get_dialog_handler: function(self: PCefClient): PCefDialogHandler; cdecl; + + // Return the handler for browser display state events. + get_display_handler: function(self: PCefClient): PCefDisplayHandler; cdecl; + + // Return the handler for download events. If no handler is returned downloads + // will not be allowed. + get_download_handler: function(self: PCefClient): PCefDownloadHandler; cdecl; + + // Return the handler for focus events. + get_focus_handler: function(self: PCefClient): PCefFocusHandler; cdecl; + + // Return the handler for geolocation permissions requests. If no handler is + // provided geolocation access will be denied by default. + get_geolocation_handler: function(self: PCefClient): PCefGeolocationHandler; cdecl; + + // Return the handler for JavaScript dialog events. + get_jsdialog_handler: function(self: PCefClient): PCefJsDialogHandler; cdecl; + + // Return the handler for keyboard events. + get_keyboard_handler: function(self: PCefClient): PCefKeyboardHandler; cdecl; + + // Return the handler for browser life span events. + get_life_span_handler: function(self: PCefClient): PCefLifeSpanHandler; cdecl; + + // Return the handler for browser load status events. + get_load_handler: function(self: PCefClient): PCefLoadHandler; cdecl; + + // Return the handler for off-screen rendering events. + get_render_handler: function(self: PCefClient): PCefRenderHandler; cdecl; + + // Return the handler for browser request events. + get_request_handler: function(self: PCefClient): PCefRequestHandler; cdecl; + + // Called when a new message is received from a different process. Return true + // (1) if the message was handled or false (0) otherwise. Do not keep a + // reference to or attempt to access the message outside of this callback. + on_process_message_received: function(self: PCefClient; browser: PCefBrowser; + source_process: TCefProcessId; message: PCefProcessMessage): Integer; cdecl; + end; + + // Structure used to represent a web request. The functions of this structure + // may be called on any thread. + TCefRequest = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is read-only. + is_read_only: function(self: PCefRequest): Integer; cdecl; + + // Get the fully qualified URL. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_url: function(self: PCefRequest): PCefStringUserFree; cdecl; + // Set the fully qualified URL. + set_url: procedure(self: PCefRequest; const url: PCefString); cdecl; + + // Get the request function type. The value will default to POST if post data + // is provided and GET otherwise. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_method: function(self: PCefRequest): PCefStringUserFree; cdecl; + // Set the request function type. + set_method: procedure(self: PCefRequest; const method: PCefString); cdecl; + + // Get the post data. + get_post_data: function(self: PCefRequest): PCefPostData; cdecl; + // Set the post data. + set_post_data: procedure(self: PCefRequest; postData: PCefPostData); cdecl; + + // Get the header values. + get_header_map: procedure(self: PCefRequest; headerMap: TCefStringMultimap); cdecl; + // Set the header values. + set_header_map: procedure(self: PCefRequest; headerMap: TCefStringMultimap); cdecl; + + // Set all values at one time. + set_: procedure(self: PCefRequest; const url, method: PCefString; + postData: PCefPostData; headerMap: TCefStringMultimap); cdecl; + + // Get the flags used in combination with cef_urlrequest_t. See + // cef_urlrequest_flags_t for supported values. + get_flags: function(self: PCefRequest): Integer; cdecl; + // Set the flags used in combination with cef_urlrequest_t. See + // cef_urlrequest_flags_t for supported values. + set_flags: procedure(self: PCefRequest; flags: Integer); cdecl; + + // Get the URL to the first party for cookies used in combination with + // cef_urlrequest_t. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_first_party_for_cookies: function(self: PCefRequest): PCefStringUserFree; cdecl; + // Set the URL to the first party for cookies used in combination with + // cef_urlrequest_t. + set_first_party_for_cookies: procedure(self: PCefRequest; const url: PCefString); cdecl; + end; + + + TCefPostDataElementArray = array[0..(High(Integer) div SizeOf(PCefPostDataElement)) - 1] of PCefPostDataElement; + PCefPostDataElementArray = ^TCefPostDataElementArray; + + // Structure used to represent post data for a web request. The functions of + // this structure may be called on any thread. + TCefPostData = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is read-only. + is_read_only: function(self: PCefPostData):Integer; cdecl; + + // Returns the number of existing post data elements. + get_element_count: function(self: PCefPostData): Cardinal; cdecl; + + // Retrieve the post data elements. + get_elements: procedure(self: PCefPostData; elementsCount: PCardinal; + elements: PCefPostDataElementArray); cdecl; + + // Remove the specified post data element. Returns true (1) if the removal + // succeeds. + remove_element: function(self: PCefPostData; + element: PCefPostDataElement): Integer; cdecl; + + // Add the specified post data element. Returns true (1) if the add succeeds. + add_element: function(self: PCefPostData; + element: PCefPostDataElement): Integer; cdecl; + + // Remove all existing post data elements. + remove_elements: procedure(self: PCefPostData); cdecl; + + end; + + // Structure used to represent a single element in the request post data. The + // functions of this structure may be called on any thread. + TCefPostDataElement = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is read-only. + is_read_only: function(self: PCefPostDataElement): Integer; cdecl; + + // Remove all contents from the post data element. + set_to_empty: procedure(self: PCefPostDataElement); cdecl; + + // The post data element will represent a file. + set_to_file: procedure(self: PCefPostDataElement; + const fileName: PCefString); cdecl; + + // The post data element will represent bytes. The bytes passed in will be + // copied. + set_to_bytes: procedure(self: PCefPostDataElement; + size: Cardinal; const bytes: Pointer); cdecl; + + // Return the type of this post data element. + get_type: function(self: PCefPostDataElement): TCefPostDataElementType; cdecl; + + // Return the file name. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_file: function(self: PCefPostDataElement): PCefStringUserFree; cdecl; + + // Return the number of bytes. + get_bytes_count: function(self: PCefPostDataElement): Cardinal; cdecl; + + // Read up to |size| bytes into |bytes| and return the number of bytes + // actually read. + get_bytes: function(self: PCefPostDataElement; + size: Cardinal; bytes: Pointer): Cardinal; cdecl; + end; + + // Structure used to represent a web response. The functions of this structure + // may be called on any thread. + TCefResponse = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is read-only. + is_read_only: function(self: PCefResponse): Integer; cdecl; + + // Get the response status code. + get_status: function(self: PCefResponse): Integer; cdecl; + // Set the response status code. + set_status: procedure(self: PCefResponse; status: Integer); cdecl; + + // Get the response status text. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_status_text: function(self: PCefResponse): PCefStringUserFree; cdecl; + // Set the response status text. + set_status_text: procedure(self: PCefResponse; const statusText: PCefString); cdecl; + + // Get the response mime type. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_mime_type: function(self: PCefResponse): PCefStringUserFree; cdecl; + // Set the response mime type. + set_mime_type: procedure(self: PCefResponse; const mimeType: PCefString); cdecl; + + // Get the value for the specified response header field. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_header: function(self: PCefResponse; const name: PCefString): PCefStringUserFree; cdecl; + + // Get all response header fields. + get_header_map: procedure(self: PCefResponse; headerMap: TCefStringMultimap); cdecl; + // Set all response header fields. + set_header_map: procedure(self: PCefResponse; headerMap: TCefStringMultimap); cdecl; + end; + + // Structure the client can implement to provide a custom stream reader. The + // functions of this structure may be called on any thread. + TCefReadHandler = record + // Base structure. + base: TCefBase; + + // Read raw binary data. + read: function(self: PCefReadHandler; ptr: Pointer; + size, n: Cardinal): Cardinal; cdecl; + + // Seek to the specified offset position. |whence| may be any one of SEEK_CUR, + // SEEK_END or SEEK_SET. Return zero on success and non-zero on failure. + seek: function(self: PCefReadHandler; offset: Int64; + whence: Integer): Integer; cdecl; + + // Return the current offset position. + tell: function(self: PCefReadHandler): Int64; cdecl; + + // Return non-zero if at end of file. + eof: function(self: PCefReadHandler): Integer; cdecl; + end; + + // Structure used to read data from a stream. The functions of this structure + // may be called on any thread. + TCefStreamReader = record + // Base structure. + base: TCefBase; + + // Read raw binary data. + read: function(self: PCefStreamReader; ptr: Pointer; + size, n: Cardinal): Cardinal; cdecl; + + // Seek to the specified offset position. |whence| may be any one of SEEK_CUR, + // SEEK_END or SEEK_SET. Returns zero on success and non-zero on failure. + seek: function(self: PCefStreamReader; offset: Int64; + whence: Integer): Integer; cdecl; + + // Return the current offset position. + tell: function(self: PCefStreamReader): Int64; cdecl; + + // Return non-zero if at end of file. + eof: function(self: PCefStreamReader): Integer; cdecl; + end; + + // Structure the client can implement to provide a custom stream writer. The + // functions of this structure may be called on any thread. + TCefWriteHandler = record + // Base structure. + base: TCefBase; + + // Write raw binary data. + write: function(self: PCefWriteHandler; + const ptr: Pointer; size, n: Cardinal): Cardinal; cdecl; + + // Seek to the specified offset position. |whence| may be any one of SEEK_CUR, + // SEEK_END or SEEK_SET. + seek: function(self: PCefWriteHandler; offset: Int64; + whence: Integer): Integer; cdecl; + + // Return the current offset position. + tell: function(self: PCefWriteHandler): Int64; cdecl; + + // Flush the stream. + flush: function(self: PCefWriteHandler): Integer; cdecl; + end; + + // Structure used to write data to a stream. The functions of this structure may + // be called on any thread. + TCefStreamWriter = record + // Base structure. + base: TCefBase; + + // Write raw binary data. + write: function(self: PCefStreamWriter; + const ptr: Pointer; size, n: Cardinal): Cardinal; cdecl; + + // Seek to the specified offset position. |whence| may be any one of SEEK_CUR, + // SEEK_END or SEEK_SET. + seek: function(self: PCefStreamWriter; offset: Int64; + whence: Integer): Integer; cdecl; + + // Return the current offset position. + tell: function(self: PCefStreamWriter): Int64; cdecl; + + // Flush the stream. + flush: function(self: PCefStreamWriter): Integer; cdecl; + end; + + // Structure representing a V8 context handle. V8 handles can only be accessed + // from the thread on which they are created. Valid threads for creating a V8 + // handle include the render process main thread (TID_RENDERER) and WebWorker + // threads. A task runner for posting tasks on the associated thread can be + // retrieved via the cef_v8context_t::get_task_runner() function. + TCefV8Context = record + // Base structure. + base: TCefBase; + + // Returns the task runner associated with this context. V8 handles can only + // be accessed from the thread on which they are created. This function can be + // called on any render process thread. + get_task_runner: function(self: PCefv8Context): PCefTask; cdecl; + + // Returns true (1) if the underlying handle is valid and it can be accessed + // on the current thread. Do not call any other functions if this function + // returns false (0). + is_valid: function(self: PCefv8Context): Integer; cdecl; + + // Returns the browser for this context. This function will return an NULL + // reference for WebWorker contexts. + get_browser: function(self: PCefv8Context): PCefBrowser; cdecl; + + // Returns the frame for this context. This function will return an NULL + // reference for WebWorker contexts. + get_frame: function(self: PCefv8Context): PCefFrame; cdecl; + + // Returns the global object for this context. The context must be entered + // before calling this function. + get_global: function(self: PCefv8Context): PCefv8Value; cdecl; + + // Enter this context. A context must be explicitly entered before creating a + // V8 Object, Array, Function or Date asynchronously. exit() must be called + // the same number of times as enter() before releasing this context. V8 + // objects belong to the context in which they are created. Returns true (1) + // if the scope was entered successfully. + enter: function(self: PCefv8Context): Integer; cdecl; + + // Exit this context. Call this function only after calling enter(). Returns + // true (1) if the scope was exited successfully. + exit: function(self: PCefv8Context): Integer; cdecl; + + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + is_same: function(self, that: PCefv8Context): Integer; cdecl; + + // Evaluates the specified JavaScript code using this context's global object. + // On success |retval| will be set to the return value, if any, and the + // function will return true (1). On failure |exception| will be set to the + // exception, if any, and the function will return false (0). + eval: function(self: PCefv8Context; const code: PCefString; + var retval: PCefv8Value; var exception: PCefV8Exception): Integer; cdecl; + end; + + // Structure that should be implemented to handle V8 function calls. The + // functions of this structure will be called on the thread associated with the + // V8 function. + TCefv8Handler = record + // Base structure. + base: TCefBase; + + // Handle execution of the function identified by |name|. |object| is the + // receiver ('this' object) of the function. |arguments| is the list of + // arguments passed to the function. If execution succeeds set |retval| to the + // function return value. If execution fails set |exception| to the exception + // that will be thrown. Return true (1) if execution was handled. + execute: function(self: PCefv8Handler; + const name: PCefString; obj: PCefv8Value; argumentsCount: Cardinal; + const arguments: PPCefV8Value; var retval: PCefV8Value; + var exception: TCefString): Integer; cdecl; + end; + + // Structure that should be implemented to handle V8 accessor calls. Accessor + // identifiers are registered by calling cef_v8value_t::set_value_byaccessor(). + // The functions of this structure will be called on the thread associated with + // the V8 accessor. + TCefV8Accessor = record + // Base structure. + base: TCefBase; + + // Handle retrieval the accessor value identified by |name|. |object| is the + // receiver ('this' object) of the accessor. If retrieval succeeds set + // |retval| to the return value. If retrieval fails set |exception| to the + // exception that will be thrown. Return true (1) if accessor retrieval was + // handled. + get: function(self: PCefV8Accessor; const name: PCefString; + obj: PCefv8Value; out retval: PCefv8Value; exception: PCefString): Integer; cdecl; + + // Handle assignment of the accessor value identified by |name|. |object| is + // the receiver ('this' object) of the accessor. |value| is the new value + // being assigned to the accessor. If assignment fails set |exception| to the + // exception that will be thrown. Return true (1) if accessor assignment was + // handled. + put: function(self: PCefV8Accessor; const name: PCefString; + obj: PCefv8Value; value: PCefv8Value; exception: PCefString): Integer; cdecl; + end; + + // Structure representing a V8 exception. The functions of this structure may be + // called on any render process thread. + TCefV8Exception = record + // Base structure. + base: TCefBase; + + // Returns the exception message. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_message: function(self: PCefV8Exception): PCefStringUserFree; cdecl; + + // Returns the line of source code that the exception occurred within. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_source_line: function(self: PCefV8Exception): PCefStringUserFree; cdecl; + + // Returns the resource name for the script from where the function causing + // the error originates. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_script_resource_name: function(self: PCefV8Exception): PCefStringUserFree; cdecl; + + // Returns the 1-based number of the line where the error occurred or 0 if the + // line number is unknown. + get_line_number: function(self: PCefV8Exception): Integer; cdecl; + + // Returns the index within the script of the first character where the error + // occurred. + get_start_position: function(self: PCefV8Exception): Integer; cdecl; + + // Returns the index within the script of the last character where the error + // occurred. + get_end_position: function(self: PCefV8Exception): Integer; cdecl; + + // Returns the index within the line of the first character where the error + // occurred. + get_start_column: function(self: PCefV8Exception): Integer; cdecl; + + // Returns the index within the line of the last character where the error + // occurred. + get_end_column: function(self: PCefV8Exception): Integer; cdecl; + end; + + // Structure representing a V8 value handle. V8 handles can only be accessed + // from the thread on which they are created. Valid threads for creating a V8 + // handle include the render process main thread (TID_RENDERER) and WebWorker + // threads. A task runner for posting tasks on the associated thread can be + // retrieved via the cef_v8context_t::get_task_runner() function. + TCefv8Value = record + // Base structure. + base: TCefBase; + + // Returns true (1) if the underlying handle is valid and it can be accessed + // on the current thread. Do not call any other functions if this function + // returns false (0). + is_valid: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is undefined. + is_undefined: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is null. + is_null: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is bool. + is_bool: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is int. + is_int: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is unsigned int. + is_uint: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is double. + is_double: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is Date. + is_date: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is string. + is_string: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is object. + is_object: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is array. + is_array: function(self: PCefv8Value): Integer; cdecl; + // True if the value type is function. + is_function: function(self: PCefv8Value): Integer; cdecl; + + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + is_same: function(self, that: PCefv8Value): Integer; cdecl; + + // Return a bool value. The underlying data will be converted to if + // necessary. + get_bool_value: function(self: PCefv8Value): Integer; cdecl; + // Return an int value. The underlying data will be converted to if + // necessary. + get_int_value: function(self: PCefv8Value): Integer; cdecl; + // Return an unisgned int value. The underlying data will be converted to if + // necessary. + get_uint_value: function(self: PCefv8Value): Cardinal; cdecl; + // Return a double value. The underlying data will be converted to if + // necessary. + get_double_value: function(self: PCefv8Value): double; cdecl; + // Return a Date value. The underlying data will be converted to if + // necessary. + get_date_value: function(self: PCefv8Value): TCefTime; cdecl; + // Return a string value. The underlying data will be converted to if + // necessary. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_string_value: function(self: PCefv8Value): PCefStringUserFree; cdecl; + + + // OBJECT METHODS - These functions are only available on objects. Arrays and + // functions are also objects. String- and integer-based keys can be used + // interchangably with the framework converting between them as necessary. + + // Returns true (1) if this is a user created object. + is_user_created: function(self: PCefv8Value): Integer; cdecl; + + // Returns true (1) if the last function call resulted in an exception. This + // attribute exists only in the scope of the current CEF value object. + has_exception: function(self: PCefv8Value): Integer; cdecl; + + // Returns the exception resulting from the last function call. This attribute + // exists only in the scope of the current CEF value object. + get_exception: function(self: PCefv8Value): PCefV8Exception; cdecl; + + // Clears the last exception and returns true (1) on success. + clear_exception: function(self: PCefv8Value): Integer; cdecl; + + // Returns true (1) if this object will re-throw future exceptions. This + // attribute exists only in the scope of the current CEF value object. + will_rethrow_exceptions: function(self: PCefv8Value): Integer; cdecl; + + // Set whether this object will re-throw future exceptions. By default + // exceptions are not re-thrown. If a exception is re-thrown the current + // context should not be accessed again until after the exception has been + // caught and not re-thrown. Returns true (1) on success. This attribute + // exists only in the scope of the current CEF value object. + set_rethrow_exceptions: function(self: PCefv8Value; rethrow: Integer): Integer; cdecl; + + + // Returns true (1) if the object has a value with the specified identifier. + has_value_bykey: function(self: PCefv8Value; const key: PCefString): Integer; cdecl; + // Returns true (1) if the object has a value with the specified identifier. + has_value_byindex: function(self: PCefv8Value; index: Integer): Integer; cdecl; + + // Deletes the value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly or an + // exception is thrown. For read-only and don't-delete values this function + // will return true (1) even though deletion failed. + delete_value_bykey: function(self: PCefv8Value; const key: PCefString): Integer; cdecl; + // Deletes the value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly, deletion + // fails or an exception is thrown. For read-only and don't-delete values this + // function will return true (1) even though deletion failed. + delete_value_byindex: function(self: PCefv8Value; index: Integer): Integer; cdecl; + + // Returns the value with the specified identifier on success. Returns NULL if + // this function is called incorrectly or an exception is thrown. + get_value_bykey: function(self: PCefv8Value; const key: PCefString): PCefv8Value; cdecl; + // Returns the value with the specified identifier on success. Returns NULL if + // this function is called incorrectly or an exception is thrown. + get_value_byindex: function(self: PCefv8Value; index: Integer): PCefv8Value; cdecl; + + // Associates a value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly or an + // exception is thrown. For read-only values this function will return true + // (1) even though assignment failed. + set_value_bykey: function(self: PCefv8Value; const key: PCefString; + value: PCefv8Value; attribute: Integer): Integer; cdecl; + // Associates a value with the specified identifier and returns true (1) on + // success. Returns false (0) if this function is called incorrectly or an + // exception is thrown. For read-only values this function will return true + // (1) even though assignment failed. + set_value_byindex: function(self: PCefv8Value; index: Integer; + value: PCefv8Value): Integer; cdecl; + + // Registers an identifier and returns true (1) on success. Access to the + // identifier will be forwarded to the cef_v8accessor_t instance passed to + // cef_v8value_t::cef_v8value_create_object(). Returns false (0) if this + // function is called incorrectly or an exception is thrown. For read-only + // values this function will return true (1) even though assignment failed. + set_value_byaccessor: function(self: PCefv8Value; const key: PCefString; + settings: Integer; attribute: Integer): Integer; cdecl; + + // Read the keys for the object's values into the specified vector. Integer- + // based keys will also be returned as strings. + get_keys: function(self: PCefv8Value; keys: TCefStringList): Integer; cdecl; + + // Sets the user data for this object and returns true (1) on success. Returns + // false (0) if this function is called incorrectly. This function can only be + // called on user created objects. + set_user_data: function(self: PCefv8Value; user_data: PCefBase): Integer; cdecl; + + // Returns the user data, if any, assigned to this object. + get_user_data: function(self: PCefv8Value): PCefBase; cdecl; + + // Returns the amount of externally allocated memory registered for the + // object. + get_externally_allocated_memory: function(self: PCefv8Value): Integer; cdecl; + + // Adjusts the amount of registered external memory for the object. Used to + // give V8 an indication of the amount of externally allocated memory that is + // kept alive by JavaScript objects. V8 uses this information to decide when + // to perform global garbage collection. Each cef_v8value_t tracks the amount + // of external memory associated with it and automatically decreases the + // global total by the appropriate amount on its destruction. + // |change_in_bytes| specifies the number of bytes to adjust by. This function + // returns the number of bytes associated with the object after the + // adjustment. This function can only be called on user created objects. + adjust_externally_allocated_memory: function(self: PCefv8Value; change_in_bytes: Integer): Integer; cdecl; + + // ARRAY METHODS - These functions are only available on arrays. + + // Returns the number of elements in the array. + get_array_length: function(self: PCefv8Value): Integer; cdecl; + + + // FUNCTION METHODS - These functions are only available on functions. + + // Returns the function name. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_function_name: function(self: PCefv8Value): PCefStringUserFree; cdecl; + + // Returns the function handler or NULL if not a CEF-created function. + get_function_handler: function( + self: PCefv8Value): PCefv8Handler; cdecl; + + // Execute the function using the current V8 context. This function should + // only be called from within the scope of a cef_v8handler_t or + // cef_v8accessor_t callback, or in combination with calling enter() and + // exit() on a stored cef_v8context_t reference. |object| is the receiver + // ('this' object) of the function. If |object| is NULL the current context's + // global object will be used. |arguments| is the list of arguments that will + // be passed to the function. Returns the function return value on success. + // Returns NULL if this function is called incorrectly or an exception is + // thrown. + execute_function: function(self: PCefv8Value; obj: PCefv8Value; + argumentsCount: Cardinal; const arguments: PPCefV8Value): PCefv8Value; cdecl; + + // Execute the function using the specified V8 context. |object| is the + // receiver ('this' object) of the function. If |object| is NULL the specified + // context's global object will be used. |arguments| is the list of arguments + // that will be passed to the function. Returns the function return value on + // success. Returns NULL if this function is called incorrectly or an + // exception is thrown. + execute_function_with_context: function(self: PCefv8Value; context: PCefv8Context; + obj: PCefv8Value; argumentsCount: Cardinal; const arguments: PPCefV8Value): PCefv8Value; cdecl; + end; + + // Structure representing a V8 stack trace handle. V8 handles can only be + // accessed from the thread on which they are created. Valid threads for + // creating a V8 handle include the render process main thread (TID_RENDERER) + // and WebWorker threads. A task runner for posting tasks on the associated + // thread can be retrieved via the cef_v8context_t::get_task_runner() function. + TCefV8StackTrace = record + // Base structure. + base: TCefBase; + + // Returns true (1) if the underlying handle is valid and it can be accessed + // on the current thread. Do not call any other functions if this function + // returns false (0). + is_valid: function(self: PCefV8StackTrace): Integer; cdecl; + + // Returns the number of stack frames. + get_frame_count: function(self: PCefV8StackTrace): Integer; cdecl; + + // Returns the stack frame at the specified 0-based index. + get_frame: function(self: PCefV8StackTrace; index: Integer): PCefV8StackFrame; cdecl; + end; + + // Structure representing a V8 stack frame handle. V8 handles can only be + // accessed from the thread on which they are created. Valid threads for + // creating a V8 handle include the render process main thread (TID_RENDERER) + // and WebWorker threads. A task runner for posting tasks on the associated + // thread can be retrieved via the cef_v8context_t::get_task_runner() function. + TCefV8StackFrame = record + // Base structure. + base: TCefBase; + + // Returns true (1) if the underlying handle is valid and it can be accessed + // on the current thread. Do not call any other functions if this function + // returns false (0). + is_valid: function(self: PCefV8StackFrame): Integer; cdecl; + + // Returns the name of the resource script that contains the function. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_script_name: function(self: PCefV8StackFrame): PCefStringUserFree; cdecl; + + // Returns the name of the resource script that contains the function or the + // sourceURL value if the script name is undefined and its source ends with a + // "//@ sourceURL=..." string. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_script_name_or_source_url: function(self: PCefV8StackFrame): PCefStringUserFree; cdecl; + + // Returns the name of the function. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_function_name: function(self: PCefV8StackFrame): PCefStringUserFree; cdecl; + + // Returns the 1-based line number for the function call or 0 if unknown. + get_line_number: function(self: PCefV8StackFrame): Integer; cdecl; + + // Returns the 1-based column offset on the line for the function call or 0 if + // unknown. + get_column: function(self: PCefV8StackFrame): Integer; cdecl; + + // Returns true (1) if the function was compiled using eval(). + is_eval: function(self: PCefV8StackFrame): Integer; cdecl; + + // Returns true (1) if the function was called as a constructor via "new". + is_constructor: function(self: PCefV8StackFrame): Integer; cdecl; + end; + + // Structure that manages custom scheme registrations. + TCefSchemeRegistrar = record + // Base structure. + base: TCefBase; + + // Register a custom scheme. This function should not be called for the built- + // in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes. + // + // If |is_standard| is true (1) the scheme will be treated as a standard + // scheme. Standard schemes are subject to URL canonicalization and parsing + // rules as defined in the Common Internet Scheme Syntax RFC 1738 Section 3.1 + // available at http://www.ietf.org/rfc/rfc1738.txt + // + // In particular, the syntax for standard scheme URLs must be of the form: + // <pre> + // [scheme]://[username]:[password]@[host]:[port]/[url-path] + // </pre> Standard scheme URLs must have a host component that is a fully + // qualified domain name as defined in Section 3.5 of RFC 1034 [13] and + // Section 2.1 of RFC 1123. These URLs will be canonicalized to + // "scheme://host/path" in the simplest case and + // "scheme://username:password@host:port/path" in the most explicit case. For + // example, "scheme:host/path" and "scheme:///host/path" will both be + // canonicalized to "scheme://host/path". The origin of a standard scheme URL + // is the combination of scheme, host and port (i.e., "scheme://host:port" in + // the most explicit case). + // + // For non-standard scheme URLs only the "scheme:" component is parsed and + // canonicalized. The remainder of the URL will be passed to the handler as- + // is. For example, "scheme:///some%20text" will remain the same. Non-standard + // scheme URLs cannot be used as a target for form submission. + // + // If |is_local| is true (1) the scheme will be treated as local (i.e., with + // the same security rules as those applied to "file" URLs). Normal pages + // cannot link to or access local URLs. Also, by default, local URLs can only + // perform XMLHttpRequest calls to the same URL (origin + path) that + // originated the request. To allow XMLHttpRequest calls from a local URL to + // other URLs with the same origin set the + // CefSettings.file_access_from_file_urls_allowed value to true (1). To allow + // XMLHttpRequest calls from a local URL to all origins set the + // CefSettings.universal_access_from_file_urls_allowed value to true (1). + // + // If |is_display_isolated| is true (1) the scheme will be treated as display- + // isolated. This means that pages cannot display these URLs unless they are + // from the same scheme. For example, pages in another origin cannot create + // iframes or hyperlinks to URLs with this scheme. + // + // This function may be called on any thread. It should only be called once + // per unique |scheme_name| value. If |scheme_name| is already registered or + // if an error occurs this function will return false (0). + add_custom_scheme: function(self: PCefSchemeRegistrar; + const scheme_name: PCefString; is_standard, is_local, + is_display_isolated: Integer): Integer; cdecl; + end; + + // Structure that creates cef_scheme_handler_t instances. The functions of this + // structure will always be called on the IO thread. + TCefSchemeHandlerFactory = record + // Base structure. + base: TCefBase; + + // Return a new resource handler instance to handle the request. |browser| and + // |frame| will be the browser window and frame respectively that originated + // the request or NULL if the request did not originate from a browser window + // (for example, if the request came from cef_urlrequest_t). The |request| + // object passed to this function will not contain cookie data. + create: function(self: PCefSchemeHandlerFactory; + browser: PCefBrowser; frame: PCefFrame; const scheme_name: PCefString; + request: PCefRequest): PCefResourceHandler; cdecl; + end; + + // Structure used to represent a download item. + TCefDownloadItem = record + // Base structure. + base: TCefBase; + + // Returns true (1) if this object is valid. Do not call any other functions + // if this function returns false (0). + is_valid: function(self: PCefDownloadItem): Integer; cdecl; + + // Returns true (1) if the download is in progress. + is_in_progress: function(self: PCefDownloadItem): Integer; cdecl; + + // Returns true (1) if the download is complete. + is_complete: function(self: PCefDownloadItem): Integer; cdecl; + + // Returns true (1) if the download has been canceled or interrupted. + is_canceled: function(self: PCefDownloadItem): Integer; cdecl; + + // Returns a simple speed estimate in bytes/s. + get_current_speed: function(self: PCefDownloadItem): Int64; cdecl; + + // Returns the rough percent complete or -1 if the receive total size is + // unknown. + get_percent_complete: function(self: PCefDownloadItem): Integer; cdecl; + + // Returns the total number of bytes. + get_total_bytes: function(self: PCefDownloadItem): Int64; cdecl; + + // Returns the number of received bytes. + get_received_bytes: function(self: PCefDownloadItem): Int64; cdecl; + + // Returns the time that the download started. + get_start_time: function(self: PCefDownloadItem): TCefTime; cdecl; + + // Returns the time that the download ended. + get_end_time: function(self: PCefDownloadItem): TCefTime; cdecl; + + // Returns the full path to the downloaded or downloading file. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_full_path: function(self: PCefDownloadItem): PCefStringUserFree; cdecl; + + // Returns the unique identifier for this download. + get_id: function(self: PCefDownloadItem): Integer; cdecl; + + // Returns the URL. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_url: function(self: PCefDownloadItem): PCefStringUserFree; cdecl; + + // Returns the suggested file name. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_suggested_file_name: function(self: PCefDownloadItem): PCefStringUserFree; cdecl; + + // Returns the content disposition. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_content_disposition: function(self: PCefDownloadItem): PCefStringUserFree; cdecl; + + // Returns the mime type. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_mime_type: function(self: PCefDownloadItem): PCefStringUserFree; cdecl; + end; + + // Callback structure used to asynchronously continue a download. + TCefBeforeDownloadCallback = record + // Base structure. + base: TCefBase; + + // Call to continue the download. Set |download_path| to the full file path + // for the download including the file name or leave blank to use the + // suggested name and the default temp directory. Set |show_dialog| to true + // (1) if you do wish to show the default "Save As" dialog. + cont: procedure(self: PCefBeforeDownloadCallback; + const download_path: PCefString; show_dialog: Integer); cdecl; + end; + + // Callback structure used to asynchronously cancel a download. + TCefDownloadItemCallback = record + // Base structure. + base: TCefBase; + + // Call to cancel the download. + cancel: procedure(self: PCefDownloadItemCallback); cdecl; + end; + + // Structure used to handle file downloads. The functions of this structure will + // always be called on the UI thread. + TCefDownloadHandler = record + // Base structure. + base: TCefBase; + + // Called before a download begins. |suggested_name| is the suggested name for + // the download file. By default the download will be canceled. Execute + // |callback| either asynchronously or in this function to continue the + // download if desired. Do not keep a reference to |download_item| outside of + // this function. + on_before_download: procedure(self: PCefDownloadHandler; + browser: PCefBrowser; download_item: PCefDownloadItem; + const suggested_name: PCefString; callback: PCefBeforeDownloadCallback); cdecl; + + // Called when a download's status or progress information has been updated. + // Execute |callback| either asynchronously or in this function to cancel the + // download if desired. Do not keep a reference to |download_item| outside of + // this function. + on_download_updated: procedure(self: PCefDownloadHandler; + browser: PCefBrowser; download_item: PCefDownloadItem; + callback: PCefDownloadItemCallback); cdecl; + end; + + // Structure that supports the reading of XML data via the libxml streaming API. + // The functions of this structure should only be called on the thread that + // creates the object. + TCefXmlReader = record + // Base structure. + base: TcefBase; + + // Moves the cursor to the next node in the document. This function must be + // called at least once to set the current cursor position. Returns true (1) + // if the cursor position was set successfully. + move_to_next_node: function(self: PCefXmlReader): Integer; cdecl; + + // Close the document. This should be called directly to ensure that cleanup + // occurs on the correct thread. + close: function(self: PCefXmlReader): Integer; cdecl; + + // Returns true (1) if an error has been reported by the XML parser. + has_error: function(self: PCefXmlReader): Integer; cdecl; + + // Returns the error string. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_error: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + + // The below functions retrieve data for the node at the current cursor + // position. + + // Returns the node type. + get_type: function(self: PCefXmlReader): TCefXmlNodeType; cdecl; + + // Returns the node depth. Depth starts at 0 for the root node. + get_depth: function(self: PCefXmlReader): Integer; cdecl; + + // Returns the local name. See http://www.w3.org/TR/REC-xml-names/#NT- + // LocalPart for additional details. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_local_name: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns the namespace prefix. See http://www.w3.org/TR/REC-xml-names/ for + // additional details. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_prefix: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns the qualified name, equal to (Prefix:)LocalName. See + // http://www.w3.org/TR/REC-xml-names/#ns-qualnames for additional details. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_qualified_name: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns the URI defining the namespace associated with the node. See + // http://www.w3.org/TR/REC-xml-names/ for additional details. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_namespace_uri: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns the base URI of the node. See http://www.w3.org/TR/xmlbase/ for + // additional details. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_base_uri: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns the xml:lang scope within which the node resides. See + // http://www.w3.org/TR/REC-xml/#sec-lang-tag for additional details. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_xml_lang: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns true (1) if the node represents an NULL element. <a/> is considered + // NULL but <a></a> is not. + is_empty_element: function(self: PCefXmlReader): Integer; cdecl; + + // Returns true (1) if the node has a text value. + has_value: function(self: PCefXmlReader): Integer; cdecl; + + // Returns the text value. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_value: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns true (1) if the node has attributes. + has_attributes: function(self: PCefXmlReader): Integer; cdecl; + + // Returns the number of attributes. + get_attribute_count: function(self: PCefXmlReader): Cardinal; cdecl; + + // Returns the value of the attribute at the specified 0-based index. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_attribute_byindex: function(self: PCefXmlReader; index: Integer): PCefStringUserFree; cdecl; + + // Returns the value of the attribute with the specified qualified name. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_attribute_byqname: function(self: PCefXmlReader; const qualifiedName: PCefString): PCefStringUserFree; cdecl; + + // Returns the value of the attribute with the specified local name and + // namespace URI. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_attribute_bylname: function(self: PCefXmlReader; const localName, namespaceURI: PCefString): PCefStringUserFree; cdecl; + + // Returns an XML representation of the current node's children. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_inner_xml: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns an XML representation of the current node including its children. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_outer_xml: function(self: PCefXmlReader): PCefStringUserFree; cdecl; + + // Returns the line number for the current node. + get_line_number: function(self: PCefXmlReader): Integer; cdecl; + + + // Attribute nodes are not traversed by default. The below functions can be + // used to move the cursor to an attribute node. move_to_carrying_element() + // can be called afterwards to return the cursor to the carrying element. The + // depth of an attribute node will be 1 + the depth of the carrying element. + + // Moves the cursor to the attribute at the specified 0-based index. Returns + // true (1) if the cursor position was set successfully. + move_to_attribute_byindex: function(self: PCefXmlReader; index: Integer): Integer; cdecl; + + // Moves the cursor to the attribute with the specified qualified name. + // Returns true (1) if the cursor position was set successfully. + move_to_attribute_byqname: function(self: PCefXmlReader; const qualifiedName: PCefString): Integer; cdecl; + + // Moves the cursor to the attribute with the specified local name and + // namespace URI. Returns true (1) if the cursor position was set + // successfully. + move_to_attribute_bylname: function(self: PCefXmlReader; const localName, namespaceURI: PCefString): Integer; cdecl; + + // Moves the cursor to the first attribute in the current element. Returns + // true (1) if the cursor position was set successfully. + move_to_first_attribute: function(self: PCefXmlReader): Integer; cdecl; + + // Moves the cursor to the next attribute in the current element. Returns true + // (1) if the cursor position was set successfully. + move_to_next_attribute: function(self: PCefXmlReader): Integer; cdecl; + + // Moves the cursor back to the carrying element. Returns true (1) if the + // cursor position was set successfully. + move_to_carrying_element: function(self: PCefXmlReader): Integer; cdecl; + end; + + // Structure that supports the reading of zip archives via the zlib unzip API. + // The functions of this structure should only be called on the thread that + // creates the object. + TCefZipReader = record + // Base structure. + base: TCefBase; + + // Moves the cursor to the first file in the archive. Returns true (1) if the + // cursor position was set successfully. + move_to_first_file: function(self: PCefZipReader): Integer; cdecl; + + // Moves the cursor to the next file in the archive. Returns true (1) if the + // cursor position was set successfully. + move_to_next_file: function(self: PCefZipReader): Integer; cdecl; + + // Moves the cursor to the specified file in the archive. If |caseSensitive| + // is true (1) then the search will be case sensitive. Returns true (1) if the + // cursor position was set successfully. + move_to_file: function(self: PCefZipReader; const fileName: PCefString; caseSensitive: Integer): Integer; cdecl; + + // Closes the archive. This should be called directly to ensure that cleanup + // occurs on the correct thread. + close: function(Self: PCefZipReader): Integer; cdecl; + + + // The below functions act on the file at the current cursor position. + + // Returns the name of the file. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_file_name: function(Self: PCefZipReader): PCefStringUserFree; cdecl; + + // Returns the uncompressed size of the file. + get_file_size: function(Self: PCefZipReader): Int64; cdecl; + + // Returns the last modified timestamp for the file. + get_file_last_modified: function(Self: PCefZipReader): LongInt; cdecl; + + // Opens the file for reading of uncompressed data. A read password may + // optionally be specified. + open_file: function(Self: PCefZipReader; const password: PCefString): Integer; cdecl; + + // Closes the file. + close_file: function(Self: PCefZipReader): Integer; cdecl; + + // Read uncompressed file contents into the specified buffer. Returns < 0 if + // an error occurred, 0 if at the end of file, or the number of bytes read. + read_file: function(Self: PCefZipReader; buffer: Pointer; bufferSize: Cardinal): Integer; cdecl; + + // Returns the current offset in the uncompressed file contents. + tell: function(Self: PCefZipReader): Int64; cdecl; + + // Returns true (1) if at end of the file contents. + eof: function(Self: PCefZipReader): Integer; cdecl; + end; + + // Structure to implement for visiting the DOM. The functions of this structure + // will be called on the render process main thread. + TCefDomVisitor = record + // Base structure. + base: TCefBase; + + // Method executed for visiting the DOM. The document object passed to this + // function represents a snapshot of the DOM at the time this function is + // executed. DOM objects are only valid for the scope of this function. Do not + // keep references to or attempt to access any DOM objects outside the scope + // of this function. + visit: procedure(self: PCefDomVisitor; document: PCefDomDocument); cdecl; + end; + + // Structure used to represent a DOM document. The functions of this structure + // should only be called on the render process main thread thread. + TCefDomDocument = record + // Base structure. + base: TCefBase; + + // Returns the document type. + get_type: function(self: PCefDomDocument): TCefDomDocumentType; cdecl; + + // Returns the root document node. + get_document: function(self: PCefDomDocument): PCefDomNode; cdecl; + + // Returns the BODY node of an HTML document. + get_body: function(self: PCefDomDocument): PCefDomNode; cdecl; + + // Returns the HEAD node of an HTML document. + get_head: function(self: PCefDomDocument): PCefDomNode; cdecl; + + // Returns the title of an HTML document. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_title: function(self: PCefDomDocument): PCefStringUserFree; cdecl; + + // Returns the document element with the specified ID value. + get_element_by_id: function(self: PCefDomDocument; const id: PCefString): PCefDomNode; cdecl; + + // Returns the node that currently has keyboard focus. + get_focused_node: function(self: PCefDomDocument): PCefDomNode; cdecl; + + // Returns true (1) if a portion of the document is selected. + has_selection: function(self: PCefDomDocument): Integer; cdecl; + + // Returns the selection start node. + get_selection_start_node: function(self: PCefDomDocument): PCefDomNode; cdecl; + + // Returns the selection offset within the start node. + get_selection_start_offset: function(self: PCefDomDocument): Integer; cdecl; + + // Returns the selection end node. + get_selection_end_node: function(self: PCefDomDocument): PCefDomNode; cdecl; + + // Returns the selection offset within the end node. + get_selection_end_offset: function(self: PCefDomDocument): Integer; cdecl; + + // Returns the contents of this selection as markup. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_selection_as_markup: function(self: PCefDomDocument): PCefStringUserFree; cdecl; + + // Returns the contents of this selection as text. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_selection_as_text: function(self: PCefDomDocument): PCefStringUserFree; cdecl; + + // Returns the base URL for the document. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_base_url: function(self: PCefDomDocument): PCefStringUserFree; cdecl; + + // Returns a complete URL based on the document base URL and the specified + // partial URL. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_complete_url: function(self: PCefDomDocument; const partialURL: PCefString): PCefStringUserFree; cdecl; + end; + + // Structure used to represent a DOM node. The functions of this structure + // should only be called on the render process main thread. + TCefDomNode = record + // Base structure. + base: TCefBase; + + // Returns the type for this node. + get_type: function(self: PCefDomNode): TCefDomNodeType; cdecl; + + // Returns true (1) if this is a text node. + is_text: function(self: PCefDomNode): Integer; cdecl; + + // Returns true (1) if this is an element node. + is_element: function(self: PCefDomNode): Integer; cdecl; + + // Returns true (1) if this is an editable node. + is_editable: function(self: PCefDomNode): Integer; cdecl; + + // Returns true (1) if this is a form control element node. + is_form_control_element: function(self: PCefDomNode): Integer; cdecl; + + // Returns the type of this form control element node. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_form_control_element_type: function(self: PCefDomNode): PCefStringUserFree; cdecl; + + // Returns true (1) if this object is pointing to the same handle as |that| + // object. + is_same: function(self, that: PCefDomNode): Integer; cdecl; + + // Returns the name of this node. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_name: function(self: PCefDomNode): PCefStringUserFree; cdecl; + + // Returns the value of this node. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_value: function(self: PCefDomNode): PCefStringUserFree; cdecl; + + // Set the value of this node. Returns true (1) on success. + set_value: function(self: PCefDomNode; const value: PCefString): Integer; cdecl; + + // Returns the contents of this node as markup. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_as_markup: function(self: PCefDomNode): PCefStringUserFree; cdecl; + + // Returns the document associated with this node. + get_document: function(self: PCefDomNode): PCefDomDocument; cdecl; + + // Returns the parent node. + get_parent: function(self: PCefDomNode): PCefDomNode; cdecl; + + // Returns the previous sibling node. + get_previous_sibling: function(self: PCefDomNode): PCefDomNode; cdecl; + + // Returns the next sibling node. + get_next_sibling: function(self: PCefDomNode): PCefDomNode; cdecl; + + // Returns true (1) if this node has child nodes. + has_children: function(self: PCefDomNode): Integer; cdecl; + + // Return the first child node. + get_first_child: function(self: PCefDomNode): PCefDomNode; cdecl; + + // Returns the last child node. + get_last_child: function(self: PCefDomNode): PCefDomNode; cdecl; + + // Add an event listener to this node for the specified event type. If + // |useCapture| is true (1) then this listener will be considered a capturing + // listener. Capturing listeners will recieve all events of the specified type + // before the events are dispatched to any other event targets beneath the + // current node in the tree. Events which are bubbling upwards through the + // tree will not trigger a capturing listener. Separate calls to this function + // can be used to register the same listener with and without capture. See + // WebCore/dom/EventNames.h for the list of supported event types. + add_event_listener: procedure(self: PCefDomNode; const eventType: PCefString; + listener: PCefDomEventListener; useCapture: Integer); cdecl; + + // The following functions are valid only for element nodes. + + // Returns the tag name of this element. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_element_tag_name: function(self: PCefDomNode): PCefStringUserFree; cdecl; + + // Returns true (1) if this element has attributes. + has_element_attributes: function(self: PCefDomNode): Integer; cdecl; + + // Returns true (1) if this element has an attribute named |attrName|. + has_element_attribute: function(self: PCefDomNode; const attrName: PCefString): Integer; cdecl; + + // Returns the element attribute named |attrName|. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_element_attribute: function(self: PCefDomNode; const attrName: PCefString): PCefStringUserFree; cdecl; + + // Returns a map of all element attributes. + get_element_attributes: procedure(self: PCefDomNode; attrMap: TCefStringMap); cdecl; + + // Set the value for the element attribute named |attrName|. Returns true (1) + // on success. + set_element_attribute: function(self: PCefDomNode; const attrName, value: PCefString): Integer; cdecl; + + // Returns the inner text of the element. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_element_inner_text: function(self: PCefDomNode): PCefStringUserFree; cdecl; + end; + + // Structure used to represent a DOM event. The functions of this structure + // should only be called on the render process main thread. + TCefDomEvent = record + // Base structure. + base: TCefBase; + + // Returns the event type. + // The resulting string must be freed by calling cef_string_userfree_free(). + get_type: function(self: PCefDomEvent): PCefStringUserFree; cdecl; + + // Returns the event category. + get_category: function(self: PCefDomEvent): TCefDomEventCategory; cdecl; + + // Returns the event processing phase. + get_phase: function(self: PCefDomEvent): TCefDomEventPhase; cdecl; + + // Returns true (1) if the event can bubble up the tree. + can_bubble: function(self: PCefDomEvent): Integer; cdecl; + + // Returns true (1) if the event can be canceled. + can_cancel: function(self: PCefDomEvent): Integer; cdecl; + + // Returns the document associated with this event. + get_document: function(self: PCefDomEvent): PCefDomDocument; cdecl; + + // Returns the target of the event. + get_target: function(self: PCefDomEvent): PCefDomNode; cdecl; + + // Returns the current target of the event. + get_current_target: function(self: PCefDomEvent): PCefDomNode; cdecl; + end; + + // Structure to implement for handling DOM events. The functions of this + // structure will be called on the render process main thread. + TCefDomEventListener = record + // Base structure. + base: TCefBase; + + // Called when an event is received. The event object passed to this function + // contains a snapshot of the DOM at the time this function is executed. DOM + // objects are only valid for the scope of this function. Do not keep + // references to or attempt to access any DOM objects outside the scope of + // this function. + handle_event: procedure(self: PCefDomEventListener; event: PCefDomEvent); cdecl; + end; + + // Structure to implement for visiting cookie values. The functions of this + // structure will always be called on the IO thread. + TCefCookieVisitor = record + // Base structure. + base: TCefBase; + + // Method that will be called once for each cookie. |count| is the 0-based + // index for the current cookie. |total| is the total number of cookies. Set + // |deleteCookie| to true (1) to delete the cookie currently being visited. + // Return false (0) to stop visiting cookies. This function may never be + // called if no cookies are found. + + visit: function(self: PCefCookieVisitor; const cookie: PCefCookie; + count, total: Integer; deleteCookie: PInteger): Integer; cdecl; + end; + + // Structure used for managing cookies. The functions of this structure may be + // called on any thread unless otherwise indicated. + TCefCookieManager = record + // Base structure. + base: TCefBase; + + // Set the schemes supported by this manager. By default only "http" and + // "https" schemes are supported. Must be called before any cookies are + // accessed. + set_supported_schemes: procedure(self: PCefCookieManager; schemes: TCefStringList); cdecl; + + // Visit all cookies. The returned cookies are ordered by longest path, then + // by earliest creation date. Returns false (0) if cookies cannot be accessed. + visit_all_cookies: function(self: PCefCookieManager; visitor: PCefCookieVisitor): Integer; cdecl; + + // Visit a subset of cookies. The results are filtered by the given url + // scheme, host, domain and path. If |includeHttpOnly| is true (1) HTTP-only + // cookies will also be included in the results. The returned cookies are + // ordered by longest path, then by earliest creation date. Returns false (0) + // if cookies cannot be accessed. + visit_url_cookies: function(self: PCefCookieManager; const url: PCefString; + includeHttpOnly: Integer; visitor: PCefCookieVisitor): Integer; cdecl; + + // Sets a cookie given a valid URL and explicit user-provided cookie + // attributes. This function expects each attribute to be well-formed. It will + // check for disallowed characters (e.g. the ';' character is disallowed + // within the cookie value attribute) and will return false (0) without + // setting the cookie if such characters are found. This function must be + // called on the IO thread. + set_cookie: function(self: PCefCookieManager; const url: PCefString; + const cookie: PCefCookie): Integer; cdecl; + + // Delete all cookies that match the specified parameters. If both |url| and + // values |cookie_name| are specified all host and domain cookies matching + // both will be deleted. If only |url| is specified all host cookies (but not + // domain cookies) irrespective of path will be deleted. If |url| is NULL all + // cookies for all hosts and domains will be deleted. Returns false (0) if a + // non- NULL invalid URL is specified or if cookies cannot be accessed. This + // function must be called on the IO thread. + delete_cookies: function(self: PCefCookieManager; + const url, cookie_name: PCefString): Integer; cdecl; + + // Sets the directory path that will be used for storing cookie data. If + // |path| is NULL data will be stored in memory only. Returns false (0) if + // cookies cannot be accessed. + set_storage_path: function(self: PCefCookieManager; + const path: PCefString): Integer; cdecl; + end; + + // Information about a specific web plugin. + TCefWebPluginInfo = record + // Base structure. + base: TCefBase; + + // Returns the plugin name (i.e. Flash). + get_name: function(self: PCefWebPluginInfo): PCefStringUserFree; cdecl; + + // Returns the plugin file path (DLL/bundle/library). + get_path: function(self: PCefWebPluginInfo): PCefStringUserFree; cdecl; + + // Returns the version of the plugin (may be OS-specific). + get_version: function(self: PCefWebPluginInfo): PCefStringUserFree; cdecl; + + // Returns a description of the plugin from the version information. + get_description: function(self: PCefWebPluginInfo): PCefStringUserFree; cdecl; + end; + + // Structure to implement for visiting web plugin information. The functions of + // this structure will be called on the browser process UI thread. + TCefWebPluginInfoVisitor = record + // Base structure. + base: TCefBase; + + // Method that will be called once for each plugin. |count| is the 0-based + // index for the current plugin. |total| is the total number of plugins. + // Return false (0) to stop visiting plugins. This function may never be + // called if no plugins are found. + visit: function(self: PCefWebPluginInfoVisitor; + info: PCefWebPluginInfo; count, total: Integer): Integer; cdecl; + end; + + // Structure to implement for receiving unstable plugin information. The + // functions of this structure will be called on the browser process IO thread. + TCefWebPluginUnstableCallback = record + // Base structure. + base: TCefBase; + + // Method that will be called for the requested plugin. |unstable| will be + // true (1) if the plugin has reached the crash count threshold of 3 times in + // 120 seconds. + is_unstable: procedure(self: PCefWebPluginUnstableCallback; + const path: PCefString; unstable: Integer); cdecl; + end; + + // Structure used to make a URL request. URL requests are not associated with a + // browser instance so no cef_client_t callbacks will be executed. URL requests + // can be created on any valid CEF thread in either the browser or render + // process. Once created the functions of the URL request object must be + // accessed on the same thread that created it. + TCefUrlRequest = record + // Base structure. + base: TCefBase; + + // Returns the request object used to create this URL request. The returned + // object is read-only and should not be modified. + get_request: function(self: PCefUrlRequest): PCefRequest; cdecl; + + // Returns the client. + get_client: function(self: PCefUrlRequest): PCefUrlRequestClient; cdecl; + + // Returns the request status. + get_request_status: function(self: PCefUrlRequest): TCefUrlRequestStatus; cdecl; + + // Returns the request error if status is UR_CANCELED or UR_FAILED, or 0 + // otherwise. + get_request_error: function(self: PCefUrlRequest): Integer; cdecl; + + // Returns the response, or NULL if no response information is available. + // Response information will only be available after the upload has completed. + // The returned object is read-only and should not be modified. + get_response: function(self: PCefUrlRequest): PCefResponse; cdecl; + + // Cancel the request. + cancel: procedure(self: PCefUrlRequest); cdecl; + end; + + // Structure that should be implemented by the cef_urlrequest_t client. The + // functions of this structure will be called on the same thread that created + // the request. + TCefUrlrequestClient = record + // Base structure. + base: TCefBase; + + // Notifies the client that the request has completed. Use the + // cef_urlrequest_t::GetRequestStatus function to determine if the request was + // successful or not. + on_request_complete: procedure(self: PCefUrlRequestClient; request: PCefUrlRequest); cdecl; + + // Notifies the client of upload progress. |current| denotes the number of + // bytes sent so far and |total| is the total size of uploading data (or -1 if + // chunked upload is enabled). This function will only be called if the + // UR_FLAG_REPORT_UPLOAD_PROGRESS flag is set on the request. + on_upload_progress: procedure(self: PCefUrlRequestClient; + request: PCefUrlRequest; current, total: UInt64); cdecl; + + // Notifies the client of download progress. |current| denotes the number of + // bytes received up to the call and |total| is the expected total size of the + // response (or -1 if not determined). + on_download_progress: procedure(self: PCefUrlRequestClient; + request: PCefUrlRequest; current, total: UInt64); cdecl; + + // Called when some part of the response is read. |data| contains the current + // bytes received since the last call. This function will not be called if the + // UR_FLAG_NO_DOWNLOAD_DATA flag is set on the request. + on_download_data: procedure(self: PCefUrlRequestClient; + request: PCefUrlRequest; const data: Pointer; data_length: Cardinal); cdecl; + end; + + // Callback structure for asynchronous continuation of file dialog requests. + TCefFileDialogCallback = record + // Base structure. + base: TCefBase; + + // Continue the file selection with the specified |file_paths|. This may be a + // single value or a list of values depending on the dialog mode. An NULL + // value is treated the same as calling cancel(). + cont: procedure(self: PCefFileDialogCallback; file_paths: TCefStringList); cdecl; + + // Cancel the file selection. + cancel: procedure(self: PCefFileDialogCallback); cdecl; + end; + + // Implement this structure to handle dialog events. The functions of this + // structure will be called on the browser process UI thread. + TCefDialogHandler = record + // Base structure. + base: TCefBase; + + // Called to run a file chooser dialog. |mode| represents the type of dialog + // to display. |title| to the title to be used for the dialog and may be NULL + // to show the default title ("Open" or "Save" depending on the mode). + // |default_file_name| is the default file name to select in the dialog. + // |accept_types| is a list of valid lower-cased MIME types or file extensions + // specified in an input element and is used to restrict selectable files to + // such types. To display a custom dialog return true (1) and execute + // |callback| either inline or at a later time. To display the default dialog + // return false (0). + on_file_dialog: function(self: PCefDialogHandler; browser: PCefBrowser; + mode: TCefFileDialogMode; const title, default_file_name: PCefString; + accept_types: TCefStringList; callback: PCefFileDialogCallback): Integer; cdecl; + end; + + // Implement this structure to handle events when window rendering is disabled. + // The functions of this structure will be called on the UI thread. + TCefRenderHandler = record + // Base structure. + base: TCefBase; + + // Called to retrieve the root window rectangle in screen coordinates. Return + // true (1) if the rectangle was provided. + get_root_screen_rect: function(self: PCefRenderHandler; browser: PCefBrowser; + rect: PCefRect): Integer; cdecl; + + // Called to retrieve the view rectangle which is relative to screen + // coordinates. Return true (1) if the rectangle was provided. + get_view_rect: function(self: PCefRenderHandler; browser: PCefBrowser; + rect: PCefRect): Integer; cdecl; + + // Called to retrieve the translation from view coordinates to actual screen + // coordinates. Return true (1) if the screen coordinates were provided. + get_screen_point: function(self: PCefRenderHandler; browser: PCefBrowser; + viewX, viewY: Integer; screenX, screenY: PInteger): Integer; cdecl; + + // Called when the browser wants to show or hide the popup widget. The popup + // should be shown if |show| is true (1) and hidden if |show| is false (0). + on_popup_show: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; + show: Integer); cdecl; + + // Called when the browser wants to move or resize the popup widget. |rect| + // contains the new location and size. + on_popup_size: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; + const rect: PCefRect); cdecl; + + // Called when an element should be painted. |type| indicates whether the + // element is the view or the popup widget. |buffer| contains the pixel data + // for the whole image. |dirtyRects| contains the set of rectangles that need + // to be repainted. On Windows |buffer| will be |width|*|height|*4 bytes in + // size and represents a BGRA image with an upper-left origin. + on_paint: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; + kind: TCefPaintElementType; dirtyRectsCount: Cardinal; + const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); cdecl; + + // Called when the browser window's cursor has changed. + on_cursor_change: procedure(self: PCefRenderProcessHandler; browser: PCefBrowser; + cursor: TCefCursorHandle); cdecl; + end; + + // Implement this structure to receive geolocation updates. The functions of + // this structure will be called on the browser process UI thread. + TCefGetGeolocationCallback = record + // Base structure. + base: TCefBase; + + // Called with the 'best available' location information or, if the location + // update failed, with error information. + on_location_update: procedure(self: PCefGetGeolocationCallback; + const position: Pcefgeoposition); cdecl; + end; + + // Implement this structure to receive trace notifications. The functions of + // this structure will be called on the browser process UI thread. + + TCefTraceClient = record + // Base structure. + base: TCefBase; + + // Called 0 or more times between CefBeginTracing and OnEndTracingComplete + // with a UTF8 JSON |fragment| of the specified |fragment_size|. Do not keep a + // reference to |fragment|. + + on_trace_data_collected: procedure(self: PCefTraceClient; + const fragment: PAnsiChar; fragment_size: Cardinal); cdecl; + + // Called in response to CefGetTraceBufferPercentFullAsync. + on_trace_buffer_percent_full_reply: procedure(self: PCefTraceClient; percent_full: Single); cdecl; + + // Called after all processes have sent their trace data. + on_end_tracing_complete: procedure(self: PCefTraceClient); cdecl; + end; + +Implementation + +end. \ No newline at end of file