1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2024-11-23 17:42:46 +01:00
TweetDuck/lib/TweetLib.Browser.CEF/Logic/ResourceRequestHandlerFactoryLogic.cs

24 lines
1.0 KiB
C#

using System.Diagnostics.CodeAnalysis;
using TweetLib.Browser.CEF.Data;
using TweetLib.Browser.CEF.Interfaces;
namespace TweetLib.Browser.CEF.Logic {
public sealed class ResourceRequestHandlerFactoryLogic<TResourceRequestHandler, TResourceHandler, TRequest> where TResourceHandler : class {
private readonly IRequestAdapter<TRequest> requestAdapter;
private readonly TResourceRequestHandler handler;
private readonly ResourceHandlerRegistry<TResourceHandler> registry;
public ResourceRequestHandlerFactoryLogic(IRequestAdapter<TRequest> requestAdapter, TResourceRequestHandler handler, ResourceHandlerRegistry<TResourceHandler> registry) {
this.handler = handler;
this.registry = registry;
this.requestAdapter = requestAdapter;
}
[SuppressMessage("ReSharper", "RedundantAssignment")]
public TResourceRequestHandler GetResourceRequestHandler(TRequest request, ref bool disableDefaultHandling) {
disableDefaultHandling = registry.HasHandler(requestAdapter.GetUrl(request));
return handler;
}
}
}