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..9bfdad470cc25bd9550873e9740a63809e011c38 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 one are selected and deletes these. |
|
calamity
2016/01/21 00:11:08
s/one/ones/
hsampson
2016/01/21 05:34:46
Done.
|
| + */ |
| +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( |
| + $('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,35 @@ window.addEventListener('keydown', function(e) { |
| window.addEventListener('resize', function() { |
| $('history-card-manager').closeMenu(); |
| }); |
| + |
| +// Chrome Callbacks------------------------------------------------------------- |
|
calamity
2016/01/21 00:11:08
Woo, I heartily endorse this sectioning.
hsampson
2016/01/21 05:34:46
Yay!
|
| + |
| +/** |
| + * 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() { |
| + window.console.log('Delete failed'); |
|
calamity
2016/01/21 00:11:08
Should this still be here?
hsampson
2016/01/21 05:34:46
Done.
|
| +} |
| + |
| +/** |
| + * Called when the history is deleted by someone else. |
| + */ |
| +function historyDeleted() { |
| +} |