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

Side by Side Diff: chrome/browser/resources/net_internals/tab_switcher_view.js

Issue 14458009: Mark hidden menu items on about:net-internals as disabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 view.show(false); 86 view.show(false);
87 87
88 // Add it to the dropdown menu. 88 // Add it to the dropdown menu.
89 var menuItem = addNode(this.dropdownMenu_, 'option'); 89 var menuItem = addNode(this.dropdownMenu_, 'option');
90 menuItem.value = tabId; 90 menuItem.value = tabId;
91 menuItem.textContent = name; 91 menuItem.textContent = name;
92 }, 92 },
93 93
94 showMenuItem: function(tabId, isVisible) { 94 showMenuItem: function(tabId, isVisible) {
95 var wasActive = this.activeTabId_ == tabId; 95 var wasActive = this.activeTabId_ == tabId;
96 setNodeDisplay(this.getMenuItemNode_(tabId), isVisible); 96
97 // Hide the menuitem from the list. Note it needs to be 'disabled' to
98 // prevent it being selectable from keyboard.
99 var menuitem = this.getMenuItemNode_(tabId);
100 setNodeDisplay(menuitem, isVisible);
101 menuitem.disabled = !isVisible;
97 102
98 if (wasActive && !isVisible) { 103 if (wasActive && !isVisible) {
99 // If the active tab is being hidden in the dropdown menu, then 104 // If the active tab is being hidden in the dropdown menu, then
100 // switch to the first tab which is still visible. 105 // switch to the first tab which is still visible.
101 for (var i = 0; i < this.dropdownMenu_.options.length; ++i) { 106 for (var i = 0; i < this.dropdownMenu_.options.length; ++i) {
102 var option = this.dropdownMenu_.options[i]; 107 var option = this.dropdownMenu_.options[i];
103 if (option.style.display != 'none') { 108 if (option.style.display != 'none') {
104 this.switchToTab(option.value); 109 this.switchToTab(option.value);
105 break; 110 break;
106 } 111 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 }, 168 },
164 169
165 onMenuSelectionChanged_: function(event) { 170 onMenuSelectionChanged_: function(event) {
166 var tabId = this.dropdownMenu_.value; 171 var tabId = this.dropdownMenu_.value;
167 this.switchToTab(tabId); 172 this.switchToTab(tabId);
168 }, 173 },
169 }; 174 };
170 175
171 return TabSwitcherView; 176 return TabSwitcherView;
172 })(); 177 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698