| 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 febc22d41b1e70e46394148759d257e9ffb05762..849f4536aaa13f7a3c6036553ee29c8bca9791d5 100644
|
| --- a/chrome/browser/resources/settings/prefs/prefs.js
|
| +++ b/chrome/browser/resources/settings/prefs/prefs.js
|
| @@ -97,40 +97,32 @@
|
| }
|
|
|
| if (shouldObserve) {
|
| - let keyObserver = new ObjectObserver(root);
|
| - keyObserver.open(
|
| - this.propertyChangeCallback_.bind(this, prefObj.key));
|
| + Object.observe(root, this.propertyChangeCallback_, ['update']);
|
| }
|
| }, this);
|
| },
|
|
|
| /**
|
| * Called when a property of a pref changes.
|
| - * @param {string} propertyPath The path before the property names.
|
| - * @param {!Array<string>} added An array of keys which were added.
|
| - * @param {!Array<string>} removed An array of keys which were removed.
|
| - * @param {!Array<string>} changed An array of keys of properties whose
|
| - * values changed.
|
| - * @param {function(string) : *} getOldValueFn A function which takes a
|
| - * property name and returns the old value for that property.
|
| + * @param {!Array<!Object>} changes An array of objects describing changes.
|
| + * @see http://www.html5rocks.com/en/tutorials/es7/observe/
|
| * @private
|
| */
|
| - propertyChangeCallback_: function(
|
| - propertyPath, added, removed, changed, getOldValueFn) {
|
| - for (let property in changed) {
|
| + propertyChangeCallback_: function(changes) {
|
| + changes.forEach(function(change) {
|
| // UI should only be able to change the value of a setting for now, not
|
| // disabled, etc.
|
| - assert(property == 'value');
|
| + assert(change.name == 'value');
|
|
|
| - let newValue = changed[property];
|
| + let newValue = change.object[change.name];
|
| assert(newValue !== undefined);
|
|
|
| chrome.settingsPrivate.setPref(
|
| - propertyPath,
|
| + change.object['key'],
|
| newValue,
|
| /* pageId */ '',
|
| /* callback */ function() {});
|
| - }
|
| + });
|
| },
|
| });
|
| })();
|
|
|