| Index: chrome/browser/resources/shared/js/cr/ui/menu.js
|
| diff --git a/chrome/browser/resources/shared/js/cr/ui/menu.js b/chrome/browser/resources/shared/js/cr/ui/menu.js
|
| index 94fea75c43948b6ca41197ff1a7ec6a92e7725b4..1928293c60406441e95f1c5a3f450ed4d1b438cd 100644
|
| --- a/chrome/browser/resources/shared/js/cr/ui/menu.js
|
| +++ b/chrome/browser/resources/shared/js/cr/ui/menu.js
|
| @@ -34,6 +34,41 @@ cr.define('cr.ui', function() {
|
| },
|
|
|
| /**
|
| + * Adds menu item at the end of the list.
|
| + * @param {Object} item Menu item properties.
|
| + * @return {cr.ui.MenuItem} The created menu item.
|
| + */
|
| + addMenuItem: function(item) {
|
| + var menuItem = this.ownerDocument.createElement('menuitem');
|
| + this.appendChild(menuItem);
|
| +
|
| + cr.ui.decorate(menuItem, MenuItem);
|
| +
|
| + if (item.label)
|
| + menuItem.label = item.label;
|
| +
|
| + if (item.iconUrl)
|
| + menuItem.iconUrl = item.iconUrl;
|
| +
|
| + return menuItem;
|
| + },
|
| +
|
| + /**
|
| + * Adds separator at the end of the list.
|
| + */
|
| + addSeparator: function() {
|
| + var separator = this.ownerDocument.createElement('hr');
|
| + this.appendChild(separator);
|
| + },
|
| +
|
| + /**
|
| + * Clears menu.
|
| + */
|
| + clear: function() {
|
| + this.textContent = '';
|
| + },
|
| +
|
| + /**
|
| * Walks up the ancestors of |el| until a menu item belonging to this menu
|
| * is found.
|
| * @param {Element} el The element to start searching from.
|
| @@ -79,6 +114,13 @@ cr.define('cr.ui', function() {
|
| },
|
|
|
| /**
|
| + * Menu length
|
| + */
|
| + get length() {
|
| + return this.children.length;
|
| + },
|
| +
|
| + /**
|
| * 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.
|
|
|