mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-02-02 10:25:26 +02:00
More checks before "for" loops to avoid variable wrap arounds
This commit is contained in:
parent
d31825a7a5
commit
8402ba077f
@ -333,23 +333,25 @@ begin
|
||||
PCefBrowserHost(FData).close_dev_tools(FData);
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.DownloadImage(const imageUrl: ustring;
|
||||
isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean;
|
||||
const callback: ICefDownloadImageCallback);
|
||||
procedure TCefBrowserHostRef.DownloadImage(const imageUrl : ustring;
|
||||
isFavicon : Boolean;
|
||||
maxImageSize : Cardinal;
|
||||
bypassCache : Boolean;
|
||||
const callback : ICefDownloadImageCallback);
|
||||
var
|
||||
url: TCefString;
|
||||
begin
|
||||
url := CefString(imageUrl);
|
||||
PCefBrowserHost(FData).download_image(FData, @url, Ord(isFavicon), maxImageSize,
|
||||
Ord(bypassCache), CefGetData(callback));
|
||||
PCefBrowserHost(FData).download_image(FData, @url, Ord(isFavicon), maxImageSize, Ord(bypassCache), CefGetData(callback));
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.DownloadImageProc(const imageUrl: ustring;
|
||||
isFavicon: Boolean; maxImageSize: Cardinal; bypassCache: Boolean;
|
||||
const callback: TOnDownloadImageFinishedProc);
|
||||
procedure TCefBrowserHostRef.DownloadImageProc(const imageUrl : ustring;
|
||||
isFavicon : Boolean;
|
||||
maxImageSize : Cardinal;
|
||||
bypassCache : Boolean;
|
||||
const callback : TOnDownloadImageFinishedProc);
|
||||
begin
|
||||
DownloadImage(imageUrl, isFavicon, maxImageSize, bypassCache,
|
||||
TCefFastDownloadImageCallback.Create(callback));
|
||||
DownloadImage(imageUrl, isFavicon, maxImageSize, bypassCache, TCefFastDownloadImageCallback.Create(callback));
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.DragSourceEndedAt(x, y: Integer; op: TCefDragOperation);
|
||||
@ -409,8 +411,7 @@ begin
|
||||
PCefBrowserHost(FData).drag_target_drop(FData, event);
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.Find(identifier: Integer;
|
||||
const searchText: ustring; forward, matchCase, findNext: Boolean);
|
||||
procedure TCefBrowserHostRef.Find(identifier: Integer; const searchText: ustring; forward, matchCase, findNext: Boolean);
|
||||
var
|
||||
s: TCefString;
|
||||
begin
|
||||
@ -428,8 +429,9 @@ begin
|
||||
PCefBrowserHost(FData).print(FData);
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.PrintToPdf(const path: ustring;
|
||||
settings: PCefPdfPrintSettings; const callback: ICefPdfPrintCallback);
|
||||
procedure TCefBrowserHostRef.PrintToPdf(const path : ustring;
|
||||
settings : PCefPdfPrintSettings;
|
||||
const callback : ICefPdfPrintCallback);
|
||||
var
|
||||
str: TCefString;
|
||||
begin
|
||||
@ -437,8 +439,9 @@ begin
|
||||
PCefBrowserHost(FData).print_to_pdf(FData, @str, settings, CefGetData(callback));
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.PrintToPdfProc(const path: ustring;
|
||||
settings: PCefPdfPrintSettings; const callback: TOnPdfPrintFinishedProc);
|
||||
procedure TCefBrowserHostRef.PrintToPdfProc(const path : ustring;
|
||||
settings : PCefPdfPrintSettings;
|
||||
const callback : TOnPdfPrintFinishedProc);
|
||||
begin
|
||||
PrintToPdf(path, settings, TCefFastPdfPrintCallback.Create(callback));
|
||||
end;
|
||||
@ -458,23 +461,38 @@ procedure TCefBrowserHostRef.RunFileDialog( mode : TCefFile
|
||||
selectedAcceptFilter : Integer;
|
||||
const callback : ICefRunFileDialogCallback);
|
||||
var
|
||||
t, f: TCefString;
|
||||
list: TCefStringList;
|
||||
item: TCefString;
|
||||
i: Integer;
|
||||
TempTitle, TempPath, TempItem : TCefString;
|
||||
TempSL : TCefStringList;
|
||||
i : Integer;
|
||||
begin
|
||||
t := CefString(title);
|
||||
f := CefString(defaultFilePath);
|
||||
list := cef_string_list_alloc();
|
||||
TempSL := nil;
|
||||
|
||||
try
|
||||
for i := 0 to acceptFilters.Count - 1 do
|
||||
begin
|
||||
item := CefString(acceptFilters[i]);
|
||||
cef_string_list_append(list, @item);
|
||||
try
|
||||
TempTitle := CefString(title);
|
||||
TempPath := CefString(defaultFilePath);
|
||||
TempSL := cef_string_list_alloc;
|
||||
|
||||
if (acceptFilters <> nil) and (acceptFilters.Count > 0) then
|
||||
for i := 0 to acceptFilters.Count - 1 do
|
||||
begin
|
||||
TempItem := CefString(acceptFilters[i]);
|
||||
cef_string_list_append(TempSL, @TempItem);
|
||||
end;
|
||||
|
||||
PCefBrowserHost(FData).run_file_dialog(PCefBrowserHost(FData),
|
||||
mode,
|
||||
@TempTitle,
|
||||
@TempPath,
|
||||
TempSL,
|
||||
selectedAcceptFilter,
|
||||
CefGetData(callback));
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCefBrowserHostRef.RunFileDialog', e) then raise;
|
||||
end;
|
||||
PCefBrowserHost(FData).run_file_dialog(PCefBrowserHost(FData), mode, @t, @f, list, selectedAcceptFilter, CefGetData(callback));
|
||||
finally
|
||||
cef_string_list_free(list);
|
||||
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -516,20 +534,20 @@ begin
|
||||
PCefBrowserHost(FData).send_key_event(FData, event);
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.SendMouseClickEvent(const event: PCefMouseEvent;
|
||||
kind: TCefMouseButtonType; mouseUp: Boolean; clickCount: Integer);
|
||||
procedure TCefBrowserHostRef.SendMouseClickEvent(const event : PCefMouseEvent;
|
||||
kind : TCefMouseButtonType;
|
||||
mouseUp : Boolean;
|
||||
clickCount : Integer);
|
||||
begin
|
||||
PCefBrowserHost(FData).send_mouse_click_event(FData, event, kind, Ord(mouseUp), clickCount);
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.SendMouseMoveEvent(const event: PCefMouseEvent;
|
||||
mouseLeave: Boolean);
|
||||
procedure TCefBrowserHostRef.SendMouseMoveEvent(const event: PCefMouseEvent; mouseLeave: Boolean);
|
||||
begin
|
||||
PCefBrowserHost(FData).send_mouse_move_event(FData, event, Ord(mouseLeave));
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.SendMouseWheelEvent(const event: PCefMouseEvent;
|
||||
deltaX, deltaY: Integer);
|
||||
procedure TCefBrowserHostRef.SendMouseWheelEvent(const event: PCefMouseEvent; deltaX, deltaY: Integer);
|
||||
begin
|
||||
PCefBrowserHost(FData).send_mouse_wheel_event(FData, event, deltaX, deltaY);
|
||||
end;
|
||||
@ -569,14 +587,12 @@ begin
|
||||
Result := TCefRequestContextRef.UnWrap(PCefBrowserHost(FData).get_request_context(FData));
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.GetNavigationEntries(
|
||||
const visitor: ICefNavigationEntryVisitor; currentOnly: Boolean);
|
||||
procedure TCefBrowserHostRef.GetNavigationEntries(const visitor: ICefNavigationEntryVisitor; currentOnly: Boolean);
|
||||
begin
|
||||
PCefBrowserHost(FData).get_navigation_entries(FData, CefGetData(visitor), Ord(currentOnly));
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.GetNavigationEntriesProc(
|
||||
const proc: TCefNavigationEntryVisitorProc; currentOnly: Boolean);
|
||||
procedure TCefBrowserHostRef.GetNavigationEntriesProc(const proc: TCefNavigationEntryVisitorProc; currentOnly: Boolean);
|
||||
begin
|
||||
GetNavigationEntries(TCefFastNavigationEntryVisitor.Create(proc), currentOnly);
|
||||
end;
|
||||
@ -586,7 +602,11 @@ begin
|
||||
Result := PCefBrowserHost(FData).get_zoom_level(PCefBrowserHost(FData));
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.IMESetComposition(const text: ustring; underlinesCount : NativeUInt; const underlines : PCefCompositionUnderline; const replacement_range, selection_range : PCefRange);
|
||||
procedure TCefBrowserHostRef.IMESetComposition(const text : ustring;
|
||||
underlinesCount : NativeUInt;
|
||||
const underlines : PCefCompositionUnderline;
|
||||
const replacement_range : PCefRange;
|
||||
const selection_range : PCefRange);
|
||||
var
|
||||
TempString : TCefString;
|
||||
begin
|
||||
@ -652,12 +672,12 @@ begin
|
||||
PCefBrowserHost(FData).set_zoom_level(PCefBrowserHost(FData), zoomLevel);
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.ShowDevTools(const windowInfo: PCefWindowInfo;
|
||||
const client: ICefClient; const settings: PCefBrowserSettings;
|
||||
inspectElementAt: PCefPoint);
|
||||
procedure TCefBrowserHostRef.ShowDevTools(const windowInfo : PCefWindowInfo;
|
||||
const client : ICefClient;
|
||||
const settings : PCefBrowserSettings;
|
||||
inspectElementAt : PCefPoint);
|
||||
begin
|
||||
PCefBrowserHost(FData).show_dev_tools(FData, windowInfo, CefGetData(client),
|
||||
settings, inspectElementAt);
|
||||
PCefBrowserHost(FData).show_dev_tools(FData, windowInfo, CefGetData(client), settings, inspectElementAt);
|
||||
end;
|
||||
|
||||
procedure TCefBrowserHostRef.StartDownload(const url: ustring);
|
||||
|
@ -59,18 +59,18 @@ type
|
||||
protected
|
||||
procedure SetSupportedSchemes(const schemes: TStrings; const callback: ICefCompletionCallback);
|
||||
procedure SetSupportedSchemesProc(const schemes: TStrings; const callback: TCefCompletionCallbackProc);
|
||||
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
|
||||
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
|
||||
function VisitUrlCookies(const url: ustring; includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean;
|
||||
function VisitUrlCookiesProc(const url: ustring; includeHttpOnly: Boolean; const visitor: TCefCookieVisitorProc): Boolean;
|
||||
function SetCookie(const url: ustring; const name, value, domain, path: ustring; secure, httponly, hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; const callback: ICefSetCookieCallback): Boolean;
|
||||
function SetCookieProc(const url: ustring; const name, value, domain, path: ustring; secure, httponly, hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; const callback: TCefSetCookieCallbackProc): Boolean;
|
||||
function DeleteCookies(const url, cookieName: ustring; const callback: ICefDeleteCookiesCallback): Boolean;
|
||||
function DeleteCookiesProc(const url, cookieName: ustring; const callback: TCefDeleteCookiesCallbackProc): Boolean;
|
||||
function SetStoragePath(const path: ustring; persistSessionCookies: Boolean; const callback: ICefCompletionCallback): Boolean;
|
||||
function SetStoragePathProc(const path: ustring; persistSessionCookies: Boolean; const callback: TCefCompletionCallbackProc): Boolean;
|
||||
function FlushStore(const handler: ICefCompletionCallback): Boolean;
|
||||
function FlushStoreProc(const proc: TCefCompletionCallbackProc): Boolean;
|
||||
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
|
||||
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
|
||||
function VisitUrlCookies(const url: ustring; includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean;
|
||||
function VisitUrlCookiesProc(const url: ustring; includeHttpOnly: Boolean; const visitor: TCefCookieVisitorProc): Boolean;
|
||||
function SetCookie(const url: ustring; const name, value, domain, path: ustring; secure, httponly, hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; const callback: ICefSetCookieCallback): Boolean;
|
||||
function SetCookieProc(const url: ustring; const name, value, domain, path: ustring; secure, httponly, hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; const callback: TCefSetCookieCallbackProc): Boolean;
|
||||
function DeleteCookies(const url, cookieName: ustring; const callback: ICefDeleteCookiesCallback): Boolean;
|
||||
function DeleteCookiesProc(const url, cookieName: ustring; const callback: TCefDeleteCookiesCallbackProc): Boolean;
|
||||
function SetStoragePath(const path: ustring; persistSessionCookies: Boolean; const callback: ICefCompletionCallback): Boolean;
|
||||
function SetStoragePathProc(const path: ustring; persistSessionCookies: Boolean; const callback: TCefCompletionCallbackProc): Boolean;
|
||||
function FlushStore(const handler: ICefCompletionCallback): Boolean;
|
||||
function FlushStoreProc(const proc: TCefCompletionCallbackProc): Boolean;
|
||||
|
||||
public
|
||||
class function UnWrap(data: Pointer): ICefCookieManager;
|
||||
@ -86,8 +86,9 @@ uses
|
||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFCompletionCallback, uCEFDeleteCookiesCallback,
|
||||
uCEFSetCookieCallback, uCEFCookieVisitor;
|
||||
|
||||
class function TCefCookieManagerRef.New(const path: ustring; persistSessionCookies: Boolean;
|
||||
const callback: ICefCompletionCallback): ICefCookieManager;
|
||||
class function TCefCookieManagerRef.New(const path : ustring;
|
||||
persistSessionCookies : Boolean;
|
||||
const callback : ICefCompletionCallback): ICefCookieManager;
|
||||
var
|
||||
pth: TCefString;
|
||||
begin
|
||||
@ -95,39 +96,37 @@ begin
|
||||
Result := UnWrap(cef_cookie_manager_create_manager(@pth, Ord(persistSessionCookies), CefGetData(callback)));
|
||||
end;
|
||||
|
||||
class function TCefCookieManagerRef.NewProc(const path: ustring;
|
||||
persistSessionCookies: Boolean;
|
||||
const callback: TCefCompletionCallbackProc): ICefCookieManager;
|
||||
class function TCefCookieManagerRef.NewProc(const path : ustring;
|
||||
persistSessionCookies : Boolean;
|
||||
const callback : TCefCompletionCallbackProc): ICefCookieManager;
|
||||
begin
|
||||
Result := New(path, persistSessionCookies, TCefFastCompletionCallback.Create(callback));
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.DeleteCookies(const url,
|
||||
cookieName: ustring; const callback: ICefDeleteCookiesCallback): Boolean;
|
||||
function TCefCookieManagerRef.DeleteCookies(const url : ustring;
|
||||
const cookieName : ustring;
|
||||
const callback : ICefDeleteCookiesCallback): Boolean;
|
||||
var
|
||||
u, n: TCefString;
|
||||
begin
|
||||
u := CefString(url);
|
||||
n := CefString(cookieName);
|
||||
Result := PCefCookieManager(FData).delete_cookies(
|
||||
PCefCookieManager(FData), @u, @n, CefGetData(callback)) <> 0;
|
||||
u := CefString(url);
|
||||
n := CefString(cookieName);
|
||||
Result := PCefCookieManager(FData).delete_cookies(PCefCookieManager(FData), @u, @n, CefGetData(callback)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.DeleteCookiesProc(const url, cookieName: ustring;
|
||||
const callback: TCefDeleteCookiesCallbackProc): Boolean;
|
||||
function TCefCookieManagerRef.DeleteCookiesProc(const url : ustring;
|
||||
const cookieName : ustring;
|
||||
const callback : TCefDeleteCookiesCallbackProc): Boolean;
|
||||
begin
|
||||
Result := DeleteCookies(url, cookieName, TCefFastDeleteCookiesCallback.Create(callback));
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.FlushStore(
|
||||
const handler: ICefCompletionCallback): Boolean;
|
||||
function TCefCookieManagerRef.FlushStore(const handler: ICefCompletionCallback): Boolean;
|
||||
begin
|
||||
Result := PCefCookieManager(FData).flush_store(PCefCookieManager(FData),
|
||||
CefGetData(handler)) <> 0;
|
||||
Result := PCefCookieManager(FData).flush_store(PCefCookieManager(FData), CefGetData(handler)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.FlushStoreProc(
|
||||
const proc: TCefCompletionCallbackProc): Boolean;
|
||||
function TCefCookieManagerRef.FlushStoreProc(const proc: TCefCompletionCallbackProc): Boolean;
|
||||
begin
|
||||
Result := FlushStore(TCefFastCompletionCallback.Create(proc))
|
||||
end;
|
||||
@ -137,59 +136,62 @@ begin
|
||||
Result := UnWrap(cef_cookie_manager_get_global_manager(CefGetData(callback)));
|
||||
end;
|
||||
|
||||
class function TCefCookieManagerRef.GlobalProc(
|
||||
const callback: TCefCompletionCallbackProc): ICefCookieManager;
|
||||
class function TCefCookieManagerRef.GlobalProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;
|
||||
begin
|
||||
Result := Global(TCefFastCompletionCallback.Create(callback));
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.SetCookie(const url, name, value, domain,
|
||||
path: ustring; secure, httponly, hasExpires: Boolean; const creation,
|
||||
lastAccess, expires: TDateTime; const callback: ICefSetCookieCallback): Boolean;
|
||||
function TCefCookieManagerRef.SetCookie(const url, name, value, domain, path: ustring;
|
||||
secure, httponly, hasExpires: Boolean;
|
||||
const creation, lastAccess, expires: TDateTime;
|
||||
const callback: ICefSetCookieCallback): Boolean;
|
||||
var
|
||||
str: TCefString;
|
||||
cook: TCefCookie;
|
||||
str : TCefString;
|
||||
cook : TCefCookie;
|
||||
begin
|
||||
str := CefString(url);
|
||||
cook.name := CefString(name);
|
||||
cook.value := CefString(value);
|
||||
cook.domain := CefString(domain);
|
||||
cook.path := CefString(path);
|
||||
cook.secure := Ord(secure);
|
||||
cook.httponly := Ord(httponly);
|
||||
cook.creation := DateTimeToCefTime(creation);
|
||||
str := CefString(url);
|
||||
cook.name := CefString(name);
|
||||
cook.value := CefString(value);
|
||||
cook.domain := CefString(domain);
|
||||
cook.path := CefString(path);
|
||||
cook.secure := Ord(secure);
|
||||
cook.httponly := Ord(httponly);
|
||||
cook.creation := DateTimeToCefTime(creation);
|
||||
cook.last_access := DateTimeToCefTime(lastAccess);
|
||||
cook.has_expires := Ord(hasExpires);
|
||||
|
||||
if hasExpires then
|
||||
cook.expires := DateTimeToCefTime(expires) else
|
||||
cook.expires := DateTimeToCefTime(expires)
|
||||
else
|
||||
FillChar(cook.expires, SizeOf(TCefTime), 0);
|
||||
Result := PCefCookieManager(FData).set_cookie(
|
||||
PCefCookieManager(FData), @str, @cook, CefGetData(callback)) <> 0;
|
||||
|
||||
Result := PCefCookieManager(FData).set_cookie(PCefCookieManager(FData), @str, @cook, CefGetData(callback)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.SetCookieProc(const url, name, value, domain,
|
||||
path: ustring; secure, httponly, hasExpires: Boolean; const creation,
|
||||
lastAccess, expires: TDateTime;
|
||||
const callback: TCefSetCookieCallbackProc): Boolean;
|
||||
function TCefCookieManagerRef.SetCookieProc(const url, name, value, domain, path: ustring;
|
||||
secure, httponly, hasExpires: Boolean;
|
||||
const creation, lastAccess, expires: TDateTime;
|
||||
const callback: TCefSetCookieCallbackProc): Boolean;
|
||||
begin
|
||||
Result := SetCookie(url, name, value, domain, path, secure,
|
||||
httponly, hasExpires, creation, lastAccess, expires,
|
||||
TCefFastSetCookieCallback.Create(callback));
|
||||
Result := SetCookie(url, name, value, domain, path,
|
||||
secure, httponly, hasExpires,
|
||||
creation, lastAccess, expires,
|
||||
TCefFastSetCookieCallback.Create(callback));
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.SetStoragePath(const path: ustring;
|
||||
persistSessionCookies: Boolean; const callback: ICefCompletionCallback): Boolean;
|
||||
function TCefCookieManagerRef.SetStoragePath(const path : ustring;
|
||||
persistSessionCookies : Boolean;
|
||||
const callback : ICefCompletionCallback): Boolean;
|
||||
var
|
||||
p: TCefString;
|
||||
begin
|
||||
p := CefString(path);
|
||||
Result := PCefCookieManager(FData)^.set_storage_path(
|
||||
PCefCookieManager(FData), @p, Ord(persistSessionCookies), CefGetData(callback)) <> 0;
|
||||
p := CefString(path);
|
||||
Result := PCefCookieManager(FData)^.set_storage_path(PCefCookieManager(FData), @p, Ord(persistSessionCookies), CefGetData(callback)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.SetStoragePathProc(const path: ustring;
|
||||
persistSessionCookies: Boolean;
|
||||
const callback: TCefCompletionCallbackProc): Boolean;
|
||||
function TCefCookieManagerRef.SetStoragePathProc(const path : ustring;
|
||||
persistSessionCookies : Boolean;
|
||||
const callback : TCefCompletionCallbackProc): Boolean;
|
||||
begin
|
||||
Result := SetStoragePath(path, persistSessionCookies, TCefFastCompletionCallback.Create(callback));
|
||||
end;
|
||||
@ -232,39 +234,37 @@ end;
|
||||
|
||||
class function TCefCookieManagerRef.UnWrap(data: Pointer): ICefCookieManager;
|
||||
begin
|
||||
if data <> nil then
|
||||
Result := Create(data) as ICefCookieManager else
|
||||
if (data <> nil) then
|
||||
Result := Create(data) as ICefCookieManager
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.VisitAllCookies(
|
||||
const visitor: ICefCookieVisitor): Boolean;
|
||||
function TCefCookieManagerRef.VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
|
||||
begin
|
||||
Result := PCefCookieManager(FData).visit_all_cookies(
|
||||
PCefCookieManager(FData), CefGetData(visitor)) <> 0;
|
||||
Result := PCefCookieManager(FData).visit_all_cookies(PCefCookieManager(FData), CefGetData(visitor)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.VisitAllCookiesProc(
|
||||
const visitor: TCefCookieVisitorProc): Boolean;
|
||||
function TCefCookieManagerRef.VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
|
||||
begin
|
||||
Result := VisitAllCookies(
|
||||
TCefFastCookieVisitor.Create(visitor) as ICefCookieVisitor);
|
||||
Result := VisitAllCookies(TCefFastCookieVisitor.Create(visitor) as ICefCookieVisitor);
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.VisitUrlCookies(const url: ustring;
|
||||
includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean;
|
||||
function TCefCookieManagerRef.VisitUrlCookies(const url : ustring;
|
||||
includeHttpOnly : Boolean;
|
||||
const visitor : ICefCookieVisitor): Boolean;
|
||||
var
|
||||
str: TCefString;
|
||||
str : TCefString;
|
||||
begin
|
||||
str := CefString(url);
|
||||
str := CefString(url);
|
||||
Result := PCefCookieManager(FData).visit_url_cookies(PCefCookieManager(FData), @str, Ord(includeHttpOnly), CefGetData(visitor)) <> 0;
|
||||
end;
|
||||
|
||||
function TCefCookieManagerRef.VisitUrlCookiesProc(const url: ustring;
|
||||
includeHttpOnly: Boolean; const visitor: TCefCookieVisitorProc): Boolean;
|
||||
function TCefCookieManagerRef.VisitUrlCookiesProc(const url : ustring;
|
||||
includeHttpOnly : Boolean;
|
||||
const visitor : TCefCookieVisitorProc): Boolean;
|
||||
begin
|
||||
Result := VisitUrlCookies(url, includeHttpOnly,
|
||||
TCefFastCookieVisitor.Create(visitor) as ICefCookieVisitor);
|
||||
Result := VisitUrlCookies(url, includeHttpOnly, TCefFastCookieVisitor.Create(visitor) as ICefCookieVisitor);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -48,9 +48,9 @@ interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
System.Classes,
|
||||
System.Classes, System.SysUtils,
|
||||
{$ELSE}
|
||||
Classes,
|
||||
Classes, SysUtils,
|
||||
{$ENDIF}
|
||||
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||
|
||||
@ -75,20 +75,31 @@ end;
|
||||
|
||||
procedure TCefFileDialogCallbackRef.Cont(selectedAcceptFilter: Integer; const filePaths: TStrings);
|
||||
var
|
||||
list: TCefStringList;
|
||||
i: Integer;
|
||||
str: TCefString;
|
||||
TempSL : TCefStringList;
|
||||
i : Integer;
|
||||
TempString : TCefString;
|
||||
begin
|
||||
list := cef_string_list_alloc;
|
||||
TempSL := nil;
|
||||
|
||||
|
||||
try
|
||||
for i := 0 to filePaths.Count - 1 do
|
||||
begin
|
||||
str := CefString(filePaths[i]);
|
||||
cef_string_list_append(list, @str);
|
||||
try
|
||||
TempSL := cef_string_list_alloc;
|
||||
|
||||
if (filePaths <> nil) and (filePaths.Count > 0) then
|
||||
for i := 0 to filePaths.Count - 1 do
|
||||
begin
|
||||
TempString := CefString(filePaths[i]);
|
||||
cef_string_list_append(TempSL, @TempString);
|
||||
end;
|
||||
|
||||
PCefFileDialogCallback(FData).cont(PCefFileDialogCallback(FData), selectedAcceptFilter, TempSL);
|
||||
except
|
||||
on e : exception do
|
||||
if CustomExceptionHandler('TCefFileDialogCallbackRef.Cont', e) then raise;
|
||||
end;
|
||||
PCefFileDialogCallback(FData).cont(FData, selectedAcceptFilter, list);
|
||||
finally
|
||||
cef_string_list_free(list);
|
||||
if (TempSL <> nil) then cef_string_list_free(TempSL);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user