Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js b/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js |
| index bc3a433720f31a3bf27ac541cf2244683f805d25..622effaf77fd75d1f29e9bc5f07614bd37000e2c 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js |
| @@ -138,6 +138,25 @@ UI.SettingsUI.createSettingFieldset = function(setting) { |
| } |
| }; |
| +/** |
| + * @param {!Runtime.Extension} extension |
| + * @return {?Element} |
| + */ |
| +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.
|
| + var descriptor = extension.descriptor(); |
| + var setting = Common.moduleSetting(descriptor['settingName']); |
| + var uiTitle = Common.UIString(extension.title() || ''); |
| + switch (descriptor['settingType']) { |
| + case 'boolean': |
| + return UI.SettingsUI.createSettingCheckbox(uiTitle, setting); |
| + case 'enum': |
| + return UI.SettingsUI.createSettingSelect(uiTitle, descriptor['options'], setting); |
|
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
|
| + default: |
| + console.error('Invalid setting type: ' + descriptor['settingType']); |
| + return null; |
| + } |
| +}; |
| + |
| /** |
| * @interface |
| */ |