| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 this.set('queryState.searchTerm', menu.itemData.item.domain); | 248 this.set('queryState.searchTerm', menu.itemData.item.domain); |
| 249 menu.closeMenu(); | 249 menu.closeMenu(); |
| 250 }, | 250 }, |
| 251 | 251 |
| 252 /** @private */ | 252 /** @private */ |
| 253 onRemoveFromHistoryTap_: function() { | 253 onRemoveFromHistoryTap_: function() { |
| 254 var browserService = md_history.BrowserService.getInstance(); | 254 var browserService = md_history.BrowserService.getInstance(); |
| 255 browserService.recordAction('EntryMenuRemoveFromHistory'); | 255 browserService.recordAction('EntryMenuRemoveFromHistory'); |
| 256 var menu = assert(this.$.sharedMenu.getIfExists()); | 256 var menu = assert(this.$.sharedMenu.getIfExists()); |
| 257 var itemData = menu.itemData; | 257 var itemData = menu.itemData; |
| 258 browserService.deleteItems([itemData.item]) | 258 browserService.deleteItems([itemData.item]).then(items => { |
| 259 .then(function(items) { | 259 // This unselect-all resets the toolbar when deleting a selected item and |
| 260 // This unselect-all resets the toolbar when deleting a selected item | 260 // clears selection state which can be invalid if items move around during |
| 261 // and clears selection state which can be invalid if items move | 261 // deletion. TODO(tsergeant): Make this automatic based on observing list |
| 262 // around during deletion. | 262 // modifications. |
| 263 // TODO(tsergeant): Make this automatic based on observing list | 263 this.fire('unselect-all'); |
| 264 // modifications. | 264 this.getSelectedList_().removeItemsByPath([itemData.path]); |
| 265 this.fire('unselect-all'); | |
| 266 this.getSelectedList_().removeItemsByPath([itemData.path]); | |
| 267 | 265 |
| 268 var index = itemData.index; | 266 var index = itemData.index; |
| 269 if (index == undefined) | 267 if (index == undefined) |
| 270 return; | 268 return; |
| 271 | 269 |
| 272 var browserService = md_history.BrowserService.getInstance(); | 270 var browserService = md_history.BrowserService.getInstance(); |
| 273 browserService.recordHistogram( | 271 browserService.recordHistogram( |
| 274 'HistoryPage.RemoveEntryPosition', | 272 'HistoryPage.RemoveEntryPosition', |
| 275 Math.min(index, UMA_MAX_BUCKET_VALUE), UMA_MAX_BUCKET_VALUE); | 273 Math.min(index, UMA_MAX_BUCKET_VALUE), UMA_MAX_BUCKET_VALUE); |
| 276 if (index <= UMA_MAX_SUBSET_BUCKET_VALUE) { | 274 if (index <= UMA_MAX_SUBSET_BUCKET_VALUE) { |
| 277 browserService.recordHistogram( | 275 browserService.recordHistogram( |
| 278 'HistoryPage.RemoveEntryPositionSubset', index, | 276 'HistoryPage.RemoveEntryPositionSubset', index, |
| 279 UMA_MAX_SUBSET_BUCKET_VALUE); | 277 UMA_MAX_SUBSET_BUCKET_VALUE); |
| 280 } | 278 } |
| 281 }.bind(this)); | 279 }); |
| 282 menu.closeMenu(); | 280 menu.closeMenu(); |
| 283 }, | 281 }, |
| 284 | 282 |
| 285 /** | 283 /** |
| 286 * @return {Element} | 284 * @return {Element} |
| 287 * @private | 285 * @private |
| 288 */ | 286 */ |
| 289 getSelectedList_: function() { return this.$$('#' + this.selectedPage_); }, | 287 getSelectedList_: function() { return this.$$('#' + this.selectedPage_); }, |
| 290 | 288 |
| 291 /** @private */ | 289 /** @private */ |
| 292 canDeleteHistory_: function() { | 290 canDeleteHistory_: function() { |
| 293 return loadTimeData.getBoolean('allowDeletingHistory'); | 291 return loadTimeData.getBoolean('allowDeletingHistory'); |
| 294 } | 292 } |
| 295 }); | 293 }); |
| OLD | NEW |