2017-01-27 17:37:51 +02:00
|
|
|
// ************************************************************************
|
|
|
|
// ***************************** CEF4Delphi *******************************
|
|
|
|
// ************************************************************************
|
|
|
|
//
|
2019-10-19 10:58:34 +02:00
|
|
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
2017-01-27 17:37:51 +02:00
|
|
|
// browser in Delphi applications.
|
|
|
|
//
|
|
|
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
|
|
|
//
|
|
|
|
// For more information about CEF4Delphi visit :
|
|
|
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
|
|
|
//
|
2020-01-01 13:48:10 +02:00
|
|
|
// Copyright � 2020 Salvador Diaz Fau. All rights reserved.
|
2017-01-27 17:37:51 +02:00
|
|
|
//
|
|
|
|
// ************************************************************************
|
|
|
|
// ************ vvvv Original license and comments below vvvv *************
|
|
|
|
// ************************************************************************
|
|
|
|
(*
|
|
|
|
* Delphi Chromium Embedded 3
|
|
|
|
*
|
|
|
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
|
|
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
|
|
* the specific language governing rights and limitations under the License.
|
|
|
|
*
|
|
|
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
|
|
|
* Web site : http://www.progdigy.com
|
|
|
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
|
|
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
|
|
|
*
|
|
|
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
|
|
|
* this source code without explicit permission.
|
|
|
|
*
|
|
|
|
*)
|
|
|
|
|
|
|
|
unit uCEFRequestContext;
|
|
|
|
|
2018-05-12 14:50:54 +02:00
|
|
|
{$IFDEF FPC}
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
{$ENDIF}
|
|
|
|
|
2018-11-22 16:02:21 +02:00
|
|
|
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
|
|
|
|
{$MINENUMSIZE 4}
|
2017-01-27 17:37:51 +02:00
|
|
|
|
2017-02-05 21:56:46 +02:00
|
|
|
{$I cef.inc}
|
|
|
|
|
2017-01-27 17:37:51 +02:00
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2017-02-05 21:56:46 +02:00
|
|
|
{$IFDEF DELPHI16_UP}
|
2018-02-26 19:40:51 +02:00
|
|
|
System.Classes, System.SysUtils,
|
2017-02-05 21:56:46 +02:00
|
|
|
{$ELSE}
|
2018-02-26 19:40:51 +02:00
|
|
|
Classes, SysUtils,
|
2017-02-05 21:56:46 +02:00
|
|
|
{$ENDIF}
|
2019-10-08 15:03:22 +02:00
|
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFCompletionCallback;
|
2017-01-27 17:37:51 +02:00
|
|
|
|
|
|
|
type
|
2017-03-16 20:09:42 +02:00
|
|
|
TCefRequestContextRef = class(TCefBaseRefCountedRef, ICefRequestContext)
|
2017-01-27 17:37:51 +02:00
|
|
|
protected
|
2017-10-26 13:23:13 +02:00
|
|
|
function IsSame(const other: ICefRequestContext): Boolean;
|
|
|
|
function IsSharingWith(const other: ICefRequestContext): Boolean;
|
|
|
|
function IsGlobal: Boolean;
|
|
|
|
function GetHandler: ICefRequestContextHandler;
|
|
|
|
function GetCachePath: ustring;
|
2019-06-16 10:31:13 +02:00
|
|
|
function GetCookieManager(const callback: ICefCompletionCallback): ICefCookieManager;
|
|
|
|
function GetCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;
|
2017-10-26 13:23:13 +02:00
|
|
|
function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean;
|
|
|
|
function ClearSchemeHandlerFactories: Boolean;
|
2017-01-27 17:37:51 +02:00
|
|
|
procedure PurgePluginListCache(reloadPages: Boolean);
|
2017-10-26 13:23:13 +02:00
|
|
|
function HasPreference(const name: ustring): Boolean;
|
|
|
|
function GetPreference(const name: ustring): ICefValue;
|
|
|
|
function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue;
|
|
|
|
function CanSetPreference(const name: ustring): Boolean;
|
|
|
|
function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean;
|
2017-01-27 17:37:51 +02:00
|
|
|
procedure ClearCertificateExceptions(const callback: ICefCompletionCallback);
|
2019-07-18 11:48:11 +02:00
|
|
|
procedure ClearHttpAuthCredentials(const callback: ICefCompletionCallback);
|
2017-01-27 17:37:51 +02:00
|
|
|
procedure CloseAllConnections(const callback: ICefCompletionCallback);
|
|
|
|
procedure ResolveHost(const origin: ustring; const callback: ICefResolveCallback);
|
2017-10-26 13:23:13 +02:00
|
|
|
procedure LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue; const handler: ICefExtensionHandler);
|
|
|
|
function DidLoadExtension(const extension_id: ustring): boolean;
|
|
|
|
function HasExtension(const extension_id: ustring): boolean;
|
|
|
|
function GetExtensions(const extension_ids: TStringList): boolean;
|
|
|
|
function GetExtension(const extension_id: ustring): ICefExtension;
|
2017-01-27 17:37:51 +02:00
|
|
|
|
|
|
|
public
|
|
|
|
class function UnWrap(data: Pointer): ICefRequestContext;
|
|
|
|
class function Global: ICefRequestContext;
|
2017-09-29 18:42:12 +02:00
|
|
|
class function New(const settings: PCefRequestContextSettings; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;
|
2019-10-30 11:26:48 +02:00
|
|
|
class function New(const aCache, aAcceptLanguageList : ustring; aPersistSessionCookies, aPersistUserPreferences, aIgnoreCertificateErrors : boolean; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;
|
2017-01-27 17:37:51 +02:00
|
|
|
class function Shared(const other: ICefRequestContext; const handler: ICefRequestContextHandler): ICefRequestContext;
|
|
|
|
end;
|
|
|
|
|
2019-10-08 15:03:22 +02:00
|
|
|
TCefClearCertificateExceptionsCompletionCallback = class(TCefCustomCompletionCallback)
|
|
|
|
protected
|
|
|
|
procedure OnComplete; override;
|
|
|
|
end;
|
|
|
|
|
|
|
|
TCefClearHttpAuthCredentialsCompletionCallback = class(TCefCustomCompletionCallback)
|
|
|
|
protected
|
|
|
|
procedure OnComplete; override;
|
|
|
|
end;
|
|
|
|
|
|
|
|
TCefCloseAllConnectionsCompletionCallback = class(TCefCustomCompletionCallback)
|
|
|
|
protected
|
|
|
|
procedure OnComplete; override;
|
|
|
|
end;
|
|
|
|
|
2017-01-27 17:37:51 +02:00
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
|
|
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, uCEFCookieManager,
|
2019-10-08 15:03:22 +02:00
|
|
|
uCEFRequestContextHandler, uCEFExtension, uCEFStringList;
|
2017-01-27 17:37:51 +02:00
|
|
|
|
|
|
|
function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean;
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := PCefRequestContext(FData)^.clear_scheme_handler_factories(PCefRequestContext(FData)) <> 0;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.GetCachePath: ustring;
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := CefStringFreeAndGet(PCefRequestContext(FData)^.get_cache_path(PCefRequestContext(FData)));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2019-06-16 10:31:13 +02:00
|
|
|
function TCefRequestContextRef.GetCookieManager(const callback: ICefCompletionCallback): ICefCookieManager;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2019-06-16 10:31:13 +02:00
|
|
|
Result := TCefCookieManagerRef.UnWrap(PCefRequestContext(FData)^.get_cookie_manager(PCefRequestContext(FData), CefGetData(callback)));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2019-06-16 10:31:13 +02:00
|
|
|
function TCefRequestContextRef.GetCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2019-06-16 10:31:13 +02:00
|
|
|
Result := GetCookieManager(TCefFastCompletionCallback.Create(callback));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.GetHandler: ICefRequestContextHandler;
|
2019-11-24 19:19:49 +02:00
|
|
|
var
|
|
|
|
TempHandler : PCefRequestContextHandler;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2019-11-24 19:19:49 +02:00
|
|
|
TempHandler := PCefRequestContext(FData)^.get_handler(PCefRequestContext(FData));
|
|
|
|
|
|
|
|
if (TempHandler <> nil) then
|
|
|
|
Result := TCefRequestContextHandlerRef.UnWrap(TempHandler)
|
|
|
|
else
|
|
|
|
Result := nil;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
class function TCefRequestContextRef.Global: ICefRequestContext;
|
|
|
|
begin
|
2017-10-26 13:23:13 +02:00
|
|
|
Result := UnWrap(cef_request_context_get_global_context());
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.IsGlobal: Boolean;
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := PCefRequestContext(FData)^.is_global(PCefRequestContext(FData)) <> 0;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.IsSame(const other: ICefRequestContext): Boolean;
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := PCefRequestContext(FData)^.is_same(PCefRequestContext(FData), CefGetData(other)) <> 0;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
function TCefRequestContextRef.IsSharingWith(const other: ICefRequestContext): Boolean;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := PCefRequestContext(FData)^.is_sharing_with(PCefRequestContext(FData), CefGetData(other)) <> 0;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2019-09-10 13:09:14 +02:00
|
|
|
class function TCefRequestContextRef.New(const settings : PCefRequestContextSettings;
|
|
|
|
const handler : ICefRequestContextHandler): ICefRequestContext;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
|
|
|
Result := UnWrap(cef_request_context_create_context(settings, CefGetData(handler)));
|
|
|
|
end;
|
|
|
|
|
2017-09-29 18:42:12 +02:00
|
|
|
class function TCefRequestContextRef.New(const aCache : ustring;
|
|
|
|
const aAcceptLanguageList : ustring;
|
|
|
|
aPersistSessionCookies : boolean;
|
|
|
|
aPersistUserPreferences : boolean;
|
|
|
|
aIgnoreCertificateErrors : boolean;
|
|
|
|
const handler : ICefRequestContextHandler): ICefRequestContext;
|
|
|
|
var
|
|
|
|
TempSettings : TCefRequestContextSettings;
|
|
|
|
begin
|
|
|
|
TempSettings.size := SizeOf(TCefRequestContextSettings);
|
|
|
|
TempSettings.cache_path := CefString(aCache);
|
|
|
|
TempSettings.persist_session_cookies := Ord(aPersistSessionCookies);
|
|
|
|
TempSettings.persist_user_preferences := Ord(aPersistUserPreferences);
|
|
|
|
TempSettings.ignore_certificate_errors := Ord(aIgnoreCertificateErrors);
|
|
|
|
TempSettings.accept_language_list := CefString(aAcceptLanguageList);
|
|
|
|
|
|
|
|
Result := UnWrap(cef_request_context_create_context(@TempSettings, CefGetData(handler)));
|
|
|
|
end;
|
|
|
|
|
2017-01-27 17:37:51 +02:00
|
|
|
procedure TCefRequestContextRef.PurgePluginListCache(reloadPages: Boolean);
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
PCefRequestContext(FData)^.purge_plugin_list_cache(PCefRequestContext(FData), Ord(reloadPages));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.HasPreference(const name: ustring): Boolean;
|
|
|
|
var
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName : TCefString;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName := CefString(name);
|
|
|
|
Result := PCefRequestContext(FData)^.has_preference(PCefRequestContext(FData), @TempName) <> 0;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.GetPreference(const name: ustring): ICefValue;
|
|
|
|
var
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName : TCefString;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName := CefString(name);
|
|
|
|
Result := TCefValueRef.UnWrap(PCefRequestContext(FData)^.get_preference(PCefRequestContext(FData), @TempName));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue;
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := TCefDictionaryValueRef.UnWrap(PCefRequestContext(FData)^.get_all_preferences(PCefRequestContext(FData), Ord(includeDefaults)));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.CanSetPreference(const name: ustring): Boolean;
|
|
|
|
var
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName : TCefString;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName := CefString(name);
|
|
|
|
Result := PCefRequestContext(FData)^.can_set_preference(PCefRequestContext(FData), @TempName) <> 0;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
function TCefRequestContextRef.SetPreference(const name : ustring;
|
|
|
|
const value : ICefValue;
|
|
|
|
out error : ustring): Boolean;
|
2017-01-27 17:37:51 +02:00
|
|
|
var
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName, TempError : TCefString;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2019-11-24 19:19:49 +02:00
|
|
|
CefStringInitialize(@TempError);
|
|
|
|
|
2018-05-12 14:50:54 +02:00
|
|
|
TempName := CefString(name);
|
|
|
|
Result := PCefRequestContext(FData)^.set_preference(PCefRequestContext(FData), @TempName, CefGetData(value), @TempError) <> 0;
|
2019-11-24 19:19:49 +02:00
|
|
|
error := CefStringClearAndGet(@TempError);
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefRequestContextRef.ClearCertificateExceptions(const callback: ICefCompletionCallback);
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
PCefRequestContext(FData)^.clear_certificate_exceptions(PCefRequestContext(FData), CefGetData(callback));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2019-07-18 11:48:11 +02:00
|
|
|
procedure TCefRequestContextRef.ClearHttpAuthCredentials(const callback: ICefCompletionCallback);
|
|
|
|
begin
|
|
|
|
PCefRequestContext(FData)^.clear_http_auth_credentials(PCefRequestContext(FData), CefGetData(callback));
|
|
|
|
end;
|
|
|
|
|
2017-01-27 17:37:51 +02:00
|
|
|
procedure TCefRequestContextRef.CloseAllConnections(const callback: ICefCompletionCallback);
|
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
PCefRequestContext(FData)^.close_all_connections(PCefRequestContext(FData), CefGetData(callback));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
procedure TCefRequestContextRef.ResolveHost(const origin : ustring;
|
|
|
|
const callback : ICefResolveCallback);
|
2017-01-27 17:37:51 +02:00
|
|
|
var
|
2018-05-12 14:50:54 +02:00
|
|
|
TempOrigin : TCefString;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
TempOrigin := CefString(origin);
|
|
|
|
PCefRequestContext(FData)^.resolve_host(PCefRequestContext(FData), @TempOrigin, CefGetData(callback));
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
procedure TCefRequestContextRef.LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue; const handler: ICefExtensionHandler);
|
|
|
|
var
|
|
|
|
TempDir : TCefString;
|
|
|
|
begin
|
|
|
|
TempDir := CefString(root_directory);
|
2018-05-12 14:50:54 +02:00
|
|
|
PCefRequestContext(FData)^.load_extension(PCefRequestContext(FData), @TempDir, CefGetData(manifest), CefGetData(handler));
|
2017-10-26 13:23:13 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.DidLoadExtension(const extension_id: ustring): boolean;
|
|
|
|
var
|
|
|
|
TempID : TCefString;
|
|
|
|
begin
|
|
|
|
TempID := CefString(extension_id);
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := PCefRequestContext(FData)^.did_load_extension(PCefRequestContext(FData), @TempID) <> 0;
|
2017-10-26 13:23:13 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.HasExtension(const extension_id: ustring): boolean;
|
|
|
|
var
|
|
|
|
TempID : TCefString;
|
|
|
|
begin
|
|
|
|
TempID := CefString(extension_id);
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := PCefRequestContext(FData)^.has_extension(PCefRequestContext(FData), @TempID) <> 0;
|
2017-10-26 13:23:13 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.GetExtensions(const extension_ids: TStringList): boolean;
|
|
|
|
var
|
2018-03-29 20:02:04 +02:00
|
|
|
TempSL : ICefStringList;
|
2017-10-26 13:23:13 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
Result := False;
|
|
|
|
TempSL := TCefStringListOwn.Create;
|
|
|
|
|
2018-05-12 14:50:54 +02:00
|
|
|
if (PCefRequestContext(FData)^.get_extensions(PCefRequestContext(FData), TempSL.Handle) <> 0) then
|
2018-03-29 20:02:04 +02:00
|
|
|
begin
|
|
|
|
TempSL.CopyToStrings(extension_ids);
|
|
|
|
Result := True;
|
2018-02-26 19:40:51 +02:00
|
|
|
end;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
function TCefRequestContextRef.GetExtension(const extension_id: ustring): ICefExtension;
|
|
|
|
var
|
|
|
|
TempID : TCefString;
|
|
|
|
begin
|
|
|
|
TempID := CefString(extension_id);
|
2018-05-12 14:50:54 +02:00
|
|
|
Result := TCefExtensionRef.UnWrap(PCefRequestContext(FData)^.get_extension(PCefRequestContext(FData), @TempID));
|
2017-10-26 13:23:13 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
function TCefRequestContextRef.RegisterSchemeHandlerFactory(const schemeName : ustring;
|
|
|
|
const domainName : ustring;
|
|
|
|
const factory : ICefSchemeHandlerFactory): Boolean;
|
2017-01-27 17:37:51 +02:00
|
|
|
var
|
2018-05-12 14:50:54 +02:00
|
|
|
TempScheme, TempDomain : TCefString;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
2018-05-12 14:50:54 +02:00
|
|
|
TempScheme := CefString(schemeName);
|
|
|
|
TempDomain := CefString(domainName);
|
|
|
|
Result := PCefRequestContext(FData)^.register_scheme_handler_factory(PCefRequestContext(FData),
|
|
|
|
@TempScheme,
|
|
|
|
@TempDomain,
|
|
|
|
CefGetData(factory)) <> 0;
|
2017-01-27 17:37:51 +02:00
|
|
|
end;
|
|
|
|
|
2017-10-26 13:23:13 +02:00
|
|
|
class function TCefRequestContextRef.Shared(const other : ICefRequestContext;
|
|
|
|
const handler : ICefRequestContextHandler): ICefRequestContext;
|
2017-01-27 17:37:51 +02:00
|
|
|
begin
|
|
|
|
Result := UnWrap(cef_create_context_shared(CefGetData(other), CefGetData(handler)));
|
|
|
|
end;
|
|
|
|
|
|
|
|
class function TCefRequestContextRef.UnWrap(data: Pointer): ICefRequestContext;
|
|
|
|
begin
|
2017-10-26 13:23:13 +02:00
|
|
|
if (data <> nil) then
|
|
|
|
Result := Create(data) as ICefRequestContext
|
|
|
|
else
|
2017-01-27 17:37:51 +02:00
|
|
|
Result := nil;
|
|
|
|
end;
|
|
|
|
|
2019-10-08 15:03:22 +02:00
|
|
|
|
|
|
|
// TCefClearCertificateExceptionsCompletionCallback
|
|
|
|
|
|
|
|
procedure TCefClearCertificateExceptionsCompletionCallback.OnComplete;
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then IChromiumEvents(FEvents).doCertificateExceptionsCleared;
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCefClearCertificateExceptionsCompletionCallback.OnComplete', e) then raise;
|
|
|
|
end;
|
|
|
|
finally
|
|
|
|
FEvents := nil;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
// TCefClearHttpAuthCredentialsCompletionCallback
|
|
|
|
|
|
|
|
procedure TCefClearHttpAuthCredentialsCompletionCallback.OnComplete;
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then IChromiumEvents(FEvents).doHttpAuthCredentialsCleared;
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCefClearHttpAuthCredentialsCompletionCallback.OnComplete', e) then raise;
|
|
|
|
end;
|
|
|
|
finally
|
|
|
|
FEvents := nil;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
// TCefCloseAllConnectionsCompletionCallback
|
|
|
|
|
|
|
|
procedure TCefCloseAllConnectionsCompletionCallback.OnComplete;
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then IChromiumEvents(FEvents).doAllConnectionsClosed;
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCefCloseAllConnectionsCompletionCallback.OnComplete', e) then raise;
|
|
|
|
end;
|
|
|
|
finally
|
|
|
|
FEvents := nil;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2017-01-27 17:37:51 +02:00
|
|
|
end.
|