Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Unified Diff: third_party/WebKit/Source/devtools/front_end/common/Settings.js

Issue 2678623002: DevTools: pass title when creating settings (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ffa709e9e1da1367edc3b560e8eb50768daf0ed5..f5e515cf67efcfd69cbd236618eb1979b7e5ce4d 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Settings.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Settings.js
@@ -57,8 +57,11 @@ Common.Settings = class {
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';
pfeldman 2017/02/13 20:24:54 revert
luoe 2017/02/13 22:18:26 Done.
+ var setting = isRegex ? this.createRegExpSetting(settingName, defaultValue, undefined, isLocal) :
+ this.createSetting(settingName, defaultValue, isLocal);
+ if (descriptor['title'])
+ setting.setTitle(descriptor['title']);
this._moduleSettings.set(settingName, setting);
}
@@ -92,9 +95,9 @@ Common.Settings = class {
*/
createSetting(key, defaultValue, isLocal) {
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(
pfeldman 2017/02/13 20:24:54 revert
luoe 2017/02/13 22:18:26 Done.
+ this, key, defaultValue, this._eventSupport, isLocal ? this._localStorage : this._settingsStorage);
+ this._registry.set(key, setting);
}
return /** @type {!Common.Setting} */ (this._registry.get(key));
}
@@ -117,10 +120,10 @@ Common.Settings = class {
*/
createRegExpSetting(key, defaultValue, regexFlags, isLocal) {
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(
pfeldman 2017/02/13 20:24:54 ditto
luoe 2017/02/13 22:18:26 Done.
+ this, key, defaultValue, this._eventSupport, isLocal ? this._localStorage : this._settingsStorage,
+ regexFlags);
+ this._registry.set(key, setting);
}
return /** @type {!Common.RegExpSetting} */ (this._registry.get(key));
}
@@ -231,6 +234,8 @@ Common.Setting = class {
this._defaultValue = defaultValue;
this._eventSupport = eventSupport;
this._storage = storage;
+ /** @type {string} */
+ this._title = '';
}
/**
@@ -254,6 +259,20 @@ Common.Setting = class {
}
/**
+ * @return {string}
+ */
+ title() {
+ return this._title;
+ }
+
+ /**
+ * @param {string} title
+ */
+ setTitle(title) {
+ this._title = title;
+ }
+
+ /**
* @return {V}
*/
get() {

Powered by Google App Engine
This is Rietveld 408576698