-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcefgui.pas
1807 lines (1569 loc) · 73.4 KB
/
cefgui.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
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(*
* Delphi Chromium Embedded
*
* 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.
*
* Embarcadero Technologies, Inc is not permitted to use or redistribute
* this source code without explicit permission.
*
* Unit owner : Henri Gourvest <[email protected]>
* Web site : http://www.progdigy.com
* Repository : http://code.google.com/p/delphichromiumembedded/
* Group : http://groups.google.com/group/delphichromiumembedded
*)
unit cefgui;
{$I cef.inc}
interface
uses
Classes, ceflib;
type
TOnBeforePopup = procedure(Sender: TObject; const parentBrowser: ICefBrowser;
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
var url: ustring; var client: ICefBase; out Result: Boolean) of object;
TOnAfterCreated = procedure(Sender: TObject; const browser: ICefBrowser) of object;
TOnClose = procedure(Sender: TObject; const browser: ICefBrowser; out Result: Boolean) of object;
TOnRunModal = procedure(Sender: TObject; const browser: ICefBrowser; out Result: Boolean) of object;
TOnLoadStart = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame) of object;
TOnLoadEnd = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer; out Result: Boolean) of object;
TOnLoadError = procedure(Sender: TObject; const browser: ICefBrowser;
const frame: ICefFrame; errorCode: TCefHandlerErrorcode;
const failedUrl: ustring; var errorText: ustring; out Result: Boolean) of object;
TOnAuthCredentials = procedure(Sender: TObject; const browser: ICefBrowser; isProxy: Boolean; Port: Integer;
const host, realm, scheme: ustring; var username, password: ustring; out Result: Boolean) of object;
TOnGetDownloadHandler = procedure(Sender: TObject; const browser: ICefBrowser; const mimeType, fileName: ustring;
contentLength: int64; var handler: ICefDownloadHandler; out Result: Boolean) of object;
TOnBeforeBrowse = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; navType: TCefHandlerNavtype;
isRedirect: boolean; out Result: Boolean) of object;
TOnBeforeResourceLoad = procedure(Sender: TObject; const browser: ICefBrowser;
const request: ICefRequest; var redirectUrl: ustring;
var resourceStream: ICefStreamReader; const response: ICefResponse;
loadFlags: Integer; out Result: Boolean) of object;
TOnProtocolExecution = procedure(Sender: TObject; const browser: ICefBrowser;
const url: ustring; var AllowOsExecution: Boolean; out Result: Boolean) of object;
TOnResourceResponse = procedure(Sender: TObject; const browser: ICefBrowser;
const url: ustring; const response: ICefResponse; var filter: ICefBase) of object;
TOnAddressChange = procedure(Sender: TObject; const browser: ICefBrowser;
const frame: ICefFrame; const url: ustring) of object;
TOnContentsSizeChange = procedure(Sender: TObject; const browser: ICefBrowser;
const frame: ICefFrame; width, height: Integer) of object;
TOnConsoleMessage = procedure(Sender: TObject; const browser: ICefBrowser; message, source: ustring;
line: Integer; out Result: Boolean) of object;
TOnNavStateChange = procedure(Sender: TObject; const browser: ICefBrowser;
canGoBack, canGoForward: Boolean; out Result: Boolean) of object;
TOnStatusMessage = procedure(Sender: TObject; const browser: ICefBrowser; const value: ustring; StatusType: TCefHandlerStatusType; out Result: Boolean) of object;
TOnTitleChange = procedure(Sender: TObject; const browser: ICefBrowser;
const title: ustring; out Result: Boolean) of object;
TOnTooltip = procedure(Sender: TObject; const browser: ICefBrowser; var text: ustring; out Result: Boolean) of object;
TOnTakeFocus = procedure(Sender: TObject; const browser: ICefBrowser; next: Boolean) of object;
TOnSetFocus = procedure(Sender: TObject; const browser: ICefBrowser; source: TCefHandlerFocusSource; out Result: Boolean) of object;
TOnFocusedNodeChanged = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode) of object;
TOnKeyEvent = procedure(Sender: TObject; const browser: ICefBrowser; event: TCefHandlerKeyEventType;
code, modifiers: Integer; isSystemKey, isAfterJavaScript: Boolean; out Result: Boolean) of object;
TOnBeforeMenu = procedure(Sender: TObject; const browser: ICefBrowser;
const menuInfo: PCefHandlerMenuInfo; out Result: Boolean) of object;
TOnGetMenuLabel = procedure(Sender: TObject; const browser: ICefBrowser;
menuId: TCefHandlerMenuId; var caption: ustring; out Result: Boolean) of object;
TOnMenuAction = procedure(Sender: TObject; const browser: ICefBrowser;
menuId: TCefHandlerMenuId; out Result: Boolean) of object;
TOnPrintHeaderFooter = procedure(Sender: TObject; const browser: ICefBrowser;
const frame: ICefFrame; printInfo: PCefPrintInfo;
const url, title: ustring; currentPage, maxPages: Integer;
var topLeft, topCenter, topRight, bottomLeft, bottomCenter,
bottomRight: ustring; out Result: Boolean) of object;
TOnPrintOptions = procedure(Sender: TObject; const browser: ICefBrowser; printOptions: PCefPrintOptions; out Result: Boolean) of object;
TOnJsAlert = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring; out Result: Boolean) of object;
TOnJsConfirm = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring; var retval: Boolean; out Result: Boolean) of object;
TOnJsPrompt = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
const message, defaultValue: ustring; var retval: Boolean;
var return: ustring; out Result: Boolean) of object;
TOnBeforeClose = procedure(Sender: TObject; const browser: ICefBrowser; out Result: Boolean) of object;
TOnJsBinding = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const obj: ICefv8Value; out Result: Boolean) of object;
TOnFindResult = procedure(Sender: TObject; const browser: ICefBrowser; count: Integer;
selectionRect: PCefRect; identifier, activeMatchOrdinal,
finalUpdate: Boolean; out Result: Boolean) of object;
TOnGetViewRect = procedure(Sender: TObject; const browser: ICefBrowser; rect: PCefRect; out Result: Boolean) of object;
TOnGetScreenRect = procedure(Sender: TObject; const browser: ICefBrowser; rect: PCefRect; out Result: Boolean) of object;
TOnGetScreenPoint = procedure(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer;
screenX, screenY: PInteger; out Result: Boolean) of object;
TOnPopupShow = procedure(Sender: TObject; const browser: ICefBrowser; show: Boolean) of object;
TOnPopupSize = procedure(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect) of object;
TOnPaint = procedure(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType;
const dirtyRect: PCefRect; const buffer: Pointer) of object;
TOnCursorChange = procedure(Sender: TObject; const browser: ICefBrowser; cursor: TCefCursorHandle) of object;
TOnDragEvent = procedure(Sender: TObject; const browser: ICefBrowser; const dragData: ICefDragData; mask: Integer; out Result: Boolean) of object;
TChromiumOptions = class(TPersistent)
private
FDragDropDisabled: Boolean;
FLoadDropsDisabled: Boolean;
FEncodingDetectorEnabled: Boolean;
FJavascriptDisabled: Boolean;
FJavascriptOpenWindowsDisallowed: Boolean;
FJavascriptCloseWindowsDisallowed: Boolean;
FJavascriptAccessClipboardDisallowed: Boolean;
FDomPasteDisabled: Boolean;
FCaretBrowsingEnabled: Boolean;
FJavaDisabled: Boolean;
FPluginsDisabled: Boolean;
FUniversalAccessFromFileUrlsAllowed: Boolean;
FFileAccessFromFileUrlsAllowed: Boolean;
FWebSecurityDisabled: Boolean;
FXssAuditorEnabled: Boolean;
FImageLoadDisabled: Boolean;
FShrinkStandaloneImagesToFit: Boolean;
FSiteSpecificQuirksDisabled: Boolean;
FTextAreaResizeDisabled: Boolean;
FPageCacheDisabled: Boolean;
FTabToLinksDisabled: Boolean;
FHyperlinkAuditingDisabled: Boolean;
FUserStyleSheetEnabled: Boolean;
FAuthorAndUserStylesDisabled: Boolean;
FLocalStorageDisabled: Boolean;
FDatabasesDisabled: Boolean;
FApplicationCacheDisabled: Boolean;
FWebglDisabled: Boolean;
FAcceleratedCompositingEnabled: Boolean;
FThreadedCompositingEnabled: Boolean;
FAcceleratedLayersDisabled: Boolean;
FAccelerated2dCanvasDisabled: Boolean;
FDeveloperToolsDisabled: Boolean;
published
property DragDropDisabled: Boolean read FDragDropDisabled write FDragDropDisabled default False;
property LoadDropsDisabled: Boolean read FLoadDropsDisabled write FLoadDropsDisabled default False;
property EncodingDetectorEnabled: Boolean read FEncodingDetectorEnabled write FEncodingDetectorEnabled default False;
property JavascriptDisabled: Boolean read FJavascriptDisabled write FJavascriptDisabled default False;
property JavascriptOpenWindowsDisallowed: Boolean read FJavascriptOpenWindowsDisallowed write FJavascriptOpenWindowsDisallowed default False;
property JavascriptCloseWindowsDisallowed: Boolean read FJavascriptCloseWindowsDisallowed write FJavascriptCloseWindowsDisallowed default False;
property JavascriptAccessClipboardDisallowed: Boolean read FJavascriptAccessClipboardDisallowed write FJavascriptAccessClipboardDisallowed default False;
property DomPasteDisabled: Boolean read FDomPasteDisabled write FDomPasteDisabled default False;
property CaretBrowsingEnabled: Boolean read FCaretBrowsingEnabled write FCaretBrowsingEnabled default False;
property JavaDisabled: Boolean read FJavaDisabled write FJavaDisabled default False;
property PluginsDisabled: Boolean read FPluginsDisabled write FPluginsDisabled default False;
property UniversalAccessFromFileUrlsAllowed: Boolean read FUniversalAccessFromFileUrlsAllowed write FUniversalAccessFromFileUrlsAllowed default False;
property FileAccessFromFileUrlsAllowed: Boolean read FFileAccessFromFileUrlsAllowed write FFileAccessFromFileUrlsAllowed default False;
property WebSecurityDisabled: Boolean read FWebSecurityDisabled write FWebSecurityDisabled default False;
property XssAuditorEnabled: Boolean read FXssAuditorEnabled write FXssAuditorEnabled default False;
property ImageLoadDisabled: Boolean read FImageLoadDisabled write FImageLoadDisabled default False;
property ShrinkStandaloneImagesToFit: Boolean read FShrinkStandaloneImagesToFit write FShrinkStandaloneImagesToFit default False;
property SiteSpecificQuirksDisabled: Boolean read FSiteSpecificQuirksDisabled write FSiteSpecificQuirksDisabled default False;
property TextAreaResizeDisabled: Boolean read FTextAreaResizeDisabled write FTextAreaResizeDisabled default False;
property PageCacheDisabled: Boolean read FPageCacheDisabled write FPageCacheDisabled default False;
property TabToLinksDisabled: Boolean read FTabToLinksDisabled write FTabToLinksDisabled default False;
property HyperlinkAuditingDisabled: Boolean read FHyperlinkAuditingDisabled write FHyperlinkAuditingDisabled default False;
property UserStyleSheetEnabled: Boolean read FUserStyleSheetEnabled write FUserStyleSheetEnabled default False;
property AuthorAndUserStylesDisabled: Boolean read FAuthorAndUserStylesDisabled write FAuthorAndUserStylesDisabled default False;
property LocalStorageDisabled: Boolean read FLocalStorageDisabled write FLocalStorageDisabled default False;
property DatabasesDisabled: Boolean read FDatabasesDisabled write FDatabasesDisabled default False;
property ApplicationCacheDisabled: Boolean read FApplicationCacheDisabled write FApplicationCacheDisabled default False;
property WebglDisabled: Boolean read FWebglDisabled write FWebglDisabled default False;
property AcceleratedCompositingEnabled: Boolean read FAcceleratedCompositingEnabled write FAcceleratedCompositingEnabled default False;
property ThreadedCompositingEnabled: Boolean read FThreadedCompositingEnabled write FThreadedCompositingEnabled default False;
property AcceleratedLayersDisabled: Boolean read FAcceleratedLayersDisabled write FAcceleratedLayersDisabled default False;
property Accelerated2dCanvasDisabled: Boolean read FAccelerated2dCanvasDisabled write FAccelerated2dCanvasDisabled default False;
property DeveloperToolsDisabled: Boolean read FDeveloperToolsDisabled write FDeveloperToolsDisabled default False;
end;
TChromiumFontOptions = class(TPersistent)
private
FStandardFontFamily: ustring;
FCursiveFontFamily: ustring;
FSansSerifFontFamily: ustring;
FMinimumLogicalFontSize: Integer;
FFantasyFontFamily: ustring;
FSerifFontFamily: ustring;
FDefaultFixedFontSize: Integer;
FDefaultFontSize: Integer;
FRemoteFontsDisabled: Boolean;
FFixedFontFamily: ustring;
FMinimumFontSize: Integer;
public
constructor Create; virtual;
published
property StandardFontFamily: ustring read FStandardFontFamily;
property FixedFontFamily: ustring read FFixedFontFamily write FFixedFontFamily;
property SerifFontFamily: ustring read FSerifFontFamily write FSerifFontFamily;
property SansSerifFontFamily: ustring read FSansSerifFontFamily write FSansSerifFontFamily;
property CursiveFontFamily: ustring read FCursiveFontFamily write FCursiveFontFamily;
property FantasyFontFamily: ustring read FFantasyFontFamily write FFantasyFontFamily;
property DefaultFontSize: Integer read FDefaultFontSize write FDefaultFontSize default 0;
property DefaultFixedFontSize: Integer read FDefaultFixedFontSize write FDefaultFixedFontSize default 0;
property MinimumFontSize: Integer read FMinimumFontSize write FMinimumFontSize default 0;
property MinimumLogicalFontSize: Integer read FMinimumLogicalFontSize write FMinimumLogicalFontSize default 0;
property RemoteFontsDisabled: Boolean read FRemoteFontsDisabled write FRemoteFontsDisabled default False;
end;
IChromiumEvents = interface
['{0C139DB1-0349-4D7F-8155-76FEA6A0126D}']
procedure GetSettings(var settings: TCefBrowserSettings);
function doOnBeforePopup(const parentBrowser: ICefBrowser;
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
var url: ustring; var client: ICefBase): Boolean;
procedure doOnAfterCreated(const browser: ICefBrowser);
function doOnBeforeClose(const browser: ICefBrowser): Boolean;
function doOnClose(const browser: ICefBrowser): Boolean;
function doOnRunModal(const browser: ICefBrowser): Boolean;
procedure doOnLoadStart(const browser: ICefBrowser; const frame: ICefFrame);
function doOnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer): Boolean;
function doOnLoadError(const browser: ICefBrowser;
const frame: ICefFrame; errorCode: TCefHandlerErrorcode;
const failedUrl: ustring; var errorText: ustring): Boolean;
function doOnAuthCredentials(const browser: ICefBrowser; isProxy: Boolean; Port: Integer;
const host, realm, scheme: ustring; var username, password: ustring): Boolean;
function doOnGetDownloadHandler(const browser: ICefBrowser; const mimeType, fileName: ustring;
contentLength: int64; var handler: ICefDownloadHandler): Boolean;
function doOnBeforeBrowse(const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; navType: TCefHandlerNavtype;
isRedirect: boolean): Boolean;
function doOnBeforeResourceLoad(const browser: ICefBrowser;
const request: ICefRequest; var redirectUrl: ustring;
var resourceStream: ICefStreamReader; const response: ICefResponse;
loadFlags: Integer): Boolean;
function doOnProtocolExecution(const browser: ICefBrowser;
const url: ustring; var AllowOsExecution: Boolean): Boolean;
procedure doOnResourceResponse(const browser: ICefBrowser;
const url: ustring; const response: ICefResponse; var filter: ICefBase);
procedure doOnAddressChange(const browser: ICefBrowser;
const frame: ICefFrame; const url: ustring);
procedure doOnContentsSizeChange(const browser: ICefBrowser;
const frame: ICefFrame; width, height: Integer);
function doOnConsoleMessage(const browser: ICefBrowser; const message,
source: ustring; line: Integer): Boolean;
function doOnNavStateChange(const browser: ICefBrowser; canGoBack,
canGoForward: Boolean): Boolean;
function doOnStatusMessage(const browser: ICefBrowser; const value: ustring;
StatusType: TCefHandlerStatusType): Boolean;
function doOnTitleChange(const browser: ICefBrowser;
const title: ustring): Boolean;
function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean;
procedure doOnTakeFocus(const browser: ICefBrowser; next: Boolean);
function doOnSetFocus(const browser: ICefBrowser; source: TCefHandlerFocusSource): Boolean;
procedure doOnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
function doOnKeyEvent(const browser: ICefBrowser; event: TCefHandlerKeyEventType;
code, modifiers: Integer; isSystemKey, isAfterJavaScript: Boolean): Boolean;
function doOnBeforeMenu(const browser: ICefBrowser;
const menuInfo: PCefHandlerMenuInfo): Boolean;
function doOnGetMenuLabel(const browser: ICefBrowser;
menuId: TCefHandlerMenuId; var caption: ustring): Boolean;
function doOnMenuAction(const browser: ICefBrowser;
menuId: TCefHandlerMenuId): Boolean;
function doOnPrintHeaderFooter(const browser: ICefBrowser;
const frame: ICefFrame; printInfo: PCefPrintInfo;
const url, title: ustring; currentPage, maxPages: Integer;
var topLeft, topCenter, topRight, bottomLeft, bottomCenter,
bottomRight: ustring): Boolean;
function doOnPrintOptions(const browser: ICefBrowser;
printOptions: PCefPrintOptions): Boolean;
function doOnJsAlert(const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring): Boolean;
function doOnJsConfirm(const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring; var retval: Boolean): Boolean;
function doOnJsPrompt(const browser: ICefBrowser; const frame: ICefFrame;
const message, defaultValue: ustring; var retval: Boolean;
var return: ustring): Boolean;
function doOnJsBinding(const browser: ICefBrowser;
const frame: ICefFrame; const obj: ICefv8Value): Boolean;
function doOnFindResult(const browser: ICefBrowser; count: Integer;
selectionRect: PCefRect; identifier, activeMatchOrdinal,
finalUpdate: Boolean): Boolean;
function doOnGetViewRect(const browser: ICefBrowser; rect: PCefRect): Boolean;
function doOnGetScreenRect(const browser: ICefBrowser; rect: PCefRect): Boolean;
function doOnGetScreenPoint(const browser: ICefBrowser; viewX, viewY: Integer;
screenX, screenY: PInteger): Boolean;
procedure doOnPopupShow(const browser: ICefBrowser; show: Boolean);
procedure doOnPopupSize(const browser: ICefBrowser; const rect: PCefRect);
procedure doOnPaint(const browser: ICefBrowser; kind: TCefPaintElementType;
const dirtyRect: PCefRect; const buffer: Pointer);
procedure doOnCursorChange(const browser: ICefBrowser; cursor: TCefCursorHandle);
function doOnDragStart(const browser: ICefBrowser;
const dragData: ICefDragData; mask: Integer): Boolean;
function doOnDragEnter(const browser: ICefBrowser;
const dragData: ICefDragData; mask: Integer): Boolean;
end;
ICefClientHandler = interface
['{E76F6888-D9C3-4FCE-9C23-E89659820A36}']
procedure Disconnect;
end;
TCustomClientHandler = class(TCefClientOwn, ICefClientHandler)
private
FLifeSpanHandler: ICefBase;
FLoadHandler: ICefBase;
FRequestHandler: ICefBase;
FDisplayHandler: ICefBase;
FFocusHandler: ICefBase;
FKeyboardHandler: ICefBase;
FMenuHandler: ICefBase;
FPrintHandler: ICefBase;
FFindHandler: ICefBase;
FJsdialogHandler: ICefBase;
FJsbindingHandler: ICefBase;
FRenderHandler: ICefBase;
FDragHandler: ICefBase;
protected
function GetLifeSpanHandler: ICefBase; override;
function GetLoadHandler: ICefBase; override;
function GetRequestHandler: ICefBase; override;
function GetDisplayHandler: ICefBase; override;
function GetFocusHandler: ICefBase; override;
function GetKeyboardHandler: ICefBase; override;
function GetMenuHandler: ICefBase; override;
function GetPrintHandler: ICefBase; override;
function GetFindHandler: ICefBase; override;
function GetJsdialogHandler: ICefBase; override;
function GetJsbindingHandler: ICefBase; override;
function GetRenderHandler: ICefBase; override;
function GetDragHandler: ICefBase; override;
procedure Disconnect;
public
constructor Create(const crm: IChromiumEvents); reintroduce; virtual;
destructor Destroy; override;
end;
TCustomClientHandlerClass = class of TCustomClientHandler;
TCustomLifeSpanHandler = class(TCefLifeSpanHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function OnBeforePopup(const parentBrowser: ICefBrowser;
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
var url: ustring; var client: ICefBase;
var settings: TCefBrowserSettings): Boolean; override;
procedure OnAfterCreated(const browser: ICefBrowser); override;
procedure OnBeforeClose(const browser: ICefBrowser); override;
function RunModal(const browser: ICefBrowser): Boolean; override;
function DoClose(const browser: ICefBrowser): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomLoadHandler = class(TCefLoadHandlerOwn)
private
FCrm: IChromiumEvents;
protected
procedure OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame); override;
procedure OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); override;
function OnLoadError(const browser: ICefBrowser; const frame: ICefFrame;
errorCode: TCefHandlerErrorcode; const failedUrl: ustring; var errorText: ustring): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomRequestHandler = class(TCefRequestHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function OnBeforeBrowse(const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; navType: TCefHandlerNavtype;
isRedirect: Boolean): Boolean; override;
function OnBeforeResourceLoad(const browser: ICefBrowser; const request: ICefRequest;
var redirectUrl: ustring; var resourceStream: ICefStreamReader;
const response: ICefResponse; loadFlags: Integer): Boolean; override;
procedure OnResourceResponse(const browser: ICefBrowser; const url: ustring;
const response: ICefResponse; var filter: ICefBase); override;
function OnProtocolExecution(const browser: ICefBrowser; const url: ustring;
var allowOSExecution: Boolean): Boolean; override;
function GetDownloadHandler(const browser: ICefBrowser;
const mimeType, fileName: ustring; contentLength: int64;
var handler: ICefDownloadHandler): Boolean; override;
function GetAuthCredentials(const browser: ICefBrowser;
isProxy: Boolean; Port: Integer; const host, realm, scheme: ustring;
var username, password: ustring): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomDisplayHandler = class(TCefDisplayHandlerOwn)
private
FCrm: IChromiumEvents;
protected
procedure OnNavStateChange(const browser: ICefBrowser;
canGoBack, canGoForward: Boolean); override;
procedure OnAddressChange(const browser: ICefBrowser;
const frame: ICefFrame; const url: ustring); override;
procedure OnContentsSizeChange(const browser: ICefBrowser;
const frame: ICefFrame; width: Integer; height: Integer); override;
procedure OnTitleChange(const browser: ICefBrowser;
const title: ustring); override;
function OnTooltip(const browser: ICefBrowser;
var text: ustring): Boolean; override;
procedure OnStatusMessage(const browser: ICefBrowser; const value: ustring;
kind: TCefHandlerStatusType); override;
function OnConsoleMessage(const browser: ICefBrowser; const message,
source: ustring; line: Integer): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomFocusHandler = class(TCefFocusHandlerOwn)
private
FCrm: IChromiumEvents;
protected
procedure OnTakeFocus(const browser: ICefBrowser; next: Boolean); override;
function OnSetFocus(const browser: ICefBrowser; source: TCefHandlerFocusSource): Boolean; override;
procedure OnFocusedNodeChanged(const browser: ICefBrowser;
const frame: ICefFrame; const node: ICefDomNode); override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomKeyboardHandler = class(TCefKeyboardHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function OnKeyEvent(const browser: ICefBrowser; event: TCefHandlerKeyEventType;
code, modifiers: Integer; isSystemKey, isAfterJavaScript: Boolean): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomMenuHandler = class(TCefMenuHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function OnBeforeMenu(const browser: ICefBrowser;
const menuInfo: PCefHandlerMenuInfo): Boolean; override;
procedure GetMenuLabel(const browser: ICefBrowser;
menuId: TCefHandlerMenuId; var caption: ustring); override;
function OnMenuAction(const browser: ICefBrowser;
menuId: TCefHandlerMenuId): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomPrintHandler = class(TCefPrintHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function GetPrintOptions(const browser: ICefBrowser;
printOptions: PCefPrintOptions): Boolean; override;
function GetPrintHeaderFooter(const browser: ICefBrowser; const frame: ICefFrame;
const printInfo: PCefPrintInfo; const url, title: ustring; currentPage, maxPages: Integer;
var topLeft, topCenter, topRight, bottomLeft, bottomCenter, bottomRight: ustring): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomFindHandler = class(TCefFindHandlerOwn)
private
FCrm: IChromiumEvents;
protected
procedure OnFindResult(const browser: ICefBrowser; count: Integer;
const selectionRect: PCefRect; identifier, activeMatchOrdinal,
finalUpdate: Boolean); override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomJsDialogHandler = class(TCefJsDialogHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function OnJsAlert(const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring): Boolean; override;
function OnJsConfirm(const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring; var retval: Boolean): Boolean; override;
function OnJsPrompt(const browser: ICefBrowser; const frame: ICefFrame;
const message, defaultValue: ustring; var retval: Boolean;
var return: ustring): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomJsBindingHandler = class(TCefJsBindingHandlerOwn)
private
FCrm: IChromiumEvents;
protected
procedure OnJsBinding(const browser: ICefBrowser;
const frame: ICefFrame; const obj: ICefv8Value); override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomRenderHandler = class(TCefRenderHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function GetViewRect(const browser: ICefBrowser; rect: PCefRect): Boolean; override;
function GetScreenRect(const browser: ICefBrowser; rect: PCefRect): Boolean; override;
function GetScreenPoint(const browser: ICefBrowser; viewX, viewY: Integer;
screenX, screenY: PInteger): Boolean; override;
procedure OnPopupShow(const browser: ICefBrowser; show: Boolean); override;
procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect); override;
procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType;
const dirtyRect: PCefRect; const buffer: Pointer); override;
procedure OnCursorChange(const browser: ICefBrowser; cursor: TCefCursorHandle); override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomDragHandler = class(TCefDragHandlerOwn)
private
FCrm: IChromiumEvents;
protected
function OnDragStart(const browser: ICefBrowser;
const dragData: ICefDragData; mask: Integer): Boolean; override;
function OnDragEnter(const browser: ICefBrowser;
const dragData: ICefDragData; mask: Integer): Boolean; override;
public
constructor Create(const crm: IChromiumEvents); reintroduce;
end;
TCustomChromiumOSR = class(TComponent, IChromiumEvents)
private
FHandler: ICefBase;
FBrowser: ICefBrowser;
FDefaultUrl: ustring;
FOnBeforePopup: TOnBeforePopup;
FOnAfterCreated: TOnAfterCreated;
FOnBeforeClose: TOnBeforeClose;
FOnClose: TOnClose;
FOnRunModal: TOnRunModal;
FOnLoadStart: TOnLoadStart;
FOnLoadEnd: TOnLoadEnd;
FOnLoadError: TOnLoadError;
FOnAuthCredentials: TOnAuthCredentials;
FOnGetDownloadHandler: TOnGetDownloadHandler;
FOnBeforeBrowse: TOnBeforeBrowse;
FOnBeforeResourceLoad: TOnBeforeResourceLoad;
FOnProtocolExecution: TOnProtocolExecution;
FOnResourceResponse: TOnResourceResponse;
FOnAddressChange: TOnAddressChange;
FOnContentsSizeChange: TOnContentsSizeChange;
FOnConsoleMessage: TOnConsoleMessage;
FOnNavStateChange: TOnNavStateChange;
FOnStatusMessage: TOnStatusMessage;
FOnTitleChange: TOnTitleChange;
FOnTooltip: TOnTooltip;
FOnTakeFocus: TOnTakeFocus;
FOnSetFocus: TOnSetFocus;
FOnFocusedNodeChanged: TOnFocusedNodeChanged;
FOnKeyEvent: TOnKeyEvent;
FOnBeforeMenu: TOnBeforeMenu;
FOnGetMenuLabel: TOnGetMenuLabel;
FOnMenuAction: TOnMenuAction;
FOnPrintHeaderFooter: TOnPrintHeaderFooter;
FOnPrintOptions: TOnPrintOptions;
FOnFindResult: TOnFindResult;
FOnJsAlert: TOnJsAlert;
FOnJsConfirm: TOnJsConfirm;
FOnJsPrompt: TOnJsPrompt;
FOnJsBinding: TOnJsBinding;
FOnGetViewRect: TOnGetViewRect;
FOnGetScreenRect: TOnGetScreenRect;
FOnGetScreenPoint: TOnGetScreenPoint;
FOnPopupShow: TOnPopupShow;
FOnPopupSize: TOnPopupSize;
FOnPaint: TOnPaint;
FOnCursorChange: TOnCursorChange;
FOnDragStart: TOnDragEvent;
FOnDragEnter: TOnDragEvent;
FOptions: TChromiumOptions;
FUserStyleSheetLocation: ustring;
FDefaultEncoding: ustring;
FFontOptions: TChromiumFontOptions;
procedure GetSettings(var settings: TCefBrowserSettings);
procedure CreateBrowser;
protected
procedure Loaded; override;
function GetHandlerClass: TCustomClientHandlerClass; virtual;
function doOnBeforePopup(const parentBrowser: ICefBrowser;
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
var url: ustring; var client: ICefBase): Boolean; virtual;
procedure doOnAfterCreated(const browser: ICefBrowser); virtual;
function doOnBeforeClose(const browser: ICefBrowser): Boolean; virtual;
function doOnClose(const browser: ICefBrowser): Boolean; virtual;
function doOnRunModal(const browser: ICefBrowser): Boolean; virtual;
procedure doOnLoadStart(const browser: ICefBrowser; const frame: ICefFrame); virtual;
function doOnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer): Boolean; virtual;
function doOnLoadError(const browser: ICefBrowser;
const frame: ICefFrame; errorCode: TCefHandlerErrorcode;
const failedUrl: ustring; var errorText: ustring): Boolean; virtual;
function doOnAuthCredentials(const browser: ICefBrowser; isProxy: Boolean; Port: Integer;
const host, realm, scheme: ustring; var username, password: ustring): Boolean; virtual;
function doOnGetDownloadHandler(const browser: ICefBrowser; const mimeType, fileName: ustring;
contentLength: int64; var handler: ICefDownloadHandler): Boolean; virtual;
function doOnBeforeBrowse(const browser: ICefBrowser; const frame: ICefFrame;
const request: ICefRequest; navType: TCefHandlerNavtype;
isRedirect: boolean): Boolean; virtual;
function doOnBeforeResourceLoad(const browser: ICefBrowser;
const request: ICefRequest; var redirectUrl: ustring;
var resourceStream: ICefStreamReader; const response: ICefResponse;
loadFlags: Integer): Boolean; virtual;
function doOnProtocolExecution(const browser: ICefBrowser;
const url: ustring; var AllowOsExecution: Boolean): Boolean; virtual;
procedure doOnResourceResponse(const browser: ICefBrowser;
const url: ustring; const response: ICefResponse; var filter: ICefBase); virtual;
procedure doOnAddressChange(const browser: ICefBrowser;
const frame: ICefFrame; const url: ustring);
procedure doOnContentsSizeChange(const browser: ICefBrowser;
const frame: ICefFrame; width, height: Integer);
function doOnConsoleMessage(const browser: ICefBrowser; const message,
source: ustring; line: Integer): Boolean; virtual;
function doOnNavStateChange(const browser: ICefBrowser; canGoBack,
canGoForward: Boolean): Boolean; virtual;
function doOnStatusMessage(const browser: ICefBrowser; const value: ustring;
StatusType: TCefHandlerStatusType): Boolean; virtual;
function doOnTitleChange(const browser: ICefBrowser;
const title: ustring): Boolean; virtual;
function doOnTooltip(const browser: ICefBrowser; var text: ustring): Boolean; virtual;
procedure doOnTakeFocus(const browser: ICefBrowser; next: Boolean); virtual;
function doOnSetFocus(const browser: ICefBrowser; source: TCefHandlerFocusSource): Boolean; virtual;
procedure doOnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
function doOnKeyEvent(const browser: ICefBrowser; event: TCefHandlerKeyEventType;
code, modifiers: Integer; isSystemKey, isAfterJavaScript: Boolean): Boolean; virtual;
function doOnBeforeMenu(const browser: ICefBrowser;
const menuInfo: PCefHandlerMenuInfo): Boolean; virtual;
function doOnGetMenuLabel(const browser: ICefBrowser;
menuId: TCefHandlerMenuId; var caption: ustring): Boolean; virtual;
function doOnMenuAction(const browser: ICefBrowser;
menuId: TCefHandlerMenuId): Boolean; virtual;
function doOnPrintHeaderFooter(const browser: ICefBrowser;
const frame: ICefFrame; printInfo: PCefPrintInfo;
const url, title: ustring; currentPage, maxPages: Integer;
var topLeft, topCenter, topRight, bottomLeft, bottomCenter,
bottomRight: ustring): Boolean; virtual;
function doOnPrintOptions(const browser: ICefBrowser;
printOptions: PCefPrintOptions): Boolean; virtual;
function doOnJsAlert(const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring): Boolean; virtual;
function doOnJsConfirm(const browser: ICefBrowser; const frame: ICefFrame;
const message: ustring; var retval: Boolean): Boolean; virtual;
function doOnJsPrompt(const browser: ICefBrowser; const frame: ICefFrame;
const message, defaultValue: ustring; var retval: Boolean;
var return: ustring): Boolean; virtual;
function doOnJsBinding(const browser: ICefBrowser;
const frame: ICefFrame; const obj: ICefv8Value): Boolean; virtual;
function doOnFindResult(const browser: ICefBrowser; count: Integer;
selectionRect: PCefRect; identifier, activeMatchOrdinal,
finalUpdate: Boolean): Boolean; virtual;
function doOnGetViewRect(const browser: ICefBrowser; rect: PCefRect): Boolean; virtual;
function doOnGetScreenRect(const browser: ICefBrowser; rect: PCefRect): Boolean; virtual;
function doOnGetScreenPoint(const browser: ICefBrowser; viewX, viewY: Integer;
screenX, screenY: PInteger): Boolean; virtual;
procedure doOnPopupShow(const browser: ICefBrowser; show: Boolean); virtual;
procedure doOnPopupSize(const browser: ICefBrowser; const rect: PCefRect); virtual;
procedure doOnPaint(const browser: ICefBrowser; kind: TCefPaintElementType;
const dirtyRect: PCefRect; const buffer: Pointer); virtual;
procedure doOnCursorChange(const browser: ICefBrowser; cursor: TCefCursorHandle); virtual;
function doOnDragStart(const browser: ICefBrowser;
const dragData: ICefDragData; mask: Integer): Boolean;
function doOnDragEnter(const browser: ICefBrowser;
const dragData: ICefDragData; mask: Integer): Boolean;
property DefaultUrl: ustring read FDefaultUrl write FDefaultUrl;
property OnBeforePopup: TOnBeforePopup read FOnBeforePopup write FOnBeforePopup;
property OnAfterCreated: TOnAfterCreated read FOnAfterCreated write FOnAfterCreated;
property OnBeforeClose: TOnBeforeClose read FOnBeforeClose write FOnBeforeClose;
property OnClose: TOnClose read FOnClose write FOnClose;
property OnRunModal: TOnRunModal read FOnRunModal write FOnRunModal;
property OnLoadStart: TOnLoadStart read FOnLoadStart write FOnLoadStart;
property OnLoadEnd: TOnLoadEnd read FOnLoadEnd write FOnLoadEnd;
property OnLoadError: TOnLoadError read FOnLoadError write FOnLoadError;
property OnAuthCredentials: TOnAuthCredentials read FOnAuthCredentials write FOnAuthCredentials;
property OnGetDownloadHandler: TOnGetDownloadHandler read FOnGetDownloadHandler write FOnGetDownloadHandler;
property OnBeforeBrowse: TOnBeforeBrowse read FOnBeforeBrowse write FOnBeforeBrowse;
property OnBeforeResourceLoad: TOnBeforeResourceLoad read FOnBeforeResourceLoad write FOnBeforeResourceLoad;
property OnProtocolExecution: TOnProtocolExecution read FOnProtocolExecution write FOnProtocolExecution;
property OnResourceResponse: TOnResourceResponse read FOnResourceResponse write FOnResourceResponse;
property OnAddressChange: TOnAddressChange read FOnAddressChange write FOnAddressChange;
property OnContentsSizeChange: TOnContentsSizeChange read FOnContentsSizeChange write FOnContentsSizeChange;
property OnConsoleMessage: TOnConsoleMessage read FOnConsoleMessage write FOnConsoleMessage;
property OnNavStateChange: TOnNavStateChange read FOnNavStateChange write FOnNavStateChange;
property OnStatusMessage: TOnStatusMessage read FOnStatusMessage write FOnStatusMessage;
property OnTitleChange: TOnTitleChange read FOnTitleChange write FOnTitleChange;
property OnTooltip: TOnTooltip read FOnTooltip write FOnTooltip;
property OnTakeFocus: TOnTakeFocus read FOnTakeFocus write FOnTakeFocus;
property OnSetFocus: TOnSetFocus read FOnSetFocus write FOnSetFocus;
property OnFocusedNodeChanged: TOnFocusedNodeChanged read FOnFocusedNodeChanged write FOnFocusedNodeChanged;
property OnKeyEvent: TOnKeyEvent read FOnKeyEvent write FOnKeyEvent;
property OnBeforeMenu: TOnBeforeMenu read FOnBeforeMenu write FOnBeforeMenu;
property OnGetMenuLabel: TOnGetMenuLabel read FOnGetMenuLabel write FOnGetMenuLabel;
property OnMenuAction: TOnMenuAction read FOnMenuAction write FOnMenuAction;
property OnPrintHeaderFooter: TOnPrintHeaderFooter read FOnPrintHeaderFooter write FOnPrintHeaderFooter;
property OnPrintOptions: TOnPrintOptions read FOnPrintOptions write FOnPrintOptions;
property OnJsAlert: TOnJsAlert read FOnJsAlert write FOnJsAlert;
property OnJsConfirm: TOnJsConfirm read FOnJsConfirm write FOnJsConfirm;
property OnJsPrompt: TOnJsPrompt read FOnJsPrompt write FOnJsPrompt;
property OnJsBinding: TOnJsBinding read FOnJsBinding write FOnJsBinding;
property OnFindResult: TOnFindResult read FOnFindResult write FOnFindResult;
property OnGetViewRect: TOnGetViewRect read FOnGetViewRect write FOnGetViewRect;
property OnGetScreenRect: TOnGetScreenRect read FOnGetScreenRect write FOnGetScreenRect;
property OnGetScreenPoint: TOnGetScreenPoint read FOnGetScreenPoint write FOnGetScreenPoint;
property OnPopupShow: TOnPopupShow read FOnPopupShow write FOnPopupShow;
property OnPopupSize: TOnPopupSize read FOnPopupSize write FOnPopupSize;
property OnPaint: TOnPaint read FOnPaint write FOnPaint;
property OnCursorChange: TOnCursorChange read FOnCursorChange write FOnCursorChange;
property OnDragStart: TOnDragEvent read FOnDragStart write FOnDragStart;
property OnDragEnter: TOnDragEvent read FOnDragEnter write FOnDragEnter;
property Options: TChromiumOptions read FOptions write FOptions;
property FontOptions: TChromiumFontOptions read FFontOptions;
property DefaultEncoding: ustring read FDefaultEncoding write FDefaultEncoding;
property UserStyleSheetLocation: ustring read FUserStyleSheetLocation write FUserStyleSheetLocation;
property Browser: ICefBrowser read FBrowser;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Load(const url: ustring);
procedure ReCreateBrowser(const url: string);
end;
implementation
{ TChromiumFontOptions }
constructor TChromiumFontOptions.Create;
begin
FStandardFontFamily := '';
FCursiveFontFamily := '';
FSansSerifFontFamily := '';
FMinimumLogicalFontSize := 0;
FFantasyFontFamily := '';
FSerifFontFamily := '';
FDefaultFixedFontSize := 0;
FDefaultFontSize := 0;
FRemoteFontsDisabled := False;
FFixedFontFamily := '';
FMinimumFontSize := 0;
end;
{ TCefCustomHandler }
constructor TCustomClientHandler.Create(const crm: IChromiumEvents);
begin
inherited Create;
FLifeSpanHandler := TCustomLifeSpanHandler.Create(crm);
FLoadHandler := TCustomLoadHandler.Create(crm);
FRequestHandler := TCustomRequestHandler.Create(crm);
FDisplayHandler := TCustomDisplayHandler.Create(crm);
FFocusHandler := TCustomFocusHandler.Create(crm);
FKeyboardHandler := TCustomKeyboardHandler.Create(crm);
FMenuHandler := TCustomMenuHandler.Create(crm);
FPrintHandler := TCustomPrintHandler.Create(crm);
FFindHandler := TCustomFindHandler.Create(crm);
FJsdialogHandler := TCustomJsDialogHandler.Create(crm);
FJsbindingHandler := TCustomJsBindingHandler.Create(crm);
FRenderHandler := TCustomRenderHandler.Create(crm);
FDragHandler := TCustomDragHandler.Create(crm);
//{$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP}
// if CefInstances = 0 then
// CefTimer := SetTimer(0, 0, 10, nil);
// InterlockedIncrement(CefInstances);
//{$ENDIF}
end;
destructor TCustomClientHandler.Destroy;
begin
//{$IFNDEF CEF_MULTI_THREADED_MESSAGE_LOOP}
// InterlockedDecrement(CefInstances);
// if CefInstances = 0 then
// KillTimer(0, CefTimer);
//{$ENDIF}
inherited;
end;
procedure TCustomClientHandler.Disconnect;
begin
FLifeSpanHandler := nil;
FLoadHandler := nil;
FRequestHandler := nil;
FDisplayHandler := nil;
FFocusHandler := nil;
FKeyboardHandler := nil;
FMenuHandler := nil;
FPrintHandler := nil;
FFindHandler := nil;
FJsdialogHandler := nil;
FJsbindingHandler := nil;
FRenderHandler := nil;
FDragHandler := nil;
end;
function TCustomClientHandler.GetDisplayHandler: ICefBase;
begin
Result := FDisplayHandler;
end;
function TCustomClientHandler.GetDragHandler: ICefBase;
begin
Result := FDragHandler;
end;
function TCustomClientHandler.GetFindHandler: ICefBase;
begin
Result := FFindHandler;
end;
function TCustomClientHandler.GetFocusHandler: ICefBase;
begin
Result := FFocusHandler;
end;
function TCustomClientHandler.GetJsbindingHandler: ICefBase;
begin
Result := FJsbindingHandler;
end;
function TCustomClientHandler.GetJsdialogHandler: ICefBase;
begin
Result := FJsdialogHandler;
end;
function TCustomClientHandler.GetKeyboardHandler: ICefBase;
begin
Result := FKeyboardHandler;
end;
function TCustomClientHandler.GetLifeSpanHandler: ICefBase;
begin
Result := FLifeSpanHandler;
end;
function TCustomClientHandler.GetLoadHandler: ICefBase;
begin
Result := FLoadHandler;
end;
function TCustomClientHandler.GetMenuHandler: ICefBase;
begin
Result := FMenuHandler;
end;
function TCustomClientHandler.GetPrintHandler: ICefBase;
begin
Result := FPrintHandler;
end;
function TCustomClientHandler.GetRenderHandler: ICefBase;
begin
Result := FRenderHandler;
end;
function TCustomClientHandler.GetRequestHandler: ICefBase;
begin
Result := FRequestHandler;
end;
{ TCustomLifeSpanHandler }
constructor TCustomLifeSpanHandler.Create(const crm: IChromiumEvents);
begin
inherited Create;
FCrm := crm;
end;
procedure TCustomLifeSpanHandler.OnAfterCreated(const browser: ICefBrowser);
begin
FCrm.doOnAfterCreated(browser);
end;
procedure TCustomLifeSpanHandler.OnBeforeClose(const browser: ICefBrowser);
begin
FCrm.doOnBeforeClose(browser);
end;
function TCustomLifeSpanHandler.OnBeforePopup(const parentBrowser: ICefBrowser;
var popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo;
var url: ustring; var client: ICefBase;
var settings: TCefBrowserSettings): Boolean;
begin
FCrm.GetSettings(settings);
Result := FCrm.doOnBeforePopup(parentBrowser, popupFeatures, windowInfo, url, client);
end;
function TCustomLifeSpanHandler.DoClose(const browser: ICefBrowser): Boolean;
begin
Result := FCrm.doOnClose(browser);
end;
function TCustomLifeSpanHandler.RunModal(const browser: ICefBrowser): Boolean;
begin
Result := FCrm.doOnRunModal(browser);
end;
{ TCustomLoadHandler }
constructor TCustomLoadHandler.Create(const crm: IChromiumEvents);
begin
inherited Create;
FCrm := crm;
end;
procedure TCustomLoadHandler.OnLoadEnd(const browser: ICefBrowser;
const frame: ICefFrame; httpStatusCode: Integer);
begin
FCrm.doOnLoadEnd(browser, frame, httpStatusCode);
end;
function TCustomLoadHandler.OnLoadError(const browser: ICefBrowser;
const frame: ICefFrame; errorCode: TCefHandlerErrorcode; const failedUrl: ustring;
var errorText: ustring): Boolean;
begin
Result := FCrm.doOnLoadError(browser, frame, errorCode, failedUrl, errorText);
end;
procedure TCustomLoadHandler.OnLoadStart(const browser: ICefBrowser;
const frame: ICefFrame);
begin
FCrm.doOnLoadStart(browser, frame)
end;
{ TCustomRequestHandler }
constructor TCustomRequestHandler.Create(const crm: IChromiumEvents);
begin
inherited Create;
FCrm := crm;
end;
function TCustomRequestHandler.GetAuthCredentials(const browser: ICefBrowser;
isProxy: Boolean; Port: Integer; const host, realm, scheme: ustring; var username,
password: ustring): Boolean;
begin
Result := FCrm.doOnAuthCredentials(browser, isProxy, Port, host, realm, scheme, username, password);
end;
function TCustomRequestHandler.GetDownloadHandler(const browser: ICefBrowser;
const mimeType, fileName: ustring; contentLength: int64;