Chromium Embedded Framework (CEF)  135.0.1+gd336310+chromium-135.0.7049.3
CefPreferenceManager Class Referenceabstract

Manage access to preferences. More...

#include "include/cef_preference.h"

Inheritance diagram for CefPreferenceManager:
CefBaseRefCounted CefRequestContext

Public Member Functions

virtual bool HasPreference (const CefString &name)=0
 Returns true if a preference with the specified |name| exists. More...
 
virtual CefRefPtr< CefValueGetPreference (const CefString &name)=0
 Returns the value for the preference with the specified |name|. More...
 
virtual CefRefPtr< CefDictionaryValueGetAllPreferences (bool include_defaults)=0
 Returns all preferences as a dictionary. More...
 
virtual bool CanSetPreference (const CefString &name)=0
 Returns true if the preference with the specified |name| can be modified using SetPreference. More...
 
virtual bool SetPreference (const CefString &name, CefRefPtr< CefValue > value, CefString &error)=0
 Set the |value| associated with preference |name|. More...
 
virtual CefRefPtr< CefRegistrationAddPreferenceObserver (const CefString &name, CefRefPtr< CefPreferenceObserver > observer)=0
 Add an observer for preference changes. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Static Public Member Functions

static void GetChromeVariationsAsSwitches (std::vector< CefString > &switches)
 Returns the current Chrome Variations configuration (combination of field trials and chrome://flags) as equivalent command-line switches (--[enable|disable]-features=XXXX, etc). More...
 
static void GetChromeVariationsAsStrings (std::vector< CefString > &strings)
 Returns the current Chrome Variations configuration (combination of field trials and chrome://flags) as human-readable strings. More...
 
static CefRefPtr< CefPreferenceManagerGetGlobalPreferenceManager ()
 Returns the global preference manager object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed Description

Manage access to preferences.

Many built-in preferences are registered by Chromium. Custom preferences can be registered in CefBrowserProcessHandler::OnRegisterCustomPreferences.

Member Function Documentation

◆ AddPreferenceObserver()

virtual CefRefPtr<CefRegistration> CefPreferenceManager::AddPreferenceObserver ( const CefString name,
CefRefPtr< CefPreferenceObserver observer 
)
pure virtual

Add an observer for preference changes.

|name| is the name of the preference to observe. If |name| is empty then all preferences will be observed. Observing all preferences has performance consequences and is not recommended outside of testing scenarios. The observer will remain registered until the returned Registration object is destroyed. This method must be called on the browser process UI thread.

◆ CanSetPreference()

virtual bool CefPreferenceManager::CanSetPreference ( const CefString name)
pure virtual

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.

◆ GetAllPreferences()

virtual CefRefPtr<CefDictionaryValue> CefPreferenceManager::GetAllPreferences ( bool  include_defaults)
pure virtual

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.

◆ GetChromeVariationsAsStrings()

static void CefPreferenceManager::GetChromeVariationsAsStrings ( std::vector< CefString > &  strings)
static

Returns the current Chrome Variations configuration (combination of field trials and chrome://flags) as human-readable strings.

This is the human-readable equivalent of the "Active Variations" section of chrome://version. See https://developer.chrome.com/docs/web-platform/chrome-variations for background and details. Note that field trial tests are disabled by default in Official CEF builds (via the disable_fieldtrial_testing_config=true GN flag). This method must be called on the browser process UI thread.

◆ GetChromeVariationsAsSwitches()

static void CefPreferenceManager::GetChromeVariationsAsSwitches ( std::vector< CefString > &  switches)
static

Returns the current Chrome Variations configuration (combination of field trials and chrome://flags) as equivalent command-line switches (--[enable|disable]-features=XXXX, etc).

These switches can be used to apply the same configuration when launching a CEF-based application. See https://developer.chrome.com/docs/web-platform/chrome-variations for background and details. Note that field trial tests are disabled by default in Official CEF builds (via the disable_fieldtrial_testing_config=true GN flag). This method must be called on the browser process UI thread.

◆ GetGlobalPreferenceManager()

static CefRefPtr<CefPreferenceManager> CefPreferenceManager::GetGlobalPreferenceManager ( )
static

Returns the global preference manager object.

◆ GetPreference()

virtual CefRefPtr<CefValue> CefPreferenceManager::GetPreference ( const CefString name)
pure virtual

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.

◆ HasPreference()

virtual bool CefPreferenceManager::HasPreference ( const CefString name)
pure virtual

Returns true if a preference with the specified |name| exists.

This method must be called on the browser process UI thread.

◆ SetPreference()

virtual bool CefPreferenceManager::SetPreference ( const CefString name,
CefRefPtr< CefValue value,
CefString error 
)
pure virtual

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.


The documentation for this class was generated from the following file: