Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts, WebIn spector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabVi ew()); | 55 this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts, WebIn spector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabVi ew()); |
| 56 this._tabbedPane.shrinkableTabs = false; | 56 this._tabbedPane.shrinkableTabs = false; |
| 57 this._tabbedPane.verticalTabLayout = true; | 57 this._tabbedPane.verticalTabLayout = true; |
| 58 | 58 |
| 59 this._lastSelectedTabSetting = WebInspector.settings.createSetting("lastSele ctedSettingsTab", WebInspector.SettingsScreen.Tabs.General); | 59 this._lastSelectedTabSetting = WebInspector.settings.createSetting("lastSele ctedSettingsTab", WebInspector.SettingsScreen.Tabs.General); |
| 60 this.selectTab(this._lastSelectedTabSetting.get()); | 60 this.selectTab(this._lastSelectedTabSetting.get()); |
| 61 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted, this._tabSelected, this); | 61 this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabSele cted, this._tabSelected, this); |
| 62 } | 62 } |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * @param {string} text | |
| 66 * @return {?string} | |
| 67 */ | |
| 68 WebInspector.SettingsScreen.regexValidator = function(text) | |
| 69 { | |
| 70 var regex; | |
| 71 try { | |
| 72 regex = new RegExp(text); | |
| 73 } catch (e) { | |
| 74 } | |
| 75 return regex ? null : WebInspector.UIString("Invalid pattern"); | |
| 76 } | |
| 77 | |
| 78 /** | |
| 79 * @param {number} min | 65 * @param {number} min |
| 80 * @param {number} max | 66 * @param {number} max |
| 81 * @param {string} text | 67 * @param {string} text |
| 82 * @return {?string} | 68 * @return {?string} |
| 83 */ | 69 */ |
| 84 WebInspector.SettingsScreen.integerValidator = function(min, max, text) | 70 WebInspector.SettingsScreen.integerValidator = function(min, max, text) |
| 85 { | 71 { |
| 86 var value = Number(text); | 72 var value = Number(text); |
| 87 if (isNaN(value)) | 73 if (isNaN(value)) |
| 88 return WebInspector.UIString("Invalid number format"); | 74 return WebInspector.UIString("Invalid number format"); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 function changeListener(e) | 184 function changeListener(e) |
| 199 { | 185 { |
| 200 // Don't use e.target.value to avoid conversion of the value to stri ng. | 186 // Don't use e.target.value to avoid conversion of the value to stri ng. |
| 201 setting.set(options[select.selectedIndex][1]); | 187 setting.set(options[select.selectedIndex][1]); |
| 202 } | 188 } |
| 203 | 189 |
| 204 select.addEventListener("change", changeListener, false); | 190 select.addEventListener("change", changeListener, false); |
| 205 return p; | 191 return p; |
| 206 }, | 192 }, |
| 207 | 193 |
| 208 /** | |
| 209 * @param {string} label | |
| 210 * @param {!WebInspector.Setting} setting | |
| 211 * @param {boolean} numeric | |
| 212 * @param {number=} maxLength | |
| 213 * @param {string=} width | |
| 214 * @param {function(string):?string=} validatorCallback | |
| 215 */ | |
| 216 _createInputSetting: function(label, setting, numeric, maxLength, width, val idatorCallback) | |
| 217 { | |
| 218 var p = document.createElement("p"); | |
| 219 var labelElement = p.createChild("label"); | |
| 220 labelElement.textContent = label; | |
| 221 var inputElement = p.createChild("input"); | |
| 222 inputElement.value = setting.get(); | |
| 223 inputElement.type = "text"; | |
| 224 if (numeric) | |
| 225 inputElement.className = "numeric"; | |
| 226 if (maxLength) | |
| 227 inputElement.maxLength = maxLength; | |
| 228 if (width) | |
| 229 inputElement.style.width = width; | |
| 230 if (validatorCallback) { | |
| 231 var errorMessageLabel = p.createChild("div"); | |
| 232 errorMessageLabel.classList.add("field-error-message"); | |
| 233 errorMessageLabel.style.color = "DarkRed"; | |
| 234 inputElement.oninput = function() | |
| 235 { | |
| 236 var error = validatorCallback(inputElement.value); | |
| 237 if (!error) | |
| 238 error = ""; | |
| 239 errorMessageLabel.textContent = error; | |
| 240 }; | |
| 241 } | |
| 242 | |
| 243 function onBlur() | |
| 244 { | |
| 245 setting.set(numeric ? Number(inputElement.value) : inputElement.valu e); | |
| 246 } | |
| 247 inputElement.addEventListener("blur", onBlur, false); | |
| 248 | |
| 249 return p; | |
| 250 }, | |
| 251 | |
| 252 _createCustomSetting: function(name, element) | |
| 253 { | |
| 254 var p = document.createElement("p"); | |
| 255 var fieldsetElement = document.createElement("fieldset"); | |
| 256 fieldsetElement.createChild("label").textContent = name; | |
| 257 fieldsetElement.appendChild(element); | |
| 258 p.appendChild(fieldsetElement); | |
| 259 return p; | |
| 260 }, | |
| 261 | |
| 262 __proto__: WebInspector.VBox.prototype | 194 __proto__: WebInspector.VBox.prototype |
| 263 } | 195 } |
| 264 | 196 |
| 265 /** | 197 /** |
| 266 * @constructor | 198 * @constructor |
| 267 * @extends {WebInspector.SettingsTab} | 199 * @extends {WebInspector.SettingsTab} |
| 268 */ | 200 */ |
| 269 WebInspector.GenericSettingsTab = function() | 201 WebInspector.GenericSettingsTab = function() |
| 270 { | 202 { |
| 271 WebInspector.SettingsTab.call(this, WebInspector.UIString("General"), "gener al-tab-content"); | 203 WebInspector.SettingsTab.call(this, WebInspector.UIString("General"), "gener al-tab-content"); |
| 272 | 204 |
| 273 var p = this._appendSection(); | 205 this._populateSectionsFromExtensions(); |
| 274 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Disable cache (while DevTools is open)"), WebInspector.settings.cacheDisa bled)); | |
| 275 var disableJSElement = WebInspector.SettingsUI.createSettingCheckbox(WebInsp ector.UIString("Disable JavaScript"), WebInspector.settings.javaScriptDisabled); | |
| 276 p.appendChild(disableJSElement); | |
| 277 WebInspector.settings.javaScriptDisabled.addChangeListener(this._javaScriptD isabledChanged, this); | |
| 278 this._disableJSCheckbox = disableJSElement.getElementsByTagName("input")[0]; | |
| 279 var disableJSInfoParent = this._disableJSCheckbox.parentElement.createChild( "span", "monospace"); | |
| 280 this._disableJSInfo = disableJSInfoParent.createChild("span", "object-info-s tate-note hidden"); | |
| 281 this._disableJSInfo.title = WebInspector.UIString("JavaScript is blocked on the inspected page (may be disabled in browser settings)."); | |
| 282 | 206 |
| 283 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameNavigated, this._updateScriptDisabledCheckbox, this); | 207 var restoreDefaults = this._appendSection().createChild("input", "settings-t ab-text-button"); |
| 284 this._updateScriptDisabledCheckbox(); | |
| 285 | |
| 286 p = this._appendSection(WebInspector.UIString("Appearance")); | |
| 287 var splitVerticallyTitle = WebInspector.UIString("Split panels vertically wh en docked to %s", WebInspector.experimentsSettings.dockToLeft.isEnabled() ? "lef t or right" : "right"); | |
| 288 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(splitVerticallyT itle, WebInspector.settings.splitVerticallyWhenDockedToRight)); | |
| 289 var panelShortcutTitle = WebInspector.UIString("Enable %s + 1-9 shortcut to switch panels", WebInspector.isMac() ? "Cmd" : "Ctrl"); | |
| 290 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(panelShortcutTit le, WebInspector.settings.shortcutPanelSwitch)); | |
| 291 | |
| 292 p = this._appendSection(WebInspector.UIString("Elements")); | |
| 293 var colorFormatElement = this._createSelectSetting(WebInspector.UIString("Co lor format"), [ | |
| 294 [ WebInspector.UIString("As authored"), WebInspector.Color.Format.Or iginal ], | |
| 295 [ "HEX: #DAC0DE", WebInspector.Color.Format.HEX ], | |
| 296 [ "RGB: rgb(128, 255, 255)", WebInspector.Color.Format.RGB ], | |
| 297 [ "HSL: hsl(300, 80%, 90%)", WebInspector.Color.Format.HSL ] | |
| 298 ], WebInspector.settings.colorFormat); | |
| 299 p.appendChild(colorFormatElement); | |
| 300 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Show user agent styles"), WebInspector.settings.showUserAgentStyles)); | |
| 301 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Show user agent shadow DOM"), WebInspector.settings.showUAShadowDOM)); | |
| 302 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Word wrap"), WebInspector.settings.domWordWrap)); | |
| 303 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Show rulers"), WebInspector.settings.showMetricsRulers)); | |
| 304 | |
| 305 p = this._appendSection(WebInspector.UIString("Sources")); | |
| 306 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Search in content scripts"), WebInspector.settings.searchInContentScripts )); | |
| 307 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Enable JavaScript source maps"), WebInspector.settings.jsSourceMapsEnable d)); | |
| 308 | |
| 309 var checkbox = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UI String("Enable CSS source maps"), WebInspector.settings.cssSourceMapsEnabled); | |
| 310 p.appendChild(checkbox); | |
| 311 var fieldset = WebInspector.SettingsUI.createSettingFieldset(WebInspector.se ttings.cssSourceMapsEnabled); | |
| 312 var autoReloadCSSCheckbox = fieldset.createChild("input"); | |
| 313 fieldset.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspec tor.UIString("Auto-reload generated CSS"), WebInspector.settings.cssReloadEnable d, false, autoReloadCSSCheckbox)); | |
| 314 checkbox.appendChild(fieldset); | |
| 315 | |
| 316 var indentationElement = this._createSelectSetting(WebInspector.UIString("De fault indentation"), [ | |
| 317 [ WebInspector.UIString("2 spaces"), WebInspector.TextUtils.Indent.T woSpaces ], | |
| 318 [ WebInspector.UIString("4 spaces"), WebInspector.TextUtils.Indent.F ourSpaces ], | |
| 319 [ WebInspector.UIString("8 spaces"), WebInspector.TextUtils.Indent.E ightSpaces ], | |
| 320 [ WebInspector.UIString("Tab character"), WebInspector.TextUtils.Ind ent.TabCharacter ] | |
| 321 ], WebInspector.settings.textEditorIndent); | |
| 322 p.appendChild(indentationElement); | |
| 323 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Detect indentation"), WebInspector.settings.textEditorAutoDetectIndent)); | |
| 324 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Autocompletion"), WebInspector.settings.textEditorAutocompletion)); | |
| 325 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Bracket matching"), WebInspector.settings.textEditorBracketMatching)); | |
| 326 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Show whitespace characters"), WebInspector.settings.showWhitespacesInEdit or)); | |
| 327 if (WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnabled()) { | |
| 328 checkbox = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UI String("Skip stepping through sources with particular names"), WebInspector.sett ings.skipStackFramesSwitch); | |
| 329 fieldset = WebInspector.SettingsUI.createSettingFieldset(WebInspector.se ttings.skipStackFramesSwitch); | |
| 330 fieldset.appendChild(this._createInputSetting(WebInspector.UIString("Pat tern"), WebInspector.settings.skipStackFramesPattern, false, 1000, "100px", WebI nspector.SettingsScreen.regexValidator)); | |
| 331 checkbox.appendChild(fieldset); | |
| 332 p.appendChild(checkbox); | |
| 333 } | |
| 334 WebInspector.settings.skipStackFramesSwitch.addChangeListener(this._skipStac kFramesSwitchOrPatternChanged, this); | |
| 335 WebInspector.settings.skipStackFramesPattern.addChangeListener(this._skipSta ckFramesSwitchOrPatternChanged, this); | |
| 336 | |
| 337 p = this._appendSection(WebInspector.UIString("Profiler")); | |
| 338 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Show advanced heap snapshot properties"), WebInspector.settings.showAdvan cedHeapSnapshotProperties)); | |
| 339 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("High resolution CPU profiling"), WebInspector.settings.highResolutionCpuP rofiling)); | |
| 340 | |
| 341 p = this._appendSection(WebInspector.UIString("Console")); | |
| 342 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Log XMLHttpRequests"), WebInspector.settings.monitoringXHREnabled)); | |
| 343 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Preserve log upon navigation"), WebInspector.settings.preserveConsoleLog) ); | |
| 344 p.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIS tring("Show timestamps"), WebInspector.settings.consoleTimestampsEnabled)); | |
| 345 | |
| 346 if (WebInspector.openAnchorLocationRegistry.handlerNames.length > 0) { | |
| 347 var handlerSelector = new WebInspector.HandlerSelector(WebInspector.open AnchorLocationRegistry); | |
| 348 p = this._appendSection(WebInspector.UIString("Extensions")); | |
| 349 p.appendChild(this._createCustomSetting(WebInspector.UIString("Open link s in"), handlerSelector.element)); | |
| 350 } | |
| 351 | |
| 352 p = this._appendSection(); | |
| 353 | |
| 354 var restoreDefaults = p.createChild("input", "settings-tab-text-button"); | |
| 355 restoreDefaults.type = "button"; | 208 restoreDefaults.type = "button"; |
| 356 restoreDefaults.value = WebInspector.UIString("Restore defaults and reload") ; | 209 restoreDefaults.value = WebInspector.UIString("Restore defaults and reload") ; |
| 357 restoreDefaults.addEventListener("click", restoreAndReload); | 210 restoreDefaults.addEventListener("click", restoreAndReload); |
| 358 | 211 |
| 359 function restoreAndReload() | 212 function restoreAndReload() |
| 360 { | 213 { |
| 361 if (window.localStorage) | 214 if (window.localStorage) |
| 362 window.localStorage.clear(); | 215 window.localStorage.clear(); |
| 363 WebInspector.reload(); | 216 WebInspector.reload(); |
| 364 } | 217 } |
| 365 } | 218 } |
| 366 | 219 |
| 367 WebInspector.GenericSettingsTab.prototype = { | 220 WebInspector.GenericSettingsTab.prototype = { |
| 368 _updateScriptDisabledCheckbox: function() | 221 _populateSectionsFromExtensions: function() |
| 369 { | 222 { |
| 223 var explicitSectionOrder = ["", "Appearance", "Elements", "Sources", "Pr ofiler", "Console", "Extensions"]; | |
| 224 | |
| 225 var allExtensions = WebInspector.moduleManager.extensions("setting"); | |
|
pfeldman
2014/03/31 12:00:43
ui-setting
apavlov
2014/04/01 10:34:56
Done.
| |
| 226 /** @type {!StringMap.<!Array.<!WebInspector.ModuleManager.Extension>>} */ | |
| 227 var extensionsBySectionId = new StringMap(); | |
| 228 /** @type {!StringMap.<!Array.<!WebInspector.ModuleManager.Extension>>} */ | |
| 229 var childSettingExtensionsByParentName = new StringMap(); | |
| 230 | |
| 370 /** | 231 /** |
| 371 * @param {?Protocol.Error} error | 232 * @param {!StringMap.<T>} map |
| 372 * @param {string} status | 233 * @param {string} key |
| 373 * @this {WebInspector.GenericSettingsTab} | 234 * @param {T} value |
| 235 * @template T | |
| 374 */ | 236 */ |
| 375 function executionStatusCallback(error, status) | 237 function appendToListByKey(map, key, value) { |
|
pfeldman
2014/03/31 12:00:43
nit: utilities.js Multimap ?
apavlov
2014/04/01 10:34:56
Done.
| |
| 376 { | 238 var list = map.get(key); |
| 377 if (error || !status) | 239 if (!list) { |
| 378 return; | 240 list = []; |
| 379 | 241 map.put(key, list); |
| 380 var forbidden = (status === "forbidden"); | 242 } |
| 381 var disabled = forbidden || (status === "disabled"); | 243 list.push(value); |
| 382 | |
| 383 this._disableJSInfo.classList.toggle("hidden", !forbidden); | |
| 384 this._disableJSCheckbox.checked = disabled; | |
| 385 this._disableJSCheckbox.disabled = forbidden; | |
| 386 } | 244 } |
| 387 | 245 |
| 388 PageAgent.getScriptExecutionStatus(executionStatusCallback.bind(this)); | 246 allExtensions.forEach(function(extension) { |
| 389 }, | 247 var descriptor = extension.descriptor(); |
| 248 var sectionName = descriptor["section"] || ""; | |
| 249 if (!sectionName && descriptor["parentSettingName"]) { | |
| 250 appendToListByKey(childSettingExtensionsByParentName, descriptor ["parentSettingName"], extension); | |
| 251 return; | |
| 252 } | |
| 253 appendToListByKey(extensionsBySectionId, sectionName, extension); | |
| 254 }); | |
| 390 | 255 |
| 391 _javaScriptDisabledChanged: function() | 256 var sectionIds = extensionsBySectionId.keys(); |
| 392 { | 257 var explicitlyOrderedSections = {}; |
| 393 // We need to manually update the checkbox state, since enabling JavaScr ipt in the page can actually uncover the "forbidden" state. | 258 for (var i = 0; i < explicitSectionOrder.length; ++i) { |
| 394 PageAgent.setScriptExecutionDisabled(WebInspector.settings.javaScriptDis abled.get(), this._updateScriptDisabledCheckbox.bind(this)); | 259 explicitlyOrderedSections[explicitSectionOrder[i]] = true; |
| 395 }, | 260 var extensions = /** @type {!Array.<!WebInspector.ModuleManager.Exte nsion>} */ (extensionsBySectionId.get(explicitSectionOrder[i])); |
| 396 | 261 if (!extensions) |
| 397 _skipStackFramesSwitchOrPatternChanged: function() | 262 continue; |
| 398 { | 263 this._addSectionWithExtensionProvidedSettings(explicitSectionOrder[i ], extensions, childSettingExtensionsByParentName); |
| 399 WebInspector.debuggerModel.applySkipStackFrameSettings(); | 264 } |
| 265 for (var i = 0; i < sectionIds.length; ++i) { | |
| 266 if (explicitlyOrderedSections[sectionIds[i]]) | |
| 267 continue; | |
| 268 this._addSectionWithExtensionProvidedSettings(sectionIds[i], /** @ty pe {!Array.<!WebInspector.ModuleManager.Extension>} */ (extensionsBySectionId.ge t(sectionIds[i])), childSettingExtensionsByParentName); | |
| 269 } | |
| 400 }, | 270 }, |
| 401 | 271 |
| 402 /** | 272 /** |
| 273 * @param {string} sectionName | |
| 274 * @param {!Array.<!WebInspector.ModuleManager.Extension>} extensions | |
| 275 * @param {!StringMap.<!Array.<!WebInspector.ModuleManager.Extension>>} chil dSettingExtensionsByParentName | |
| 276 */ | |
| 277 _addSectionWithExtensionProvidedSettings: function(sectionName, extensions, childSettingExtensionsByParentName) | |
| 278 { | |
| 279 var uiSectionName = sectionName && WebInspector.UIString(sectionName); | |
| 280 var sectionElement = this._appendSection(uiSectionName); | |
|
pfeldman
2014/03/31 12:00:43
What if several extensions provide setting into th
apavlov
2014/04/01 10:34:56
|extensions| contains all extensions that provide
| |
| 281 extensions.forEach(processSetting.bind(this, null)); | |
| 282 | |
| 283 /** | |
| 284 * @param {?Element} parentFieldset | |
| 285 * @param {!WebInspector.ModuleManager.Extension} extension | |
| 286 * @this {WebInspector.GenericSettingsTab} | |
| 287 */ | |
| 288 function processSetting(parentFieldset, extension) | |
| 289 { | |
| 290 var descriptor = extension.descriptor(); | |
| 291 var experimentName = descriptor["experiment"]; | |
| 292 if (experimentName && (!WebInspector.experimentsSettings[experimentN ame] || !WebInspector.experimentsSettings[experimentName].isEnabled())) | |
| 293 return; | |
| 294 | |
| 295 var settingName = descriptor["settingName"]; | |
| 296 var setting = WebInspector.settings[settingName]; | |
| 297 var instance = extension.instance(); | |
| 298 var settingControl; | |
| 299 if (instance) { | |
| 300 if (descriptor["settingType"] === "custom") { | |
| 301 settingControl = instance.settingElement(); | |
| 302 if (!settingControl) | |
| 303 return; | |
| 304 } | |
| 305 if (setting) | |
| 306 setting.addChangeListener(instance.settingChanged, instance) ; | |
| 307 } | |
| 308 if (!settingControl) { | |
| 309 var uiTitle = WebInspector.UIString(descriptor["title"]); | |
| 310 settingControl = createSettingControl.call(this, uiTitle, settin g, descriptor, instance); | |
| 311 } | |
| 312 if (settingName) { | |
| 313 var childSettings = childSettingExtensionsByParentName.get(setti ngName); | |
| 314 if (childSettings) { | |
| 315 var fieldSet = WebInspector.SettingsUI.createSettingFieldset (setting); | |
| 316 settingControl.appendChild(fieldSet); | |
| 317 for (var i = 0; i < childSettings.length; ++i) | |
| 318 processSetting.call(this, fieldSet, childSettings[i]); | |
| 319 } | |
| 320 } | |
| 321 var containerElement = parentFieldset || sectionElement; | |
| 322 containerElement.appendChild(settingControl); | |
| 323 } | |
| 324 | |
| 325 /** | |
| 326 * @param {string} uiTitle | |
| 327 * @param {!WebInspector.Setting} setting | |
| 328 * @param {!Object} descriptor | |
| 329 * @param {?Object} instance | |
| 330 * @return {!Element} | |
| 331 * @this {WebInspector.GenericSettingsTab} | |
| 332 */ | |
| 333 function createSettingControl(uiTitle, setting, descriptor, instance) | |
| 334 { | |
| 335 switch (descriptor["settingType"]) { | |
| 336 case "checkbox": | |
| 337 return WebInspector.SettingsUI.createSettingCheckbox(uiTitle, se tting); | |
| 338 case "select": | |
| 339 var descriptorOptions = descriptor["options"] | |
| 340 var options = new Array(descriptorOptions.length); | |
| 341 for (var i = 0; i < options.length; ++i) { | |
| 342 // The third array item flags that the option name is "raw" (non-i18n-izable). | |
| 343 var optionName = descriptorOptions[i][2] ? descriptorOptions [i][0] : WebInspector.UIString(descriptorOptions[i][0]); | |
| 344 options[i] = [WebInspector.UIString(descriptorOptions[i][0]) , descriptorOptions[i][1]]; | |
| 345 } | |
| 346 return this._createSelectSetting(uiTitle, options, setting); | |
| 347 default: | |
| 348 throw "Invalid setting type: " + descriptor["settingType"]; | |
| 349 } | |
| 350 } | |
| 351 }, | |
| 352 | |
| 353 /** | |
| 403 * @param {?Element} p | 354 * @param {?Element} p |
| 404 */ | 355 */ |
| 405 _appendDrawerNote: function(p) | 356 _appendDrawerNote: function(p) |
| 406 { | 357 { |
| 407 var noteElement = p.createChild("div", "help-field-note"); | 358 var noteElement = p.createChild("div", "help-field-note"); |
| 408 noteElement.createTextChild("Hit "); | 359 noteElement.createTextChild("Hit "); |
| 409 noteElement.createChild("span", "help-key").textContent = "Esc"; | 360 noteElement.createChild("span", "help-key").textContent = "Esc"; |
| 410 noteElement.createTextChild(WebInspector.UIString(" or click the")); | 361 noteElement.createTextChild(WebInspector.UIString(" or click the")); |
| 411 noteElement.appendChild(new WebInspector.StatusBarButton(WebInspector.UI String("Drawer"), "console-status-bar-item").element); | 362 noteElement.appendChild(new WebInspector.StatusBarButton(WebInspector.UI String("Drawer"), "console-status-bar-item").element); |
| 412 noteElement.createTextChild(WebInspector.UIString("toolbar item")); | 363 noteElement.createTextChild(WebInspector.UIString("toolbar item")); |
| 413 }, | 364 }, |
| 414 | 365 |
| 415 __proto__: WebInspector.SettingsTab.prototype | 366 __proto__: WebInspector.SettingsTab.prototype |
| 416 } | 367 } |
| 417 | 368 |
| 418 /** | 369 /** |
| 419 * @constructor | 370 * @constructor |
| 420 * @extends {WebInspector.SettingsTab} | 371 * @extends {WebInspector.SettingsTab} |
| 421 */ | 372 */ |
| 422 WebInspector.WorkspaceSettingsTab = function() | 373 WebInspector.WorkspaceSettingsTab = function() |
| 423 { | 374 { |
| 424 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor kspace-tab-content"); | 375 WebInspector.SettingsTab.call(this, WebInspector.UIString("Workspace"), "wor kspace-tab-content"); |
| 425 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this); | 376 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this); |
| 426 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this); | 377 WebInspector.isolatedFileSystemManager.addEventListener(WebInspector.Isolate dFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this); |
| 427 | 378 |
| 428 this._commonSection = this._appendSection(WebInspector.UIString("Common")); | 379 this._commonSection = this._appendSection(WebInspector.UIString("Common")); |
| 429 var folderExcludePatternInput = this._createInputSetting(WebInspector.UIStri ng("Folder exclude pattern"), WebInspector.settings.workspaceFolderExcludePatter n, false, 0, "270px", WebInspector.SettingsScreen.regexValidator); | 380 var folderExcludePatternInput = WebInspector.SettingsUI.createSettingInputFi eld(WebInspector.UIString("Folder exclude pattern"), WebInspector.settings.works paceFolderExcludePattern, false, 0, "270px", WebInspector.SettingsUI.regexValida tor); |
| 430 this._commonSection.appendChild(folderExcludePatternInput); | 381 this._commonSection.appendChild(folderExcludePatternInput); |
| 431 | 382 |
| 432 this._fileSystemsSection = this._appendSection(WebInspector.UIString("Folder s")); | 383 this._fileSystemsSection = this._appendSection(WebInspector.UIString("Folder s")); |
| 433 this._fileSystemsListContainer = this._fileSystemsSection.createChild("p", " settings-list-container"); | 384 this._fileSystemsListContainer = this._fileSystemsSection.createChild("p", " settings-list-container"); |
| 434 | 385 |
| 435 this._addFileSystemRowElement = this._fileSystemsSection.createChild("div"); | 386 this._addFileSystemRowElement = this._fileSystemsSection.createChild("div"); |
| 436 var addFileSystemButton = this._addFileSystemRowElement.createChild("input", "settings-tab-text-button"); | 387 var addFileSystemButton = this._addFileSystemRowElement.createChild("input", "settings-tab-text-button"); |
| 437 addFileSystemButton.type = "button"; | 388 addFileSystemButton.type = "button"; |
| 438 addFileSystemButton.value = WebInspector.UIString("Add folder\u2026"); | 389 addFileSystemButton.value = WebInspector.UIString("Add folder\u2026"); |
| 439 addFileSystemButton.addEventListener("click", this._addFileSystemClicked.bin d(this)); | 390 addFileSystemButton.addEventListener("click", this._addFileSystemClicked.bin d(this)); |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1120 var inputElement = this._addInputElements[columnId]; | 1071 var inputElement = this._addInputElements[columnId]; |
| 1121 inputElement.value = ""; | 1072 inputElement.value = ""; |
| 1122 } | 1073 } |
| 1123 }, | 1074 }, |
| 1124 | 1075 |
| 1125 __proto__: WebInspector.SettingsList.prototype | 1076 __proto__: WebInspector.SettingsList.prototype |
| 1126 } | 1077 } |
| 1127 | 1078 |
| 1128 /** @type {!WebInspector.SettingsController} */ | 1079 /** @type {!WebInspector.SettingsController} */ |
| 1129 WebInspector.settingsController; | 1080 WebInspector.settingsController; |
| OLD | NEW |