Add visualization for Chrome configuration changes (fixes #3892)

- Add new API to retrieve/observe configuration values.
- cefclient: Add https://tests/config to inspect configuration
  values in real time.
This commit is contained in:
Marshall Greenblatt
2025-03-10 15:50:46 +00:00
parent ec31b2b505
commit 549e8fe05c
25 changed files with 1887 additions and 40 deletions

View File

@ -44,6 +44,7 @@
#include "include/cef_cookie.h"
#include "include/cef_media_router.h"
#include "include/cef_preference.h"
#include "include/cef_registration.h"
#include "include/cef_values.h"
class CefRequestContextHandler;
@ -66,6 +67,27 @@ class CefResolveCallback : public virtual CefBaseRefCounted {
const std::vector<CefString>& resolved_ips) = 0;
};
#if CEF_API_ADDED(CEF_NEXT)
///
/// Implemented by the client to observe content and website setting changes and
/// registered via CefRequestContext::AddSettingObserver. The methods of this
/// class will be called on the browser process UI thread.
///
/*--cef(source=client,added=next)--*/
class CefSettingObserver : public virtual CefBaseRefCounted {
public:
///
/// Called when a content or website setting has changed. The new value can be
/// retrieved using CefRequestContext::GetContentSetting or
/// CefRequestContext::GetWebsiteSetting.
///
/*--cef(optional_param=requesting_url,optional_param=top_level_url)--*/
virtual void OnSettingChanged(const CefString& requesting_url,
const CefString& top_level_url,
cef_content_setting_types_t content_type) = 0;
};
#endif
///
/// A request context provides request handling for a set of related browser
/// or URL request objects. A request context can be specified when creating a
@ -292,6 +314,17 @@ class CefRequestContext : public CefPreferenceManager {
cef_content_setting_types_t content_type,
cef_content_setting_values_t value) = 0;
#if CEF_API_ADDED(CEF_NEXT)
///
/// Add an observer for content and website setting changes. The observer will
/// remain registered until the returned Registration object is destroyed.
/// This method must be called on the browser process UI thread.
///
/*--cef(added=next)--*/
virtual CefRefPtr<CefRegistration> AddSettingObserver(
CefRefPtr<CefSettingObserver> observer) = 0;
#endif
///
/// Sets the Chrome color scheme for all browsers that share this request
/// context. |variant| values of SYSTEM, LIGHT and DARK change the underlying