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

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

Issue 2744883003: DevTools: generalize setting UI for enum/select settings (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 280e168499ef29428b2a15c9190a0eabe04baea1..372336c000b8f10a3354c2c80691a0c17b38db95 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/Settings.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/Settings.js
@@ -75,6 +75,8 @@ Common.Settings = class {
this.createSetting(settingName, defaultValue, storageType);
if (descriptor['title'])
setting.setTitle(descriptor['title']);
+ if (descriptor['options'])
+ setting.setOptions(descriptor['options']);
this._moduleSettings.set(settingName, setting);
}
@@ -263,6 +265,8 @@ Common.Setting = class {
this._storage = storage;
/** @type {string} */
this._title = '';
+ /** @type {!Array<!Common.Setting.Option>|undefined} */
+ this._options;
}
/**
@@ -300,6 +304,20 @@ Common.Setting = class {
}
/**
+ * @return {!Array<!Common.Setting.Option>}
+ */
+ options() {
lushnikov 2017/03/11 00:46:00 Let's not infect Common.Setting with fields which
luoe 2017/05/09 02:58:00 Done.
+ return this._options || [];
+ }
+
+ /**
+ * @param {!Array<!Common.Setting.Option>} options
+ */
+ setOptions(options) {
+ this._options = options;
+ }
+
+ /**
* @return {V}
*/
get() {
@@ -814,6 +832,9 @@ Common.SettingStorageType = {
Session: Symbol('Session')
};
+/** @typedef {!{title: string, value: *, raw: (boolean|undefined)}} */
+Common.Setting.Option;
+
/**
* @param {string} settingName
* @return {!Common.Setting}
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698