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..7410c14cca463c59a14a2bb660a4803de51c98f4 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 |
| + * @return {!Element} |
| + */ |
| + _createSettingCheckbox: function(name, setting, tooltip) |
| + { |
| + if (!this._recordingOptionUIControls) |
| + this._recordingOptionUIControls = []; |
| + |
| + var checkboxElement = document.createElement("input"); |
| + var 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,19 @@ WebInspector.TimelinePanel.prototype = { |
| }, |
| /** |
| + * @param {boolean} disabled |
| + */ |
| + _disableUIControls: function(disabled) { |
| + function handler(uiControl) |
| + { |
| + uiControl.checkbox.disabled = disabled; |
| + uiControl.label.classList.toggle("dimmed", disabled); |
| + } |
| + this._recordingOptionUIControls.forEach(handler); |
| + WebInspector.inspectorView.setCurrentPanelLocked(disabled); |
| + }, |
| + |
| + /** |
| * @param {boolean} userInitiated |
| */ |
| _startRecording: function(userInitiated) |
| @@ -679,7 +709,7 @@ WebInspector.TimelinePanel.prototype = { |
| if (userInitiated) |
| WebInspector.userMetrics.TimelineStarted.record(); |
| - WebInspector.inspectorView.setCurrentPanelLocked(true); |
| + this._disableUIControls(true); |
|
loislo
2014/07/03 13:00:48
Please change the name to positive logic: this._se
|
| }, |
| _stopRecording: function() |
| @@ -693,7 +723,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() |