| 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 26 matching lines...) Expand all Loading... |
| 37 historyResult: function(info, results) { | 37 historyResult: function(info, results) { |
| 38 this.initializeResults_(info, results); | 38 this.initializeResults_(info, results); |
| 39 this.closeMenu_(); | 39 this.closeMenu_(); |
| 40 | 40 |
| 41 if (this.selectedPage_ == 'grouped-list') { | 41 if (this.selectedPage_ == 'grouped-list') { |
| 42 this.$$('#grouped-list').historyData = results; | 42 this.$$('#grouped-list').historyData = results; |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 | 45 |
| 46 var list = /** @type {HistoryListElement} */(this.$['infinite-list']); | 46 var list = /** @type {HistoryListElement} */(this.$['infinite-list']); |
| 47 list.addNewResults(results); | 47 list.addNewResults(results, this.queryState.incremental); |
| 48 if (info.finished) | 48 if (info.finished) |
| 49 list.disableResultLoading(); | 49 list.disableResultLoading(); |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 /** | 52 /** |
| 53 * Queries the history backend for results based on queryState. | 53 * Queries the history backend for results based on queryState. |
| 54 * @param {boolean} incremental Whether the new query should continue where | 54 * @param {boolean} incremental Whether the new query should continue where |
| 55 * the previous query stopped. | 55 * the previous query stopped. |
| 56 */ | 56 */ |
| 57 queryHistory: function(incremental) { | 57 queryHistory: function(incremental) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 var maxResults = | 82 var maxResults = |
| 83 queryState.range == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0; | 83 queryState.range == HistoryRange.ALL_TIME ? RESULTS_PER_PAGE : 0; |
| 84 chrome.send('queryHistory', [ | 84 chrome.send('queryHistory', [ |
| 85 queryState.searchTerm, queryState.groupedOffset, queryState.range, | 85 queryState.searchTerm, queryState.groupedOffset, queryState.range, |
| 86 lastVisitTime, maxResults | 86 lastVisitTime, maxResults |
| 87 ]); | 87 ]); |
| 88 }, | 88 }, |
| 89 | 89 |
| 90 historyDeleted: function() { |
| 91 // Do not reload the list when there are items checked. |
| 92 if (this.getSelectedItemCount() > 0) |
| 93 return; |
| 94 |
| 95 // Reload the list with current search state. |
| 96 this.queryHistory(false); |
| 97 }, |
| 98 |
| 90 /** @return {number} */ | 99 /** @return {number} */ |
| 91 getSelectedItemCount: function() { | 100 getSelectedItemCount: function() { |
| 92 return this.getSelectedList_().selectedPaths.size; | 101 return this.getSelectedList_().selectedPaths.size; |
| 93 }, | 102 }, |
| 94 | 103 |
| 95 unselectAllItems: function(count) { | 104 unselectAllItems: function(count) { |
| 96 this.getSelectedList_().unselectAllItems(count); | 105 this.getSelectedList_().unselectAllItems(count); |
| 97 }, | 106 }, |
| 98 | 107 |
| 99 /** | 108 /** |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 }, | 216 }, |
| 208 | 217 |
| 209 /** | 218 /** |
| 210 * @return {HTMLElement} | 219 * @return {HTMLElement} |
| 211 * @private | 220 * @private |
| 212 */ | 221 */ |
| 213 getSelectedList_: function() { | 222 getSelectedList_: function() { |
| 214 return this.$.content.selectedItem; | 223 return this.$.content.selectedItem; |
| 215 }, | 224 }, |
| 216 }); | 225 }); |
| OLD | NEW |