Chromium Code Reviews| Index: chrome/browser/resources/md_history/list_container.js |
| diff --git a/chrome/browser/resources/md_history/list_container.js b/chrome/browser/resources/md_history/list_container.js |
| index 51120d5333d7308826b2bfed2a8f5316f563687a..bb1c70bbf2f55d48df46b6ca4f0e44f8def485f9 100644 |
| --- a/chrome/browser/resources/md_history/list_container.js |
| +++ b/chrome/browser/resources/md_history/list_container.js |
| @@ -23,6 +23,14 @@ Polymer({ |
| /** @type {!QueryResult} */ |
| queryResult: Object, |
| + |
| + /** |
| + * @private {?{ |
| + * index: number, item: !HistoryEntry, |
| + * path: string, target: !HTMLElement |
|
Dan Beam
2016/12/21 22:06:38
indent off, why are you wrapping like this?
dpapad
2016/12/21 22:41:09
Done. If only there was a linter to tell me how to
|
| + * }} |
| + */ |
| + actionMenuModel_: Object, |
| }, |
| observers: [ |
| @@ -31,9 +39,8 @@ Polymer({ |
| ], |
| listeners: { |
| - 'history-list-scrolled': 'closeMenu_', |
| 'load-more-history': 'loadMoreHistory_', |
| - 'toggle-menu': 'toggleMenu_', |
| + 'open-menu': 'openMenu_', |
| }, |
| /** |
| @@ -222,20 +229,25 @@ Polymer({ |
| */ |
| closeMenu_: function() { |
| var menu = this.$.sharedMenu.getIfExists(); |
| - if (menu) |
| - menu.closeMenu(); |
| + if (menu && menu.open) { |
| + this.actionMenuModel_ = null; |
| + menu.close(); |
| + } |
| }, |
| /** |
| - * Opens the overflow menu unless the menu is already open and the same button |
| - * is pressed. |
| - * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e |
| + * Opens the overflow menu. |
| + * @param {{detail: { |
| + * index: number, item: !HistoryEntry, |
| + * path: string, target: !HTMLElement |
| + * }}} e |
| * @private |
| */ |
| - toggleMenu_: function(e) { |
| + openMenu_: function(e) { |
| var target = e.detail.target; |
| + this.actionMenuModel_ = e.detail; |
| var menu = /** @type {CrSharedMenuElement} */ this.$.sharedMenu.get(); |
| - menu.toggleMenu(target, e.detail); |
| + menu.showAt(target); |
| }, |
| /** @private */ |
| @@ -244,8 +256,9 @@ Polymer({ |
| 'EntryMenuShowMoreFromSite'); |
| var menu = assert(this.$.sharedMenu.getIfExists()); |
| - this.set('queryState.searchTerm', menu.itemData.item.domain); |
| - menu.closeMenu(); |
| + this.set('queryState.searchTerm', this.actionMenuModel_.item.domain); |
| + this.actionMenuModel_ = null; |
| + this.closeMenu_(); |
| }, |
| /** @private */ |
| @@ -253,7 +266,7 @@ Polymer({ |
| var browserService = md_history.BrowserService.getInstance(); |
| browserService.recordAction('EntryMenuRemoveFromHistory'); |
| var menu = assert(this.$.sharedMenu.getIfExists()); |
| - var itemData = menu.itemData; |
| + var itemData = this.actionMenuModel_; |
| browserService.deleteItems([itemData.item]).then(function(items) { |
| // This unselect-all resets the toolbar when deleting a selected item |
| // and clears selection state which can be invalid if items move |
| @@ -277,7 +290,7 @@ Polymer({ |
| UMA_MAX_SUBSET_BUCKET_VALUE); |
| } |
| }.bind(this)); |
| - menu.closeMenu(); |
| + this.closeMenu_(); |
| }, |
| /** |