| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * The |name| is shown in the gui. The |value| us use to set or compare with | 6 * The |name| is shown in the gui. The |value| us use to set or compare with |
| 7 * the preference value. | 7 * the preference value. |
| 8 * @typedef {{ | 8 * @typedef {{ |
| 9 * name: string, | 9 * name: string, |
| 10 * value: (number|string) | 10 * value: (number|string) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 /** | 69 /** |
| 70 * Pass the selection change to the pref value. | 70 * Pass the selection change to the pref value. |
| 71 * @private | 71 * @private |
| 72 */ | 72 */ |
| 73 onChange_: function() { | 73 onChange_: function() { |
| 74 var selected = this.$.dropdownMenu.value; | 74 var selected = this.$.dropdownMenu.value; |
| 75 | 75 |
| 76 if (selected == this.notFoundValue_) | 76 if (selected == this.notFoundValue_) |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 var prefValue = Settings.PrefUtil.stringToPrefValue( | 79 var prefValue = |
| 80 selected, assert(this.pref)); | 80 Settings.PrefUtil.stringToPrefValue(selected, assert(this.pref)); |
| 81 if (prefValue !== undefined) | 81 if (prefValue !== undefined) |
| 82 this.set('pref.value', prefValue); | 82 this.set('pref.value', prefValue); |
| 83 }, | 83 }, |
| 84 | 84 |
| 85 /** | 85 /** |
| 86 * Updates the selected item when the pref or menuOptions change. | 86 * Updates the selected item when the pref or menuOptions change. |
| 87 * @private | 87 * @private |
| 88 */ | 88 */ |
| 89 updateSelected_: function() { | 89 updateSelected_: function() { |
| 90 if (this.menuOptions === null || !this.menuOptions.length) | 90 if (this.menuOptions === null || !this.menuOptions.length) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * @return {boolean} | 125 * @return {boolean} |
| 126 * @private | 126 * @private |
| 127 */ | 127 */ |
| 128 shouldDisableMenu_: function() { | 128 shouldDisableMenu_: function() { |
| 129 return this.disabled || this.isPrefEnforced() || | 129 return this.disabled || this.isPrefEnforced() || |
| 130 this.menuOptions === null || this.menuOptions.length == 0; | 130 this.menuOptions === null || this.menuOptions.length == 0; |
| 131 }, | 131 }, |
| 132 }); | 132 }); |
| OLD | NEW |