Core - Add AddPreferenceObserver support. (#5279)

* Core - Add `AddPreferenceObserver` support.
This commit is contained in:
Schuyler Tan
2026-08-29 08:44:25 +08:00
committed by GitHub
parent 16bc6e0711
commit 732afb1f66
12 changed files with 189 additions and 1 deletions
+14
View File
@@ -11,9 +11,12 @@
#include "Internals\CefSchemeHandlerFactoryAdapter.h"
#include "Internals\CefCompletionCallbackAdapter.h"
#include "Internals\CefResolveCallbackAdapter.h"
#include "Internals\PreferenceObserverAdapter.h"
#include "Internals\TypeConversion.h"
#include "Internals\CefRegistrationWrapper.h"
using namespace System::Runtime::InteropServices;
using namespace CefSharp::Callback;
namespace CefSharp
{
@@ -117,6 +120,17 @@ namespace CefSharp
return success;
}
IRegistration^ RequestContext::AddPreferenceObserver(String^ name, IPreferenceObserver^ observer)
{
ThrowIfDisposed();
ThrowIfExecutedOnNonCefUiThread();
auto registration = _requestContext->AddPreferenceObserver(StringUtils::ToNative(name), new PreferenceObserverAdapter(observer));
return gcnew CefRegistrationWrapper(registration);
}
void RequestContext::ClearCertificateExceptions(ICompletionCallback^ callback)
{
ThrowIfDisposed();