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

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

Issue 2739443002: 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
88 /** 99 /**
89 * Switches the specified tab into view. 100 * Switches the specified tab into view.
90 * 101 *
91 * @param {string} activeId The id the of the tab that should be switched to 102 * @param {string} activeId The id the of the tab that should be switched to
92 * active state. 103 * active state.
93 * @private 104 * @private
94 */ 105 */
95 switchTab_: function(activeId) { 106 switchTab_: function(activeId) {
96 if (this.activeTabId_ && this.tabElements_[this.activeTabId_]) { 107 if (this.activeTabId_ && this.tabElements_[this.activeTabId_]) {
97 this.tabElements_[this.activeTabId_].body.classList.remove( 108 this.tabElements_[this.activeTabId_].body.classList.remove(
(...skipping 12 matching lines...) Expand all
110 121
111 /** Initializes the bar containing the tab heads. */ 122 /** Initializes the bar containing the tab heads. */
112 initializeHeadBar_: function() { 123 initializeHeadBar_: function() {
113 this.headBar_ = document.createElement('div'); 124 this.headBar_ = document.createElement('div');
114 this.root_.appendChild(this.headBar_); 125 this.root_.appendChild(this.headBar_);
115 this.headBar_.style.textAlign = 'center'; 126 this.headBar_.style.textAlign = 'center';
116 }, 127 },
117 }; 128 };
118 return TabView; 129 return TabView;
119 })(); 130 })();
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