Chromium Code Reviews| 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..a4c907b05eba42b3461a8cec89f5b0d1ddc994d8 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. |
| }, |
| + /** |
|
michaelpg
2015/03/06 02:08:17
Looks like there's an extra space on this line
Jeremy Klein
2015/03/06 02:20:01
Done.
|
| + * 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) { |
|
michaelpg
2015/03/06 02:08:17
let's avoid using $ in variable/parameter names, e
Jeremy Klein
2015/03/06 02:20:01
Done.
|
| + 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]}`); |
| // TODO(jlklein): Actually set the changed property back to prefs. |
| - }); |
| + }.bind(this)); |
| }, |
| }); |