| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 this.historyData_.splice(i, 1); | 174 this.historyData_.splice(i, 1); |
| 175 } | 175 } |
| 176 } | 176 } |
| 177 // notifySplices gives better performance than individually splicing as it | 177 // notifySplices gives better performance than individually splicing as it |
| 178 // batches all of the updates together. | 178 // batches all of the updates together. |
| 179 this.notifySplices('historyData_', splices); | 179 this.notifySplices('historyData_', splices); |
| 180 }, | 180 }, |
| 181 | 181 |
| 182 /** | 182 /** |
| 183 * Performs a request to the backend to delete all selected items. If | 183 * Performs a request to the backend to delete all selected items. If |
| 184 * successful, removes them from the view. | 184 * successful, removes them from the view. Does not prompt the user before |
| 185 * deleting -- see <history-list-container> for a version of this method which |
| 186 * does prompt. |
| 185 */ | 187 */ |
| 186 deleteSelected: function() { | 188 deleteSelected: function() { |
| 187 var toBeRemoved = this.historyData_.filter(function(item) { | 189 var toBeRemoved = this.historyData_.filter(function(item) { |
| 188 return item.selected; | 190 return item.selected; |
| 189 }); | 191 }); |
| 190 md_history.BrowserService.getInstance() | 192 md_history.BrowserService.getInstance() |
| 191 .deleteItems(toBeRemoved) | 193 .deleteItems(toBeRemoved) |
| 192 .then(function(items) { | 194 .then(function(items) { |
| 193 this.removeDeletedHistory_(items); | 195 this.removeDeletedHistory_(items); |
| 194 this.fire('unselect-all'); | 196 this.fire('unselect-all'); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 267 |
| 266 /** | 268 /** |
| 267 * @param {number} index | 269 * @param {number} index |
| 268 * @return {boolean} | 270 * @return {boolean} |
| 269 * @private | 271 * @private |
| 270 */ | 272 */ |
| 271 isFirstItem_: function(index) { | 273 isFirstItem_: function(index) { |
| 272 return index == 0; | 274 return index == 0; |
| 273 } | 275 } |
| 274 }); | 276 }); |
| OLD | NEW |