Skip to content

Instantly share code, notes, and snippets.

@justin-caldicott
Created September 1, 2016 07:00
Show Gist options
  • Save justin-caldicott/c20bbd011c250d9f6d226d598cb2b9ff to your computer and use it in GitHub Desktop.
Save justin-caldicott/c20bbd011c250d9f6d226d598cb2b9ff to your computer and use it in GitHub Desktop.
An example of a SchemeHandlerFactory that throws a NRE in 49.0.1
using CefSharp;
namespace BirdJournal.Html.Windows
{
public sealed class CustomSchemeHandlerFactory : ISchemeHandlerFactory
{
readonly NancyService m_nancyService;
public CustomSchemeHandlerFactory(NancyService nancyService)
{
m_nancyService = nancyService;
}
public IResourceHandler Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
{
// Defer to CEF for external requests
return request.Url.Contains("localhost") ? new CustomSchemeHandler(m_nancyService) : null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment