|
16 | 16 |
|
17 | 17 | using namespace System::Runtime::InteropServices; |
18 | 18 | using namespace System::Threading::Tasks; |
| 19 | +using namespace CefSharp::Callback; |
19 | 20 |
|
20 | 21 | namespace CefSharp |
21 | 22 | { |
@@ -254,6 +255,23 @@ namespace CefSharp |
254 | 255 | /// application thread will be the CEF UI thread.</remarks> |
255 | 256 | virtual bool CanSetPreference(String^ name); |
256 | 257 |
|
| 258 | + /// <summary> |
| 259 | + /// Add an observer for preference changes. <paramref name="name"/> is the name of the |
| 260 | + /// preference to observe. If <paramref name="name"/> is empty then all preferences will |
| 261 | + /// be observed. Observing all preferences has performance consequences and |
| 262 | + /// is not recommended outside of testing scenarios. The observer will remain |
| 263 | + /// registered until the returned Registration object is destroyed. This |
| 264 | + /// method must be called on the browser process UI thread. |
| 265 | + /// </summary> |
| 266 | + /// <param name="name">preference key</param> |
| 267 | + /// <param name="observer">preference observer</param> |
| 268 | + /// <remarks>Use Cef.UIThreadTaskFactory to execute this method if required, |
| 269 | + /// <see cref="IBrowserProcessHandler.OnContextInitialized"/> and ChromiumWebBrowser.IsBrowserInitializedChanged are both |
| 270 | + /// executed on the CEF UI thread, so can be called directly. |
| 271 | + /// When CefSettings.MultiThreadedMessageLoop == false (the default is true) then the main |
| 272 | + /// application thread will be the CEF UI thread.</remarks> |
| 273 | + virtual IRegistration^ AddPreferenceObserver(String^ name, IPreferenceObserver^ observer); |
| 274 | + |
257 | 275 | /// <summary> |
258 | 276 | /// Set the value associated with preference name. If value is null the |
259 | 277 | /// preference will be restored to its default value. If setting the preference |
|
0 commit comments