| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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', | 6 is: 'history-list', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // The search term for the current query. Set when the query returns. | 9 // The search term for the current query. Set when the query returns. |
| 10 searchedTerm: { | 10 searchedTerm: { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 this.historyData_.splice(i, 1); | 182 this.historyData_.splice(i, 1); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 // notifySplices gives better performance than individually splicing as it | 185 // notifySplices gives better performance than individually splicing as it |
| 186 // batches all of the updates together. | 186 // batches all of the updates together. |
| 187 this.notifySplices('historyData_', splices); | 187 this.notifySplices('historyData_', splices); |
| 188 }, | 188 }, |
| 189 | 189 |
| 190 /** | 190 /** |
| 191 * Performs a request to the backend to delete all selected items. If | 191 * Performs a request to the backend to delete all selected items. If |
| 192 * successful, removes them from the view. | 192 * successful, removes them from the view. Does not prompt the user before |
| 193 * deleting -- see <history-list-container> for a version of this method which |
| 194 * does prompt. |
| 193 */ | 195 */ |
| 194 deleteSelected: function() { | 196 deleteSelected: function() { |
| 195 var toBeRemoved = this.historyData_.filter(function(item) { | 197 var toBeRemoved = this.historyData_.filter(function(item) { |
| 196 return item.selected; | 198 return item.selected; |
| 197 }); | 199 }); |
| 198 md_history.BrowserService.getInstance() | 200 md_history.BrowserService.getInstance() |
| 199 .deleteItems(toBeRemoved) | 201 .deleteItems(toBeRemoved) |
| 200 .then(function(items) { | 202 .then(function(items) { |
| 201 this.removeDeletedHistory_(items); | 203 this.removeDeletedHistory_(items); |
| 202 this.fire('unselect-all'); | 204 this.fire('unselect-all'); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 275 |
| 274 /** | 276 /** |
| 275 * @param {number} index | 277 * @param {number} index |
| 276 * @return {boolean} | 278 * @return {boolean} |
| 277 * @private | 279 * @private |
| 278 */ | 280 */ |
| 279 isFirstItem_: function(index) { | 281 isFirstItem_: function(index) { |
| 280 return index == 0; | 282 return index == 0; |
| 281 } | 283 } |
| 282 }); | 284 }); |
| OLD | NEW |