Index: chrome/browser/resources/settings/prefs/prefs.js |
diff --git a/chrome/browser/resources/settings/prefs/prefs.js b/chrome/browser/resources/settings/prefs/prefs.js |
index a50dd7f9852e8b54892725b0cae13f7d54a66405..10abcdba9ba170d0519becb00d4e7dbb60ec2b5d 100644 |
--- a/chrome/browser/resources/settings/prefs/prefs.js |
+++ b/chrome/browser/resources/settings/prefs/prefs.js |
@@ -75,6 +75,18 @@ Polymer('cr-settings-prefs', { |
// TODO(jlklein): Actually pull the data out of prefs and initialize. |
}, |
+ /** |
+ * Converts a camel-case property name to the prefs underscore format. |
+ * @param {string} camelCaseName |
+ * @return {string} The name with underscores instead of dashes. |
+ * @private |
+ */ |
+ camelCaseToUnderscores_: function(camelCaseName) { |
+ return camelCaseName.replace(/([A-Z])/g, function($1) { |
+ return '_' + $1.toLowerCase(); |
+ }); |
+ }, |
+ |
/** |
* @param {string} propertyPath The path before the property names. |
* @param {!Array<string>} added An array of keys which were added. |
@@ -88,12 +100,14 @@ Polymer('cr-settings-prefs', { |
propertyChangeCallback_: function( |
propertyPath, added, removed, changed, getOldValueFn) { |
Object.keys(changed).forEach(function(property) { |
+ var pref = this.camelCaseToUnderscores_(`${propertyPath}.${property}`); |
+ var value = changed[property]; |
console.log( |
- `${propertyPath}.${property}`, |
+ pref, |
`old : ${getOldValueFn(property)}`, |
- `newValue : ${changed[property]}`); |
+ `newValue : ${value}`); |
// TODO(jlklein): Actually set the changed property back to prefs. |
- }); |
+ }.bind(this)); |
}, |
}); |