|
5 | 5 | using System; |
6 | 6 | using System.Collections.Generic; |
7 | 7 | using System.Threading.Tasks; |
| 8 | +using CefSharp.Callback; |
8 | 9 | using CefSharp.Enums; |
9 | 10 |
|
10 | 11 | namespace CefSharp |
@@ -158,6 +159,23 @@ public interface IRequestContext : IDisposable |
158 | 159 | /// application thread will be the CEF UI thread.</remarks> |
159 | 160 | bool SetPreference(string name, object value, out string error); |
160 | 161 |
|
| 162 | + /// <summary> |
| 163 | + /// Add an observer for preference changes. <paramref name="name"/> is the name of the |
| 164 | + /// preference to observe. If <paramref name="name"/> is empty then all preferences will |
| 165 | + /// be observed. Observing all preferences has performance consequences and |
| 166 | + /// is not recommended outside of testing scenarios. The observer will remain |
| 167 | + /// registered until the returned Registration object is destroyed. This |
| 168 | + /// method must be called on the browser process UI thread. |
| 169 | + /// </summary> |
| 170 | + /// <param name="name">preference key</param> |
| 171 | + /// <param name="observer">preference observer</param> |
| 172 | + /// <remarks>Use Cef.UIThreadTaskFactory to execute this method if required, |
| 173 | + /// <see cref="IBrowserProcessHandler.OnContextInitialized"/> and ChromiumWebBrowser.IsBrowserInitializedChanged are both |
| 174 | + /// executed on the CEF UI thread, so can be called directly. |
| 175 | + /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main |
| 176 | + /// application thread will be the CEF UI thread.</remarks> |
| 177 | + IRegistration AddPreferenceObserver(string name, IPreferenceObserver observer); |
| 178 | + |
161 | 179 | /// <summary> |
162 | 180 | /// Clears all certificate exceptions that were added as part of handling |
163 | 181 | /// <see cref="IRequestHandler.OnCertificateError"/>. If you call this it is |
|
0 commit comments