Chromium Code Reviews| Index: Source/devtools/front_end/timeline/TimelinePanel.js |
| diff --git a/Source/devtools/front_end/timeline/TimelinePanel.js b/Source/devtools/front_end/timeline/TimelinePanel.js |
| index 6b29e6e664288b6ce4487d5b3da71f082c3b4f90..c3b3223220c4bbfdab6a22022c17f496f9307ab0 100644 |
| --- a/Source/devtools/front_end/timeline/TimelinePanel.js |
| +++ b/Source/devtools/front_end/timeline/TimelinePanel.js |
| @@ -330,35 +330,52 @@ WebInspector.TimelinePanel.prototype = { |
| var topPaneSidebarElement = this._topPane.sidebarElement(); |
| this._captureStacksSetting = WebInspector.settings.createSetting("timelineCaptureStacks", true); |
| - topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture stacks"), |
| - this._captureStacksSetting, true, undefined, |
| - WebInspector.UIString("Capture JavaScript stack on every timeline event"))); |
| + |
| + this._recordingOptionUIControls = []; |
| + captureStacksCheckbox = document.createElement("input"); |
| + captureStacksLabel = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture stacks"), |
| + this._captureStacksSetting, true, captureStacksCheckbox, |
| + WebInspector.UIString("Capture JavaScript stack on every timeline event")) |
| + this._recordingOptionUIControls.push({ "label": captureStacksLabel, "checkbox": captureStacksCheckbox }); |
| + topPaneSidebarElement.appendChild(captureStacksLabel); |
| this._captureMemorySetting = WebInspector.settings.createSetting("timelineCaptureMemory", false); |
| - topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture memory"), |
| - this._captureMemorySetting, true, undefined, |
| - WebInspector.UIString("Capture memory information on every timeline event"))); |
| + captureMemoryCheckbox = document.createElement("input"); |
| + captureMemoryLabel = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture memory"), |
| + this._captureMemorySetting, true, captureMemoryCheckbox, |
| + WebInspector.UIString("Capture memory information on every timeline event")); |
| + this._recordingOptionUIControls.push({ "label": captureMemoryLabel, "checkbox": captureMemoryCheckbox }); |
| + topPaneSidebarElement.appendChild(captureMemoryLabel); |
| this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
| if (Capabilities.canProfilePower) { |
| this._capturePowerSetting = WebInspector.settings.createSetting("timelineCapturePower", false); |
| - topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture power"), |
| - this._capturePowerSetting, true, undefined, |
| - WebInspector.UIString("Capture power information"))); |
| + capturePowerCheckbox = document.createElement("input"); |
| + capturePowerLabel = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture power"), |
| + this._capturePowerSetting, true, capturePowerCheckbox, |
| + WebInspector.UIString("Capture power information")); |
| + this._recordingOptionUIControls.push({ "label": capturePowerLabel, "checkbox": capturePowerCheckbox }); |
| + topPaneSidebarElement.appendChild(capturePowerLabel); |
| this._capturePowerSetting.addChangeListener(this._onModeChanged, this); |
| } |
| if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { |
| this._captureTracingSetting = WebInspector.settings.createSetting("timelineCaptureTracing", false); |
| - topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture tracing"), |
| - this._captureTracingSetting, true, undefined, |
| - WebInspector.UIString("Capture tracing information"))); |
| + captureTracingCheckbox = document.createElement("input"); |
| + captureTracingLabel = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture... tracing"), |
| + this._captureTracingSetting, true, captureTracingCheckbox, |
| + WebInspector.UIString("Capture tracing information")); |
| + this._recordingOptionUIControls.push({ "label": captureTracingLabel, "checkbox": captureTracingCheckbox }); |
| + topPaneSidebarElement.appendChild(captureTracingLabel); |
| this._captureTracingSetting.addChangeListener(this._onModeChanged, this); |
| } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { |
| this._captureLayersAndPicturesSetting = WebInspector.settings.createSetting("timelineCaptureLayersAndPictures", false); |
| - topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture pictures"), |
| - this._captureLayersAndPicturesSetting, true, undefined, |
| - WebInspector.UIString("Capture graphics layer positions and painted pictures"))); |
| + captureLayersAndPicturesCheckbox = document.createElement("input"); |
| + captureLayersAndPicturesLabel = WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIString("Capture pictures"), |
| + this._captureLayersAndPicturesSetting, true, captureLayersAndPicturesCheckbox, |
| + WebInspector.UIString("Capture graphics layer positions and painted pictures")); |
| + this._recordingOptionUIControls.push({ "label": captureLayersAndPicturesLabel, "checkbox": captureLayersAndPicturesCheckbox }); |
| + topPaneSidebarElement.appendChild(captureLayersAndPicturesLabel); |
|
aandrey
2014/07/03 08:25:37
now let's extract common code to a method, like: t
vivekg
2014/07/03 10:36:22
Done.
|
| } |
| }, |
| @@ -665,6 +682,20 @@ WebInspector.TimelinePanel.prototype = { |
| }, |
| /** |
| + * @param {boolean} disabled |
| + */ |
| + _disableUIControls: function(disabled) { |
| + this._recordingOptionUIControls.forEach(function(uiControl) { |
| + uiControl.checkbox.disabled = disabled; |
| + if (disabled) |
| + uiControl.label.classList.add("disabled-label"); |
| + else |
| + uiControl.label.classList.remove("disabled-label"); |
| + }); |
| + WebInspector.inspectorView.setCurrentPanelLocked(disabled); |
| + }, |
| + |
| + /** |
| * @param {boolean} userInitiated |
| */ |
| _startRecording: function(userInitiated) |
| @@ -679,7 +710,7 @@ WebInspector.TimelinePanel.prototype = { |
| if (userInitiated) |
| WebInspector.userMetrics.TimelineStarted.record(); |
| - WebInspector.inspectorView.setCurrentPanelLocked(true); |
| + this._disableUIControls(true); |
| }, |
| _stopRecording: function() |
| @@ -693,7 +724,7 @@ WebInspector.TimelinePanel.prototype = { |
| for (var i = 0; i < this._overviewControls.length; ++i) |
| this._overviewControls[i].timelineStopped(); |
| - WebInspector.inspectorView.setCurrentPanelLocked(false); |
| + this._disableUIControls(false); |
| }, |
| _onProfilingStateChanged: function() |