| 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 // Globals: | 5 // Globals: |
| 6 /** @const */ var RESULTS_PER_PAGE = 150; | 6 /** @const */ var RESULTS_PER_PAGE = 150; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Amount of time between pageviews that we consider a 'break' in browsing, | 9 * Amount of time between pageviews that we consider a 'break' in browsing, |
| 10 * measured in milliseconds. | 10 * measured in milliseconds. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 }); | 61 }); |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Resizing browser window will cause the overflow menu to close. | 64 * Resizing browser window will cause the overflow menu to close. |
| 65 */ | 65 */ |
| 66 window.addEventListener('resize', function() { | 66 window.addEventListener('resize', function() { |
| 67 $('history-list').closeMenu(); | 67 $('history-list').closeMenu(); |
| 68 }); | 68 }); |
| 69 | 69 |
| 70 /** |
| 71 * When the search is changed refresh the results and load either search results |
| 72 * or normal history results. |
| 73 */ |
| 74 window.addEventListener('refresh-results', function(e) { |
| 75 $('history-list').resetHistoryResults(); |
| 76 chrome.send('queryHistory', [e.detail.search, 0, 0, 0, RESULTS_PER_PAGE]); |
| 77 }); |
| 78 |
| 70 // Chrome Callbacks------------------------------------------------------------- | 79 // Chrome Callbacks------------------------------------------------------------- |
| 71 | 80 |
| 72 /** | 81 /** |
| 73 * Our history system calls this function with results from searches. | 82 * Our history system calls this function with results from searches. |
| 74 * @param {HistoryQuery} info An object containing information about the query. | 83 * @param {HistoryQuery} info An object containing information about the query. |
| 75 * @param {Array<HistoryEntry>} results A list of results. | 84 * @param {Array<HistoryEntry>} results A list of results. |
| 76 */ | 85 */ |
| 77 function historyResult(info, results) { | 86 function historyResult(info, results) { |
| 78 $('history-list').addNewResults(results); | 87 $('history-list').addNewResults(results, info.term); |
| 79 } | 88 } |
| 80 | 89 |
| 81 /** | 90 /** |
| 82 * Called by the history backend when deletion was succesful. | 91 * Called by the history backend when deletion was succesful. |
| 83 */ | 92 */ |
| 84 function deleteComplete() { | 93 function deleteComplete() { |
| 85 $('history-list').removeDeletedHistory($('toolbar').count); | 94 $('history-list').removeDeletedHistory($('toolbar').count); |
| 86 $('toolbar').count = 0; | 95 $('toolbar').count = 0; |
| 87 } | 96 } |
| 88 | 97 |
| 89 /** | 98 /** |
| 90 * Called by the history backend when the deletion failed. | 99 * Called by the history backend when the deletion failed. |
| 91 */ | 100 */ |
| 92 function deleteFailed() { | 101 function deleteFailed() { |
| 93 } | 102 } |
| 94 | 103 |
| 95 /** | 104 /** |
| 96 * Called when the history is deleted by someone else. | 105 * Called when the history is deleted by someone else. |
| 97 */ | 106 */ |
| 98 function historyDeleted() { | 107 function historyDeleted() { |
| 99 } | 108 } |
| OLD | NEW |