Add an "affinity" option to webPreferences

This commit is contained in:
Emmanuel Kimmerlin 2017-12-13 11:57:41 +01:00 committed by Cheng Zhao
parent 8d55334016
commit 9c1b47361f
6 changed files with 242 additions and 12 deletions

View file

@ -237,6 +237,22 @@ bool WebContentsPreferences::IsPreferenceEnabled(
return bool_value;
}
bool WebContentsPreferences::GetPreferenceString(
const std::string& attribute_name,
content::WebContents* web_contents,
std::string* strValue) {
WebContentsPreferences* self;
if (!web_contents)
return false;
self = FromWebContents(web_contents);
if (!self)
return false;
base::DictionaryValue& web_preferences = self->web_preferences_;
return web_preferences.GetString(attribute_name, strValue);
}
bool WebContentsPreferences::IsSandboxed(content::WebContents* web_contents) {
return IsPreferenceEnabled("sandbox", web_contents);
}
@ -256,6 +272,12 @@ bool WebContentsPreferences::DisablePopups(
return IsPreferenceEnabled("disablePopups", web_contents);
}
bool WebContentsPreferences::GetAffinity(
content::WebContents* web_contents,
std::string* string_value) {
return GetPreferenceString("affinity", web_contents, string_value);
}
// static
void WebContentsPreferences::OverrideWebkitPrefs(
content::WebContents* web_contents, content::WebPreferences* prefs) {