Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: chrome/browser/resources/md_history/history.js

Issue 1586373002: MD History: Delete button in the toolbar allows deletion of multiple history-items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@patch_to_be_uploaded
Patch Set: Fix supervised user test. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..ae6da278a7d8760938ccae0a38caeff0f5b6d49e 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').getSelectedItems($('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() {
+}
« no previous file with comments | « chrome/browser/resources/md_history/compiled_resources.gyp ('k') | chrome/browser/resources/md_history/history_card.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698