| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 Polymer({ | 5 Polymer({ |
| 6 is: 'history-list-container', | 6 is: 'history-list-container', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // The path of the currently selected page. | 9 // The path of the currently selected page. |
| 10 selectedPage_: String, | 10 selectedPage_: String, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * Opens the overflow menu unless the menu is already open and the same button | 161 * Opens the overflow menu unless the menu is already open and the same button |
| 162 * is pressed. | 162 * is pressed. |
| 163 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e | 163 * @param {{detail: {item: !HistoryEntry, target: !HTMLElement}}} e |
| 164 * @private | 164 * @private |
| 165 */ | 165 */ |
| 166 toggleMenu_: function(e) { | 166 toggleMenu_: function(e) { |
| 167 var target = e.detail.target; | 167 var target = e.detail.target; |
| 168 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).toggleMenu( | 168 /** @type {CrSharedMenuElement} */(this.$.sharedMenu).toggleMenu( |
| 169 target, e.detail.item); | 169 target, e.detail); |
| 170 }, | 170 }, |
| 171 | 171 |
| 172 /** @private */ | 172 /** @private */ |
| 173 onMoreFromSiteTap_: function() { | 173 onMoreFromSiteTap_: function() { |
| 174 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); | 174 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); |
| 175 this.fire('search-domain', {domain: menu.itemData.domain}); | 175 this.fire('search-domain', {domain: menu.itemData.item.domain}); |
| 176 menu.closeMenu(); | 176 menu.closeMenu(); |
| 177 }, | 177 }, |
| 178 | 178 |
| 179 /** @private */ | 179 /** @private */ |
| 180 onRemoveFromHistoryTap_: function() { | 180 onRemoveFromHistoryTap_: function() { |
| 181 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); | 181 var menu = /** @type {CrSharedMenuElement} */(this.$.sharedMenu); |
| 182 var itemData = menu.itemData; |
| 182 md_history.BrowserService.getInstance() | 183 md_history.BrowserService.getInstance() |
| 183 .deleteItems([menu.itemData]) | 184 .deleteItems([itemData.item]) |
| 184 .then(function(items) { | 185 .then(function(items) { |
| 185 this.getSelectedList_().removeItemsByPath(items[0].path); | 186 this.getSelectedList_().removeItemsByPath([itemData.path]); |
| 186 // This unselect-all is to reset the toolbar when deleting a selected | 187 // This unselect-all is to reset the toolbar when deleting a selected |
| 187 // item. TODO(tsergeant): Make this automatic based on observing list | 188 // item. TODO(tsergeant): Make this automatic based on observing list |
| 188 // modifications. | 189 // modifications. |
| 189 this.fire('unselect-all'); | 190 this.fire('unselect-all'); |
| 190 }.bind(this)); | 191 }.bind(this)); |
| 191 menu.closeMenu(); | 192 menu.closeMenu(); |
| 192 }, | 193 }, |
| 193 | 194 |
| 194 /** | 195 /** |
| 195 * @return {HTMLElement} | 196 * @return {HTMLElement} |
| 196 * @private | 197 * @private |
| 197 */ | 198 */ |
| 198 getSelectedList_: function() { | 199 getSelectedList_: function() { |
| 199 return this.$.content.selectedItem; | 200 return this.$.content.selectedItem; |
| 200 }, | 201 }, |
| 201 }); | 202 }); |
| OLD | NEW |