You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-22 22:17:48 +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:
@ -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;
|
||||
|
Reference in New Issue
Block a user