mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-29 20:34:04 +02:00
29 lines
1.0 KiB
C#
29 lines
1.0 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using CefSharp;
|
|
using TweetDuck.Configuration;
|
|
|
|
namespace TweetDuck.Browser.Handling.General{
|
|
sealed class BrowserProcessHandler : IBrowserProcessHandler{
|
|
public static Task UpdatePrefs(){
|
|
return Cef.UIThreadTaskFactory.StartNew(UpdatePrefsInternal);
|
|
}
|
|
|
|
private static void UpdatePrefsInternal(){
|
|
UserConfig config = Program.Config.User;
|
|
using IRequestContext ctx = Cef.GetGlobalRequestContext();
|
|
|
|
ctx.SetPreference("browser.enable_spellchecking", config.EnableSpellCheck, out string _);
|
|
ctx.SetPreference("spellcheck.dictionary", config.SpellCheckLanguage, out string _);
|
|
ctx.SetPreference("settings.a11y.animation_policy", config.EnableAnimatedImages ? "allowed" : "none", out string _);
|
|
}
|
|
|
|
void IBrowserProcessHandler.OnContextInitialized(){
|
|
UpdatePrefsInternal();
|
|
}
|
|
|
|
void IBrowserProcessHandler.OnScheduleMessagePumpWork(long delay){}
|
|
void IDisposable.Dispose(){}
|
|
}
|
|
}
|