| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 }, | 231 }, |
| 232 | 232 |
| 233 /** @private */ | 233 /** @private */ |
| 234 onRemoveFromHistoryTap_: function() { | 234 onRemoveFromHistoryTap_: function() { |
| 235 var browserService = md_history.BrowserService.getInstance(); | 235 var browserService = md_history.BrowserService.getInstance(); |
| 236 browserService.recordAction('EntryMenuRemoveFromHistory'); | 236 browserService.recordAction('EntryMenuRemoveFromHistory'); |
| 237 var menu = assert(this.$.sharedMenu.getIfExists()); | 237 var menu = assert(this.$.sharedMenu.getIfExists()); |
| 238 var itemData = menu.itemData; | 238 var itemData = menu.itemData; |
| 239 browserService.deleteItems([itemData.item]) | 239 browserService.deleteItems([itemData.item]) |
| 240 .then(function(items) { | 240 .then(function(items) { |
| 241 this.getSelectedList_().removeItemsByPath([itemData.path]); | 241 // This unselect-all resets the toolbar when deleting a selected item |
| 242 // This unselect-all is to reset the toolbar when deleting a selected | 242 // and clears selection state which can be invalid if items move |
| 243 // item. TODO(tsergeant): Make this automatic based on observing list | 243 // around during deletion. |
| 244 // TODO(tsergeant): Make this automatic based on observing list |
| 244 // modifications. | 245 // modifications. |
| 245 this.fire('unselect-all'); | 246 this.fire('unselect-all'); |
| 247 this.getSelectedList_().removeItemsByPath([itemData.path]); |
| 246 | 248 |
| 247 var index = itemData.index; | 249 var index = itemData.index; |
| 248 if (index == undefined) | 250 if (index == undefined) |
| 249 return; | 251 return; |
| 250 | 252 |
| 251 var browserService = md_history.BrowserService.getInstance(); | 253 var browserService = md_history.BrowserService.getInstance(); |
| 252 browserService.recordHistogram( | 254 browserService.recordHistogram( |
| 253 'HistoryPage.RemoveEntryPosition', index, | 255 'HistoryPage.RemoveEntryPosition', index, |
| 254 UMA_MAX_BUCKET_VALUE); | 256 UMA_MAX_BUCKET_VALUE); |
| 255 if (index <= UMA_MAX_SUBSET_BUCKET_VALUE) { | 257 if (index <= UMA_MAX_SUBSET_BUCKET_VALUE) { |
| 256 browserService.recordHistogram( | 258 browserService.recordHistogram( |
| 257 'HistoryPage.RemoveEntryPositionSubset', index, | 259 'HistoryPage.RemoveEntryPositionSubset', index, |
| 258 UMA_MAX_SUBSET_BUCKET_VALUE); | 260 UMA_MAX_SUBSET_BUCKET_VALUE); |
| 259 } | 261 } |
| 260 }.bind(this)); | 262 }.bind(this)); |
| 261 menu.closeMenu(); | 263 menu.closeMenu(); |
| 262 }, | 264 }, |
| 263 | 265 |
| 264 /** | 266 /** |
| 265 * @return {HTMLElement} | 267 * @return {HTMLElement} |
| 266 * @private | 268 * @private |
| 267 */ | 269 */ |
| 268 getSelectedList_: function() { return this.$.content.selectedItem; }, | 270 getSelectedList_: function() { return this.$.content.selectedItem; }, |
| 269 }); | 271 }); |
| OLD | NEW |