Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview Common prefs behavior. | |
| 7 */ | |
| 8 | |
| 9 /** @polymerBehavior */ | |
| 10 var PrefsBehavior = { | |
| 11 /** | |
| 12 * Gets the pref at the given prefPath. Throws if the pref is not found. | |
| 13 * @param {string} prefPath | |
| 14 * @return {!chrome.settingsPrivate.PrefObject} | |
| 15 * @private | |
| 16 */ | |
| 17 getPref_: function(prefPath) { | |
| 18 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */( | |
| 19 this.get(prefPath, this.prefs)); | |
| 20 assert(typeof pref != 'undefined', 'Pref is missing: ' + prefPath); | |
| 21 return pref; | |
| 22 }, | |
| 23 | |
| 24 /** | |
| 25 * Sets the value of the pref at the given prefPath. | |
| 26 * @param {string} prefPath | |
| 27 * @param {*} value | |
| 28 * @private | |
| 29 */ | |
| 30 setPrefValue_: function(prefPath, value) { | |
| 31 this.set('prefs.' + prefPath + '.value', value); | |
|
michaelpg
2015/10/26 22:15:22
call this.getPref_ so the assert runs:
setPref
Finnur
2015/10/27 11:30:48
Done.
| |
| 32 }, | |
| 33 }; | |
| OLD | NEW |