| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 /** | 68 /** |
| 69 * Pass the selection change to the pref value. | 69 * Pass the selection change to the pref value. |
| 70 * @private | 70 * @private |
| 71 */ | 71 */ |
| 72 onChange_: function() { | 72 onChange_: function() { |
| 73 var selected = this.$.dropdownMenu.value; | 73 var selected = this.$.dropdownMenu.value; |
| 74 | 74 |
| 75 if (selected == this.notFoundValue_) | 75 if (selected == this.notFoundValue_) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 var prefValue = Settings.PrefUtil.stringToPrefValue( | 78 var prefValue = |
| 79 selected, assert(this.pref)); | 79 Settings.PrefUtil.stringToPrefValue(selected, assert(this.pref)); |
| 80 if (prefValue !== undefined) | 80 if (prefValue !== undefined) |
| 81 this.set('pref.value', prefValue); | 81 this.set('pref.value', prefValue); |
| 82 }, | 82 }, |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * Updates the selected item when the pref or menuOptions change. | 85 * Updates the selected item when the pref or menuOptions change. |
| 86 * @private | 86 * @private |
| 87 */ | 87 */ |
| 88 updateSelected_: function() { | 88 updateSelected_: function() { |
| 89 if (this.menuOptions === null || !this.menuOptions.length) | 89 if (this.menuOptions === null || !this.menuOptions.length) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @return {boolean} | 124 * @return {boolean} |
| 125 * @private | 125 * @private |
| 126 */ | 126 */ |
| 127 shouldDisableMenu_: function() { | 127 shouldDisableMenu_: function() { |
| 128 return this.disabled || this.menuOptions === null || | 128 return this.disabled || this.menuOptions === null || |
| 129 this.menuOptions.length == 0; | 129 this.menuOptions.length == 0; |
| 130 }, | 130 }, |
| 131 }); | 131 }); |
| OLD | NEW |