From 2f61de7025a18d6089be244955fb42769fdcb7d8 Mon Sep 17 00:00:00 2001 From: chylex <contact@chylex.com> Date: Sat, 13 Jan 2018 22:37:24 +0100 Subject: [PATCH] Add GetHandlerFactory extension method to BrowserUtils --- Core/Notification/FormNotificationBase.cs | 3 +-- Core/Utils/BrowserUtils.cs | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/Notification/FormNotificationBase.cs b/Core/Notification/FormNotificationBase.cs index 86b5c055..67e119a7 100644 --- a/Core/Notification/FormNotificationBase.cs +++ b/Core/Notification/FormNotificationBase.cs @@ -139,8 +139,7 @@ protected FormNotificationBase(FormBrowser owner, bool enableContextMenu){ DpiScale = this.GetDPIScale(); - DefaultResourceHandlerFactory handlerFactory = (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory; - handlerFactory.RegisterHandler(TwitterUtils.TweetDeckURL, this.resourceHandler); + browser.GetHandlerFactory().RegisterHandler(TwitterUtils.TweetDeckURL, this.resourceHandler); Controls.Add(browser); diff --git a/Core/Utils/BrowserUtils.cs b/Core/Utils/BrowserUtils.cs index 7109ce36..90789a68 100644 --- a/Core/Utils/BrowserUtils.cs +++ b/Core/Utils/BrowserUtils.cs @@ -35,6 +35,10 @@ public static ChromiumWebBrowser AsControl(this IWebBrowser browserControl){ return (ChromiumWebBrowser)browserControl; } + public static DefaultResourceHandlerFactory GetHandlerFactory(this ChromiumWebBrowser browser){ + return (DefaultResourceHandlerFactory)browser.ResourceHandlerFactory; + } + private const string TwitterTrackingUrl = "t.co"; public enum UrlCheckResult{