public static void Main() { var profileRoot = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Browser", "ProfileOptimization"); CefSharpSettings.SubprocessExitIfParentProcessClosed = true; var settings = new CefSettings() { CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache") }; settings.CefCommandLineArgs.Add("enable-media-stream", "1"); settings.CommandLineArgsDisabled = true; settings.LogSeverity = LogSeverity.Disable; settings.CefCommandLineArgs.Add("enable-npapi", "1"); //settings.CefCommandLineArgs.Add("enable-system-flash", "1"); //Automatically discovered and load a system-wide installation of Pepper Flash. //settings.CefCommandLineArgs.Add("ppapi-flash-path", @"C:\WINDOWS\SysWOW64\Macromed\Flash\pepflashplayer32_18_0_0_209.dll"); //Load a specific pepper flash version (Step 1 of 2) //settings.CefCommandLineArgs.Add("ppapi-flash-version", "18.0.0.209"); //Load a specific pepper flash version (Step 2 of 2) Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null); Cef.EnableHighDPISupport(); Cef.RegisterWidevineCdm(@".\WidevineCdm"); var browser = new BrowserForm(); Application.Run(browser); }
private void Application_Startup(object sender, StartupEventArgs e) { bool invalidApp = false; var activeDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var widevineCdn = Path.Combine(activeDirectory, "WidevineCdm"); var cefSettings = new CefSettings(); cefSettings.CefCommandLineArgs.Add("enable-media-stream", "1"); cefSettings.CefCommandLineArgs.Add("enable-widevine-cdm", "1"); cefSettings.CefCommandLineArgs.Add("no-proxy-server", "1"); cefSettings.LogSeverity = LogSeverity.Disable; cefSettings.UserAgent = $"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Opeity/{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}"; if (Directory.Exists(widevineCdn)) { Cef.RegisterWidevineCdm(widevineCdn); } Parser.Default.ParseArguments <Options>(Environment.GetCommandLineArgs()).WithParsed(options => { if (options.App) { var appHelper = new AppHelper(); if (!string.IsNullOrEmpty(options.OpenUrl)) { var app = appHelper.Find(options.OpenUrl); if (app != null) { cefSettings.CachePath = app.CachePath; } else { invalidApp = true; } } else { invalidApp = true; } } }); Cef.EnableHighDPISupport(); Cef.Initialize( cefSettings, performDependencyCheck: false, browserProcessHandler: null ); new MainWindow(invalidApp).Show(); }
public void Init() { Instance = this; SteamVR_WebKit.SteamVR_WebKit.UseExperimentalOGL = true; SteamVR_WebKit.SteamVR_WebKit.DefaultFragmentShaderPath = Path.Combine(PathUtilities.Constants.GlobalShadersPath, "fragShader.frag"); SteamVR_WebKit.SteamVR_WebKit.PrefixOverlayType = false; SteamVR_WebKit.SteamVR_WebKit.FPS = 30; SteamVR_WebKit.SteamVR_WebKit.LogEvent += SteamVR_WebKit_LogEvent; SteamVR_WebKit.SteamVR_WebKit.PreUpdateCallback += PreUpdate; SteamVR_WebKit.SteamVR_WebKit.PreDrawCallback += PreDraw; SteamVR_WebKit.SteamVR_WebKit.PostUpdateCallback += PostUpdate; SteamVR_WebKit.SteamVR_WebKit.PostDrawCallback += PostDraw; CefSettings cefSettings = new CefSettings() { CachePath = PathUtilities.Constants.GlobalCachePath, FocusedNodeChangedEnabled = true, }; cefSettings.RegisterScheme(new CefCustomScheme() { SchemeName = "addon", SchemeHandlerFactory = new RestrictedPathSchemeHandler("addon", null), IsSecure = true, IsLocal = false, IsStandard = false, IsCorsEnabled = false, IsDisplayIsolated = false, }); cefSettings.RegisterScheme(new CefCustomScheme() { SchemeName = "vrub", SchemeHandlerFactory = new RestrictedPathSchemeHandler("vrub", PathUtilities.Constants.GlobalStaticResourcesPath), IsSecure = true, IsLocal = false, IsStandard = false, IsCorsEnabled = false, IsDisplayIsolated = false, }); cefSettings.RegisterScheme(new CefCustomScheme() { SchemeName = "plugin", SchemeHandlerFactory = new PluginSchemeHandler(), IsSecure = true, IsLocal = false, IsStandard = false, IsCorsEnabled = false, IsDisplayIsolated = false, }); cefSettings.CefCommandLineArgs.Add("enable-widevine-cdm", "1"); // Will experiment with this at some point. //cefSettings.CefCommandLineArgs.Add("touch-events", "1"); SteamVR_WebKit.SteamVR_WebKit.Init(cefSettings); if (Directory.Exists(Path.Combine(Environment.CurrentDirectory, "WidevineCdm"))) { Cef.RegisterWidevineCdm(@".\WidevineCdm", new DRM.WidevineCallback()); } if (!Cef.IsInitialized) { SteamVR_WebKit.SteamVR_WebKit.Log("Failed to Init Cef!"); } if (!_isRunning) { return; } CefSharp.Cef.GetGlobalCookieManager().SetStoragePath(PathUtilities.Constants.GlobalCookiePath, false); RegisterCallbacks(); RegisterGlobalEventListeners(); SetupAnchorOverlays(); PopulateAddons(); GetWorkshopAddons(); SetupPluginsAndStart(); Permissions.PermissionManager.Load(); _displayMirrorManager = new DesktopMirrorManager(); if (ConfigUtility.Get <bool>("desktop.enabled", false)) { _displayMirrorManager.SetupMirrors(); } HasInit = true; SteamVR_WebKit.SteamVR_WebKit.RunOverlays(); }
public void Initialize() { if (_initialized) { return; } _initialized = true; Cef.EnableHighDPISupport(); var pluginPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var chromiumPath = Path.Combine(pluginPath, "Chromium", Environment.Is64BitProcess ? "x64" : "x86"); var settings = new CefSettings { CachePath = Path.Combine(pluginPath, "cache"), ResourcesDirPath = chromiumPath, LocalesDirPath = Path.Combine(chromiumPath, "locales"), UserDataPath = Path.Combine(pluginPath, "User Data"), BrowserSubprocessPath = Path.Combine(chromiumPath, "CefSharp.BrowserSubprocess.exe"), MultiThreadedMessageLoop = true, WindowlessRenderingEnabled = false, PersistSessionCookies = true, LogSeverity = LogSeverity.Disable, PersistUserPreferences = true //FocusedNodeChangedEnabled = true }; CefSharpSettings.FocusedNodeChangedEnabled = true; CefSharpSettings.SubprocessExitIfParentProcessClosed = true; CefSharpSettings.WcfEnabled = false; CefSharpSettings.WcfTimeout = new TimeSpan(0); settings.CefCommandLineArgs.Add("--touch-events", "enabled"); settings.CefCommandLineArgs.Add("--enable-pinch", ""); settings.CefCommandLineArgs.Add("--ppapi-flash-path", Path.Combine(pluginPath, "PepperFlash", Environment.Is64BitProcess ? "x64" : "x86", "pepflashplayer.dll")); //Load a specific pepper flash version (Step 1 of 2) settings.CefCommandLineArgs.Add("--ppapi-flash-version", "32.0.0.238"); settings.CefCommandLineArgs.Add("--enable-ephemeral-flash-permission", "0"); settings.CefCommandLineArgs.Add("--plugin-policy", "allow"); //settings.CefCommandLineArgs.Add("--disable-smart-virtual-keyboard", "1"); //settings.CefCommandLineArgs.Add("--disable-virtual-keyboard", "1"); settings.CefCommandLineArgs.Add("--enable-media-stream", "1"); //settings.CefCommandLineArgs.Add("--ignore-certificate-errors", "1"); settings.CefCommandLineArgs.Add("enable-experimental-web-platform-features", "1"); settings.CefCommandLineArgs.Add("disable-web-security", "disable-web-security"); foreach (var kp in _args) { if (kp.Value == null) { settings.CefCommandLineArgs.Add(kp.Key, ""); } else { settings.CefCommandLineArgs.Add(kp.Key, kp.Value); } } Cef.RegisterWidevineCdm(Path.Combine(pluginPath, @"Widevine", Environment.Is64BitProcess ? "x64" : "x86"), new Callback()); if (!Cef.Initialize(settings)) { throw new Exception("Unable to Initialize Cef"); } //Cef.GetGlobalRequestContext(). set SetStoragePath(Path.Combine(pluginPath, "cookies"), true); }