-
Notifications
You must be signed in to change notification settings - Fork 52
/
cef3scp.pas
69 lines (53 loc) · 1.51 KB
/
cef3scp.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
(*
* Free Pascal Chromium Embedded 3
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Author: [email protected]
* Repository: https://github.com/dliw/fpCEF3
*)
Unit cef3scp;
{$MODE objfpc}{$H+}
{$I cef.inc}
Interface
Uses
Classes, SysUtils,
cef3api, cef3types;
Type
TCefBaseScopedRef = class
private
fData: Pointer;
public
constructor Create(data: Pointer); virtual;
function Wrap: Pointer;
end;
TCefSchemeRegistrarRef = class(TCefBaseScopedRef)
public
function AddCustomScheme(const schemeName: ustring;
isStandard, isLocal, isDisplayIsolated, isSecure, isCorsEnabled, isCspBypassing: Boolean): Boolean;
end;
implementation
Uses cef3lib;
{ TCefBaseScopedRef }
constructor TCefBaseScopedRef.Create(data: Pointer);
begin
Assert(data <> nil);
fData := data;
end;
function TCefBaseScopedRef.Wrap: Pointer;
begin
Result := fData;
end;
{ TCefSchemeRegistrarRef }
function TCefSchemeRegistrarRef.AddCustomScheme(const schemeName: ustring;
isStandard, isLocal, isDisplayIsolated, isSecure, isCorsEnabled, isCspBypassing: Boolean): Boolean;
Var
s : TCefString;
begin
s := CefString(schemeName);
Result := PCefSchemeRegistrar(fData)^.add_custom_scheme(fData, @s, Ord(isStandard), Ord(isLocal),
Ord(isDisplayIsolated), Ord(isSecure), Ord(isCorsEnabled), Ord(isCspBypassing)) <> 0;
end;
end.