mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-16 00:05:55 +01:00
ca8bc9dff4
Added the PDS file to extract the HTML Help files using PasDoc Added more XML documentation Fixed some XML errors. Removed the license copy from the pas units. Updated the LICENSE.md file
73 lines
2.4 KiB
ObjectPascal
73 lines
2.4 KiB
ObjectPascal
unit uCEFSchemeHandlerFactory;
|
|
|
|
{$IFDEF FPC}
|
|
{$MODE OBJFPC}{$H+}
|
|
{$ENDIF}
|
|
|
|
{$I cef.inc}
|
|
|
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
|
{$MINENUMSIZE 4}
|
|
|
|
interface
|
|
|
|
uses
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFResourceHandler;
|
|
|
|
type
|
|
TCefSchemeHandlerFactoryOwn = class(TCefBaseRefCountedOwn, ICefSchemeHandlerFactory)
|
|
protected
|
|
FClass : TCefResourceHandlerClass;
|
|
|
|
function New(const browser: ICefBrowser; const frame: ICefFrame; const schemeName: ustring; const request: ICefRequest): ICefResourceHandler; virtual;
|
|
|
|
public
|
|
constructor Create(const AClass: TCefResourceHandlerClass); virtual;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser, uCEFFrame, uCEFRequest;
|
|
|
|
function cef_scheme_handler_factory_create( self : PCefSchemeHandlerFactory;
|
|
browser : PCefBrowser;
|
|
frame : PCefFrame;
|
|
const scheme_name : PCefString;
|
|
request : PCefRequest): PCefResourceHandler; stdcall;
|
|
var
|
|
TempObject : TObject;
|
|
begin
|
|
Result := nil;
|
|
TempObject := CefGetObject(self);
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefSchemeHandlerFactoryOwn) then
|
|
Result := CefGetData(TCefSchemeHandlerFactoryOwn(TempObject).New(TCefBrowserRef.UnWrap(browser),
|
|
TCefFrameRef.UnWrap(frame),
|
|
CefString(scheme_name),
|
|
TCefRequestRef.UnWrap(request)));
|
|
end;
|
|
|
|
constructor TCefSchemeHandlerFactoryOwn.Create(const AClass: TCefResourceHandlerClass);
|
|
begin
|
|
inherited CreateData(SizeOf(TCefSchemeHandlerFactory));
|
|
|
|
FClass := AClass;
|
|
|
|
PCefSchemeHandlerFactory(FData)^.create := {$IFDEF FPC}@{$ENDIF}cef_scheme_handler_factory_create;
|
|
end;
|
|
|
|
function TCefSchemeHandlerFactoryOwn.New(const browser : ICefBrowser;
|
|
const frame : ICefFrame;
|
|
const schemeName : ustring;
|
|
const request : ICefRequest): ICefResourceHandler;
|
|
begin
|
|
if (FClass <> nil) then
|
|
Result := FClass.Create(browser, frame, schemeName, request)
|
|
else
|
|
Result := nil;
|
|
end;
|
|
|
|
|
|
end.
|