Chromium Code Reviews| Index: chrome/browser/resources/md_history/history.js |
| diff --git a/chrome/browser/resources/md_history/history.js b/chrome/browser/resources/md_history/history.js |
| index ceb5dab5be840a6da95a6a160fabe69ed0dc6523..09561748f78937a26792e6fd1a3dc15c3f5cf721 100644 |
| --- a/chrome/browser/resources/md_history/history.js |
| +++ b/chrome/browser/resources/md_history/history.js |
| @@ -17,15 +17,6 @@ window.addEventListener('load', function() { |
| }); |
| /** |
| - * Our history system calls this function with results from searches. |
| - * @param {HistoryQuery} info An object containing information about the query. |
| - * @param {Array<HistoryEntry>} results A list of results. |
| - */ |
| -function historyResult(info, results) { |
| - $('history-card-manager').addNewResults(results); |
| -} |
| - |
| -/** |
| * Listens for history-item being selected or deselected (through checkbox) |
| * and changes the view of the top toolbar. |
| */ |
| @@ -43,6 +34,23 @@ window.addEventListener('unselect-all', function() { |
| }); |
| /** |
| + * Listens for call to delete all selected items and loops through all items to |
| + * to determine which ones are selected and deletes these. |
| + */ |
| +window.addEventListener('delete-selected', function() { |
| + if (!loadTimeData.getBoolean('allowDeletingHistory')) { |
| + return; |
| + } |
| + |
| + // TODO(hsampson): add a popup to check whether the user definitely wants to |
| + // delete the selected items. |
| + |
| + var toBeRemoved = $('history-card-manager').getItemsToDelete( |
|
calamity
2016/02/02 05:34:58
nit: wrap after the = instead.
hsampson
2016/02/02 22:59:53
Done.
|
| + $('toolbar').count); |
| + chrome.send('removeVisits', toBeRemoved); |
| +}); |
| + |
| +/** |
| * Listens for any keyboard presses which will close the overflow menu. |
| */ |
| window.addEventListener('keydown', function(e) { |
| @@ -58,3 +66,34 @@ window.addEventListener('keydown', function(e) { |
| window.addEventListener('resize', function() { |
| $('history-card-manager').closeMenu(); |
| }); |
| + |
| +// Chrome Callbacks------------------------------------------------------------- |
| + |
| +/** |
| + * Our history system calls this function with results from searches. |
| + * @param {HistoryQuery} info An object containing information about the query. |
| + * @param {Array<HistoryEntry>} results A list of results. |
| + */ |
| +function historyResult(info, results) { |
| + $('history-card-manager').addNewResults(results); |
| +} |
| + |
| +/** |
| + * Called by the history backend when deletion was succesful. |
| + */ |
| +function deleteComplete() { |
| + $('history-card-manager').removeDeletedHistory($('toolbar').count); |
| + $('toolbar').count = 0; |
| +} |
| + |
| +/** |
| + * Called by the history backend when the deletion failed. |
| + */ |
| +function deleteFailed() { |
| +} |
| + |
| +/** |
| + * Called when the history is deleted by someone else. |
| + */ |
| +function historyDeleted() { |
| +} |