in libcef/browser/prefs/renderer_prefs.cc [52:142]
void SetChromePrefs(Profile* profile, blink::web_pref::WebPreferences& web) {
PrefService* prefs = profile->GetPrefs();
// Fill per-script font preferences.
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitStandardFontFamilyMap,
&web.standard_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitFixedFontFamilyMap,
&web.fixed_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitSerifFontFamilyMap,
&web.serif_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitSansSerifFontFamilyMap,
&web.sans_serif_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitCursiveFontFamilyMap,
&web.cursive_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitFantasyFontFamilyMap,
&web.fantasy_font_family_map);
FontFamilyCache::FillFontFamilyMap(profile,
prefs::kWebKitPictographFontFamilyMap,
&web.pictograph_font_family_map);
web.default_font_size = prefs->GetInteger(prefs::kWebKitDefaultFontSize);
web.default_fixed_font_size =
prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize);
web.minimum_font_size = prefs->GetInteger(prefs::kWebKitMinimumFontSize);
web.minimum_logical_font_size =
prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize);
web.default_encoding = prefs->GetString(prefs::kDefaultCharset);
web.dom_paste_enabled = prefs->GetBoolean(prefs::kWebKitDomPasteEnabled);
web.tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks);
if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled))
web.javascript_enabled = false;
if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled))
web.web_security_enabled = false;
if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled))
web.plugins_enabled = false;
web.loads_images_automatically =
prefs->GetBoolean(prefs::kWebKitLoadsImagesAutomatically);
if (prefs->GetBoolean(prefs::kDisable3DAPIs)) {
web.webgl1_enabled = false;
web.webgl2_enabled = false;
}
web.allow_running_insecure_content =
prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent);
web.password_echo_enabled = browser_defaults::kPasswordEchoEnabled;
web.text_areas_are_resizable =
prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable);
web.hyperlink_auditing_enabled =
prefs->GetBoolean(prefs::kEnableHyperlinkAuditing);
if (extensions::ExtensionsEnabled()) {
std::string image_animation_policy =
prefs->GetString(prefs::kAnimationPolicy);
if (image_animation_policy == kAnimationPolicyOnce) {
web.animation_policy =
blink::mojom::ImageAnimationPolicy::kImageAnimationPolicyAnimateOnce;
} else if (image_animation_policy == kAnimationPolicyNone) {
web.animation_policy =
blink::mojom::ImageAnimationPolicy::kImageAnimationPolicyNoAnimation;
} else {
web.animation_policy =
blink::mojom::ImageAnimationPolicy::kImageAnimationPolicyAllowed;
}
}
// Make sure we will set the default_encoding with canonical encoding name.
web.default_encoding =
base::GetCanonicalEncodingNameByAliasName(web.default_encoding);
if (web.default_encoding.empty()) {
prefs->ClearPref(prefs::kDefaultCharset);
web.default_encoding = prefs->GetString(prefs::kDefaultCharset);
}
DCHECK(!web.default_encoding.empty());
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnablePotentiallyAnnoyingSecurityFeatures)) {
web.disable_reading_from_canvas = true;
web.strict_mixed_content_checking = true;
web.strict_powerful_feature_restrictions = true;
}
}