Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: content/browser/resources/media/tab_view.js

Issue 2745433004: Revert of webrtc-internals: dont remove tab (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/resources/media/webrtc_internals.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 * A TabView provides the ability to create tabs and switch between tabs. It's 6 * A TabView provides the ability to create tabs and switch between tabs. It's
7 * responsible for creating the DOM and managing the visibility of each tab. 7 * responsible for creating the DOM and managing the visibility of each tab.
8 * The first added tab is active by default and the others hidden. 8 * The first added tab is active by default and the others hidden.
9 */ 9 */
10 var TabView = (function() { 10 var TabView = (function() {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 this.tabElements_[id].head); 78 this.tabElements_[id].head);
79 this.tabElements_[id].body.parentNode.removeChild( 79 this.tabElements_[id].body.parentNode.removeChild(
80 this.tabElements_[id].body); 80 this.tabElements_[id].body);
81 81
82 delete this.tabElements_[id]; 82 delete this.tabElements_[id];
83 if (this.activeTabId_ == id) { 83 if (this.activeTabId_ == id) {
84 this.switchTab_(Object.keys(this.tabElements_)[0]); 84 this.switchTab_(Object.keys(this.tabElements_)[0]);
85 } 85 }
86 }, 86 },
87 87
88 makeTabRemovable: function(id) {
89 if (!this.tabElements_[id])
90 return;
91 var close = document.createElement('a');
92 close.textContent = '[x]';
93 close.addEventListener('click', function() {
94 this.removeTab(id);
95 }.bind(this));
96 this.tabElements_[id].head.appendChild(close);
97 },
98
99 /** 88 /**
100 * Switches the specified tab into view. 89 * Switches the specified tab into view.
101 * 90 *
102 * @param {string} activeId The id the of the tab that should be switched to 91 * @param {string} activeId The id the of the tab that should be switched to
103 * active state. 92 * active state.
104 * @private 93 * @private
105 */ 94 */
106 switchTab_: function(activeId) { 95 switchTab_: function(activeId) {
107 if (this.activeTabId_ && this.tabElements_[this.activeTabId_]) { 96 if (this.activeTabId_ && this.tabElements_[this.activeTabId_]) {
108 this.tabElements_[this.activeTabId_].body.classList.remove( 97 this.tabElements_[this.activeTabId_].body.classList.remove(
(...skipping 12 matching lines...) Expand all
121 110
122 /** Initializes the bar containing the tab heads. */ 111 /** Initializes the bar containing the tab heads. */
123 initializeHeadBar_: function() { 112 initializeHeadBar_: function() {
124 this.headBar_ = document.createElement('div'); 113 this.headBar_ = document.createElement('div');
125 this.root_.appendChild(this.headBar_); 114 this.root_.appendChild(this.headBar_);
126 this.headBar_.style.textAlign = 'center'; 115 this.headBar_.style.textAlign = 'center';
127 }, 116 },
128 }; 117 };
129 return TabView; 118 return TabView;
130 })(); 119 })();
OLDNEW
« no previous file with comments | « no previous file | content/browser/resources/media/webrtc_internals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698