internal static void RaiseOnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { if (OnBeforeCommandLineProcessing != null) { OnBeforeCommandLineProcessing.Invoke(e); } }
private static void ChromiumWebBrowser_OnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { Console.WriteLine("ChromiumWebBrowser_OnBeforeCommandLineProcessing"); e.CommandLine.AppendSwitchWithValue("disable-gpu", "1"); e.CommandLine.AppendSwitchWithValue("disable-gpu-compositing", "1"); Console.WriteLine(e.CommandLine.CommandLineString); }
/// <summary> /// 在浏览器命令行处理之前执行事件 /// </summary> /// <param name="sender">传递对象</param> /// <param name="e">浏览器命令行处理事件参数</param> private void ChromiumFx_OnBeforeCommandLineProcessing(object sender, CfxOnBeforeCommandLineProcessingEventArgs e) { e.CommandLine.AppendSwitch("disable-gpu"); //Uses WinHTTP to fetch and evaluate PAC scripts. Otherwise the default is to use Chromium's network stack to fetch, and V8 to evaluate. //https://peter.sh/experiments/chromium-command-line-switches/#winhttp-proxy-resolver e.CommandLine.AppendSwitch("--winhttp-proxy-resolver"); //Don't use a proxy server, always make direct connections. Overrides any other proxy server flags that are passed. //https://peter.sh/experiments/chromium-command-line-switches/#no-proxy-server e.CommandLine.AppendSwitch("--no-proxy-server"); //Don't enforce the same-origin policy. (Used by people testing their sites.) //禁用跨域安全检测 & 关闭同源策略 e.CommandLine.AppendSwitch("--disable-web-security"); //PepperFlash\manifest.json中的version e.CommandLine.AppendSwitchWithValue("ppapi-flash-version", "19.0.0.207"); e.CommandLine.AppendSwitchWithValue("ppapi-flash-path", $@"{_basePath}\PepperFlash\pepflashplayer.dll"); //使用系统 Flash //e.CommandLine.AppendSwitch("--enable-system-flash"); #if DEBUG Console.WriteLine("ChromiumWebBrowser_OnBeforeCommandLineProcessing"); Console.WriteLine(e.CommandLine.CommandLineString); #endif }
internal static void EventCall(object sender, CfxOnBeforeCommandLineProcessingEventArgs e) { var call = new CfxOnBeforeCommandLineProcessingBrowserProcessCall(); call.sender = RemoteProxy.Wrap((CfxBase)sender); call.eventArgsId = AddEventArgs(e); call.RequestExecution(RemoteClient.connection); RemoveEventArgs(call.eventArgsId); }
private void PrivateUpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand) { beforeLineCommand.CommandLine.AppendSwitch("disable-gpu"); if (DisableWebSecurity) { beforeLineCommand.CommandLine.AppendSwitch("disable-web-security"); } UpdateLineCommandArg(beforeLineCommand); }
internal static void RaiseOnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { var handler = OnBeforeCommandLineProcessing; if (handler != null) { handler(e); } }
internal static void on_before_command_line_processing(IntPtr gcHandlePtr, IntPtr process_type_str, int process_type_length, IntPtr command_line, out int command_line_release) { var self = (CfxApp)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target; if (self == null || self.CallbacksDisabled) { command_line_release = 1; return; } var e = new CfxOnBeforeCommandLineProcessingEventArgs(process_type_str, process_type_length, command_line); self.m_OnBeforeCommandLineProcessing?.Invoke(self, e); e.m_isInvalid = true; command_line_release = e.m_command_line_wrapped == null? 1 : 0; }
private static void initCommandlineArgs(CfxOnBeforeCommandLineProcessingEventArgs e) { // // //e.CommandLine.AppendSwitch ("multi-threaded-message-loop"); //// e.CommandLine.AppendSwitch ("off-screen-rendering-enabled"); // e.CommandLine.AppendSwitch("renderer-cmd-prefix"); //e.CommandLine.AppendSwitch("disable-text-input-focus-manager"); //e.CommandLine.AppendSwitch("no-zygote"); //e.CommandLine.AppendSwitchWithValue("type","utility"); //e.CommandLine.AppendSwitch("use-views"); e.CommandLine.AppendArgument("--disable-gpu"); }
static void ChromiumWebBrowser_OnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { Console.WriteLine("ChromiumWebBrowser_OnBeforeCommandLineProcessing"); Console.WriteLine(e.CommandLine.CommandLineString); e.CommandLine.AppendSwitchWithValue("proxy-server", "http://193.42.126.143:8000"); e.CommandLine.AppendSwitchWithValue("enable-features", "NetworkService"); if (proxy != null) { e.CommandLine.AppendSwitchWithValue("enable-features", "NetworkService"); e.CommandLine.AppendSwitchWithValue("proxy-server", proxy); //e.CommandLine.AppendSwitchWithValue("proxy-server", "http://119.191.79.46:80"); } //e.CommandLine.AppendSwitchWithValue("proxy-server", "http://193.42.126.143:8000"); arguments += " " + e.CommandLine.CommandLineString; //e.CommandLine.AppendSwitchWithValue("proxy-server", "http://119.191.79.46:80"); //e.CommandLine.AppendSwitchWithValue("persist-session-cookies", "1"); }
private static void SetFlashSupport(CfxOnBeforeCommandLineProcessingEventArgs args) { var flashSupportPath = System.IO.Path.Combine(CfxRuntime.LibCefDirPath, "PepperFlash"); var manifestPath = System.IO.Path.Combine(flashSupportPath, "manifest.json"); var libPath = System.IO.Path.Combine(flashSupportPath, "pepflashplayer.dll"); if (!System.IO.File.Exists(manifestPath) || !System.IO.File.Exists(libPath)) { return; } var match = System.Text.RegularExpressions.Regex.Match(System.IO.File.ReadAllText(manifestPath), @"""version"":.""(?<version>.+?)"""); if (match.Success) { var version = match.Groups["version"].Value; args.CommandLine.AppendSwitchWithValue("ppapi-flash-version", version); args.CommandLine.AppendSwitchWithValue("ppapi-flash-path", libPath); } }
internal static void on_before_command_line_processing(IntPtr gcHandlePtr, IntPtr process_type_str, int process_type_length, IntPtr command_line) { var self = (CfxApp)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target; if (self == null || self.CallbacksDisabled) { return; } var e = new CfxOnBeforeCommandLineProcessingEventArgs(process_type_str, process_type_length, command_line); var eventHandler = self.m_OnBeforeCommandLineProcessing; if (eventHandler != null) { eventHandler(self, e); } e.m_isInvalid = true; if (e.m_command_line_wrapped == null) { CfxApi.cfx_release(e.m_command_line); } }
private void ChromiumWebBrowser_OnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { }
protected override void UpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand) { beforeLineCommand.CommandLine.AppendSwitch("disable-web-security"); }
static void ChromiumWebBrowser_OnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { Console.WriteLine("ChromiumWebBrowser_OnBeforeCommandLineProcessing"); Console.WriteLine(e.CommandLine.CommandLineString); }
private void ChromiumWebBrowser_OnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { _CommandLineHandler?.Invoke(e); }
//These do nothing protected override void UpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand) { }
private void PrivateUpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand) { beforeLineCommand.CommandLine.AppendSwitch("disable-gpu"); UpdateLineCommandArg(beforeLineCommand); }
internal OnCSBeforeCfxCommandLineEventArgs(CfxOnBeforeCommandLineProcessingEventArgs e) { CommandLineProcessing = e; }
/// <summary> /// 执行浏览器命令行处理之前执行回调事件 /// </summary> /// <param name="e">浏览器命令行处理事件参数</param> internal static void RaiseOnBeforeCommandLineProcessing(CfxOnBeforeCommandLineProcessingEventArgs e) { OnBeforeCommandLineProcessing?.Invoke(null, e); }
protected virtual void UpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand) { }