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

Unified Diff: chrome/browser/resources/uber/uber_frame.js

Issue 313363004: Separate Settings and Help from History and Extensions when settings-in- (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (no conflicts) Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/uber/uber_frame.html ('k') | chrome/browser/ui/chrome_pages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/uber/uber_frame.js
diff --git a/chrome/browser/resources/uber/uber_frame.js b/chrome/browser/resources/uber/uber_frame.js
index 8c5bb3bfe5c6be5c5c40373a6532f72a720c66d0..c4a5aea27dca4d66cfea60bd8c6650384b72b084 100644
--- a/chrome/browser/resources/uber/uber_frame.js
+++ b/chrome/browser/resources/uber/uber_frame.js
@@ -77,14 +77,22 @@ cr.define('uber_frame', function() {
var navItem =
document.querySelector('li[controls="' + params.pageId + '"]');
setSelection(navItem);
+ showNavItems();
+ }
+
+ /**
+ * @return {Element} The currently selected nav item, if any.
+ */
+ function getSelectedNavItem() {
+ return document.querySelector('li.selected');
}
/**
* Sets selection on the given nav item.
- * @param {boolean} newSelection The item to be selected.
+ * @param {Element} newSelection The item to be selected.
*/
function setSelection(newSelection) {
- var lastSelectedNavItem = document.querySelector('li.selected');
+ var lastSelectedNavItem = getSelectedNavItem();
if (lastSelectedNavItem !== newSelection) {
newSelection.classList.add('selected');
if (lastSelectedNavItem)
@@ -93,6 +101,20 @@ cr.define('uber_frame', function() {
}
/**
+ * Shows nav items belonging to the same group as the selected item.
+ */
+ function showNavItems() {
+ var navItems = document.querySelectorAll('li');
+ var selectedNavItem = getSelectedNavItem();
+ assert(selectedNavItem);
+
+ var selectedGroup = selectedNavItem.getAttribute('group');
+ for (var i = 0; i < navItems.length; ++i) {
+ navItems[i].hidden = navItems[i].getAttribute('group') != selectedGroup;
+ }
+ }
+
+ /**
* Adjusts this frame's content to scrolls from the outer frame. This is done
* to obscure text in RTL as a user scrolls over the content of this frame (as
* currently RTL scrollbars still draw on the right).
@@ -124,7 +146,7 @@ cr.define('uber_frame', function() {
}
/**
- * @return {Object} The currently selected iframe container.
+ * @return {Element} The currently selected iframe container.
* @private
*/
function getSelectedIframe() {
« no previous file with comments | « chrome/browser/resources/uber/uber_frame.html ('k') | chrome/browser/ui/chrome_pages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698