mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
Fixes in string handling and CEF types
- Modified Cefv8Accessor and Cefv8Interceptor helper function declarations. - Fixed and renamed ICefV8Interceptor parameters. - Fixed and renamed ICefV8Accessor parameters. - Modified ICefValue.SetBool parameter. - Fixed ICefMenuModelDelegate.FormatLabel "label" parameter. - Modified CefStringClearAndGet parameter. - Added CefStringInitialize function. - Fixed string handling in TCefRequestContextRef.SetPreference. - Fixed string handling in TCefCustomResourceBundleHandler.GetLocalizedString. - Fixed string handling in TCefResourceHandlerOwn.GetResponseHeaders. - Fixed string handling in TCefResourceRequestHandlerOwn.OnResourceRedirect. - Fixed string handling in TCefStringMapOwn. - Fixed string handling in TCefStringMultimapOwn. - Fixed and renamed ICefv8Handler.Execute parameters. - Adapted JSWindowBindingWithObject demo to new Cefv8Accessor declaration.
This commit is contained in:
parent
e5c2d4cc99
commit
c455886d29
@ -50,7 +50,8 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl, uCEFSentinel;
|
||||
uCEFConstants, uCEFv8Value, uCEFWinControl, uCEFSentinel,
|
||||
uCEFChromiumCore;
|
||||
|
||||
const
|
||||
JSDEMO_CONTEXTMENU_EXECFUNCTION = MENU_ID_USER_FIRST + 1;
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
uCEFWinControl, uCEFSentinel, uCEFChromiumCore;
|
||||
|
||||
const
|
||||
MINIBROWSER_SHOWTEXTVIEWER = WM_APP + $100;
|
||||
|
@ -53,7 +53,7 @@ uses
|
||||
type
|
||||
TTestExtensionHandler = class(TCefv8HandlerOwn)
|
||||
protected
|
||||
function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Execute(const name: ustring; const object_: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -62,7 +62,7 @@ uses
|
||||
uCEFMiscFunctions, uCEFConstants, uJSExtension;
|
||||
|
||||
function TTestExtensionHandler.Execute(const name : ustring;
|
||||
const obj : ICefv8Value;
|
||||
const object_ : ICefv8Value;
|
||||
const arguments : TCefv8ValueArray;
|
||||
var retval : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
uCEFWinControl, uCEFSentinel, uCEFChromiumCore;
|
||||
|
||||
type
|
||||
TJSExtensionWithFunctionFrm = class(TForm)
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
uCEFWinControl, uCEFSentinel, uCEFChromiumCore;
|
||||
|
||||
type
|
||||
TJSWindowBindingWithObjectFrm = class(TForm)
|
||||
|
@ -49,15 +49,15 @@ type
|
||||
protected
|
||||
FMyVal : ustring;
|
||||
|
||||
function Get(const name: ustring; const obj: ICefv8Value; out retval : ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Get(const name: ustring; const object_: ICefv8Value; var retval : ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
function TMyV8Accessor.Get(const name : ustring;
|
||||
const obj : ICefv8Value;
|
||||
out retval : ICefv8Value;
|
||||
const object_ : ICefv8Value;
|
||||
var retval : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
begin
|
||||
if (name = 'myval') then
|
||||
@ -69,10 +69,10 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TMyV8Accessor.Put(const name : ustring;
|
||||
const obj : ICefv8Value;
|
||||
const value : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
function TMyV8Accessor.Set_(const name : ustring;
|
||||
const object_ : ICefv8Value;
|
||||
const value : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
begin
|
||||
if (name = 'myval') then
|
||||
begin
|
||||
|
@ -51,7 +51,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, AppEvnts, ActiveX, ShlObj,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
|
||||
uCEFWinControl, uCEFSentinel;
|
||||
uCEFWinControl, uCEFSentinel, uCEFChromiumCore;
|
||||
|
||||
const
|
||||
MINIBROWSER_SHOWDEVTOOLS = WM_APP + $101;
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uChildForm,
|
||||
Vcl.AppEvnts, uCEFWinControl, uCEFSentinel;
|
||||
Vcl.AppEvnts, uCEFWinControl, uCEFSentinel, uCEFChromiumCore;
|
||||
|
||||
const
|
||||
CEF_CREATENEXTCHILD = WM_APP + $A50;
|
||||
|
@ -51,7 +51,7 @@ uses
|
||||
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel,
|
||||
uCEFSentinel;
|
||||
uCEFSentinel, uCEFChromiumCore;
|
||||
|
||||
const
|
||||
// Set this constant to True and load "file://transparency.html" to test a
|
||||
|
@ -51,7 +51,7 @@ uses
|
||||
Controls, Forms, Dialogs, ExtCtrls,
|
||||
{$ENDIF}
|
||||
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uMainForm,
|
||||
uCEFWinControl;
|
||||
uCEFWinControl, uCEFChromiumCore;
|
||||
|
||||
type
|
||||
TChildForm = class(TForm)
|
||||
|
@ -20,9 +20,8 @@
|
||||
<ComponentName Value="JSWindowBindingWithObjectFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<TopLine Value="102"/>
|
||||
<TopLine Value="120"/>
|
||||
<CursorPos X="82" Y="126"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
@ -32,8 +31,12 @@
|
||||
<Unit2>
|
||||
<Filename Value="uMyV8Accessor.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<EditorIndex Value="2"/>
|
||||
<TopLine Value="34"/>
|
||||
<CursorPos X="5" Y="90"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
<DefaultSyntaxHighlighter Value="Delphi"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
|
@ -51,15 +51,15 @@ type
|
||||
protected
|
||||
FMyVal : ustring;
|
||||
|
||||
function Get(const name: ustring; const obj: ICefv8Value; out retval : ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Get(const name: ustring; const object_: ICefv8Value; var retval : ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
function TMyV8Accessor.Get(const name : ustring;
|
||||
const obj : ICefv8Value;
|
||||
out retval : ICefv8Value;
|
||||
const object_ : ICefv8Value;
|
||||
var retval : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
begin
|
||||
if (name = 'myval') then
|
||||
@ -71,10 +71,10 @@ begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TMyV8Accessor.Put(const name : ustring;
|
||||
const obj : ICefv8Value;
|
||||
const value : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
function TMyV8Accessor.Set_(const name : ustring;
|
||||
const object_ : ICefv8Value;
|
||||
const value : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
begin
|
||||
if (name = 'myval') then
|
||||
begin
|
||||
|
@ -3086,12 +3086,7 @@ begin
|
||||
aBrowser.Host.RequestContext.CanSetPreference(aName) then
|
||||
begin
|
||||
TempValue := TCefValueRef.New;
|
||||
|
||||
if aValue then
|
||||
TempValue.SetBool(1)
|
||||
else
|
||||
TempValue.SetBool(0);
|
||||
|
||||
TempValue.SetBool(aValue);
|
||||
Result := aBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
|
||||
|
||||
if not(Result) then
|
||||
|
@ -192,10 +192,10 @@ begin
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefDisplayHandlerOwn) then
|
||||
begin
|
||||
TempText := CefStringClearAndGet(text^);
|
||||
TempText := CefStringClearAndGet(text);
|
||||
Result := Ord(TCefDisplayHandlerOwn(TempObject).OnTooltip(TCefBrowserRef.UnWrap(browser),
|
||||
TempText));
|
||||
text^ := CefStringAlloc(TempText);
|
||||
if (text <> nil) then text^ := CefStringAlloc(TempText);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -191,12 +191,12 @@ type
|
||||
TCefv8ArrayBufferReleaseCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(buffer : Pointer);
|
||||
TCefWebPluginInfoVisitorProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const info: ICefWebPluginInfo; count, total: Integer): Boolean;
|
||||
TCefWebPluginIsUnstableProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const path: ustring; unstable: Boolean);
|
||||
TCefV8AccessorGetterProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const obj: ICefv8Value; out value: ICefv8Value; const exception: ustring): Boolean;
|
||||
TCefV8AccessorSetterProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const obj, value: ICefv8Value; const exception: ustring): Boolean;
|
||||
TCefV8InterceptorGetterByNameProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const obj: ICefv8Value; out value: ICefv8Value; const exception: ustring): Boolean;
|
||||
TCefV8InterceptorSetterByNameProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const obj, value: ICefv8Value; const exception: ustring): Boolean;
|
||||
TCefV8InterceptorGetterByIndexProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(index: integer; const obj: ICefv8Value; out value: ICefv8Value; const exception: ustring): Boolean;
|
||||
TCefV8InterceptorSetterByIndexProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(index: integer; const obj, value: ICefv8Value; const exception: ustring): Boolean;
|
||||
TCefV8AccessorGetterProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const object_: ICefv8Value; var value: ICefv8Value; var exception: ustring): Boolean;
|
||||
TCefV8AccessorSetterProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
TCefV8InterceptorGetterByNameProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const object_: ICefv8Value; var value: ICefv8Value; var exception: ustring): Boolean;
|
||||
TCefV8InterceptorSetterByNameProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
TCefV8InterceptorGetterByIndexProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(index: integer; const object_: ICefv8Value; var value: ICefv8Value; var exception: ustring): Boolean;
|
||||
TCefV8InterceptorSetterByIndexProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(index: integer; const object_, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
TOnPdfPrintFinishedProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const path: ustring; ok: Boolean);
|
||||
TCefDomVisitorProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const document: ICefDomDocument);
|
||||
TCefDomVisitorProc2 = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser : ICefBrowser; const frame: ICefFrame; const document: ICefDomDocument);
|
||||
@ -906,25 +906,25 @@ type
|
||||
// /include/capi/cef_v8_capi.h (cef_v8handler_t)
|
||||
ICefv8Handler = interface(ICefBaseRefCounted)
|
||||
['{F94CDC60-FDCB-422D-96D5-D2A775BD5D73}']
|
||||
function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
function Execute(const name: ustring; const object_: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
end;
|
||||
|
||||
// TCefV8Interceptor
|
||||
// /include/capi/cef_v8_capi.h (cef_v8interceptor_t)
|
||||
ICefV8Interceptor = interface(ICefBaseRefCounted)
|
||||
['{B3B8FD7C-A916-4B25-93A2-2892AC324F21}']
|
||||
function GetByName(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean;
|
||||
function GetByIndex(index: integer; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean;
|
||||
function SetByName(const name: ustring; const obj, value: ICefv8Value; const exception: ustring): boolean;
|
||||
function SetByIndex(index: integer; const obj, value: ICefv8Value; const exception: ustring): boolean;
|
||||
function GetByName(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean;
|
||||
function GetByIndex(index: integer; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean;
|
||||
function SetByName(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): boolean;
|
||||
function SetByIndex(index: integer; const object_, value: ICefv8Value; var exception: ustring): boolean;
|
||||
end;
|
||||
|
||||
// TCefV8Accessor
|
||||
// /include/capi/cef_v8_capi.h (cef_v8accessor_t)
|
||||
ICefV8Accessor = interface(ICefBaseRefCounted)
|
||||
['{DCA6D4A2-726A-4E24-AA64-5E8C731D868A}']
|
||||
function Get(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
function Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
function Get(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
end;
|
||||
|
||||
// TCefTask
|
||||
@ -1505,7 +1505,7 @@ type
|
||||
function GetDictionary: ICefDictionaryValue;
|
||||
function GetList: ICefListValue;
|
||||
function SetNull: Boolean;
|
||||
function SetBool(value: Integer): Boolean;
|
||||
function SetBool(value: boolean): Boolean;
|
||||
function SetInt(value: Integer): Boolean;
|
||||
function SetDouble(value: Double): Boolean;
|
||||
function SetString(const value: ustring): Boolean;
|
||||
@ -2213,7 +2213,7 @@ type
|
||||
procedure UnhandledCloseSubmenu(const menuModel: ICefMenuModel; isRTL: boolean);
|
||||
procedure MenuWillShow(const menuModel: ICefMenuModel);
|
||||
procedure MenuClosed(const menuModel: ICefMenuModel);
|
||||
function FormatLabel(const menuModel: ICefMenuModel; const label_ : ustring) : boolean;
|
||||
function FormatLabel(const menuModel: ICefMenuModel; var label_ : ustring) : boolean;
|
||||
end;
|
||||
|
||||
// TCefServer
|
||||
|
@ -257,7 +257,7 @@ var
|
||||
// /include/internal/cef_logging_internal.h
|
||||
cef_get_min_log_level : function : Integer; cdecl;
|
||||
cef_get_vlog_level : function(const file_start: PAnsiChar; N: NativeInt): Integer; cdecl;
|
||||
cef_log : procedure(const file_: PAnsiChar; line, severity: Integer; const message: PAnsiChar); cdecl;
|
||||
cef_log : procedure(const file_: PAnsiChar; line, severity: Integer; const message_: PAnsiChar); cdecl;
|
||||
|
||||
// /include/internal/cef_string_list.h
|
||||
cef_string_list_alloc : function : TCefStringList; cdecl;
|
||||
@ -271,9 +271,9 @@ var
|
||||
// /include/internal/cef_string_map.h
|
||||
cef_string_map_alloc : function : TCefStringMap; cdecl;
|
||||
cef_string_map_size : function(map: TCefStringMap): NativeUInt; cdecl;
|
||||
cef_string_map_find : function(map: TCefStringMap; const key: PCefString; var value: TCefString): Integer; cdecl;
|
||||
cef_string_map_key : function(map: TCefStringMap; index: NativeUInt; var key: TCefString): Integer; cdecl;
|
||||
cef_string_map_value : function(map: TCefStringMap; index: NativeUInt; var value: TCefString): Integer; cdecl;
|
||||
cef_string_map_find : function(map: TCefStringMap; const key: PCefString; value: PCefString): Integer; cdecl;
|
||||
cef_string_map_key : function(map: TCefStringMap; index: NativeUInt; key: PCefString): Integer; cdecl;
|
||||
cef_string_map_value : function(map: TCefStringMap; index: NativeUInt; value: PCefString): Integer; cdecl;
|
||||
cef_string_map_append : function(map: TCefStringMap; const key, value: PCefString): Integer; cdecl;
|
||||
cef_string_map_clear : procedure(map: TCefStringMap); cdecl;
|
||||
cef_string_map_free : procedure(map: TCefStringMap); cdecl;
|
||||
@ -282,9 +282,9 @@ var
|
||||
cef_string_multimap_alloc : function : TCefStringMultimap; cdecl;
|
||||
cef_string_multimap_size : function(map: TCefStringMultimap): NativeUInt; cdecl;
|
||||
cef_string_multimap_find_count : function(map: TCefStringMultimap; const key: PCefString): NativeUInt; cdecl;
|
||||
cef_string_multimap_enumerate : function(map: TCefStringMultimap; const key: PCefString; value_index: NativeUInt; var value: TCefString): Integer; cdecl;
|
||||
cef_string_multimap_key : function(map: TCefStringMultimap; index: NativeUInt; var key: TCefString): Integer; cdecl;
|
||||
cef_string_multimap_value : function(map: TCefStringMultimap; index: NativeUInt; var value: TCefString): Integer; cdecl;
|
||||
cef_string_multimap_enumerate : function(map: TCefStringMultimap; const key: PCefString; value_index: NativeUInt; value: PCefString): Integer; cdecl;
|
||||
cef_string_multimap_key : function(map: TCefStringMultimap; index: NativeUInt; key: PCefString): Integer; cdecl;
|
||||
cef_string_multimap_value : function(map: TCefStringMultimap; index: NativeUInt; value: PCefString): Integer; cdecl;
|
||||
cef_string_multimap_append : function(map: TCefStringMultimap; const key, value: PCefString): Integer; cdecl;
|
||||
cef_string_multimap_clear : procedure(map: TCefStringMultimap); cdecl;
|
||||
cef_string_multimap_free : procedure(map: TCefStringMultimap); cdecl;
|
||||
|
@ -60,7 +60,7 @@ type
|
||||
procedure UnhandledCloseSubmenu(const menuModel: ICefMenuModel; isRTL: boolean); virtual;
|
||||
procedure MenuWillShow(const menuModel: ICefMenuModel); virtual;
|
||||
procedure MenuClosed(const menuModel: ICefMenuModel); virtual;
|
||||
function FormatLabel(const menuModel: ICefMenuModel; const label_ : uString) : boolean; virtual;
|
||||
function FormatLabel(const menuModel: ICefMenuModel; var label_ : ustring) : boolean; virtual;
|
||||
public
|
||||
constructor Create; virtual;
|
||||
end;
|
||||
@ -150,13 +150,17 @@ function cef_menu_model_delegate_format_label(self : PCefMenuModelDelegate
|
||||
label_ : PCefString) : integer; stdcall;
|
||||
var
|
||||
TempObject : TObject;
|
||||
TempLabel : ustring;
|
||||
begin
|
||||
Result := Ord(False);
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefMenuModelDelegateOwn) then
|
||||
Result := Ord(TCefMenuModelDelegateOwn(TempObject).FormatLabel(TCefMenuModelRef.UnWrap(menu_model),
|
||||
CefString(label_)));
|
||||
begin
|
||||
TempLabel := CefStringClearAndGet(label_);
|
||||
Result := Ord(TCefMenuModelDelegateOwn(TempObject).FormatLabel(TCefMenuModelRef.UnWrap(menu_model), TempLabel));
|
||||
if (label_ <> nil) then label_^ := CefStringAlloc(TempLabel);
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TCefMenuModelDelegateOwn.Create;
|
||||
@ -207,7 +211,7 @@ begin
|
||||
//
|
||||
end;
|
||||
|
||||
function TCefMenuModelDelegateOwn.FormatLabel(const menuModel: ICefMenuModel; const label_ : uString) : boolean;
|
||||
function TCefMenuModelDelegateOwn.FormatLabel(const menuModel: ICefMenuModel; var label_ : ustring) : boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
@ -78,7 +78,7 @@ function CefGetObject(ptr: Pointer): TObject; {$IFDEF SUPPORTS_INLINE} inline;
|
||||
function CefGetData(const i: ICefBaseRefCounted): Pointer; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}
|
||||
|
||||
function CefStringAlloc(const str: ustring): TCefString;
|
||||
function CefStringClearAndGet(var str: TCefString): ustring;
|
||||
function CefStringClearAndGet(str: PCefString): ustring;
|
||||
|
||||
function CefString(const str: ustring): TCefString; overload;
|
||||
function CefString(const str: PCefString): ustring; overload;
|
||||
@ -86,6 +86,7 @@ function CefUserFreeString(const str: ustring): PCefStringUserFree;
|
||||
procedure CefStringFree(const str: PCefString);
|
||||
function CefStringFreeAndGet(const str: PCefStringUserFree): ustring;
|
||||
procedure CefStringSet(const str: PCefString; const value: ustring);
|
||||
procedure CefStringInitialize(const aCefString : PCefString); {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}
|
||||
|
||||
function CefRegisterExtension(const name, code: ustring; const Handler: ICefv8Handler): Boolean;
|
||||
|
||||
@ -204,6 +205,8 @@ function CefBase64Decode(const data: ustring): ICefBinaryValue;
|
||||
function CefUriEncode(const text: ustring; usePlus: Boolean): ustring;
|
||||
function CefUriDecode(const text: ustring; convertToUtf8: Boolean; unescapeRule: TCefUriUnescapeRule): ustring;
|
||||
|
||||
function CefGetPath(const aPathKey : TCefPathKey) : ustring;
|
||||
|
||||
function CefParseJson(const jsonString: ustring; options: TCefJsonParserOptions): ICefValue;
|
||||
function CefParseJsonAndReturnError(const jsonString : ustring;
|
||||
options : TCefJsonParserOptions;
|
||||
@ -293,12 +296,12 @@ begin
|
||||
Result := (int64_val shr 32) and $FFFFFFFF;
|
||||
end;
|
||||
|
||||
function CefStringClearAndGet(var str: TCefString): ustring;
|
||||
function CefStringClearAndGet(str: PCefString): ustring;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
if (str <> nil) and (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
begin
|
||||
Result := CefString(@str);
|
||||
cef_string_utf16_clear(@str);
|
||||
Result := CefString(str);
|
||||
cef_string_utf16_clear(str);
|
||||
end
|
||||
else
|
||||
Result := '';
|
||||
@ -347,7 +350,17 @@ end;
|
||||
procedure CefStringSet(const str: PCefString; const value: ustring);
|
||||
begin
|
||||
if (str <> nil) and (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
cef_string_utf16_set(PWideChar(value), Length(value), str, 1);
|
||||
cef_string_utf16_set(PWideChar(value), Length(value), str, Ord(True));
|
||||
end;
|
||||
|
||||
procedure CefStringInitialize(const aCefString : PCefString); {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}
|
||||
begin
|
||||
if (aCefString <> nil) then
|
||||
begin
|
||||
aCefString^.str := nil;
|
||||
aCefString^.length := 0;
|
||||
aCefString^.dtor := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function CefStringFreeAndGet(const str: PCefStringUserFree): ustring;
|
||||
@ -363,7 +376,8 @@ end;
|
||||
|
||||
function CefStringAlloc(const str: ustring): TCefString;
|
||||
begin
|
||||
FillChar(Result, SizeOf(Result), 0);
|
||||
CefStringInitialize(@Result);
|
||||
|
||||
if (str <> '') and (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
cef_string_wide_to_utf16(PWideChar(str), Length(str), @Result);
|
||||
end;
|
||||
@ -1572,7 +1586,6 @@ begin
|
||||
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
begin
|
||||
FillChar(TempParts, sizeof(TempParts), 0);
|
||||
TempParts.spec := CefString(parts.spec);
|
||||
TempParts.scheme := CefString(parts.scheme);
|
||||
TempParts.username := CefString(parts.username);
|
||||
@ -1583,8 +1596,10 @@ begin
|
||||
TempParts.path := CefString(parts.path);
|
||||
TempParts.query := CefString(parts.query);
|
||||
|
||||
FillChar(TempURL, SizeOf(TempURL), 0);
|
||||
if cef_create_url(@TempParts, @TempURL) <> 0 then Result := CefString(@TempURL);
|
||||
CefStringInitialize(@TempURL);
|
||||
|
||||
if (cef_create_url(@TempParts, @TempURL) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempURL);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1692,10 +1707,10 @@ var
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
begin
|
||||
FillChar(TempError, SizeOf(TempError), 0);
|
||||
CefStringInitialize(@TempError);
|
||||
TempJSON := CefString(jsonString);
|
||||
Result := TCefValueRef.UnWrap(cef_parse_jsonand_return_error(@TempJSON, options, @errorCodeOut, @TempError));
|
||||
errorMsgOut := CefString(@TempError);
|
||||
errorMsgOut := CefStringClearAndGet(@TempError);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1705,6 +1720,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function CefGetPath(const aPathKey : TCefPathKey) : ustring;
|
||||
var
|
||||
TempPath : TCefString;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
begin
|
||||
CefStringInitialize(@TempPath);
|
||||
|
||||
if (cef_get_path(aPathKey, @TempPath) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempPath);
|
||||
end
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function CefWriteJson(const node: ICefValue; options: TCefJsonWriterOptions): ustring;
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
@ -1732,9 +1762,9 @@ var
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
begin
|
||||
FillChar(TempPath, SizeOf(TempPath), 0);
|
||||
CefStringInitialize(@TempPath);
|
||||
Result := cef_get_temp_directory(@TempPath) <> 0;
|
||||
tempDir := CefString(@TempPath);
|
||||
tempDir := CefStringClearAndGet(@TempPath);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1749,10 +1779,10 @@ var
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
begin
|
||||
FillChar(TempPath, SizeOf(TempPath), 0);
|
||||
CefStringInitialize(@TempPath);
|
||||
TempPref := CefString(prefix);
|
||||
Result := cef_create_new_temp_directory(@TempPref, @TempPath) <> 0;
|
||||
newTempPath := CefString(@TempPath);
|
||||
newTempPath := CefStringClearAndGet(@TempPath);
|
||||
end
|
||||
else
|
||||
begin
|
||||
@ -1767,11 +1797,11 @@ var
|
||||
begin
|
||||
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
|
||||
begin
|
||||
FillChar(TempPath, SizeOf(TempPath), 0);
|
||||
CefStringInitialize(@TempPath);
|
||||
TempPref := CefString(prefix);
|
||||
TempBase := CefString(baseDir);
|
||||
Result := cef_create_temp_directory_in_directory(@TempBase, @TempPref, @TempPath) <> 0;
|
||||
newDir := CefString(@TempPath);
|
||||
newDir := CefStringClearAndGet(@TempPath);
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
@ -275,9 +275,10 @@ begin
|
||||
FReadOnly := readonly;
|
||||
FDataType := PDE_TYPE_EMPTY;
|
||||
FValueByte := nil;
|
||||
FillChar(FValueStr, SizeOf(FValueStr), 0);
|
||||
FSize := 0;
|
||||
|
||||
CefStringInitialize(@FValueStr);
|
||||
|
||||
with PCefPostDataElement(FData)^ do
|
||||
begin
|
||||
is_read_only := {$IFDEF FPC}@{$ENDIF}cef_post_data_element_is_read_only;
|
||||
|
@ -134,8 +134,15 @@ begin
|
||||
end;
|
||||
|
||||
function TCefRequestContextRef.GetHandler: ICefRequestContextHandler;
|
||||
var
|
||||
TempHandler : PCefRequestContextHandler;
|
||||
begin
|
||||
Result := TCefRequestContextHandlerRef.UnWrap(PCefRequestContext(FData)^.get_handler(PCefRequestContext(FData)));
|
||||
TempHandler := PCefRequestContext(FData)^.get_handler(PCefRequestContext(FData));
|
||||
|
||||
if (TempHandler <> nil) then
|
||||
Result := TCefRequestContextHandlerRef.UnWrap(TempHandler)
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
class function TCefRequestContextRef.Global: ICefRequestContext;
|
||||
@ -223,10 +230,11 @@ function TCefRequestContextRef.SetPreference(const name : ustring;
|
||||
var
|
||||
TempName, TempError : TCefString;
|
||||
begin
|
||||
CefStringInitialize(@TempError);
|
||||
|
||||
TempName := CefString(name);
|
||||
FillChar(TempError, SizeOf(TempError), 0);
|
||||
Result := PCefRequestContext(FData)^.set_preference(PCefRequestContext(FData), @TempName, CefGetData(value), @TempError) <> 0;
|
||||
error := CefString(@TempError);
|
||||
error := CefStringClearAndGet(@TempError);
|
||||
end;
|
||||
|
||||
procedure TCefRequestContextRef.ClearCertificateExceptions(const callback: ICefCompletionCallback);
|
||||
|
@ -94,7 +94,7 @@ implementation
|
||||
|
||||
uses
|
||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser, uCEFFrame, uCEFRequest,
|
||||
uCEFCookieManager, uCEFWebPluginInfo, uCEFRequestContext, uCEFResourceRequestHandler;
|
||||
uCEFWebPluginInfo, uCEFRequestContext, uCEFResourceRequestHandler;
|
||||
|
||||
// TCefRequestContextHandlerOwn
|
||||
|
||||
|
@ -100,7 +100,11 @@ begin
|
||||
TempString := '';
|
||||
Result := Ord(TCefResourceBundleHandlerOwn(TempObject).GetLocalizedString(string_id, TempString));
|
||||
|
||||
if (Result <> 0) then string_val^ := CefString(TempString);
|
||||
if (string_val <> nil) then
|
||||
begin
|
||||
CefStringFree(string_val);
|
||||
string_val^ := CefStringAlloc(TempString);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -137,11 +137,13 @@ begin
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefResourceHandlerOwn) then
|
||||
TCefResourceHandlerOwn(TempObject).GetResponseHeaders(TCefResponseRef.UnWrap(response),
|
||||
response_length^,
|
||||
TempRedirect);
|
||||
|
||||
if (TempRedirect <> '') then CefStringSet(redirectUrl, TempRedirect);
|
||||
begin
|
||||
TCefResourceHandlerOwn(TempObject).GetResponseHeaders(TCefResponseRef.UnWrap(response),
|
||||
response_length^,
|
||||
TempRedirect);
|
||||
CefStringFree(redirectUrl);
|
||||
if (redirectUrl <> nil) then redirectUrl^ := CefStringAlloc(TempRedirect);
|
||||
end;
|
||||
end;
|
||||
|
||||
function cef_resource_handler_skip(self : PCefResourceHandler;
|
||||
|
@ -197,17 +197,18 @@ var
|
||||
TempURL : ustring;
|
||||
TempObject : TObject;
|
||||
begin
|
||||
TempURL := CefString(new_url);
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefResourceRequestHandlerOwn) then
|
||||
TCefResourceRequestHandlerOwn(TempObject).OnResourceRedirect(TCefBrowserRef.UnWrap(browser),
|
||||
TCefFrameRef.UnWrap(frame),
|
||||
TCefRequestRef.UnWrap(request),
|
||||
TCefResponseRef.UnWrap(response),
|
||||
TempURL);
|
||||
|
||||
if (TempURL <> '') then CefStringSet(new_url, TempURL);
|
||||
begin
|
||||
TempURL := CefStringClearAndGet(new_url);
|
||||
TCefResourceRequestHandlerOwn(TempObject).OnResourceRedirect(TCefBrowserRef.UnWrap(browser),
|
||||
TCefFrameRef.UnWrap(frame),
|
||||
TCefRequestRef.UnWrap(request),
|
||||
TCefResponseRef.UnWrap(response),
|
||||
TempURL);
|
||||
if (new_url <> nil) then new_url^ := CefStringAlloc(TempURL);
|
||||
end;
|
||||
end;
|
||||
|
||||
function cef_resource_request_handler_on_resource_response(self : PCefResourceRequestHandler;
|
||||
|
@ -148,17 +148,17 @@ begin
|
||||
|
||||
if (FHandle <> nil) then
|
||||
begin
|
||||
FillChar(TempValue, SizeOf(TempValue), 0);
|
||||
CefStringInitialize(@TempValue);
|
||||
|
||||
if (cef_string_list_value(FHandle, index, @TempValue) <> 0) then
|
||||
Result := CefString(@TempValue);
|
||||
Result := CefStringClearAndGet(@TempValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCefCustomStringList.CopyToStrings(const aStrings : TStrings);
|
||||
var
|
||||
i, j : NativeUInt;
|
||||
TempString : TCefString;
|
||||
TempValue : TCefString;
|
||||
begin
|
||||
if (aStrings <> nil) and (FHandle <> nil) then
|
||||
begin
|
||||
@ -167,10 +167,10 @@ begin
|
||||
|
||||
while (i < j) do
|
||||
begin
|
||||
FillChar(TempString, SizeOf(TCefString), 0);
|
||||
CefStringInitialize(@TempValue);
|
||||
|
||||
if (cef_string_list_value(FHandle, i, @TempString) <> 0) then
|
||||
aStrings.Add(CefStringClearAndGet(TempString));
|
||||
if (cef_string_list_value(FHandle, i, @TempValue) <> 0) then
|
||||
aStrings.Add(CefStringClearAndGet(@TempValue));
|
||||
|
||||
inc(i);
|
||||
end;
|
||||
|
@ -124,11 +124,12 @@ begin
|
||||
|
||||
if (FHandle <> nil) then
|
||||
begin
|
||||
FillChar(TempValue, SizeOf(TempValue), 0);
|
||||
CefStringInitialize(@TempValue);
|
||||
|
||||
TempKey := CefString(key);
|
||||
|
||||
if (cef_string_map_find(FHandle, @TempKey, TempValue) <> 0) then
|
||||
Result := CefString(@TempValue);
|
||||
if (cef_string_map_find(FHandle, @TempKey, @TempValue) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -145,10 +146,10 @@ begin
|
||||
|
||||
if (FHandle <> nil) then
|
||||
begin
|
||||
FillChar(TempKey, SizeOf(TempKey), 0);
|
||||
CefStringInitialize(@TempKey);
|
||||
|
||||
if (cef_string_map_key(FHandle, index, TempKey) <> 0) then
|
||||
Result := CefString(@TempKey);
|
||||
if (cef_string_map_key(FHandle, index, @TempKey) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempKey);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -168,10 +169,10 @@ begin
|
||||
|
||||
if (FHandle <> nil) then
|
||||
begin
|
||||
FillChar(TempValue, SizeOf(TempValue), 0);
|
||||
CefStringInitialize(@TempValue);
|
||||
|
||||
if (cef_string_map_value(FHandle, index, TempValue) <> 0) then
|
||||
Result := CefString(@TempValue);
|
||||
if (cef_string_map_value(FHandle, index, @TempValue) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -138,11 +138,12 @@ begin
|
||||
|
||||
if (FHandle <> nil) then
|
||||
begin
|
||||
TempKey := CefString(Key);
|
||||
FillChar(TempValue, SizeOf(TempValue), 0);
|
||||
CefStringInitialize(@TempValue);
|
||||
|
||||
if (cef_string_multimap_enumerate(FHandle, @TempKey, ValueIndex, TempValue) <> 0) then
|
||||
Result := CefString(@TempValue);
|
||||
TempKey := CefString(Key);
|
||||
|
||||
if (cef_string_multimap_enumerate(FHandle, @TempKey, ValueIndex, @TempValue) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -159,10 +160,10 @@ begin
|
||||
|
||||
if (FHandle <> nil) then
|
||||
begin
|
||||
FillChar(TempKey, SizeOf(TempKey), 0);
|
||||
CefStringInitialize(@TempKey);
|
||||
|
||||
if (cef_string_multimap_key(FHandle, index, TempKey) <> 0) then
|
||||
Result := CefString(@TempKey);
|
||||
if (cef_string_multimap_key(FHandle, index, @TempKey) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempKey);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -182,10 +183,10 @@ begin
|
||||
|
||||
if (FHandle <> nil) then
|
||||
begin
|
||||
FillChar(TempValue, SizeOf(TempValue), 0);
|
||||
CefStringInitialize(@TempValue);
|
||||
|
||||
if (cef_string_multimap_value(FHandle, index, TempValue) <> 0) then
|
||||
Result := CefString(@TempValue);
|
||||
if (cef_string_multimap_value(FHandle, index, @TempValue) <> 0) then
|
||||
Result := CefStringClearAndGet(@TempValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -2452,7 +2452,7 @@ type
|
||||
// /include/capi/cef_v8_capi.h (cef_v8handler_t)
|
||||
TCefv8Handler = record
|
||||
base : TCefBaseRefCounted;
|
||||
execute : function(self: PCefv8Handler; const name: PCefString; obj: PCefv8Value; argumentsCount: NativeUInt; const arguments: PPCefV8Value; var retval: PCefV8Value; var exception: TCefString): Integer; stdcall;
|
||||
execute : function(self: PCefv8Handler; const name: PCefString; object_: PCefv8Value; argumentsCount: NativeUInt; const arguments: PPCefV8Value; var retval: PCefV8Value; exception: PCefString): Integer; stdcall;
|
||||
end;
|
||||
|
||||
// /include/capi/cef_v8_capi.h (cef_v8exception_t)
|
||||
@ -2543,17 +2543,17 @@ type
|
||||
// /include/capi/cef_v8_capi.h (cef_v8interceptor_t)
|
||||
TCefV8Interceptor = record
|
||||
base : TCefBaseRefCounted;
|
||||
get_byname : function(self: PCefV8Interceptor; const name: PCefString; obj: PCefV8Value; out retval: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
get_byindex : function(self: PCefV8Interceptor; index: integer; obj: PCefV8Value; out retval: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
set_byname : function(self: PCefV8Interceptor; const name: PCefString; obj, value: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
set_byindex : function(self: PCefV8Interceptor; index: integer; obj, value: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
get_byname : function(self: PCefV8Interceptor; const name: PCefString; object_: PCefV8Value; out retval: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
get_byindex : function(self: PCefV8Interceptor; index: integer; object_: PCefV8Value; out retval: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
set_byname : function(self: PCefV8Interceptor; const name: PCefString; object_, value: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
set_byindex : function(self: PCefV8Interceptor; index: integer; object_, value: PCefv8Value; exception: PCefString): integer; stdcall;
|
||||
end;
|
||||
|
||||
// /include/capi/cef_v8_capi.h (cef_v8accessor_t)
|
||||
TCefV8Accessor = record
|
||||
base : TCefBaseRefCounted;
|
||||
get : function(self: PCefV8Accessor; const name: PCefString; obj: PCefv8Value; out retval: PCefv8Value; exception: PCefString): Integer; stdcall;
|
||||
put : function(self: PCefV8Accessor; const name: PCefString; obj, value: PCefv8Value; exception: PCefString): Integer; stdcall;
|
||||
get : function(self: PCefV8Accessor; const name: PCefString; object_: PCefv8Value; out retval: PCefv8Value; exception: PCefString): Integer; stdcall;
|
||||
set_ : function(self: PCefV8Accessor; const name: PCefString; object_, value: PCefv8Value; exception: PCefString): Integer; stdcall;
|
||||
end;
|
||||
|
||||
// /include/capi/cef_frame_capi.h (cef_frame_t)
|
||||
|
@ -69,7 +69,7 @@ type
|
||||
function GetDictionary: ICefDictionaryValue;
|
||||
function GetList: ICefListValue;
|
||||
function SetNull: Boolean;
|
||||
function SetBool(value: Integer): Boolean;
|
||||
function SetBool(value: boolean): Boolean;
|
||||
function SetInt(value: Integer): Boolean;
|
||||
function SetDouble(value: Double): Boolean;
|
||||
function SetString(const value: ustring): Boolean;
|
||||
@ -167,9 +167,9 @@ begin
|
||||
Result := PCefValue(FData)^.set_binary(PCefValue(FData), CefGetData(value)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefValueRef.SetBool(value: Integer): Boolean;
|
||||
function TCefValueRef.SetBool(value: boolean): Boolean;
|
||||
begin
|
||||
Result := PCefValue(FData)^.set_bool(PCefValue(FData), value) <> 0;
|
||||
Result := PCefValue(FData)^.set_bool(PCefValue(FData), ord(value)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefValueRef.SetDictionary(const value: ICefDictionaryValue): Boolean;
|
||||
|
@ -54,8 +54,8 @@ uses
|
||||
type
|
||||
TCefV8AccessorOwn = class(TCefBaseRefCountedOwn, ICefV8Accessor)
|
||||
protected
|
||||
function Get(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; var exception: ustring): Boolean; virtual;
|
||||
function Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean; virtual;
|
||||
function Get(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): Boolean; virtual;
|
||||
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean; virtual;
|
||||
|
||||
public
|
||||
constructor Create; virtual;
|
||||
@ -66,8 +66,8 @@ type
|
||||
FGetter: TCefV8AccessorGetterProc;
|
||||
FSetter: TCefV8AccessorSetterProc;
|
||||
|
||||
function Get(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Get(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
|
||||
public
|
||||
constructor Create(const getter: TCefV8AccessorGetterProc; const setter: TCefV8AccessorSetterProc); reintroduce;
|
||||
@ -80,48 +80,76 @@ uses
|
||||
|
||||
function cef_v8_accessor_get( self : PCefV8Accessor;
|
||||
const name : PCefString;
|
||||
obj : PCefv8Value;
|
||||
object_ : PCefv8Value;
|
||||
out retval : PCefv8Value;
|
||||
exception : PCefString): Integer; stdcall;
|
||||
var
|
||||
ret : ICefv8Value;
|
||||
TempExcept : ustring;
|
||||
TempObject : TObject;
|
||||
TempObject : TObject;
|
||||
TempException : ustring;
|
||||
TempReturnValue : ICefv8Value;
|
||||
TempRecObject : ICefv8Value;
|
||||
begin
|
||||
Result := Ord(False);
|
||||
TempExcept := CefString(exception);
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefV8AccessorOwn) then
|
||||
Result := Ord(TCefV8AccessorOwn(TempObject).Get(CefString(name),
|
||||
TCefv8ValueRef.UnWrap(obj),
|
||||
ret,
|
||||
TempExcept));
|
||||
try
|
||||
TempRecObject := TCefv8ValueRef.UnWrap(object_);
|
||||
TempException := '';
|
||||
TempReturnValue := nil;
|
||||
|
||||
retval := CefGetData(ret);
|
||||
exception^ := CefString(TempExcept);
|
||||
Result := Ord(TCefV8AccessorOwn(TempObject).Get(CefString(name),
|
||||
TempRecObject,
|
||||
TempReturnValue,
|
||||
TempException));
|
||||
|
||||
retval := CefGetData(TempReturnValue);
|
||||
|
||||
if (exception <> nil) then
|
||||
begin
|
||||
CefStringFree(exception);
|
||||
exception^ := CefStringAlloc(TempException);
|
||||
end;
|
||||
finally
|
||||
TempRecObject := nil;
|
||||
TempReturnValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function cef_v8_accessor_put( self : PCefV8Accessor;
|
||||
function cef_v8_accessor_set( self : PCefV8Accessor;
|
||||
const name : PCefString;
|
||||
obj : PCefv8Value;
|
||||
object_ : PCefv8Value;
|
||||
value : PCefv8Value;
|
||||
exception : PCefString): Integer; stdcall;
|
||||
var
|
||||
TempExcept : ustring;
|
||||
TempObject : TObject;
|
||||
TempObject : TObject;
|
||||
TempException : ustring;
|
||||
TempValue : ICefv8Value;
|
||||
TempRecObject : ICefv8Value;
|
||||
begin
|
||||
Result := Ord(False);
|
||||
TempExcept := CefString(exception);
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefV8AccessorOwn) then
|
||||
Result := Ord(TCefV8AccessorOwn(TempObject).Put(CefString(name),
|
||||
TCefv8ValueRef.UnWrap(obj),
|
||||
TCefv8ValueRef.UnWrap(value),
|
||||
TempExcept));
|
||||
try
|
||||
TempRecObject := TCefv8ValueRef.UnWrap(object_);
|
||||
TempValue := TCefv8ValueRef.UnWrap(value);
|
||||
TempException := '';
|
||||
|
||||
exception^ := CefString(TempExcept);
|
||||
Result := Ord(TCefV8AccessorOwn(TempObject).Set_(CefString(name),
|
||||
TempRecObject,
|
||||
TempValue,
|
||||
TempException));
|
||||
|
||||
if (exception <> nil) then
|
||||
begin
|
||||
CefStringFree(exception);
|
||||
exception^ := CefStringAlloc(TempException);
|
||||
end;
|
||||
finally
|
||||
TempRecObject := nil;
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// TCefV8AccessorOwn
|
||||
@ -132,17 +160,17 @@ begin
|
||||
|
||||
with PCefV8Accessor(FData)^ do
|
||||
begin
|
||||
get := {$IFDEF FPC}@{$ENDIF}cef_v8_accessor_get;
|
||||
put := {$IFDEF FPC}@{$ENDIF}cef_v8_accessor_put;
|
||||
get := {$IFDEF FPC}@{$ENDIF}cef_v8_accessor_get;
|
||||
set_ := {$IFDEF FPC}@{$ENDIF}cef_v8_accessor_set;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCefV8AccessorOwn.Get(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
function TCefV8AccessorOwn.Get(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefV8AccessorOwn.Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
function TCefV8AccessorOwn.Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
@ -155,18 +183,18 @@ begin
|
||||
FSetter := setter;
|
||||
end;
|
||||
|
||||
function TCefFastV8Accessor.Get(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
function TCefFastV8Accessor.Get(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
begin
|
||||
if Assigned(FGetter) then
|
||||
Result := FGetter(name, obj, retval, exception)
|
||||
Result := FGetter(name, object_, retval, exception)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefFastV8Accessor.Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
function TCefFastV8Accessor.Set_(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): Boolean;
|
||||
begin
|
||||
if Assigned(FSetter) then
|
||||
Result := FSetter(name, obj, value, exception)
|
||||
Result := FSetter(name, object_, value, exception)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
@ -60,7 +60,7 @@ uses
|
||||
type
|
||||
TCefv8HandlerRef = class(TCefBaseRefCountedRef, ICefv8Handler)
|
||||
protected
|
||||
function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
function Execute(const name: ustring; const object_: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
|
||||
public
|
||||
class function UnWrap(data: Pointer): ICefv8Handler;
|
||||
@ -68,7 +68,7 @@ type
|
||||
|
||||
TCefv8HandlerOwn = class(TCefBaseRefCountedOwn, ICefv8Handler)
|
||||
protected
|
||||
function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; virtual;
|
||||
function Execute(const name: ustring; const object_: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; virtual;
|
||||
|
||||
public
|
||||
constructor Create; virtual;
|
||||
@ -87,7 +87,7 @@ type
|
||||
class function StrToPtr(const str: ustring): Pointer;
|
||||
class function PtrToStr(p: Pointer): ustring;
|
||||
{$ENDIF}
|
||||
function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
function Execute(const name: ustring; const object_: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override;
|
||||
|
||||
public
|
||||
constructor Create(const value: TValue; SyncMainThread: Boolean = False); reintroduce;
|
||||
@ -103,70 +103,97 @@ uses
|
||||
|
||||
function cef_v8_handler_execute( self : PCefv8Handler;
|
||||
const name : PCefString;
|
||||
obj : PCefv8Value;
|
||||
object_ : PCefv8Value;
|
||||
argumentsCount : NativeUInt;
|
||||
const arguments : PPCefV8Value;
|
||||
var retval : PCefV8Value;
|
||||
var exception : TCefString): Integer; stdcall;
|
||||
exception : PCefString): Integer; stdcall;
|
||||
var
|
||||
args : TCefv8ValueArray;
|
||||
i, j : NativeInt;
|
||||
ret : ICefv8Value;
|
||||
exc : ustring;
|
||||
TempObject : TObject;
|
||||
TempArgs : TCefv8ValueArray;
|
||||
i : NativeUInt;
|
||||
TempReturnValue : ICefv8Value;
|
||||
TempException : ustring;
|
||||
TempObject : TObject;
|
||||
TempRecObject : ICefv8Value;
|
||||
begin
|
||||
Result := -Ord(False);
|
||||
Result := Ord(False);
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefv8HandlerOwn) then
|
||||
begin
|
||||
i := 0;
|
||||
j := argumentsCount;
|
||||
try
|
||||
TempRecObject := TCefv8ValueRef.UnWrap(object_);
|
||||
TempReturnValue := nil;
|
||||
TempArgs := nil;
|
||||
TempException := '';
|
||||
|
||||
SetLength(args, j);
|
||||
|
||||
while (i < j) do
|
||||
if (arguments <> nil) and (argumentsCount > 0) then
|
||||
begin
|
||||
args[i] := TCefv8ValueRef.UnWrap(arguments^[i]);
|
||||
SetLength(TempArgs, argumentsCount);
|
||||
|
||||
i := 0;
|
||||
while (i < argumentsCount) do
|
||||
begin
|
||||
TempArgs[i] := TCefv8ValueRef.UnWrap(arguments^[i]);
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
Result := Ord(TCefv8HandlerOwn(TempObject).Execute(CefString(name),
|
||||
TempRecObject,
|
||||
TempArgs,
|
||||
TempReturnValue,
|
||||
TempException));
|
||||
|
||||
retval := CefGetData(TempReturnValue);
|
||||
|
||||
if (exception <> nil) then
|
||||
begin
|
||||
CefStringFree(exception);
|
||||
exception^ := CefStringAlloc(TempException);
|
||||
end;
|
||||
finally
|
||||
i := 0;
|
||||
while (i < argumentsCount) do
|
||||
begin
|
||||
TempArgs[i] := nil;
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
Result := -Ord(TCefv8HandlerOwn(TempObject).Execute(CefString(name), TCefv8ValueRef.UnWrap(obj), args, ret, exc));
|
||||
retval := CefGetData(ret);
|
||||
ret := nil;
|
||||
exception := CefString(exc);
|
||||
TempRecObject := nil;
|
||||
TempReturnValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCefv8HandlerRef.Execute(const name : ustring;
|
||||
const obj : ICefv8Value;
|
||||
const object_ : ICefv8Value;
|
||||
const arguments : TCefv8ValueArray;
|
||||
var retval : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
var
|
||||
args : array of PCefV8Value;
|
||||
i, j : Integer;
|
||||
ret : PCefV8Value;
|
||||
exc : TCefString;
|
||||
n : TCefString;
|
||||
TempArgs : array of PCefV8Value;
|
||||
TempLen, i : integer;
|
||||
TempReturnValue : PCefV8Value;
|
||||
TempException : TCefString;
|
||||
TempName : TCefString;
|
||||
begin
|
||||
i := 0;
|
||||
j := Length(arguments);
|
||||
i := 0;
|
||||
TempLen := Length(arguments);
|
||||
|
||||
SetLength(args, j);
|
||||
SetLength(TempArgs, TempLen);
|
||||
|
||||
while (i < j) do
|
||||
while (i < TempLen) do
|
||||
begin
|
||||
args[i] := CefGetData(arguments[i]);
|
||||
TempArgs[i] := CefGetData(arguments[i]);
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
FillChar(exc, SizeOf(exc), 0);
|
||||
ret := nil;
|
||||
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);
|
||||
CefStringInitialize(@TempException);
|
||||
|
||||
TempReturnValue := nil;
|
||||
TempName := CefString(name);
|
||||
Result := PCefv8Handler(FData)^.execute(PCefv8Handler(FData), @TempName, CefGetData(object_), TempLen, @TempArgs, TempReturnValue, @TempException) <> 0;
|
||||
retval := TCefv8ValueRef.UnWrap(TempReturnValue);
|
||||
exception := CefStringClearAndGet(@TempException);
|
||||
end;
|
||||
|
||||
class function TCefv8HandlerRef.UnWrap(data: Pointer): ICefv8Handler;
|
||||
@ -186,7 +213,7 @@ begin
|
||||
PCefv8Handler(FData)^.execute := {$IFDEF FPC}@{$ENDIF}cef_v8_handler_execute;
|
||||
end;
|
||||
|
||||
function TCefv8HandlerOwn.Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
function TCefv8HandlerOwn.Execute(const name: ustring; const object_: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
@ -778,9 +805,11 @@ begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TCefRTTIExtension.Execute(const name: ustring; const obj: ICefv8Value;
|
||||
const arguments: TCefv8ValueArray; var retval: ICefv8Value;
|
||||
var exception: ustring): Boolean;
|
||||
function TCefRTTIExtension.Execute(const name : ustring;
|
||||
const object_ : ICefv8Value;
|
||||
const arguments : TCefv8ValueArray;
|
||||
var retval : ICefv8Value;
|
||||
var exception : ustring): Boolean;
|
||||
var
|
||||
p: PChar;
|
||||
ud: ICefv8Value;
|
||||
@ -798,9 +827,9 @@ begin
|
||||
Result := True;
|
||||
p := PChar(name);
|
||||
m := nil;
|
||||
if obj <> nil then
|
||||
if object_ <> nil then
|
||||
begin
|
||||
ud := obj.GetUserData;
|
||||
ud := object_.GetUserData;
|
||||
if ud <> nil then
|
||||
begin
|
||||
{$IFDEF CPUX64}
|
||||
|
@ -54,10 +54,10 @@ uses
|
||||
type
|
||||
TCefV8InterceptorOwn = class(TCefBaseRefCountedOwn, ICefV8Interceptor)
|
||||
protected
|
||||
function GetByName(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean; virtual;
|
||||
function GetByIndex(index: integer; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean; virtual;
|
||||
function SetByName(const name: ustring; const obj, value: ICefv8Value; const exception: ustring): boolean; virtual;
|
||||
function SetByIndex(index: integer; const obj, value: ICefv8Value; const exception: ustring): boolean; virtual;
|
||||
function GetByName(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean; virtual;
|
||||
function GetByIndex(index: integer; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean; virtual;
|
||||
function SetByName(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): boolean; virtual;
|
||||
function SetByIndex(index: integer; const object_, value: ICefv8Value; var exception: ustring): boolean; virtual;
|
||||
|
||||
public
|
||||
constructor Create; virtual;
|
||||
@ -70,10 +70,10 @@ type
|
||||
FGetterByIndex : TCefV8InterceptorGetterByIndexProc;
|
||||
FSetterByIndex : TCefV8InterceptorSetterByIndexProc;
|
||||
|
||||
function GetByName(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean; override;
|
||||
function GetByIndex(index: integer; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean; override;
|
||||
function SetByName(const name: ustring; const obj, value: ICefv8Value; const exception: ustring): boolean; override;
|
||||
function SetByIndex(index: integer; const obj, value: ICefv8Value; const exception: ustring): boolean; override;
|
||||
function GetByName(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean; override;
|
||||
function GetByIndex(index: integer; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean; override;
|
||||
function SetByName(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): boolean; override;
|
||||
function SetByIndex(index: integer; const object_, value: ICefv8Value; var exception: ustring): boolean; override;
|
||||
|
||||
public
|
||||
constructor Create(const getterbyname : TCefV8InterceptorGetterByNameProc;
|
||||
@ -89,86 +89,152 @@ uses
|
||||
|
||||
function cef_v8_interceptor_get_byname( self : PCefV8Interceptor;
|
||||
const name : PCefString;
|
||||
obj : PCefV8Value;
|
||||
object_ : PCefV8Value;
|
||||
out retval : PCefv8Value;
|
||||
exception : PCefString): Integer; stdcall;
|
||||
var
|
||||
ret: ICefv8Value;
|
||||
TempObject : TObject;
|
||||
TempObject : TObject;
|
||||
TempException : ustring;
|
||||
TempReturnValue : ICefv8Value;
|
||||
TempRecObject : ICefv8Value;
|
||||
begin
|
||||
Result := Ord(False);
|
||||
retval := nil;
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefV8InterceptorOwn) then
|
||||
begin
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).GetByName(CefString(name),
|
||||
TCefv8ValueRef.UnWrap(obj),
|
||||
ret,
|
||||
CefString(exception)));
|
||||
try
|
||||
TempRecObject := TCefv8ValueRef.UnWrap(object_);
|
||||
TempException := '';
|
||||
TempReturnValue := nil;
|
||||
|
||||
retval := CefGetData(ret);
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).GetByName(CefString(name),
|
||||
TempRecObject,
|
||||
TempReturnValue,
|
||||
TempException));
|
||||
|
||||
retval := CefGetData(TempReturnValue);
|
||||
|
||||
if (exception <> nil) then
|
||||
begin
|
||||
CefStringFree(exception);
|
||||
exception^ := CefStringAlloc(TempException);
|
||||
end;
|
||||
finally
|
||||
TempRecObject := nil;
|
||||
TempReturnValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function cef_v8_interceptor_get_byindex( self : PCefV8Interceptor;
|
||||
index : integer;
|
||||
obj : PCefV8Value;
|
||||
object_ : PCefV8Value;
|
||||
out retval : PCefv8Value;
|
||||
exception : PCefString): integer; stdcall;
|
||||
var
|
||||
ret: ICefv8Value;
|
||||
TempObject : TObject;
|
||||
TempObject : TObject;
|
||||
TempException : ustring;
|
||||
TempReturnValue : ICefv8Value;
|
||||
TempRecObject : ICefv8Value;
|
||||
begin
|
||||
Result := Ord(False);
|
||||
retval := nil;
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefV8InterceptorOwn) then
|
||||
begin
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).GetByIndex(index,
|
||||
TCefv8ValueRef.UnWrap(obj),
|
||||
ret,
|
||||
CefString(exception)));
|
||||
try
|
||||
TempRecObject := TCefv8ValueRef.UnWrap(object_);
|
||||
TempException := '';
|
||||
TempReturnValue := nil;
|
||||
|
||||
retval := CefGetData(ret);
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).GetByIndex(index,
|
||||
TempRecObject,
|
||||
TempReturnValue,
|
||||
TempException));
|
||||
|
||||
retval := CefGetData(TempReturnValue);
|
||||
|
||||
if (exception <> nil) then
|
||||
begin
|
||||
CefStringFree(exception);
|
||||
exception^ := CefStringAlloc(TempException);
|
||||
end;
|
||||
finally
|
||||
TempRecObject := nil;
|
||||
TempReturnValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function cef_v8_interceptor_set_byname( self : PCefV8Interceptor;
|
||||
const name : PCefString;
|
||||
obj : PCefV8Value;
|
||||
object_ : PCefV8Value;
|
||||
value : PCefv8Value;
|
||||
exception : PCefString): integer; stdcall;
|
||||
var
|
||||
TempObject : TObject;
|
||||
TempObject : TObject;
|
||||
TempException : ustring;
|
||||
TempValue : ICefv8Value;
|
||||
TempRecObject : ICefv8Value;
|
||||
begin
|
||||
Result := Ord(False);
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefV8InterceptorOwn) then
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).SetByName(CefString(name),
|
||||
TCefv8ValueRef.UnWrap(obj),
|
||||
TCefv8ValueRef.UnWrap(value),
|
||||
CefString(exception)));
|
||||
try
|
||||
TempRecObject := TCefv8ValueRef.UnWrap(object_);
|
||||
TempValue := TCefv8ValueRef.UnWrap(value);
|
||||
TempException := '';
|
||||
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).SetByName(CefString(name),
|
||||
TempRecObject,
|
||||
TempValue,
|
||||
TempException));
|
||||
|
||||
if (exception <> nil) then
|
||||
begin
|
||||
CefStringFree(exception);
|
||||
exception^ := CefStringAlloc(TempException);
|
||||
end;
|
||||
finally
|
||||
TempRecObject := nil;
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function cef_v8_interceptor_set_byindex(self : PCefV8Interceptor;
|
||||
index : integer;
|
||||
obj : PCefV8Value;
|
||||
object_ : PCefV8Value;
|
||||
value : PCefv8Value;
|
||||
exception : PCefString): integer; stdcall;
|
||||
var
|
||||
TempObject : TObject;
|
||||
TempObject : TObject;
|
||||
TempException : ustring;
|
||||
TempValue : ICefv8Value;
|
||||
TempRecObject : ICefv8Value;
|
||||
begin
|
||||
Result := Ord(False);
|
||||
TempObject := CefGetObject(self);
|
||||
|
||||
if (TempObject <> nil) and (TempObject is TCefV8InterceptorOwn) then
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).SetByIndex(index,
|
||||
TCefv8ValueRef.UnWrap(obj),
|
||||
TCefv8ValueRef.UnWrap(value),
|
||||
CefString(exception)));
|
||||
try
|
||||
TempRecObject := TCefv8ValueRef.UnWrap(object_);
|
||||
TempValue := TCefv8ValueRef.UnWrap(value);
|
||||
TempException := '';
|
||||
|
||||
Result := Ord(TCefV8InterceptorOwn(TempObject).SetByIndex(index,
|
||||
TempRecObject,
|
||||
TempValue,
|
||||
TempException));
|
||||
|
||||
if (exception <> nil) then
|
||||
begin
|
||||
CefStringFree(exception);
|
||||
exception^ := CefStringAlloc(TempException);
|
||||
end;
|
||||
finally
|
||||
TempRecObject := nil;
|
||||
TempValue := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// TCefV8InterceptorOwn
|
||||
@ -186,22 +252,22 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCefV8InterceptorOwn.GetByName(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefV8InterceptorOwn.GetByName(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefV8InterceptorOwn.GetByIndex(index: integer; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefV8InterceptorOwn.GetByIndex(index: integer; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefV8InterceptorOwn.SetByName(const name: ustring; const obj, value: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefV8InterceptorOwn.SetByName(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefV8InterceptorOwn.SetByIndex(index: integer; const obj, value: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefV8InterceptorOwn.SetByIndex(index: integer; const object_, value: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
Result := False;
|
||||
end;
|
||||
@ -219,34 +285,34 @@ begin
|
||||
FSetterByIndex := setterbyindex;
|
||||
end;
|
||||
|
||||
function TCefFastV8Interceptor.GetByName(const name: ustring; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefFastV8Interceptor.GetByName(const name: ustring; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
if assigned(FGetterByName) then
|
||||
Result := FGetterByName(name, obj, retval, exception)
|
||||
Result := FGetterByName(name, object_, retval, exception)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefFastV8Interceptor.GetByIndex(index: integer; const obj: ICefv8Value; out retval: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefFastV8Interceptor.GetByIndex(index: integer; const object_: ICefv8Value; var retval: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
if assigned(FGetterByIndex) then
|
||||
Result := FGetterByIndex(index, obj, retval, exception)
|
||||
Result := FGetterByIndex(index, object_, retval, exception)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefFastV8Interceptor.SetByName(const name: ustring; const obj, value: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefFastV8Interceptor.SetByName(const name: ustring; const object_, value: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
if assigned(FSetterByName) then
|
||||
Result := FSetterByName(name, obj, value, exception)
|
||||
Result := FSetterByName(name, object_, value, exception)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TCefFastV8Interceptor.SetByIndex(index: integer; const obj, value: ICefv8Value; const exception: ustring): boolean;
|
||||
function TCefFastV8Interceptor.SetByIndex(index: integer; const object_, value: ICefv8Value; var exception: ustring): boolean;
|
||||
begin
|
||||
if assigned(FSetterByIndex) then
|
||||
Result := FSetterByIndex(index, obj, value, exception)
|
||||
Result := FSetterByIndex(index, object_, value, exception)
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"UpdateLazPackages" : [
|
||||
{
|
||||
"ForceNotify" : false,
|
||||
"InternalVersion" : 67,
|
||||
"ForceNotify" : true,
|
||||
"InternalVersion" : 68,
|
||||
"Name" : "cef4delphi_lazarus.lpk",
|
||||
"Version" : "78.3.4.0"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user