Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 fieldset.disabled = !setting.get(); | 132 fieldset.disabled = !setting.get(); |
| 133 setting.addChangeListener(settingChanged); | 133 setting.addChangeListener(settingChanged); |
| 134 return fieldset; | 134 return fieldset; |
| 135 | 135 |
| 136 function settingChanged() { | 136 function settingChanged() { |
| 137 fieldset.disabled = !setting.get(); | 137 fieldset.disabled = !setting.get(); |
| 138 } | 138 } |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * @param {!Runtime.Extension} extension | |
| 143 * @return {?Element} | |
| 144 */ | |
| 145 UI.SettingsUI.settingExtensionToControl = function(extension) { | |
|
dgozman
2017/05/15 19:07:44
Let's pass setting instance here, and let it have
luoe
2017/05/16 00:05:47
Done.
Introducing an extension() getter feels a l
dgozman
2017/05/16 18:47:25
I think removing setting.title() is the right way.
| |
| 146 var descriptor = extension.descriptor(); | |
| 147 var setting = Common.moduleSetting(descriptor['settingName']); | |
| 148 var uiTitle = Common.UIString(extension.title() || ''); | |
| 149 switch (descriptor['settingType']) { | |
| 150 case 'boolean': | |
| 151 return UI.SettingsUI.createSettingCheckbox(uiTitle, setting); | |
| 152 case 'enum': | |
| 153 return UI.SettingsUI.createSettingSelect(uiTitle, descriptor['options'], s etting); | |
|
dgozman
2017/05/15 19:07:44
Let's do some validation here - that options exist
luoe
2017/05/16 00:05:47
Done in the previous patch, since it falls within
| |
| 154 default: | |
| 155 console.error('Invalid setting type: ' + descriptor['settingType']); | |
| 156 return null; | |
| 157 } | |
| 158 }; | |
| 159 | |
| 160 /** | |
| 142 * @interface | 161 * @interface |
| 143 */ | 162 */ |
| 144 UI.SettingUI = function() {}; | 163 UI.SettingUI = function() {}; |
| 145 | 164 |
| 146 UI.SettingUI.prototype = { | 165 UI.SettingUI.prototype = { |
| 147 /** | 166 /** |
| 148 * @return {?Element} | 167 * @return {?Element} |
| 149 */ | 168 */ |
| 150 settingElement() {} | 169 settingElement() {} |
| 151 }; | 170 }; |
| OLD | NEW |