| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 * TabSwitcher is an implementation of View that handles tab switching. | 6 * TabSwitcher is an implementation of View that handles tab switching. |
| 7 * | 7 * |
| 8 * +-----------------------------------+ | 8 * +-----------------------------------+ |
| 9 * | Tab1 / Tab2 / Tab3 / .. | <- tab handle view | 9 * | Tab1 / Tab2 / Tab3 / .. | <- tab handle view |
| 10 * +-----------------------------------+ | 10 * +-----------------------------------+ |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 g_browser.checkForUpdatedInfo(); | 129 g_browser.checkForUpdatedInfo(); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 TabSwitcherView.prototype.getAllTabIds = function() { | 132 TabSwitcherView.prototype.getAllTabIds = function() { |
| 133 var ids = []; | 133 var ids = []; |
| 134 for (var i = 0; i < this.tabs_.length; ++i) | 134 for (var i = 0; i < this.tabs_.length; ++i) |
| 135 ids.push(this.tabs_[i].id); | 135 ids.push(this.tabs_[i].id); |
| 136 return ids; | 136 return ids; |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 // Shows/hides the DOM node that is used to select the tab. Will not change |
| 140 // the active tab. |
| 141 TabSwitcherView.prototype.showTabHandleNode = function(id, isVisible) { |
| 142 var tab = this.findTabById(id); |
| 143 setNodeDisplay(tab.getTabHandleNode(), isVisible); |
| 144 }; |
| 145 |
| 139 //----------------------------------------------------------------------------- | 146 //----------------------------------------------------------------------------- |
| 140 | 147 |
| 141 /** | 148 /** |
| 142 * @constructor | 149 * @constructor |
| 143 */ | 150 */ |
| 144 function TabEntry(id, contentView) { | 151 function TabEntry(id, contentView) { |
| 145 this.id = id; | 152 this.id = id; |
| 146 this.contentView = contentView; | 153 this.contentView = contentView; |
| 147 } | 154 } |
| 148 | 155 |
| 149 TabEntry.prototype.setSelected = function(isSelected) { | 156 TabEntry.prototype.setSelected = function(isSelected) { |
| 150 this.active = isSelected; | 157 this.active = isSelected; |
| 151 changeClassName(this.getTabHandleNode(), 'selected', isSelected); | 158 changeClassName(this.getTabHandleNode(), 'selected', isSelected); |
| 152 this.contentView.show(isSelected); | 159 this.contentView.show(isSelected); |
| 153 }; | 160 }; |
| 154 | 161 |
| 155 /** | 162 /** |
| 156 * Returns the DOM node that is used to select the tab. | 163 * Returns the DOM node that is used to select the tab. |
| 157 */ | 164 */ |
| 158 TabEntry.prototype.getTabHandleNode = function() { | 165 TabEntry.prototype.getTabHandleNode = function() { |
| 159 return document.getElementById(this.id); | 166 return document.getElementById(this.id); |
| 160 }; | 167 }; |
| 161 | 168 |
| OLD | NEW |