Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/common/Settings.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/common/Settings.js b/third_party/WebKit/Source/devtools/front_end/common/Settings.js |
| index 6c822c45fb3ecc7bdeb92908c395959d5f15d547..60d68378eb7bd8d54fdb272cb701da93af5e8a62 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/common/Settings.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/common/Settings.js |
| @@ -53,12 +53,14 @@ Common.Settings = class { |
| */ |
| _registerModuleSetting(extension) { |
| var descriptor = extension.descriptor(); |
| + var title = descriptor['title']; |
| var settingName = descriptor['settingName']; |
| var settingType = descriptor['settingType']; |
| var defaultValue = descriptor['defaultValue']; |
| var isLocal = !!descriptor['local']; |
| - var setting = settingType === 'regex' ? this.createRegExpSetting(settingName, defaultValue, undefined, isLocal) : |
| - this.createSetting(settingName, defaultValue, isLocal); |
| + var isRegex = settingType === 'regex'; |
| + var setting = isRegex ? this.createRegExpSetting(settingName, defaultValue, undefined, isLocal, title) : |
| + this.createSetting(settingName, defaultValue, isLocal, title); |
| this._moduleSettings.set(settingName, setting); |
| } |
| @@ -88,13 +90,14 @@ Common.Settings = class { |
| * @param {string} key |
| * @param {*} defaultValue |
| * @param {boolean=} isLocal |
| + * @param {string=} title |
| * @return {!Common.Setting} |
| */ |
| - createSetting(key, defaultValue, isLocal) { |
| + createSetting(key, defaultValue, isLocal, title) { |
|
pfeldman
2017/02/07 20:10:28
Unfortunately, this makes all the users that want
luoe
2017/02/13 06:27:19
Done.
|
| if (!this._registry.get(key)) { |
| - this._registry.set( |
| - key, new Common.Setting( |
| - this, key, defaultValue, this._eventSupport, isLocal ? this._localStorage : this._settingsStorage)); |
| + var setting = new Common.Setting( |
| + this, key, defaultValue, this._eventSupport, isLocal ? this._localStorage : this._settingsStorage, title); |
| + this._registry.set(key, setting); |
| } |
| return /** @type {!Common.Setting} */ (this._registry.get(key)); |
| } |
| @@ -102,10 +105,11 @@ Common.Settings = class { |
| /** |
| * @param {string} key |
| * @param {*} defaultValue |
| + * @param {string=} title |
| * @return {!Common.Setting} |
| */ |
| - createLocalSetting(key, defaultValue) { |
| - return this.createSetting(key, defaultValue, true); |
| + createLocalSetting(key, defaultValue, title) { |
| + return this.createSetting(key, defaultValue, true, title); |
| } |
| /** |
| @@ -113,14 +117,15 @@ Common.Settings = class { |
| * @param {string} defaultValue |
| * @param {string=} regexFlags |
| * @param {boolean=} isLocal |
| + * @param {string=} title |
| * @return {!Common.RegExpSetting} |
| */ |
| - createRegExpSetting(key, defaultValue, regexFlags, isLocal) { |
| + createRegExpSetting(key, defaultValue, regexFlags, isLocal, title) { |
| if (!this._registry.get(key)) { |
| - this._registry.set( |
| - key, new Common.RegExpSetting( |
| - this, key, defaultValue, this._eventSupport, isLocal ? this._localStorage : this._settingsStorage, |
| - regexFlags)); |
| + var setting = new Common.RegExpSetting( |
| + this, key, defaultValue, this._eventSupport, isLocal ? this._localStorage : this._settingsStorage, regexFlags, |
| + title); |
| + this._registry.set(key, setting); |
| } |
| return /** @type {!Common.RegExpSetting} */ (this._registry.get(key)); |
| } |
| @@ -224,13 +229,15 @@ Common.Setting = class { |
| * @param {V} defaultValue |
| * @param {!Common.Object} eventSupport |
| * @param {!Common.SettingsStorage} storage |
| + * @param {string=} title |
| */ |
| - constructor(settings, name, defaultValue, eventSupport, storage) { |
| + constructor(settings, name, defaultValue, eventSupport, storage, title) { |
| this._settings = settings; |
| this._name = name; |
| this._defaultValue = defaultValue; |
| this._eventSupport = eventSupport; |
| this._storage = storage; |
| + this._title = title; |
| } |
| /** |
| @@ -254,6 +261,13 @@ Common.Setting = class { |
| } |
| /** |
| + * @return {string|undefined} |
| + */ |
| + title() { |
| + return this._title; |
| + } |
| + |
| + /** |
| * @return {V} |
| */ |
| get() { |
| @@ -320,9 +334,10 @@ Common.RegExpSetting = class extends Common.Setting { |
| * @param {!Common.Object} eventSupport |
| * @param {!Common.SettingsStorage} storage |
| * @param {string=} regexFlags |
| + * @param {string=} title |
| */ |
| - constructor(settings, name, defaultValue, eventSupport, storage, regexFlags) { |
| - super(settings, name, defaultValue ? [{pattern: defaultValue}] : [], eventSupport, storage); |
| + constructor(settings, name, defaultValue, eventSupport, storage, regexFlags, title) { |
| + super(settings, name, defaultValue ? [{pattern: defaultValue}] : [], eventSupport, storage, title); |
| this._regexFlags = regexFlags; |
| } |