# Class TCefPreferenceManagerRef

Description
Hierarchy
Fields
Methods
Properties

## Unit

uCEFPreferenceManager

## Declaration

`type TCefPreferenceManagerRef = class(TCefBaseRefCountedRef, ICefPreferenceManager)`

## Description

Manage access to preferences. Many built-in preferences are registered by Chromium. Custom preferences can be registered in ICefBrowserProcessHandler.OnRegisterCustomPreferences.

<see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_preference_capi.h">CEF source file: /include/capi/cef_preference_capi.h (cef_preference_manager_t))

## Hierarchy

- TInterfacedObject
- TCefBaseRefCountedRef
- TCefPreferenceManagerRef

## Overview

### Methods

| `function HasPreference(const name: ustring): Boolean;`
| `function GetPreference(const name: ustring): ICefValue;`
| `function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue;`
| `function CanSetPreference(const name: ustring): Boolean;`
| `function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean;`
| `function AddPreferenceObserver(const name: ustring; const observer: ICefPreferenceObserver): ICefRegistration;`
| `class function UnWrap(data: Pointer): ICefPreferenceManager;`
| `class function Global: ICefPreferenceManager;`
| `class procedure GetChromeVariationsAsSwitches(const switches: TStrings);`
| `class procedure GetChromeVariationsAsStrings(const strings: TStrings);`

## Description

### Methods

| `function HasPreference(const name: ustring): Boolean;`
Returns true (1) if a preference with the specified |name| exists. This function must be called on the browser process UI thread.

| `function GetPreference(const name: ustring): ICefValue;`
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 function must be called on the browser process UI thread.

| `function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue;`
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 function must be called on the browser process UI thread.

| `function CanSetPreference(const name: ustring): Boolean;`
Returns true (1) 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 function must be called on the browser process UI thread.

| `function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean;`
Returns true (1) 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 function must be called on the browser process UI thread.

| `function AddPreferenceObserver(const name: ustring; const observer: ICefPreferenceObserver): ICefRegistration;`

Add an observer for preference changes. |name| is the name of the preference to observe. If |name| is NULL 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 function must be called on the browser process UI thread.

| `class function UnWrap(data: Pointer): ICefPreferenceManager;`
This item has no description.

| `class function Global: ICefPreferenceManager;`
Returns the global preference manager object.

| `class procedure GetChromeVariationsAsSwitches(const switches: TStrings);`

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 (1)` GN flag). This function must be called on the browser process UI thread.

| `class procedure GetChromeVariationsAsStrings(const strings: TStrings);`

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 (1)` GN flag). This function must be called on the browser process UI thread.

Generated by PasDoc 0.17.0.snapshot.