You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-08-14 21:42:50 +02:00
Bug fix #98
This commit is contained in:
@@ -95,8 +95,8 @@ type
|
|||||||
function GetRequestContext: ICefRequestContext;
|
function GetRequestContext: ICefRequestContext;
|
||||||
function GetZoomLevel: Double;
|
function GetZoomLevel: Double;
|
||||||
procedure SetZoomLevel(zoomLevel: Double);
|
procedure SetZoomLevel(zoomLevel: Double);
|
||||||
procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: ICefRunFileDialogCallback);
|
procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: ICefRunFileDialogCallback);
|
||||||
procedure RunFileDialogProc(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: TCefRunFileDialogCallbackProc);
|
procedure RunFileDialogProc(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: TCefRunFileDialogCallbackProc);
|
||||||
procedure StartDownload(const url: ustring);
|
procedure StartDownload(const url: ustring);
|
||||||
procedure DownloadImage(const imageUrl: ustring; isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean; const callback: ICefDownloadImageCallback);
|
procedure DownloadImage(const imageUrl: ustring; isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean; const callback: ICefDownloadImageCallback);
|
||||||
procedure DownloadImageProc(const imageUrl: ustring; isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean; const callback: TOnDownloadImageFinishedProc);
|
procedure DownloadImageProc(const imageUrl: ustring; isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean; const callback: TOnDownloadImageFinishedProc);
|
||||||
@@ -223,7 +223,7 @@ end;
|
|||||||
function TCefBrowserRef.GetFrameNames(var aFrameNames : TStrings) : boolean;
|
function TCefBrowserRef.GetFrameNames(var aFrameNames : TStrings) : boolean;
|
||||||
var
|
var
|
||||||
TempSL : TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i, j : Integer;
|
i, j : NativeUInt;
|
||||||
TempString : TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
TempSL := nil;
|
TempSL := nil;
|
||||||
@@ -235,7 +235,6 @@ begin
|
|||||||
begin
|
begin
|
||||||
TempSL := cef_string_list_alloc;
|
TempSL := cef_string_list_alloc;
|
||||||
PCefBrowser(FData)^.get_frame_names(PCefBrowser(FData), TempSL);
|
PCefBrowser(FData)^.get_frame_names(PCefBrowser(FData), TempSL);
|
||||||
FillChar(TempString, SizeOf(TempString), 0);
|
|
||||||
|
|
||||||
i := 0;
|
i := 0;
|
||||||
j := cef_string_list_size(TempSL);
|
j := cef_string_list_size(TempSL);
|
||||||
@@ -453,8 +452,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefBrowserHostRef.RunFileDialog( mode : TCefFileDialogMode;
|
procedure TCefBrowserHostRef.RunFileDialog( mode : TCefFileDialogMode;
|
||||||
const title, defaultFilePath: ustring; acceptFilters: TStrings;
|
const title : ustring;
|
||||||
selectedAcceptFilter: Integer; const callback: ICefRunFileDialogCallback);
|
const defaultFilePath : ustring;
|
||||||
|
const acceptFilters : TStrings;
|
||||||
|
selectedAcceptFilter : Integer;
|
||||||
|
const callback : ICefRunFileDialogCallback);
|
||||||
var
|
var
|
||||||
t, f: TCefString;
|
t, f: TCefString;
|
||||||
list: TCefStringList;
|
list: TCefStringList;
|
||||||
@@ -470,19 +472,20 @@ begin
|
|||||||
item := CefString(acceptFilters[i]);
|
item := CefString(acceptFilters[i]);
|
||||||
cef_string_list_append(list, @item);
|
cef_string_list_append(list, @item);
|
||||||
end;
|
end;
|
||||||
PCefBrowserHost(FData).run_file_dialog(PCefBrowserHost(FData), mode, @t, @f,
|
PCefBrowserHost(FData).run_file_dialog(PCefBrowserHost(FData), mode, @t, @f, list, selectedAcceptFilter, CefGetData(callback));
|
||||||
list, selectedAcceptFilter, CefGetData(callback));
|
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
cef_string_list_free(list);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefBrowserHostRef.RunFileDialogProc( mode : TCefFileDialogMode;
|
procedure TCefBrowserHostRef.RunFileDialogProc( mode : TCefFileDialogMode;
|
||||||
const title, defaultFilePath: ustring; acceptFilters: TStrings;
|
const title : ustring;
|
||||||
selectedAcceptFilter: Integer; const callback: TCefRunFileDialogCallbackProc);
|
const defaultFilePath : ustring;
|
||||||
|
const acceptFilters : TStrings;
|
||||||
|
selectedAcceptFilter : Integer;
|
||||||
|
const callback : TCefRunFileDialogCallbackProc);
|
||||||
begin
|
begin
|
||||||
RunFileDialog(mode, title, defaultFilePath, acceptFilters, selectedAcceptFilter,
|
RunFileDialog(mode, title, defaultFilePath, acceptFilters, selectedAcceptFilter, TCefFastRunFileDialogCallback.Create(callback));
|
||||||
TCefFastRunFileDialogCallback.Create(callback));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefBrowserHostRef.AddWordToDictionary(const word: ustring);
|
procedure TCefBrowserHostRef.AddWordToDictionary(const word: ustring);
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFTypes, uCEFInterfaces;
|
uCEFBaseRefCounted, uCEFTypes, uCEFInterfaces;
|
||||||
|
|
||||||
@@ -64,17 +64,17 @@ type
|
|||||||
procedure InitFromString(const commandLine: ustring);
|
procedure InitFromString(const commandLine: ustring);
|
||||||
procedure Reset;
|
procedure Reset;
|
||||||
function GetCommandLineString: ustring;
|
function GetCommandLineString: ustring;
|
||||||
procedure GetArgv(args: TStrings);
|
procedure GetArgv(var args: TStrings);
|
||||||
function GetProgram: ustring;
|
function GetProgram: ustring;
|
||||||
procedure SetProgram(const prog: ustring);
|
procedure SetProgram(const prog: ustring);
|
||||||
function HasSwitches: Boolean;
|
function HasSwitches: Boolean;
|
||||||
function HasSwitch(const name: ustring): Boolean;
|
function HasSwitch(const name: ustring): Boolean;
|
||||||
function GetSwitchValue(const name: ustring): ustring;
|
function GetSwitchValue(const name: ustring): ustring;
|
||||||
procedure GetSwitches(switches: TStrings);
|
procedure GetSwitches(var switches: TStrings);
|
||||||
procedure AppendSwitch(const name: ustring);
|
procedure AppendSwitch(const name: ustring);
|
||||||
procedure AppendSwitchWithValue(const name, value: ustring);
|
procedure AppendSwitchWithValue(const name, value: ustring);
|
||||||
function HasArguments: Boolean;
|
function HasArguments: Boolean;
|
||||||
procedure GetArguments(arguments: TStrings);
|
procedure GetArguments(var arguments: TStrings);
|
||||||
procedure AppendArgument(const argument: ustring);
|
procedure AppendArgument(const argument: ustring);
|
||||||
procedure PrependWrapper(const wrapper: ustring);
|
procedure PrependWrapper(const wrapper: ustring);
|
||||||
|
|
||||||
@@ -119,43 +119,73 @@ begin
|
|||||||
Result := UnWrap(PCefCommandLine(FData).copy(PCefCommandLine(FData)));
|
Result := UnWrap(PCefCommandLine(FData).copy(PCefCommandLine(FData)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefCommandLineRef.GetArguments(arguments: TStrings);
|
procedure TCefCommandLineRef.GetArguments(var arguments : TStrings);
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc;
|
TempSL := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
PCefCommandLine(FData).get_arguments(PCefCommandLine(FData), list);
|
try
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
if (arguments <> nil) then
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
PCefCommandLine(FData).get_arguments(PCefCommandLine(FData), TempSL);
|
||||||
arguments.Add(CefStringClearAndGet(str));
|
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
arguments.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefCommandLineRef.GetArguments', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefCommandLineRef.GetArgv(args: TStrings);
|
procedure TCefCommandLineRef.GetArgv(var args: TStrings);
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc;
|
TempSL := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
PCefCommandLine(FData).get_argv(FData, list);
|
try
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
if (args <> nil) then
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
PCefCommandLine(FData).get_argv(PCefCommandLine(FData), TempSL);
|
||||||
args.Add(CefStringClearAndGet(str));
|
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
args.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefCommandLineRef.GetArgv', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -169,23 +199,38 @@ begin
|
|||||||
Result := CefStringFreeAndGet(PCefCommandLine(FData).get_program(PCefCommandLine(FData)));
|
Result := CefStringFreeAndGet(PCefCommandLine(FData).get_program(PCefCommandLine(FData)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefCommandLineRef.GetSwitches(switches: TStrings);
|
procedure TCefCommandLineRef.GetSwitches(var switches: TStrings);
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc;
|
TempSL := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
PCefCommandLine(FData).get_switches(PCefCommandLine(FData), list);
|
try
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
if (switches <> nil) then
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
PCefCommandLine(FData).get_switches(PCefCommandLine(FData), TempSL);
|
||||||
switches.Add(CefStringClearAndGet(str));
|
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
switches.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefCommandLineRef.GetSwitches', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
@@ -88,25 +88,43 @@ uses
|
|||||||
uCEFMiscFunctions, uCEFLibFunctions;
|
uCEFMiscFunctions, uCEFLibFunctions;
|
||||||
|
|
||||||
|
|
||||||
function TCefContextMenuParamsRef.GetDictionarySuggestions(
|
function TCefContextMenuParamsRef.GetDictionarySuggestions(const suggestions : TStringList): Boolean;
|
||||||
const suggestions: TStringList): Boolean;
|
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc;
|
TempSL := nil;
|
||||||
|
Result := False;
|
||||||
|
|
||||||
try
|
try
|
||||||
Result := PCefContextMenuParams(FData).get_dictionary_suggestions(PCefContextMenuParams(FData), list) <> 0;
|
try
|
||||||
FillChar(str, SizeOf(str), 0);
|
if (suggestions <> nil) then
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
|
||||||
suggestions.Add(CefStringClearAndGet(str));
|
if (PCefContextMenuParams(FData).get_dictionary_suggestions(PCefContextMenuParams(FData), TempSL) <> 0) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
suggestions.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefContextMenuParamsRef.GetDictionarySuggestions', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -48,17 +48,17 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCefCookieManagerRef = class(TCefBaseRefCountedRef, ICefCookieManager)
|
TCefCookieManagerRef = class(TCefBaseRefCountedRef, ICefCookieManager)
|
||||||
protected
|
protected
|
||||||
procedure SetSupportedSchemes(schemes: TStrings; const callback: ICefCompletionCallback);
|
procedure SetSupportedSchemes(const schemes: TStrings; const callback: ICefCompletionCallback);
|
||||||
procedure SetSupportedSchemesProc(schemes: TStrings; const callback: TCefCompletionCallbackProc);
|
procedure SetSupportedSchemesProc(const schemes: TStrings; const callback: TCefCompletionCallbackProc);
|
||||||
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
|
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
|
||||||
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
|
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
|
||||||
function VisitUrlCookies(const url: ustring; includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean;
|
function VisitUrlCookies(const url: ustring; includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean;
|
||||||
@@ -194,30 +194,38 @@ begin
|
|||||||
Result := SetStoragePath(path, persistSessionCookies, TCefFastCompletionCallback.Create(callback));
|
Result := SetStoragePath(path, persistSessionCookies, TCefFastCompletionCallback.Create(callback));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefCookieManagerRef.SetSupportedSchemes(schemes: TStrings; const callback: ICefCompletionCallback);
|
procedure TCefCookieManagerRef.SetSupportedSchemes(const schemes: TStrings; const callback: ICefCompletionCallback);
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i : Integer;
|
i : Integer;
|
||||||
item: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc();
|
TempSL := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
if (schemes <> nil) then
|
try
|
||||||
|
if (schemes <> nil) and (schemes.Count > 0) then
|
||||||
|
begin
|
||||||
|
TempSL := cef_string_list_alloc();
|
||||||
|
|
||||||
for i := 0 to schemes.Count - 1 do
|
for i := 0 to schemes.Count - 1 do
|
||||||
begin
|
begin
|
||||||
item := CefString(schemes[i]);
|
TempString := CefString(schemes[i]);
|
||||||
cef_string_list_append(list, @item);
|
cef_string_list_append(TempSL, @TempString);
|
||||||
end;
|
end;
|
||||||
PCefCookieManager(FData).set_supported_schemes(
|
|
||||||
PCefCookieManager(FData), list, CefGetData(callback));
|
|
||||||
|
|
||||||
|
PCefCookieManager(FData).set_supported_schemes(PCefCookieManager(FData), TempSL, CefGetData(callback));
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefCookieManagerRef.SetSupportedSchemes', e) then raise;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefCookieManagerRef.SetSupportedSchemesProc(schemes: TStrings;
|
procedure TCefCookieManagerRef.SetSupportedSchemesProc(const schemes: TStrings; const callback: TCefCompletionCallbackProc);
|
||||||
const callback: TCefCompletionCallbackProc);
|
|
||||||
begin
|
begin
|
||||||
SetSupportedSchemes(schemes, TCefFastCompletionCallback.Create(callback));
|
SetSupportedSchemes(schemes, TCefFastCompletionCallback.Create(callback));
|
||||||
end;
|
end;
|
||||||
|
@@ -88,30 +88,49 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser, uCEFFileDialogCallback;
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser, uCEFFileDialogCallback;
|
||||||
|
|
||||||
function cef_dialog_handler_on_file_dialog(self: PCefDialogHandler; browser: PCefBrowser;
|
function cef_dialog_handler_on_file_dialog(self : PCefDialogHandler;
|
||||||
mode: TCefFileDialogMode; const title, default_file_path: PCefString;
|
browser : PCefBrowser;
|
||||||
accept_filters: TCefStringList; selected_accept_filter: Integer;
|
mode : TCefFileDialogMode;
|
||||||
|
const title : PCefString;
|
||||||
|
const default_file_path : PCefString;
|
||||||
|
accept_filters : TCefStringList;
|
||||||
|
selected_accept_filter : Integer;
|
||||||
callback : PCefFileDialogCallback): Integer; stdcall;
|
callback : PCefFileDialogCallback): Integer; stdcall;
|
||||||
var
|
var
|
||||||
list: TStringList;
|
TempSL : TStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := TStringList.Create;
|
TempSL := nil;
|
||||||
|
Result := 0; // False
|
||||||
|
|
||||||
try
|
try
|
||||||
for i := 0 to cef_string_list_size(accept_filters) - 1 do
|
try
|
||||||
|
TempSL := TStringList.Create;
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(accept_filters);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
cef_string_list_value(accept_filters, i, @str);
|
cef_string_list_value(accept_filters, i, @TempString);
|
||||||
list.Add(CefStringClearAndGet(str));
|
TempSL.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
with TCefDialogHandlerOwn(CefGetObject(self)) do
|
Result := Ord(TCefDialogHandlerOwn(CefGetObject(self)).OnFileDialog(TCefBrowserRef.UnWrap(browser),
|
||||||
Result := Ord(OnFileDialog(TCefBrowserRef.UnWrap(browser), mode, CefString(title),
|
mode,
|
||||||
CefString(default_file_path), list, selected_accept_filter,
|
CefString(title),
|
||||||
|
CefString(default_file_path),
|
||||||
|
TempSL,
|
||||||
|
selected_accept_filter,
|
||||||
TCefFileDialogCallbackRef.UnWrap(callback)));
|
TCefFileDialogCallbackRef.UnWrap(callback)));
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('cef_dialog_handler_on_file_dialog', e) then raise;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
list.Free;
|
if (TempSL <> nil) then FreeAndNil(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
@@ -151,22 +151,41 @@ end;
|
|||||||
|
|
||||||
function TCefDictionaryValueRef.GetKeys(const keys : TStrings): Boolean;
|
function TCefDictionaryValueRef.GetKeys(const keys : TStrings): Boolean;
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc;
|
TempSL := nil;
|
||||||
|
Result := False;
|
||||||
|
|
||||||
try
|
try
|
||||||
Result := PCefDictionaryValue(FData).get_keys(PCefDictionaryValue(FData), list) <> 0;
|
try
|
||||||
FillChar(str, SizeOf(str), 0);
|
if (keys <> nil) then
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
|
||||||
keys.Add(CefStringClearAndGet(str));
|
if (PCefDictionaryValue(FData).get_keys(PCefDictionaryValue(FData), TempSL) <> 0) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
keys.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefDictionaryValueRef.GetKeys', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -127,22 +127,33 @@ procedure cef_display_handler_on_favicon_urlchange(self: PCefDisplayHandler;
|
|||||||
browser : PCefBrowser;
|
browser : PCefBrowser;
|
||||||
icon_urls : TCefStringList); stdcall;
|
icon_urls : TCefStringList); stdcall;
|
||||||
var
|
var
|
||||||
list: TStringList;
|
TempSL : TStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := TStringList.Create;
|
TempSL := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
for i := 0 to cef_string_list_size(icon_urls) - 1 do
|
try
|
||||||
|
TempSL := TStringList.Create;
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(icon_urls);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
cef_string_list_value(icon_urls, i, @str);
|
cef_string_list_value(icon_urls, i, @TempString);
|
||||||
list.Add(CefStringClearAndGet(str));
|
TempSL.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCefDisplayHandlerOwn(CefGetObject(self)).OnFaviconUrlChange(TCefBrowserRef.UnWrap(browser), TempSL);
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('cef_display_handler_on_favicon_urlchange', e) then raise;
|
||||||
end;
|
end;
|
||||||
with TCefDisplayHandlerOwn(CefGetObject(self)) do
|
|
||||||
OnFaviconUrlChange(TCefBrowserRef.UnWrap(browser), list);
|
|
||||||
finally
|
finally
|
||||||
list.Free;
|
if (TempSL <> nil) then FreeAndNil(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ type
|
|||||||
function GetFragmentBaseUrl: ustring;
|
function GetFragmentBaseUrl: ustring;
|
||||||
function GetFileName: ustring;
|
function GetFileName: ustring;
|
||||||
function GetFileContents(const writer: ICefStreamWriter): NativeUInt;
|
function GetFileContents(const writer: ICefStreamWriter): NativeUInt;
|
||||||
function GetFileNames(names: TStrings): Integer;
|
function GetFileNames(var names: TStrings): Integer;
|
||||||
procedure SetLinkUrl(const url: ustring);
|
procedure SetLinkUrl(const url: ustring);
|
||||||
procedure SetLinkTitle(const title: ustring);
|
procedure SetLinkTitle(const title: ustring);
|
||||||
procedure SetLinkMetadata(const data: ustring);
|
procedure SetLinkMetadata(const data: ustring);
|
||||||
@@ -132,23 +132,43 @@ begin
|
|||||||
Result := CefStringFreeAndGet(PCefDragData(FData).get_file_name(FData));
|
Result := CefStringFreeAndGet(PCefDragData(FData).get_file_name(FData));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefDragDataRef.GetFileNames(names: TStrings): Integer;
|
function TCefDragDataRef.GetFileNames(var names: TStrings): Integer;
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc;
|
TempSL := nil;
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
Result := PCefDragData(FData).get_file_names(FData, list);
|
try
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
if (names <> nil) then
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
|
||||||
names.Add(CefStringClearAndGet(str));
|
if (PCefDragData(FData).get_file_names(FData, TempSL) <> 0) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
names.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := j;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefDragDataRef.GetFileNames', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ uses
|
|||||||
type
|
type
|
||||||
TCefFileDialogCallbackRef = class(TCefBaseRefCountedRef, ICefFileDialogCallback)
|
TCefFileDialogCallbackRef = class(TCefBaseRefCountedRef, ICefFileDialogCallback)
|
||||||
protected
|
protected
|
||||||
procedure Cont(selectedAcceptFilter: Integer; filePaths: TStrings);
|
procedure Cont(selectedAcceptFilter: Integer; const filePaths: TStrings);
|
||||||
procedure Cancel;
|
procedure Cancel;
|
||||||
public
|
public
|
||||||
class function UnWrap(data: Pointer): ICefFileDialogCallback;
|
class function UnWrap(data: Pointer): ICefFileDialogCallback;
|
||||||
@@ -73,7 +73,7 @@ begin
|
|||||||
PCefFileDialogCallback(FData).cancel(FData);
|
PCefFileDialogCallback(FData).cancel(FData);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCefFileDialogCallbackRef.Cont(selectedAcceptFilter: Integer; filePaths: TStrings);
|
procedure TCefFileDialogCallbackRef.Cont(selectedAcceptFilter: Integer; const filePaths: TStrings);
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
list: TCefStringList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@@ -92,11 +92,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TCefFileDialogCallbackRef.UnWrap(
|
class function TCefFileDialogCallbackRef.UnWrap(data: Pointer): ICefFileDialogCallback;
|
||||||
data: Pointer): ICefFileDialogCallback;
|
|
||||||
begin
|
begin
|
||||||
if data <> nil then
|
if (data <> nil) then
|
||||||
Result := Create(data) as ICefFileDialogCallback else
|
Result := Create(data) as ICefFileDialogCallback
|
||||||
|
else
|
||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -189,8 +189,8 @@ type
|
|||||||
function GetRequestContext: ICefRequestContext;
|
function GetRequestContext: ICefRequestContext;
|
||||||
function GetZoomLevel: Double;
|
function GetZoomLevel: Double;
|
||||||
procedure SetZoomLevel(zoomLevel: Double);
|
procedure SetZoomLevel(zoomLevel: Double);
|
||||||
procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: ICefRunFileDialogCallback);
|
procedure RunFileDialog(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: ICefRunFileDialogCallback);
|
||||||
procedure RunFileDialogProc(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: TCefRunFileDialogCallbackProc);
|
procedure RunFileDialogProc(mode: TCefFileDialogMode; const title, defaultFilePath: ustring; const acceptFilters: TStrings; selectedAcceptFilter: Integer; const callback: TCefRunFileDialogCallbackProc);
|
||||||
procedure StartDownload(const url: ustring);
|
procedure StartDownload(const url: ustring);
|
||||||
procedure DownloadImage(const imageUrl: ustring; isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean; const callback: ICefDownloadImageCallback);
|
procedure DownloadImage(const imageUrl: ustring; isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean; const callback: ICefDownloadImageCallback);
|
||||||
procedure Print;
|
procedure Print;
|
||||||
@@ -840,17 +840,17 @@ type
|
|||||||
procedure InitFromString(const commandLine: ustring);
|
procedure InitFromString(const commandLine: ustring);
|
||||||
procedure Reset;
|
procedure Reset;
|
||||||
function GetCommandLineString: ustring;
|
function GetCommandLineString: ustring;
|
||||||
procedure GetArgv(args: TStrings);
|
procedure GetArgv(var args: TStrings);
|
||||||
function GetProgram: ustring;
|
function GetProgram: ustring;
|
||||||
procedure SetProgram(const prog: ustring);
|
procedure SetProgram(const prog: ustring);
|
||||||
function HasSwitches: Boolean;
|
function HasSwitches: Boolean;
|
||||||
function HasSwitch(const name: ustring): Boolean;
|
function HasSwitch(const name: ustring): Boolean;
|
||||||
function GetSwitchValue(const name: ustring): ustring;
|
function GetSwitchValue(const name: ustring): ustring;
|
||||||
procedure GetSwitches(switches: TStrings);
|
procedure GetSwitches(var switches: TStrings);
|
||||||
procedure AppendSwitch(const name: ustring);
|
procedure AppendSwitch(const name: ustring);
|
||||||
procedure AppendSwitchWithValue(const name, value: ustring);
|
procedure AppendSwitchWithValue(const name, value: ustring);
|
||||||
function HasArguments: Boolean;
|
function HasArguments: Boolean;
|
||||||
procedure GetArguments(arguments: TStrings);
|
procedure GetArguments(var arguments: TStrings);
|
||||||
procedure AppendArgument(const argument: ustring);
|
procedure AppendArgument(const argument: ustring);
|
||||||
procedure PrependWrapper(const wrapper: ustring);
|
procedure PrependWrapper(const wrapper: ustring);
|
||||||
property CommandLineString: ustring read GetCommandLineString;
|
property CommandLineString: ustring read GetCommandLineString;
|
||||||
@@ -924,8 +924,8 @@ type
|
|||||||
|
|
||||||
ICefCookieManager = Interface(ICefBaseRefCounted)
|
ICefCookieManager = Interface(ICefBaseRefCounted)
|
||||||
['{CC1749E6-9AD3-4283-8430-AF6CBF3E8785}']
|
['{CC1749E6-9AD3-4283-8430-AF6CBF3E8785}']
|
||||||
procedure SetSupportedSchemes(schemes: TStrings; const callback: ICefCompletionCallback);
|
procedure SetSupportedSchemes(const schemes: TStrings; const callback: ICefCompletionCallback);
|
||||||
procedure SetSupportedSchemesProc(schemes: TStrings; const callback: TCefCompletionCallbackProc);
|
procedure SetSupportedSchemesProc(const schemes: TStrings; const callback: TCefCompletionCallbackProc);
|
||||||
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
|
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
|
||||||
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
|
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
|
||||||
function VisitUrlCookies(const url: ustring;
|
function VisitUrlCookies(const url: ustring;
|
||||||
@@ -1467,7 +1467,7 @@ type
|
|||||||
|
|
||||||
ICefFileDialogCallback = interface(ICefBaseRefCounted)
|
ICefFileDialogCallback = interface(ICefBaseRefCounted)
|
||||||
['{1AF659AB-4522-4E39-9C52-184000D8E3C7}']
|
['{1AF659AB-4522-4E39-9C52-184000D8E3C7}']
|
||||||
procedure Cont(selectedAcceptFilter: Integer; filePaths: TStrings);
|
procedure Cont(selectedAcceptFilter: Integer; const filePaths: TStrings);
|
||||||
procedure Cancel;
|
procedure Cancel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -1486,7 +1486,7 @@ type
|
|||||||
function GetFragmentBaseUrl: ustring;
|
function GetFragmentBaseUrl: ustring;
|
||||||
function GetFileName: ustring;
|
function GetFileName: ustring;
|
||||||
function GetFileContents(const writer: ICefStreamWriter): NativeUInt;
|
function GetFileContents(const writer: ICefStreamWriter): NativeUInt;
|
||||||
function GetFileNames(names: TStrings): Integer;
|
function GetFileNames(var names: TStrings): Integer;
|
||||||
procedure SetLinkUrl(const url: ustring);
|
procedure SetLinkUrl(const url: ustring);
|
||||||
procedure SetLinkTitle(const title: ustring);
|
procedure SetLinkTitle(const title: ustring);
|
||||||
procedure SetLinkMetadata(const data: ustring);
|
procedure SetLinkMetadata(const data: ustring);
|
||||||
|
@@ -150,7 +150,7 @@ function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean;
|
|||||||
function CefCreateUrl(var parts: TUrlParts): ustring;
|
function CefCreateUrl(var parts: TUrlParts): ustring;
|
||||||
function CefFormatUrlForSecurityDisplay(const originUrl: string): string;
|
function CefFormatUrlForSecurityDisplay(const originUrl: string): string;
|
||||||
function CefGetMimeType(const extension: ustring): ustring;
|
function CefGetMimeType(const extension: ustring): ustring;
|
||||||
procedure CefGetExtensionsForMimeType(const mimeType: ustring; extensions: TStringList);
|
procedure CefGetExtensionsForMimeType(const mimeType: ustring; var extensions: TStringList);
|
||||||
|
|
||||||
function CefBase64Encode(const data: Pointer; dataSize: NativeUInt): ustring;
|
function CefBase64Encode(const data: Pointer; dataSize: NativeUInt): ustring;
|
||||||
function CefBase64Decode(const data: ustring): ICefBinaryValue;
|
function CefBase64Decode(const data: ustring): ICefBinaryValue;
|
||||||
@@ -256,7 +256,7 @@ begin
|
|||||||
if (aSrcSL <> nil) and (aDstSL <> nil) then
|
if (aSrcSL <> nil) and (aDstSL <> nil) then
|
||||||
begin
|
begin
|
||||||
i := 0;
|
i := 0;
|
||||||
j := pred(cef_string_list_size(aSrcSL));
|
j := cef_string_list_size(aSrcSL);
|
||||||
|
|
||||||
while (i < j) do
|
while (i < j) do
|
||||||
begin
|
begin
|
||||||
@@ -1073,24 +1073,40 @@ begin
|
|||||||
Result := CefStringFreeAndGet(cef_get_mime_type(@s));
|
Result := CefStringFreeAndGet(cef_get_mime_type(@s));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure CefGetExtensionsForMimeType(const mimeType: ustring; extensions: TStringList);
|
procedure CefGetExtensionsForMimeType(const mimeType: ustring; var extensions: TStringList);
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
s, str: TCefString;
|
TempMimeType, TempString : TCefString;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc();
|
TempSL := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
s := CefString(mimeType);
|
try
|
||||||
cef_get_extensions_for_mime_type(@s, list);
|
if (extensions <> nil) then
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
TempMimeType := CefString(mimeType);
|
||||||
extensions.Add(CefStringClearAndGet(str));
|
|
||||||
|
cef_get_extensions_for_mime_type(@TempMimeType, TempSL);
|
||||||
|
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
extensions.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('CefGetExtensionsForMimeType', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
@@ -86,8 +86,7 @@ begin
|
|||||||
Result := PCefPostData(FData)^.has_excluded_elements(PCefPostData(FData)) <> 0;
|
Result := PCefPostData(FData)^.has_excluded_elements(PCefPostData(FData)) <> 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefPostDataRef.AddElement(
|
function TCefPostDataRef.AddElement(const element: ICefPostDataElement): Integer;
|
||||||
const element: ICefPostDataElement): Integer;
|
|
||||||
begin
|
begin
|
||||||
Result := PCefPostData(FData)^.add_element(PCefPostData(FData), CefGetData(element));
|
Result := PCefPostData(FData)^.add_element(PCefPostData(FData), CefGetData(element));
|
||||||
end;
|
end;
|
||||||
@@ -100,17 +99,32 @@ end;
|
|||||||
function TCefPostDataRef.GetElements(Count: NativeUInt): IInterfaceList;
|
function TCefPostDataRef.GetElements(Count: NativeUInt): IInterfaceList;
|
||||||
var
|
var
|
||||||
items : PCefPostDataElementArray;
|
items : PCefPostDataElementArray;
|
||||||
i: Integer;
|
i : NativeUInt;
|
||||||
begin
|
begin
|
||||||
Result := TInterfaceList.Create;
|
Result := nil;
|
||||||
|
items := nil;
|
||||||
|
|
||||||
|
try
|
||||||
|
try
|
||||||
GetMem(items, SizeOf(PCefPostDataElement) * Count);
|
GetMem(items, SizeOf(PCefPostDataElement) * Count);
|
||||||
FillChar(items^, SizeOf(PCefPostDataElement) * Count, 0);
|
FillChar(items^, SizeOf(PCefPostDataElement) * Count, 0);
|
||||||
try
|
|
||||||
PCefPostData(FData)^.get_elements(PCefPostData(FData), @Count, items);
|
PCefPostData(FData)^.get_elements(PCefPostData(FData), @Count, items);
|
||||||
for i := 0 to Count - 1 do
|
|
||||||
|
Result := TInterfaceList.Create;
|
||||||
|
i := 0;
|
||||||
|
|
||||||
|
while (i < Count) do
|
||||||
|
begin
|
||||||
Result.Add(TCefPostDataElementRef.UnWrap(items[i]));
|
Result.Add(TCefPostDataElementRef.UnWrap(items[i]));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefPostDataRef.GetElements', e) then raise;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
FreeMem(items);
|
if (items <> nil) then FreeMem(items);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
@@ -237,21 +237,27 @@ function TCefRequestContextRef.ResolveHostCached(const origin : ustring;
|
|||||||
const resolvedIps : TStrings): TCefErrorCode;
|
const resolvedIps : TStrings): TCefErrorCode;
|
||||||
var
|
var
|
||||||
ips : TCefStringList;
|
ips : TCefStringList;
|
||||||
o, str : TCefString;
|
TempOrigin, TempString : TCefString;
|
||||||
i : Integer;
|
i, j : NativeUInt;
|
||||||
begin
|
begin
|
||||||
ips := cef_string_list_alloc;
|
ips := cef_string_list_alloc;
|
||||||
|
|
||||||
try
|
try
|
||||||
o := CefString(origin);
|
TempOrigin := CefString(origin);
|
||||||
Result := PCefRequestContext(FData).resolve_host_cached(FData, @o, ips);
|
Result := PCefRequestContext(FData).resolve_host_cached(FData, @TempOrigin, ips);
|
||||||
|
|
||||||
if Assigned(ips) then
|
if (resolvedIps <> nil) and (ips <> nil) then
|
||||||
for i := 0 to cef_string_list_size(ips) - 1 do
|
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
i := 0;
|
||||||
cef_string_list_value(ips, i, @str);
|
j := cef_string_list_size(ips);
|
||||||
resolvedIps.Add(CefStringClearAndGet(str));
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(ips, i, @TempString);
|
||||||
|
resolvedIps.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(ips);
|
cef_string_list_free(ips);
|
||||||
@@ -285,15 +291,19 @@ end;
|
|||||||
function TCefRequestContextRef.GetExtensions(const extension_ids: TStringList): boolean;
|
function TCefRequestContextRef.GetExtensions(const extension_ids: TStringList): boolean;
|
||||||
var
|
var
|
||||||
TempIDs : TCefStringList;
|
TempIDs : TCefStringList;
|
||||||
i, j : integer;
|
i, j : NativeUInt;
|
||||||
TempString : TCefString;
|
TempString : TCefString;
|
||||||
|
begin
|
||||||
|
TempIDs := nil;
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
try
|
||||||
|
try
|
||||||
|
if (extension_ids <> nil) then
|
||||||
begin
|
begin
|
||||||
TempIDs := cef_string_list_alloc;
|
TempIDs := cef_string_list_alloc;
|
||||||
|
|
||||||
try
|
if (PCefRequestContext(FData).get_extensions(PCefRequestContext(FData), TempIDs) <> 0) then
|
||||||
Result := PCefRequestContext(FData).get_extensions(FData, TempIDs) <> 0;
|
|
||||||
|
|
||||||
if Assigned(TempIDs) then
|
|
||||||
begin
|
begin
|
||||||
i := 0;
|
i := 0;
|
||||||
j := cef_string_list_size(TempIDs);
|
j := cef_string_list_size(TempIDs);
|
||||||
@@ -305,9 +315,16 @@ begin
|
|||||||
extension_ids.Add(CefStringClearAndGet(TempString));
|
extension_ids.Add(CefStringClearAndGet(TempString));
|
||||||
inc(i);
|
inc(i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefRequestContextRef.GetExtensions', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(TempIDs);
|
if (TempIDs <> nil) then cef_string_list_free(TempIDs);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -84,8 +84,8 @@ procedure cef_resolve_callback_on_resolve_completed(self: PCefResolveCallback;
|
|||||||
resolved_ips: TCefStringList); stdcall;
|
resolved_ips: TCefStringList); stdcall;
|
||||||
var
|
var
|
||||||
TempSL : TStringList;
|
TempSL : TStringList;
|
||||||
i, j : Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
TempSL := nil;
|
TempSL := nil;
|
||||||
|
|
||||||
@@ -97,9 +97,9 @@ begin
|
|||||||
|
|
||||||
while (i < j) do
|
while (i < j) do
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
cef_string_list_value(resolved_ips, i, @str);
|
cef_string_list_value(resolved_ips, i, @TempString);
|
||||||
TempSL.Add(CefStringClearAndGet(str));
|
TempSL.Add(CefStringClearAndGet(TempString));
|
||||||
inc(i);
|
inc(i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces;
|
uCEFBaseRefCounted, uCEFInterfaces;
|
||||||
|
|
||||||
@@ -78,24 +78,37 @@ implementation
|
|||||||
uses
|
uses
|
||||||
uCEFTypes, uCEFMiscFunctions, uCEFLibFunctions;
|
uCEFTypes, uCEFMiscFunctions, uCEFLibFunctions;
|
||||||
|
|
||||||
procedure cef_run_file_dialog_callback_on_file_dialog_dismissed(self: PCefRunFileDialogCallback; selected_accept_filter: Integer; file_paths: TCefStringList); stdcall;
|
procedure cef_run_file_dialog_callback_on_file_dialog_dismissed(self : PCefRunFileDialogCallback;
|
||||||
|
selected_accept_filter : Integer;
|
||||||
|
file_paths : TCefStringList); stdcall;
|
||||||
var
|
var
|
||||||
TempSL : TStringList;
|
TempSL : TStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
TempSL := TStringList.Create;
|
TempSL := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
for i := 0 to cef_string_list_size(file_paths) - 1 do
|
try
|
||||||
|
TempSL := TStringList.Create;
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(file_paths);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
cef_string_list_value(file_paths, i, @str);
|
cef_string_list_value(file_paths, i, @TempString);
|
||||||
TempSL.Add(CefStringClearAndGet(str));
|
TempSL.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCefRunFileDialogCallbackOwn(CefGetObject(self)).OnFileDialogDismissed(selected_accept_filter, TempSL);
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('cef_run_file_dialog_callback_on_file_dialog_dismissed', e) then raise;
|
||||||
end;
|
end;
|
||||||
with TCefRunFileDialogCallbackOwn(CefGetObject(self)) do
|
|
||||||
OnFileDialogDismissed(selected_accept_filter, TempSL);
|
|
||||||
finally
|
finally
|
||||||
TempSL.Free;
|
if (TempSL <> nil) then FreeAndNil(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@@ -100,44 +100,62 @@ uses
|
|||||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFv8Value, uCEFConstants;
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFv8Value, uCEFConstants;
|
||||||
|
|
||||||
function cef_v8_handler_execute(self : PCefv8Handler;
|
function cef_v8_handler_execute(self : PCefv8Handler;
|
||||||
const name: PCefString; obj: PCefv8Value; argumentsCount: NativeUInt;
|
const name : PCefString;
|
||||||
const arguments: PPCefV8Value; var retval: PCefV8Value;
|
obj : PCefv8Value;
|
||||||
|
argumentsCount : NativeUInt;
|
||||||
|
const arguments : PPCefV8Value;
|
||||||
|
var retval : PCefV8Value;
|
||||||
var exception : TCefString): Integer; stdcall;
|
var exception : TCefString): Integer; stdcall;
|
||||||
var
|
var
|
||||||
args : TCefv8ValueArray;
|
args : TCefv8ValueArray;
|
||||||
i: NativeInt;
|
i, j : NativeInt;
|
||||||
ret : ICefv8Value;
|
ret : ICefv8Value;
|
||||||
exc : ustring;
|
exc : ustring;
|
||||||
begin
|
begin
|
||||||
SetLength(args, argumentsCount);
|
i := 0;
|
||||||
for i := 0 to argumentsCount - 1 do
|
j := argumentsCount;
|
||||||
args[i] := TCefv8ValueRef.UnWrap(arguments[i]);
|
|
||||||
|
|
||||||
Result := -Ord(TCefv8HandlerOwn(CefGetObject(self)).Execute(
|
SetLength(args, j);
|
||||||
CefString(name), TCefv8ValueRef.UnWrap(obj), args, ret, exc));
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
args[i] := TCefv8ValueRef.UnWrap(arguments[i]);
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := -Ord(TCefv8HandlerOwn(CefGetObject(self)).Execute(CefString(name), TCefv8ValueRef.UnWrap(obj), args, ret, exc));
|
||||||
retval := CefGetData(ret);
|
retval := CefGetData(ret);
|
||||||
ret := nil;
|
ret := nil;
|
||||||
exception := CefString(exc);
|
exception := CefString(exc);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefv8HandlerRef.Execute(const name: ustring; const obj: ICefv8Value;
|
function TCefv8HandlerRef.Execute(const name : ustring;
|
||||||
const arguments: TCefv8ValueArray; var retval: ICefv8Value;
|
const obj : ICefv8Value;
|
||||||
|
const arguments : TCefv8ValueArray;
|
||||||
|
var retval : ICefv8Value;
|
||||||
var exception : ustring): Boolean;
|
var exception : ustring): Boolean;
|
||||||
var
|
var
|
||||||
args : array of PCefV8Value;
|
args : array of PCefV8Value;
|
||||||
i: Integer;
|
i, j : Integer;
|
||||||
ret : PCefV8Value;
|
ret : PCefV8Value;
|
||||||
exc : TCefString;
|
exc : TCefString;
|
||||||
n : TCefString;
|
n : TCefString;
|
||||||
begin
|
begin
|
||||||
SetLength(args, Length(arguments));
|
i := 0;
|
||||||
for i := 0 to Length(arguments) - 1 do
|
j := Length(arguments);
|
||||||
|
|
||||||
|
SetLength(args, j);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
args[i] := CefGetData(arguments[i]);
|
args[i] := CefGetData(arguments[i]);
|
||||||
ret := nil;
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
FillChar(exc, SizeOf(exc), 0);
|
FillChar(exc, SizeOf(exc), 0);
|
||||||
|
ret := nil;
|
||||||
n := CefString(name);
|
n := CefString(name);
|
||||||
Result := PCefv8Handler(FData)^.execute(PCefv8Handler(FData), @n,
|
Result := PCefv8Handler(FData).execute(PCefv8Handler(FData), @n, CefGetData(obj), Length(arguments), @args, ret, exc) <> 0;
|
||||||
CefGetData(obj), Length(arguments), @args, ret, exc) <> 0;
|
|
||||||
retval := TCefv8ValueRef.UnWrap(ret);
|
retval := TCefv8ValueRef.UnWrap(ret);
|
||||||
exception := CefStringClearAndGet(exc);
|
exception := CefStringClearAndGet(exc);
|
||||||
end;
|
end;
|
||||||
@@ -324,7 +342,7 @@ function TCefRTTIExtension.GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret
|
|||||||
function ProcessVariant: Boolean;
|
function ProcessVariant: Boolean;
|
||||||
var
|
var
|
||||||
vr : Variant;
|
vr : Variant;
|
||||||
i: Integer;
|
i, j : Integer;
|
||||||
vl : TValue;
|
vl : TValue;
|
||||||
begin
|
begin
|
||||||
VarClear(vr);
|
VarClear(vr);
|
||||||
@@ -336,14 +354,20 @@ function TCefRTTIExtension.GetValue(pi: PTypeInfo; const v: ICefv8Value; var ret
|
|||||||
if v.IsNull then TVarData(vr).VType := varNull else
|
if v.IsNull then TVarData(vr).VType := varNull else
|
||||||
if v.IsArray then
|
if v.IsArray then
|
||||||
begin
|
begin
|
||||||
vr := VarArrayCreate([0, v.GetArrayLength], varVariant);
|
i := 0;
|
||||||
for i := 0 to v.GetArrayLength - 1 do
|
j := v.GetArrayLength;
|
||||||
|
vr := VarArrayCreate([0, j], varVariant);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
begin
|
begin
|
||||||
if not GetValue(pi, v.GetValueByIndex(i), vl) then Exit(False);
|
if not GetValue(pi, v.GetValueByIndex(i), vl) then Exit(False);
|
||||||
VarArrayPut(vr, vl.AsVariant, i);
|
VarArrayPut(vr, vl.AsVariant, i);
|
||||||
|
inc(i);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end else
|
end else
|
||||||
Exit(False);
|
Exit(False);
|
||||||
|
|
||||||
TValue.Make(@vr, pi, ret);
|
TValue.Make(@vr, pi, ret);
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
@@ -48,9 +48,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
{$IFDEF DELPHI16_UP}
|
{$IFDEF DELPHI16_UP}
|
||||||
System.Classes,
|
System.Classes, System.SysUtils,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
Classes,
|
Classes, SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFv8Types;
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFv8Types;
|
||||||
|
|
||||||
@@ -222,37 +222,80 @@ begin
|
|||||||
Result := PCefV8Value(FData)^.delete_value_bykey(PCefV8Value(FData), @k) <> 0;
|
Result := PCefV8Value(FData)^.delete_value_bykey(PCefV8Value(FData), @k) <> 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefv8ValueRef.ExecuteFunction(const obj: ICefv8Value;
|
function TCefv8ValueRef.ExecuteFunction(const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value;
|
||||||
const arguments: TCefv8ValueArray): ICefv8Value;
|
|
||||||
var
|
var
|
||||||
args : PPCefV8Value;
|
args : PPCefV8Value;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
begin
|
begin
|
||||||
GetMem(args, SizeOf(PCefV8Value) * Length(arguments));
|
Result := nil;
|
||||||
|
args := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
for i := 0 to Length(arguments) - 1 do
|
try
|
||||||
|
if (arguments <> nil) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
j := Length(arguments);
|
||||||
|
|
||||||
|
GetMem(args, SizeOf(PCefV8Value) * j);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
args[i] := CefGetData(arguments[i]);
|
args[i] := CefGetData(arguments[i]);
|
||||||
Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData)^.execute_function(PCefV8Value(FData),
|
inc(i);
|
||||||
CefGetData(obj), Length(arguments), args));
|
end;
|
||||||
|
|
||||||
|
Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData).execute_function(PCefV8Value(FData),
|
||||||
|
CefGetData(obj),
|
||||||
|
j,
|
||||||
|
args));
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefv8ValueRef.ExecuteFunction', e) then raise;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
FreeMem(args);
|
if (args <> nil) then FreeMem(args);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefv8ValueRef.ExecuteFunctionWithContext(const context : ICefv8Context;
|
function TCefv8ValueRef.ExecuteFunctionWithContext(const context : ICefv8Context;
|
||||||
const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value;
|
const obj : ICefv8Value;
|
||||||
|
const arguments : TCefv8ValueArray): ICefv8Value;
|
||||||
var
|
var
|
||||||
args : PPCefV8Value;
|
args : PPCefV8Value;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
begin
|
begin
|
||||||
GetMem(args, SizeOf(PCefV8Value) * Length(arguments));
|
Result := nil;
|
||||||
|
args := nil;
|
||||||
|
|
||||||
try
|
try
|
||||||
for i := 0 to Length(arguments) - 1 do
|
try
|
||||||
|
if (arguments <> nil) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
j := Length(arguments);
|
||||||
|
|
||||||
|
GetMem(args, SizeOf(PCefV8Value) * j);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
args[i] := CefGetData(arguments[i]);
|
args[i] := CefGetData(arguments[i]);
|
||||||
Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData)^.execute_function_with_context(PCefV8Value(FData),
|
inc(i);
|
||||||
CefGetData(context), CefGetData(obj), Length(arguments), args));
|
end;
|
||||||
|
|
||||||
|
Result := TCefv8ValueRef.UnWrap(PCefV8Value(FData).execute_function_with_context(PCefV8Value(FData),
|
||||||
|
CefGetData(context),
|
||||||
|
CefGetData(obj),
|
||||||
|
j,
|
||||||
|
args));
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefv8ValueRef.ExecuteFunctionWithContext', e) then raise;
|
||||||
|
end;
|
||||||
finally
|
finally
|
||||||
FreeMem(args);
|
if (args <> nil) then FreeMem(args);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -303,22 +346,41 @@ end;
|
|||||||
|
|
||||||
function TCefv8ValueRef.GetKeys(const keys: TStrings): Integer;
|
function TCefv8ValueRef.GetKeys(const keys: TStrings): Integer;
|
||||||
var
|
var
|
||||||
list: TCefStringList;
|
TempSL : TCefStringList;
|
||||||
i: Integer;
|
i, j : NativeUInt;
|
||||||
str: TCefString;
|
TempString : TCefString;
|
||||||
begin
|
begin
|
||||||
list := cef_string_list_alloc;
|
TempSL := nil;
|
||||||
|
Result := 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
Result := PCefV8Value(FData)^.get_keys(PCefV8Value(FData), list);
|
try
|
||||||
FillChar(str, SizeOf(str), 0);
|
if (keys <> nil) then
|
||||||
for i := 0 to cef_string_list_size(list) - 1 do
|
|
||||||
begin
|
begin
|
||||||
FillChar(str, SizeOf(str), 0);
|
TempSL := cef_string_list_alloc;
|
||||||
cef_string_list_value(list, i, @str);
|
|
||||||
keys.Add(CefStringClearAndGet(str));
|
if (PCefV8Value(FData).get_keys(PCefV8Value(FData), TempSL) <> 0) then
|
||||||
|
begin
|
||||||
|
i := 0;
|
||||||
|
j := cef_string_list_size(TempSL);
|
||||||
|
|
||||||
|
while (i < j) do
|
||||||
|
begin
|
||||||
|
FillChar(TempString, SizeOf(TempString), 0);
|
||||||
|
cef_string_list_value(TempSL, i, @TempString);
|
||||||
|
keys.Add(CefStringClearAndGet(TempString));
|
||||||
|
inc(i);
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result := j;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
except
|
||||||
|
on e : exception do
|
||||||
|
if CustomExceptionHandler('TCefv8ValueRef.GetKeys', e) then raise;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
cef_string_list_free(list);
|
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user