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 d37b2416bb0fbd2daf5ff63f3da8863c711d1954..64e601177f60507d4994abbad34a35ede4254152 100644 |
| --- a/Source/devtools/front_end/timeline/TimelinePanel.js |
| +++ b/Source/devtools/front_end/timeline/TimelinePanel.js |
| @@ -154,6 +154,12 @@ WebInspector.TimelinePanel.prototype = { |
| style.textContent = Object.values(categories).map(WebInspector.TimelineUIUtils.createStyleRuleForCategory).join("\n"); |
| this.element.ownerDocument.head.appendChild(style); |
| } |
| + WebInspector.context.setFlavor(WebInspector.TimelinePanel, this); |
| + }, |
| + |
| + willHide: function() |
| + { |
| + WebInspector.context.setFlavor(WebInspector.TimelinePanel, null); |
| }, |
| /** |
| @@ -303,8 +309,7 @@ WebInspector.TimelinePanel.prototype = { |
| { |
| this._panelToolbar = new WebInspector.Toolbar(this.element); |
| - this.toggleTimelineButton = new WebInspector.ToolbarButton("Record timeline", "record-toolbar-item"); |
| - this.toggleTimelineButton.addEventListener("click", this._toggleTimelineButtonClicked, this); |
| + this.toggleTimelineButton = WebInspector.ToolbarButton.createActionButton("timeline.toggle-recording"); |
| this._panelToolbar.appendToolbarItem(this.toggleTimelineButton); |
| this._updateToggleTimelineButton(false); |
| @@ -477,7 +482,6 @@ WebInspector.TimelinePanel.prototype = { |
| _registerShortcuts: function() |
| { |
| - this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.StartStopRecording, this._toggleTimelineButtonClicked.bind(this)); |
| this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.SaveToFile, this._saveToFile.bind(this)); |
| this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.LoadFromFile, this._selectFileToLoad.bind(this)); |
| this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcuts.JumpToPreviousFrame, this._jumpToFrame.bind(this, -1)); |
| @@ -1799,3 +1803,26 @@ WebInspector.LoadTimelineHandler.prototype = { |
| WebInspector.TimelinePanel.instance()._loadFromURL(value); |
| } |
| } |
| + |
| +/** |
| + * @constructor |
| + * @implements {WebInspector.ActionDelegate} |
| + */ |
| +WebInspector.TimelinePanel.RecordActionDelegate = function() |
| +{ |
| +} |
| + |
| +WebInspector.TimelinePanel.RecordActionDelegate.prototype = { |
| + /** |
| + * @override |
| + * @param {!WebInspector.Context} context |
| + * @param {string} actionId |
| + */ |
| + handleAction: function(context, actionId) |
| + { |
| + var panel = WebInspector.context.flavor(WebInspector.TimelinePanel); |
| + if (!panel || !(panel instanceof WebInspector.TimelinePanel)) |
|
pfeldman
2015/08/28 16:24:45
When you specify the context, this should become a
samli
2015/08/28 17:21:22
Done.
|
| + return; |
| + panel._toggleTimelineButtonClicked(); |
| + } |
| +} |