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

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

Issue 2583353003: MD History: Replace last usage of cr-shared-menu with cr-action-menu. (Closed)
Patch Set: Fix more Created 4 years 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 b6c1ba2170396571dd22206fb1e4374e269a86ab..5a21bbf9a5ef8f6ce0d1db20ca1c0be80ac399d7 100644
--- a/chrome/browser/resources/md_history/list_container.js
+++ b/chrome/browser/resources/md_history/list_container.js
@@ -20,6 +20,14 @@ Polymer({
/** @type {!QueryResult} */
queryResult: Object,
+
+ /**
+ * @private {?{
+ * index: number, item: !HistoryEntry,
+ * path: string, target: !HTMLElement
+ * }}
+ */
+ actionMenuModel_: Object,
},
observers: [
@@ -28,9 +36,8 @@ Polymer({
],
listeners: {
- 'history-list-scrolled': 'closeMenu_',
'load-more-history': 'loadMoreHistory_',
- 'toggle-menu': 'toggleMenu_',
+ 'open-menu': 'openMenu_',
},
/**
@@ -223,20 +230,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 */
@@ -245,8 +257,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 */
@@ -254,7 +267,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
@@ -279,7 +292,7 @@ Polymer({
UMA_MAX_SUBSET_BUCKET_VALUE);
}
}.bind(this));
- menu.closeMenu();
+ this.closeMenu_();
},
/**

Powered by Google App Engine
This is Rietveld 408576698