Documentation
¶
Overview ¶
Package profile reads and mutates Chromium profile data files.
Index ¶
- Constants
- func ApplyLocalState(profileDir string, patches []Patch) error
- func ApplyPreferences(profileDir string, patches []Patch) error
- func ApplyVariations(profileDir string, patches []Patch) error
- func EnsureAcceleratorAdded(customAccelerators map[string]any, commandID, accelerator string)
- func NestedObject(root map[string]any, dottedPath string) (map[string]any, error)
- func PatchValues(root map[string]any, values []Value, description string) error
- func ReadLocalState(profileDir string) (map[string]any, error)
- func ReadPreferences(profileDir string) (map[string]any, error)
- func ReadVariations(profileDir string) (map[string]any, error)
- func SetCookieAllowlist(preferences map[string]any, patterns []string) error
- func SetCookiePolicy(preferences map[string]any, policy CookiePolicy) error
- func SetNestedValue(root map[string]any, dottedPath string, value any) error
- func WriteLocalState(profileDir string, localState map[string]any) error
- func WritePreferences(profileDir string, preferences map[string]any) error
- func WriteVariations(profileDir string, variations map[string]any) error
- type Accelerator
- type Builder
- type CookiePolicy
- type CookieSetting
- type Defaults
- type Patch
- type ThirdPartyCookiePolicy
- type Value
Constants ¶
const ( PreferencesFilename = "Preferences" LocalStateFilename = "Local State" VariationsFilename = "Variations" )
Variables ¶
This section is empty.
Functions ¶
func ApplyLocalState ¶
func ApplyPreferences ¶
func ApplyVariations ¶
func EnsureAcceleratorAdded ¶
func NestedObject ¶
func SetCookieAllowlist ¶
func SetCookiePolicy ¶
func SetCookiePolicy(preferences map[string]any, policy CookiePolicy) error
SetCookiePolicy updates Chromium's default cookie setting, third-party cookie mode, and per-pattern exceptions. A nil exception list is unmanaged. A non-nil list owns exceptions with that setting, including when the list is empty and therefore removes existing exceptions of that setting.
Types ¶
type Accelerator ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder collects typed preference values and optionally resolves symbolic names to their stored Chromium paths.
func (*Builder) Add ¶
Add resolves a symbolic preference name and adds a value of any concrete type. Generic methods require Go 1.27.
func (*Builder) AddOptional ¶
AddOptional is the pointer-valued counterpart to Add.
type CookiePolicy ¶
type CookiePolicy struct {
Default CookieSetting `toml:"default"`
ThirdParty ThirdPartyCookiePolicy `toml:"third_party"`
Allow []string `toml:"allow"`
Block []string `toml:"block"`
SessionOnly []string `toml:"session_only"`
}
func (CookiePolicy) HasPolicy ¶
func (config CookiePolicy) HasPolicy() bool
func (CookiePolicy) Validate ¶
func (config CookiePolicy) Validate() error
type CookieSetting ¶
type CookieSetting string
const ( CookieSettingAllow CookieSetting = "allow" CookieSettingBlock CookieSetting = "block" CookieSettingSessionOnly CookieSetting = "session_only" )
type Defaults ¶
type Defaults struct {
Values []Value `toml:"values"`
LocalStateValues []Value `toml:"local_state_values"`
VariationValues []Value `toml:"variation_values"`
Accelerators []Accelerator `toml:"accelerators"`
Cookies CookiePolicy `toml:"cookies"`
}
func (Defaults) HasPreferences ¶
func (Defaults) PatchLocalState ¶
func (Defaults) PatchPreferences ¶
type ThirdPartyCookiePolicy ¶
type ThirdPartyCookiePolicy string
const ( ThirdPartyCookiePolicyOff ThirdPartyCookiePolicy = "off" ThirdPartyCookiePolicyBlock ThirdPartyCookiePolicy = "block" ThirdPartyCookiePolicyIncognitoOnly ThirdPartyCookiePolicy = "incognito_only" )
Chromium 157 treats off and incognito_only alike in incognito profiles Retain both stored enum values for compatibility with other browser builds