mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 08:03:22 +00:00
04d2a8ede8
Make ResourceHandler.FromFileName obsolete
25 lines
1.0 KiB
C#
25 lines
1.0 KiB
C#
// Copyright © 2010-2016 The CefSharp Authors. All rights reserved.
|
|
//
|
|
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
|
|
|
|
namespace CefSharp.Example
|
|
{
|
|
public class CefSharpSchemeHandlerFactory : ISchemeHandlerFactory
|
|
{
|
|
public const string SchemeName = "custom";
|
|
public const string SchemeNameTest = "test";
|
|
|
|
public IResourceHandler Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
|
|
{
|
|
if (schemeName == SchemeName && request.Url.EndsWith("CefSharp.Core.xml", System.StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
//Convenient helper method to lookup the mimeType
|
|
var mimeType = ResourceHandler.GetMimeType(".xml");
|
|
//Load a resource handler for CefSharp.Core.xml
|
|
//mimeType is optional and will default to text/html
|
|
return ResourceHandler.FromFilePath("CefSharp.Core.xml", mimeType);
|
|
}
|
|
return new CefSharpSchemeHandler();
|
|
}
|
|
}
|
|
} |