-
Notifications
You must be signed in to change notification settings - Fork 78
/
unCEF.pas
50 lines (41 loc) · 1.45 KB
/
unCEF.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
unit unCEF;
interface
uses
uCEFv8Handler, uCEFApplication, uCEFConstants,
uCEFInterfaces, uCEFMiscFunctions, unV8Extension, unConfig, SysUtils,Windows;
procedure CreateGlobalCEFApp;
implementation
procedure GlobalCEFApp_OnWebKitInitializedEvent;
begin
TCefRTTIExtension.Register('app', TV8Extension);
end;
procedure CreateGlobalCEFApp;
var
strFlashPath: string;
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent;
GlobalCEFApp.Locale := 'zh-CN';
strFlashPath := unConfig.FAppPath + 'PepperFlash';
if DirectoryExists(strFlashPath) then
GlobalCEFApp.CustomFlashPath := strFlashPath
else
GlobalCEFApp.FlashEnabled := True;
GlobalCEFApp.EnableGPU := False;
GlobalCEFApp.DisableWebSecurity := True;
// GlobalCEFApp.MuteAudio := True;//开启后会导致flash播放没有声音
// GlobalCEFApp.FastUnload := True;
GlobalCEFApp.DisableSafeBrowsing := True;
// GlobalCEFApp.LogFile := 'log\debug.log';
// GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
GlobalCEFApp.EnableMediaStream := True;
// GlobalCEFApp.EnableSpeechInput := False;
GlobalCEFApp.NoSandbox := False;
// GlobalCEFApp.SingleProcess := True;
// GlobalCEFApp.Cookies := 'cookies';
GlobalCEFApp.Cache := 'cache';
GlobalCEFApp.SetCurrentDir := True;
// GlobalCEFApp.BrowserSubprocessPath := 'browse.exe';// 多进程模式,默认不启动
// ShowMessage(IntToStr(GlobalCEFApp.ChildProcessesCount));
end;
end.