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