Chromium Code Reviews| Index: Source/devtools/front_end/profiler/ProfilesPanel.js |
| diff --git a/Source/devtools/front_end/profiler/ProfilesPanel.js b/Source/devtools/front_end/profiler/ProfilesPanel.js |
| index 01d40dee977d0cb9758dacd8efa318616fb8f216..f8f7f8534d66f6fc91c73f4c82bd04831a89b752 100644 |
| --- a/Source/devtools/front_end/profiler/ProfilesPanel.js |
| +++ b/Source/devtools/front_end/profiler/ProfilesPanel.js |
| @@ -80,7 +80,10 @@ WebInspector.ProfileType.prototype = { |
| return null; |
| }, |
| - get statusBarItems() |
| + /** |
| + * @return {!Array.<!WebInspector.StatusBarItem>} |
| + */ |
| + statusBarItems: function() |
| { |
| return []; |
| }, |
| @@ -453,25 +456,24 @@ WebInspector.ProfilesPanel = function() |
| this.profileViews.classList.add("vbox"); |
| mainView.element.appendChild(this.profileViews); |
| - var statusBarContainer = createElementWithClass("div", "profiles-status-bar"); |
| - mainView.element.insertBefore(statusBarContainer, mainView.element.firstChild); |
| - this._statusBarElement = statusBarContainer.createChild("div", "status-bar"); |
| + this._statusBarElement = createElementWithClass("div", "profiles-status-bar"); |
| + mainView.element.insertBefore(this._statusBarElement, mainView.element.firstChild); |
| this.sidebarElement().classList.add("profiles-sidebar-tree-box"); |
| var statusBarContainerLeft = createElementWithClass("div", "profiles-status-bar"); |
| this.sidebarElement().insertBefore(statusBarContainerLeft, this.sidebarElement().firstChild); |
| - this._statusBarButtons = statusBarContainerLeft.createChild("div", "status-bar"); |
| + var statusBar = new WebInspector.StatusBar(statusBarContainerLeft); |
| this.recordButton = new WebInspector.StatusBarButton("", "record-profile-status-bar-item"); |
| this.recordButton.addEventListener("click", this.toggleRecordButton, this); |
| - this._statusBarButtons.appendChild(this.recordButton.element); |
| + statusBar.appendStatusBarItem(this.recordButton); |
| this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear all profiles."), "clear-status-bar-item"); |
| this.clearResultsButton.addEventListener("click", this._reset, this); |
| - this._statusBarButtons.appendChild(this.clearResultsButton.element); |
| + statusBar.appendStatusBarItem(this.clearResultsButton); |
| - this._profileTypeStatusBarItemsContainer = this._statusBarElement.createChild("div"); |
| - this._profileViewStatusBarItemsContainer = this._statusBarElement.createChild("div"); |
| + this._profileTypeStatusBar = new WebInspector.StatusBar(this._statusBarElement); |
| + this._profileViewStatusBar = new WebInspector.StatusBar(this._statusBarElement); |
| this._profileGroups = {}; |
| this._launcherView = new WebInspector.MultiProfileLauncherView(this); |
| @@ -617,12 +619,10 @@ WebInspector.ProfilesPanel.prototype = { |
| _updateProfileTypeSpecificUI: function() |
| { |
| this._updateRecordButton(this.recordButton.toggled()); |
| - this._profileTypeStatusBarItemsContainer.removeChildren(); |
| - var statusBarItems = this._selectedProfileType.statusBarItems; |
| - if (statusBarItems) { |
| - for (var i = 0; i < statusBarItems.length; ++i) |
| - this._profileTypeStatusBarItemsContainer.appendChild(statusBarItems[i]); |
| - } |
| + this._profileTypeStatusBar.removeStatusBarItems(); |
|
apavlov
2014/11/14 09:36:08
clear() ?
pfeldman
2014/11/14 09:37:19
Acknowledged.
|
| + var statusBarItems = this._selectedProfileType.statusBarItems(); |
| + for (var i = 0; i < statusBarItems.length; ++i) |
| + this._profileTypeStatusBar.appendStatusBarItem(statusBarItems[i]); |
| }, |
| _reset: function() |
| @@ -643,12 +643,12 @@ WebInspector.ProfilesPanel.prototype = { |
| this._launcherView.detach(); |
| this.profileViews.removeChildren(); |
| - this._profileViewStatusBarItemsContainer.removeChildren(); |
| + this._profileViewStatusBar.removeStatusBarItems(); |
| this.removeAllListeners(); |
| this.recordButton.setVisible(true); |
| - this._profileViewStatusBarItemsContainer.classList.remove("hidden"); |
| + this._profileViewStatusBar.element.classList.remove("hidden"); |
| this.clearResultsButton.element.classList.remove("hidden"); |
| this.profilesItemTreeElement.select(); |
| this._showLauncherView(); |
| @@ -657,7 +657,7 @@ WebInspector.ProfilesPanel.prototype = { |
| _showLauncherView: function() |
| { |
| this.closeVisibleView(); |
| - this._profileViewStatusBarItemsContainer.removeChildren(); |
| + this._profileViewStatusBar.removeStatusBarItems(); |
| this._launcherView.show(this.profileViews); |
| this.visibleView = this._launcherView; |
| }, |
| @@ -800,12 +800,11 @@ WebInspector.ProfilesPanel.prototype = { |
| var sidebarElement = profileTypeSection.sidebarElementForProfile(profile); |
| sidebarElement.revealAndSelect(); |
| - this._profileViewStatusBarItemsContainer.removeChildren(); |
| + this._profileViewStatusBar.removeStatusBarItems(); |
| - var statusBarItems = view.statusBarItems; |
| - if (statusBarItems) |
| - for (var i = 0; i < statusBarItems.length; ++i) |
| - this._profileViewStatusBarItemsContainer.appendChild(statusBarItems[i]); |
| + var statusBarItems = view.statusBarItems(); |
| + for (var i = 0; i < statusBarItems.length; ++i) |
| + this._profileViewStatusBar.appendStatusBarItem(statusBarItems[i]); |
| return view; |
| }, |