-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCEF_LCL_Frame.inc
233 lines (207 loc) · 5.58 KB
/
CEF_LCL_Frame.inc
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
//----------------------------------------
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Lazarus.modifiedLGPL
//----------------------------------------
//CEFFrame_Undo
procedure CEFFrame_Undo(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.Undo;
handleExceptionEnd
end;
//CEFFrame_Redo
procedure CEFFrame_Redo(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.Redo;
handleExceptionEnd
end;
//CEFFrame_Cut
procedure CEFFrame_Cut(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.Cut;
handleExceptionEnd
end;
//CEFFrame_Copy
procedure CEFFrame_Copy(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.Copy;
handleExceptionEnd
end;
//CEFFrame_Paste
procedure CEFFrame_Paste(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.Paste;
handleExceptionEnd
end;
//CEFFrame_Del
procedure CEFFrame_Del(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.Del;
handleExceptionEnd
end;
//CEFFrame_SelectAll
procedure CEFFrame_SelectAll(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.SelectAll;
handleExceptionEnd
end;
//CEFFrame_ViewSource
procedure CEFFrame_ViewSource(const TObj: ICefFrame); extdecl;
begin
handleExceptionBegin
TObj.ViewSource;
handleExceptionEnd
end;
//CEFFrame_LoadUrl
procedure CEFFrame_LoadUrl(const TObj: ICefFrame; PUrl: PChar); extdecl;
begin
handleExceptionBegin
TObj.LoadUrl(PCharToUStr(PUrl));
handleExceptionEnd
end;
//CEFFrame_ExecuteJavaScript
procedure CEFFrame_ExecuteJavaScript(const TObj: ICefFrame; const PCode, PScriptUrl: PChar; startLine: Integer); extdecl;
begin
handleExceptionBegin
TObj.ExecuteJavaScript(PCharToUStr(PCode), PCharToUStr(PScriptUrl), startLine);
handleExceptionEnd
end;
//CEFFrame_IsValid
function CEFFrame_IsValid(const TObj: ICefFrame): LongBool; extdecl;
begin
handleExceptionBegin
Result := TObj.IsValid;
handleExceptionEnd
end;
//CEFFrame_IsMain
function CEFFrame_IsMain(const TObj: ICefFrame): LongBool; extdecl;
begin
handleExceptionBegin
Result := TObj.IsMain;
handleExceptionEnd
end;
//CEFFrame_IsFocused
function CEFFrame_IsFocused(const TObj: ICefFrame): LongBool; extdecl;
begin
handleExceptionBegin
Result := TObj.IsFocused;
handleExceptionEnd
end;
//进程发送消息
procedure CEFFrame_SendProcessMessage(const TObj: ICefFrame; targetProcess: Integer; const message_: ICefProcessMessage); extdecl;
begin
handleExceptionBegin
TObj.SendProcessMessage(TCefProcessId(targetProcess), message_);
handleExceptionEnd
end;
procedure CEFFrame_SendProcessMessageForJSONBytes(const AObj: ICefFrame; const PName: PChar; targetProcess: Integer; const data: Pointer; dataSize: NativeUInt); extdecl;
var
message_ : ICefProcessMessage;
begin
handleExceptionBegin
message_ := TCefProcessMessageRef.New(PCharToUStr(PName));
message_.ArgumentList.SetBinary(0, TCefBinaryValueRef.New(data, dataSize));
AObj.SendProcessMessage(TCefProcessId(targetProcess), message_);
message_.ArgumentList.Clear;
handleExceptionEnd
end;
procedure CEFFrame_SendProcessMessageForV8Value(const AObj: ICefFrame; const PName: PChar; targetProcess: Integer; const arguments: ICefv8Value); extdecl;
var
message_ : ICefProcessMessage;
begin
handleExceptionBegin
message_ := TValueConvert.V8ValueToProcessMessage(PCharToUStr(PName), arguments);
if message_ <> nil then
begin
AObj.SendProcessMessage(TCefProcessId(targetProcess), message_);
message_.ArgumentList.Clear;
end;
handleExceptionEnd
end;
procedure CEFFrame_LoadRequest(const TObj: ICefFrame; const request: ICefRequest); extdecl;
begin
handleExceptionBegin
TObj.LoadRequest(request);
handleExceptionEnd
end;
procedure CEFFrame_Browser(const TObj: ICefFrame; var Result: ICefBrowser); extdecl;
begin
handleExceptionBegin
Result := TObj.Browser;
handleExceptionEnd
end;
procedure CEFFrame_GetV8Context(const TObj: ICefFrame; var Result: ICefv8Context); extdecl;
begin
handleExceptionBegin
Result := TObj.GetV8Context;
handleExceptionEnd
end;
procedure CEFFrame_VisitDom(const TObj: ICefFrame; const visitor: ICefDomVisitor); extdecl;
begin
handleExceptionBegin
TObj.VisitDom(visitor);
handleExceptionEnd
end;
procedure CEFFrame_Identifier(const TObj: ICefFrame; var Result: PChar); extdecl;
begin
handleExceptionBegin
Result := PChar(string(TObj.Identifier));
handleExceptionEnd
end;
procedure CEFFrame_Name(const TObj: ICefFrame; const Result: TString); extdecl;
begin
handleExceptionBegin
Result.SetValue(string(TObj.Url));
handleExceptionEnd
end;
procedure CEFFrame_Url(const TObj: ICefFrame; const Result: TString); extdecl;
begin
handleExceptionBegin
Result.SetValue(string(TObj.Url));
handleExceptionEnd
end;
procedure CEFFrame_Parent(const TObj: ICefFrame; var Result: ICefFrame); extdecl;
begin
handleExceptionBegin
Result := TObj.Parent;
handleExceptionEnd
end;
procedure CEFFrameRef_UnWrap(const data: ICefFrame; var Result: ICefFrame); extdecl;
begin
handleExceptionBegin
Result := TCefFrameRef.UnWrap(data.Wrap);
handleExceptionEnd
end;
exports
CEFFrame_Undo,
CEFFrame_Redo,
CEFFrame_Cut,
CEFFrame_Copy,
CEFFrame_Paste,
CEFFrame_Del,
CEFFrame_SelectAll,
CEFFrame_ViewSource,
CEFFrame_LoadUrl,
CEFFrame_ExecuteJavaScript,
CEFFrame_IsValid,
CEFFrame_IsMain,
CEFFrame_IsFocused,
CEFFrame_SendProcessMessage,
CEFFrame_SendProcessMessageForJSONBytes,
CEFFrame_SendProcessMessageForV8Value,
CEFFrame_LoadRequest,
CEFFrame_Browser,
CEFFrame_GetV8Context,
CEFFrame_VisitDom,
CEFFrame_Identifier,
CEFFrame_Name,
CEFFrame_Url,
CEFFrame_Parent,
CEFFrameRef_UnWrap;