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

Unified Diff: chrome/browser/resources/md_history/list_container.js

Issue 2160173002: [MD History] Move the shared menu from history list to list container. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@research
Patch Set: rebase Created 4 years, 5 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
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();
+ },
});

Powered by Google App Engine
This is Rietveld 408576698