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 f8e5507781cd864ee40693527c8eaf999292d37e..448c27cae3356014d508703b4af85849af34b910 100644 |
--- a/chrome/browser/resources/md_history/list_container.js |
+++ b/chrome/browser/resources/md_history/list_container.js |
@@ -24,7 +24,10 @@ Polymer({ |
], |
listeners: { |
+ 'history-list-scrolled': 'closeMenu_', |
'load-more-history': 'loadMoreHistory_', |
+ 'tap': 'closeMenu_', |
+ 'toggle-menu': 'toggleMenu_', |
}, |
/** |
@@ -143,5 +146,47 @@ Polymer({ |
/** @private */ |
onDialogCancelTap_: function() { |
this.$.dialog.close(); |
- } |
+ }, |
+ |
+ /** |
+ * Closes the overflow menu. |
+ * @private |
+ */ |
+ closeMenu_: function() { |
+ /** @type {CrSharedMenuElement} */(this.$.sharedMenu).closeMenu(); |
+ }, |
+ |
+ /** |
+ * Opens the overflow menu unless the menu is already open and the same button |
+ * is pressed. |
+ * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e |
+ * @private |
+ */ |
+ toggleMenu_: function(e) { |
+ var target = e.detail.target; |
+ /** @type {CrSharedMenuElement} */(this.$.sharedMenu).toggleMenu( |
+ target, e.detail.item); |
+ }, |
+ |
+ /** @private */ |
+ onMoreFromSiteTap_: function() { |
+ var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); |
+ this.fire('search-domain', {domain: menu.itemData.domain}); |
+ menu.closeMenu(); |
+ }, |
+ |
+ /** @private */ |
+ onRemoveFromHistoryTap_: function() { |
+ var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); |
+ md_history.BrowserService.getInstance() |
+ .deleteItems([menu.itemData]) |
+ .then(function(items) { |
+ this.$['infinite-list'].removeDeletedHistory_(items); |
+ // This unselect-all is to reset the toolbar when deleting a selected |
+ // item. TODO(tsergeant): Make this automatic based on observing list |
+ // modifications. |
+ this.fire('unselect-all'); |
+ }.bind(this)); |
+ menu.closeMenu(); |
+ }, |
}); |