Set appropriate defaults for webview options (#12271)
* Persist defaults to webPreferences object to JS land can read the inferred values instead of just user defined values * Test inherited default propogation * Refactor to remove coupling from fetching values and defaults * Test description type * Fix up tests
This commit is contained in:
parent
f54c94d6c9
commit
c2673aa970
11 changed files with 110 additions and 11 deletions
|
@ -57,10 +57,16 @@ class WebContentsPreferences
|
|||
|
||||
// Returns the web preferences.
|
||||
base::DictionaryValue* web_preferences() { return &web_preferences_; }
|
||||
base::DictionaryValue* last_web_preferences() {
|
||||
return &last_web_preferences_;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class content::WebContentsUserData<WebContentsPreferences>;
|
||||
|
||||
// Set preference value to given bool if user did not provide value
|
||||
bool SetDefaultBoolIfUndefined(const std::string key, bool val);
|
||||
|
||||
// Get preferences value as integer possibly coercing it from a string
|
||||
bool GetInteger(const std::string& attributeName, int* intValue);
|
||||
|
||||
|
@ -68,6 +74,7 @@ class WebContentsPreferences
|
|||
|
||||
content::WebContents* web_contents_;
|
||||
base::DictionaryValue web_preferences_;
|
||||
base::DictionaryValue last_web_preferences_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebContentsPreferences);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue