kyy
2025-07-02 07558e32634314eec359ec8437d97bdc5def64f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright © 2021 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.
 
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
 
namespace CefSharp.SchemeHandler
{
    //Shorthand for Owin pipeline func
    using AppFunc = Func<IDictionary<string, object>, Task>;
 
    /// <summary>
    /// <see cref="ISchemeHandlerFactory"/> implementation that takes an OWIN  AppFunc
    /// and uses an <see cref="OwinResourceHandler"/> to fulfill each requests.
    /// </summary>
    public class OwinSchemeHandlerFactory : ISchemeHandlerFactory
    {
        private readonly AppFunc appFunc;
 
        /// <summary>
        /// OwinSchemeHandlerFactory
        /// </summary>
        /// <param name="appFunc">Owin pipeline func</param>
        public OwinSchemeHandlerFactory(AppFunc appFunc)
        {
            this.appFunc = appFunc;
        }
 
        /// <inheritdoc/>
        public IResourceHandler Create(IBrowser browser, IFrame frame, string schemeName, IRequest request)
        {
            return new OwinResourceHandler(appFunc);
        }
    }
}