Support registration of custom preferences.

Custom global and request context preferences can now be registered via
CefBrowserProcessHandler::OnRegisterCustomPreferences. CefRequestContext
now extends CefPreferenceManager and global preferences can be accessed
via CefPreferenceManager::GetGlobalPreferenceManager.
This commit is contained in:
Marshall Greenblatt
2022-10-25 18:50:29 -04:00
parent 767c4422ac
commit 09bb643ef6
45 changed files with 2022 additions and 531 deletions

View File

@ -45,7 +45,7 @@
#include "include/cef_extension.h"
#include "include/cef_extension_handler.h"
#include "include/cef_media_router.h"
#include "include/cef_values.h"
#include "include/cef_preference.h"
class CefRequestContextHandler;
class CefSchemeHandlerFactory;
@ -84,7 +84,7 @@ class CefResolveCallback : public virtual CefBaseRefCounted {
/// all other request context objects will be ignored.
///
/*--cef(source=library,no_debugct_check)--*/
class CefRequestContext : public virtual CefBaseRefCounted {
class CefRequestContext : public CefPreferenceManager {
public:
///
/// Returns the global context object.
@ -179,57 +179,6 @@ class CefRequestContext : public virtual CefBaseRefCounted {
/*--cef()--*/
virtual bool ClearSchemeHandlerFactories() = 0;
///
/// Returns true if a preference with the specified |name| exists. This method
/// must be called on the browser process UI thread.
///
/*--cef()--*/
virtual bool HasPreference(const CefString& name) = 0;
///
/// Returns the value for the preference with the specified |name|. Returns
/// NULL if the preference does not exist. The returned object contains a copy
/// of the underlying preference value and modifications to the returned
/// object will not modify the underlying preference value. This method must
/// be called on the browser process UI thread.
///
/*--cef()--*/
virtual CefRefPtr<CefValue> GetPreference(const CefString& name) = 0;
///
/// Returns all preferences as a dictionary. If |include_defaults| is true
/// then preferences currently at their default value will be included. The
/// returned object contains a copy of the underlying preference values and
/// modifications to the returned object will not modify the underlying
/// preference values. This method must be called on the browser process UI
/// thread.
///
/*--cef()--*/
virtual CefRefPtr<CefDictionaryValue> GetAllPreferences(
bool include_defaults) = 0;
///
/// Returns true if the preference with the specified |name| can be modified
/// using SetPreference. As one example preferences set via the command-line
/// usually cannot be modified. This method must be called on the browser
/// process UI thread.
///
/*--cef()--*/
virtual bool CanSetPreference(const CefString& name) = 0;
///
/// Set the |value| associated with preference |name|. Returns true if the
/// value is set successfully and false otherwise. If |value| is NULL the
/// preference will be restored to its default value. If setting the
/// preference fails then |error| will be populated with a detailed
/// description of the problem. This method must be called on the browser
/// process UI thread.
///
/*--cef(optional_param=value)--*/
virtual bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) = 0;
///
/// Clears all certificate exceptions that were added as part of handling
/// CefRequestHandler::OnCertificateError(). If you call this it is