Chromium Code Reviews| Index: chrome/browser/resources/net_internals/details_view.js |
| =================================================================== |
| --- chrome/browser/resources/net_internals/details_view.js (revision 109671) |
| +++ chrome/browser/resources/net_internals/details_view.js (working copy) |
| @@ -5,35 +5,18 @@ |
| var DetailsView = (function() { |
| 'use strict'; |
| - // We inherit from VerticalSplitView. |
| - var superClass = VerticalSplitView; |
| + // We inherit from DivView. |
| + var superClass = DivView; |
| /** |
| - * The DetailsView handles the tabbed view that displays either the "log" or |
| - * "timeline" view. This class keeps track of what the current view is, and |
| - * invalidates the specific view each time the selected data has changed. |
| + * The DetailsView is displays the "log" view. This class keeps track of the |
|
eroman
2011/11/16 04:03:46
wording: "is displays" --> "displays".
mmenke
2011/11/16 18:39:35
Done.
|
| + * selected SourceEntries, and repaints when they change. |
| * |
| * @constructor |
| */ |
| - function DetailsView(tabHandlesContainerId, |
| - logTabId, |
| - timelineTabId, |
| - logBoxId, |
| - timelineBoxId) { |
| - var tabSwitcher = new TabSwitcherView(); |
| - |
| - superClass.call(this, new DivView(tabHandlesContainerId), tabSwitcher); |
| - |
| - this.tabSwitcher_ = tabSwitcher; |
| - |
| - this.logView_ = new DetailsLogView(logBoxId); |
| - this.timelineView_ = new DetailsTimelineView(timelineBoxId); |
| - |
| - this.tabSwitcher_.addTab(logTabId, this.logView_, true, true); |
| - this.tabSwitcher_.addTab(timelineTabId, this.timelineView_, true, true); |
| - |
| - // Default to the log view. |
| - this.tabSwitcher_.switchToTab(logTabId, null); |
| + function DetailsView(boxId) { |
| + superClass.call(this, boxId); |
| + this.sourceEntries_ = []; |
| } |
| // The delay between updates to repaint. |
| @@ -43,17 +26,32 @@ |
| // Inherit the superclass's methods. |
| __proto__: superClass.prototype, |
| - /** |
| - * Updates the data this view is using. |
| - */ |
| - setData: function(currentData) { |
| + setData: function(sourceEntries) { |
| // Make a copy of the array (in case the caller mutates it), and sort it |
| // by the source ID. |
| - var sortedCurrentData = createSortedCopy(currentData); |
| + this.sourceEntries_ = createSortedCopy(sourceEntries); |
| - // TODO(eroman): Should not access private members of TabSwitcherView. |
| - for (var i = 0; i < this.tabSwitcher_.tabs_.length; ++i) |
| - this.tabSwitcher_.tabs_[i].contentView.setData(sortedCurrentData); |
| + // Repaint the view. |
| + if (this.isVisible() && !this.outstandingRepaint_) { |
| + this.outstandingRepaint_ = true; |
| + window.setTimeout(this.repaint.bind(this), |
| + REPAINT_TIMEOUT_MS); |
| + } |
| + }, |
| + |
| + repaint: function() { |
| + this.outstandingRepaint_ = false; |
| + this.getNode().innerHTML = ''; |
| + PaintLogView(this.sourceEntries_, this.getNode()); |
| + }, |
| + |
| + show: function(isVisible) { |
| + superClass.prototype.show.call(this, isVisible); |
| + if (isVisible) { |
| + this.repaint(); |
| + } else { |
| + this.getNode().innerHTML = ''; |
| + } |
| } |
| }; |
| @@ -65,108 +63,5 @@ |
| return sortedArray; |
| } |
| - //--------------------------------------------------------------------------- |
| - |
| - var DetailsSubView = (function() { |
| - // We inherit from DivView. |
| - var superClass = DivView; |
| - |
| - /** |
| - * Base class for the Log view and Timeline view. |
| - * |
| - * @constructor |
| - */ |
| - function DetailsSubView(boxId) { |
| - superClass.call(this, boxId); |
| - this.sourceEntries_ = []; |
| - } |
| - |
| - DetailsSubView.prototype = { |
| - // Inherit the superclass's methods. |
| - __proto__: superClass.prototype, |
| - |
| - setData: function(sourceEntries) { |
| - this.sourceEntries_ = sourceEntries; |
| - |
| - // Repaint the view. |
| - if (this.isVisible() && !this.outstandingRepaint_) { |
| - this.outstandingRepaint_ = true; |
| - window.setTimeout(this.repaint.bind(this), |
| - REPAINT_TIMEOUT_MS); |
| - } |
| - }, |
| - |
| - repaint: function() { |
| - this.outstandingRepaint_ = false; |
| - this.getNode().innerHTML = ''; |
| - }, |
| - |
| - show: function(isVisible) { |
| - superClass.prototype.show.call(this, isVisible); |
| - if (isVisible) { |
| - this.repaint(); |
| - } else { |
| - this.getNode().innerHTML = ''; |
| - } |
| - } |
| - }; |
| - |
| - return DetailsSubView; |
| - })(); |
| - |
| - //--------------------------------------------------------------------------- |
| - |
| - var DetailsLogView = (function() { |
| - // We inherit from DetailsSubView. |
| - var superClass = DetailsSubView; |
| - |
| - /** |
| - * Subview that is displayed in the log tab. |
| - * @constructor |
| - */ |
| - function DetailsLogView(boxId) { |
| - superClass.call(this, boxId); |
| - } |
| - |
| - DetailsLogView.prototype = { |
| - // Inherit the superclass's methods. |
| - __proto__: superClass.prototype, |
| - |
| - repaint: function() { |
| - superClass.prototype.repaint.call(this); |
| - PaintLogView(this.sourceEntries_, this.getNode()); |
| - } |
| - }; |
| - |
| - return DetailsLogView; |
| - })(); |
| - |
| - //--------------------------------------------------------------------------- |
| - |
| - var DetailsTimelineView = (function() { |
| - // We inherit from DetailsSubView. |
| - var superClass = DetailsSubView; |
| - |
| - /** |
| - * Subview that is displayed in the timeline tab. |
| - * @constructor |
| - */ |
| - function DetailsTimelineView(boxId) { |
| - superClass.call(this, boxId); |
| - } |
| - |
| - DetailsTimelineView.prototype = { |
| - // Inherit the superclass's methods. |
| - __proto__: superClass.prototype, |
| - |
| - repaint: function() { |
| - superClass.prototype.repaint.call(this); |
| - PaintTimelineView(this.sourceEntries_, this.getNode()); |
| - } |
| - }; |
| - |
| - return DetailsTimelineView; |
| - })(); |
| - |
| return DetailsView; |
| })(); |