OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Controller and View for switching between tabs. | 6 * Controller and View for switching between tabs. |
7 * | 7 * |
8 * The View part of TabSwitcherView displays the contents of the currently | 8 * The View part of TabSwitcherView displays the contents of the currently |
9 * selected tab (only one tab can be active at a time). | 9 * selected tab (only one tab can be active at a time). |
10 * | 10 * |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // list only after its been populated. | 63 // list only after its been populated. |
64 var tabListWidth = this.tabListWidth_; | 64 var tabListWidth = this.tabListWidth_; |
65 if (tabListWidth > width) | 65 if (tabListWidth > width) |
66 tabListWidth = width; | 66 tabListWidth = width; |
67 tabListNode.style.position = 'absolute'; | 67 tabListNode.style.position = 'absolute'; |
68 setNodePosition(tabListNode, left, top, tabListWidth, height); | 68 setNodePosition(tabListNode, left, top, tabListWidth, height); |
69 | 69 |
70 // Position each of the tab's content areas. | 70 // Position each of the tab's content areas. |
71 for (var tabId in this.tabIdToView_) { | 71 for (var tabId in this.tabIdToView_) { |
72 var view = this.tabIdToView_[tabId]; | 72 var view = this.tabIdToView_[tabId]; |
73 view.setGeometry(left + tabListWidth, top, width - tabListWidth, | 73 view.setGeometry( |
74 height); | 74 left + tabListWidth, top, width - tabListWidth, height); |
75 } | 75 } |
76 }, | 76 }, |
77 | 77 |
78 show: function(isVisible) { | 78 show: function(isVisible) { |
79 superClass.prototype.show.call(this, isVisible); | 79 superClass.prototype.show.call(this, isVisible); |
80 var activeView = this.getActiveTabView(); | 80 var activeView = this.getActiveTabView(); |
81 if (activeView) | 81 if (activeView) |
82 activeView.show(isVisible); | 82 activeView.show(isVisible); |
83 }, | 83 }, |
84 | 84 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 newView.show(this.isVisible()); | 172 newView.show(this.isVisible()); |
173 | 173 |
174 if (this.onTabSwitched_) | 174 if (this.onTabSwitched_) |
175 this.onTabSwitched_(oldTabId, tabId); | 175 this.onTabSwitched_(oldTabId, tabId); |
176 }, | 176 }, |
177 }; | 177 }; |
178 | 178 |
179 return TabSwitcherView; | 179 return TabSwitcherView; |
180 })(); | 180 })(); |
OLD | NEW |