mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 10:22:55 +00:00
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using CefSharp.Internals;
|
|
|
|
namespace CefSharp.BrowserSubprocess
|
|
{
|
|
public class CefSubProcess : CefAppWrapper
|
|
{
|
|
public int? ParentProcessId { get; private set; }
|
|
|
|
internal CefSubProcess(IEnumerable<string> args)
|
|
{
|
|
LocateParentProcessId(args);
|
|
}
|
|
|
|
private void LocateParentProcessId(IEnumerable<string> args)
|
|
{
|
|
// Format being parsed:
|
|
// --channel=3828.2.1260352072\1102986608
|
|
// We only really care about the PID (3828) part.
|
|
const string channelPrefix = "--channel=";
|
|
var channelArgument = args.SingleOrDefault(arg => arg.StartsWith(channelPrefix));
|
|
if (channelArgument == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var parentProcessId = channelArgument
|
|
.Substring(channelPrefix.Length)
|
|
.Split('.')
|
|
.First();
|
|
ParentProcessId = int.Parse(parentProcessId);
|
|
}
|
|
|
|
public override void OnBrowserCreated(CefBrowserWrapper cefBrowserWrapper)
|
|
{
|
|
|
|
}
|
|
|
|
public override void OnBrowserDestroyed(CefBrowserWrapper cefBrowserWrapper)
|
|
{
|
|
|
|
}
|
|
|
|
public override IBrowserProcess CreateBrowserProxy()
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
} |