| 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 11 matching lines...) Expand all Loading... |
| 22 */ | 22 */ |
| 23 window.addEventListener('history-checkbox-select', function(e) { | 23 window.addEventListener('history-checkbox-select', function(e) { |
| 24 $('toolbar').count += e.detail.countAddition; | 24 $('toolbar').count += e.detail.countAddition; |
| 25 }); | 25 }); |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * Listens for call to cancel selection and loops through all items to set | 28 * Listens for call to cancel selection and loops through all items to set |
| 29 * checkbox to be unselected. | 29 * checkbox to be unselected. |
| 30 */ | 30 */ |
| 31 window.addEventListener('unselect-all', function() { | 31 window.addEventListener('unselect-all', function() { |
| 32 $('history-card-manager').unselectAllItems($('toolbar').count); | 32 $('history-list').unselectAllItems($('toolbar').count); |
| 33 $('toolbar').count = 0; | 33 $('toolbar').count = 0; |
| 34 }); | 34 }); |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Listens for call to delete all selected items and loops through all items to | 37 * Listens for call to delete all selected items and loops through all items to |
| 38 * to determine which ones are selected and deletes these. | 38 * to determine which ones are selected and deletes these. |
| 39 */ | 39 */ |
| 40 window.addEventListener('delete-selected', function() { | 40 window.addEventListener('delete-selected', function() { |
| 41 if (!loadTimeData.getBoolean('allowDeletingHistory')) { | 41 if (!loadTimeData.getBoolean('allowDeletingHistory')) { |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // TODO(hsampson): add a popup to check whether the user definitely wants to | 45 // TODO(hsampson): add a popup to check whether the user definitely wants to |
| 46 // delete the selected items. | 46 // delete the selected items. |
| 47 | 47 |
| 48 var toBeRemoved = | 48 var toBeRemoved = |
| 49 $('history-card-manager').getSelectedItems($('toolbar').count); | 49 $('history-list').getSelectedItems($('toolbar').count); |
| 50 chrome.send('removeVisits', toBeRemoved); | 50 chrome.send('removeVisits', toBeRemoved); |
| 51 }); | 51 }); |
| 52 | 52 |
| 53 /** | 53 /** |
| 54 * Listens for any keyboard presses which will close the overflow menu. | 54 * Listens for any keyboard presses which will close the overflow menu. |
| 55 */ | 55 */ |
| 56 window.addEventListener('keydown', function(e) { | 56 window.addEventListener('keydown', function(e) { |
| 57 // Escape button on keyboard | 57 // Escape button on keyboard |
| 58 if (e.keyCode == 27) { | 58 if (e.keyCode == 27) { |
| 59 $('history-card-manager').closeMenu(); | 59 $('history-list').closeMenu(); |
| 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-card-manager').closeMenu(); | 67 $('history-list').closeMenu(); |
| 68 }); | 68 }); |
| 69 | 69 |
| 70 // Chrome Callbacks------------------------------------------------------------- | 70 // Chrome Callbacks------------------------------------------------------------- |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Our history system calls this function with results from searches. | 73 * Our history system calls this function with results from searches. |
| 74 * @param {HistoryQuery} info An object containing information about the query. | 74 * @param {HistoryQuery} info An object containing information about the query. |
| 75 * @param {Array<HistoryEntry>} results A list of results. | 75 * @param {Array<HistoryEntry>} results A list of results. |
| 76 */ | 76 */ |
| 77 function historyResult(info, results) { | 77 function historyResult(info, results) { |
| 78 $('history-card-manager').addNewResults(results); | 78 $('history-list').addNewResults(results); |
| 79 } | 79 } |
| 80 | 80 |
| 81 /** | 81 /** |
| 82 * Called by the history backend when deletion was succesful. | 82 * Called by the history backend when deletion was succesful. |
| 83 */ | 83 */ |
| 84 function deleteComplete() { | 84 function deleteComplete() { |
| 85 $('history-card-manager').removeDeletedHistory($('toolbar').count); | 85 $('history-list').removeDeletedHistory($('toolbar').count); |
| 86 $('toolbar').count = 0; | 86 $('toolbar').count = 0; |
| 87 } | 87 } |
| 88 | 88 |
| 89 /** | 89 /** |
| 90 * Called by the history backend when the deletion failed. | 90 * Called by the history backend when the deletion failed. |
| 91 */ | 91 */ |
| 92 function deleteFailed() { | 92 function deleteFailed() { |
| 93 } | 93 } |
| 94 | 94 |
| 95 /** | 95 /** |
| 96 * Called when the history is deleted by someone else. | 96 * Called when the history is deleted by someone else. |
| 97 */ | 97 */ |
| 98 function historyDeleted() { | 98 function historyDeleted() { |
| 99 } | 99 } |
| OLD | NEW |