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

Unified Diff: ui/webui/resources/js/cr/ui/menu.js

Issue 22154002: Not to show context menu if there are no visible items to show. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comment Created 7 years, 4 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 | « ui/webui/resources/js/cr/ui/context_menu_handler.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/cr/ui/menu.js
diff --git a/ui/webui/resources/js/cr/ui/menu.js b/ui/webui/resources/js/cr/ui/menu.js
index 3047123e5e150a9612439d6a344d31f6c0519590..d46980f019339a0ba0877aaf777b329f65e8c1ce 100644
--- a/ui/webui/resources/js/cr/ui/menu.js
+++ b/ui/webui/resources/js/cr/ui/menu.js
@@ -156,6 +156,19 @@ cr.define('cr.ui', function() {
},
/**
+ * Returns if the menu has any visible item.
+ * @return {boolean} True if the menu has visible item. Otherwise, false.
+ */
+ hasVisibleItems: function() {
+ var menuItems = this.menuItems; // Cache.
+ for (var i = 0, menuItem; menuItem = menuItems[i]; i++) {
+ if (!menuItem.hidden)
+ return true;
+ }
+ return false;
+ },
+
+ /**
* This is the function that handles keyboard navigation. This is usually
* called by the element responsible for managing the menu.
* @param {Event} e The keydown event object.
« no previous file with comments | « ui/webui/resources/js/cr/ui/context_menu_handler.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698