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..1b837ed0ccfc0047a42e971406f3ac2b8d8d7037 100644 |
--- a/Source/devtools/front_end/timeline/TimelinePanel.js |
+++ b/Source/devtools/front_end/timeline/TimelinePanel.js |
@@ -325,40 +325,57 @@ WebInspector.TimelinePanel.prototype = { |
this._stackView.detachChildViews(); |
}, |
+ /** |
+ * @param {string} name |
+ * @param {!WebInspector.Setting} setting |
+ * @param {string=} tooltip |
aandrey
2014/07/03 11:24:33
{string=} -> {string}
|
+ * @return {!Element} |
+ */ |
+ _createSettingCheckbox: function(name, setting, tooltip) |
+ { |
+ if (!this._recordingOptionUIControls) |
+ this._recordingOptionUIControls = []; |
+ |
+ checkboxElement = document.createElement("input"); |
loislo
2014/07/03 11:33:38
var checkboxElement
|
+ labelElement = WebInspector.SettingsUI.createSettingCheckbox(name, setting, true, checkboxElement, tooltip); |
+ this._recordingOptionUIControls.push({ "label": labelElement, "checkbox": checkboxElement }); |
+ return labelElement; |
+ }, |
+ |
_createRecordingOptions: function() |
{ |
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"))); |
+ topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Capture stacks"), |
+ this._captureStacksSetting, |
+ WebInspector.UIString("Capture JavaScript stack on every timeline event"))); |
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"))); |
+ topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Capture memory"), |
+ this._captureMemorySetting, |
+ WebInspector.UIString("Capture memory information on every timeline event"))); |
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"))); |
+ topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Capture power"), |
+ this._capturePowerSetting, |
+ WebInspector.UIString("Capture power information"))); |
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"))); |
+ topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Capture tracing"), |
+ this._captureTracingSetting, |
+ WebInspector.UIString("Capture tracing information"))); |
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"))); |
+ topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspector.UIString("Capture pictures"), |
+ this._captureLayersAndPicturesSetting, |
+ WebInspector.UIString("Capture graphics layer positions and painted pictures"))); |
} |
}, |
@@ -665,6 +682,17 @@ WebInspector.TimelinePanel.prototype = { |
}, |
/** |
+ * @param {boolean} disabled |
+ */ |
+ _disableUIControls: function(disabled) { |
+ this._recordingOptionUIControls.forEach(function(uiControl) { |
aandrey
2014/07/03 11:24:33
we generally don't inline function callbacks. i.e.
|
+ uiControl.checkbox.disabled = disabled; |
+ uiControl.label.classList.toggle("disabled-label", disabled); |
aandrey
2014/07/03 11:24:33
nit: we already use "dimmed" class.
|
+ }); |
+ WebInspector.inspectorView.setCurrentPanelLocked(disabled); |
+ }, |
+ |
+ /** |
* @param {boolean} userInitiated |
*/ |
_startRecording: function(userInitiated) |
@@ -679,7 +707,7 @@ WebInspector.TimelinePanel.prototype = { |
if (userInitiated) |
WebInspector.userMetrics.TimelineStarted.record(); |
- WebInspector.inspectorView.setCurrentPanelLocked(true); |
+ this._disableUIControls(true); |
}, |
_stopRecording: function() |
@@ -693,7 +721,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() |