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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java

Issue 2555273002: [Android History] Add support for removing items (Closed)
Patch Set: Changes from dfalcantara@ review Created 4 years 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/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java
index cbe8dfaabd4dd367c18130de6bda78f2ddb333ea..f2738ad8754e5ae823942d14466318c2557cf85b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java
@@ -75,6 +75,13 @@ public class HistoryManager implements OnMenuItemClickListener {
openItemsInNewTabs(mSelectionDelegate.getSelectedItems(), true);
mSelectionDelegate.clearSelection();
return true;
+ } else if (item.getItemId() == R.id.selection_mode_delete_menu_id) {
+ for (HistoryItem historyItem : mSelectionDelegate.getSelectedItems()) {
+ mHistoryAdapter.markItemForRemoval(historyItem);
+ }
+ mHistoryAdapter.removeItems();
+ mSelectionDelegate.clearSelection();
+ return true;
}
return false;
}
@@ -95,6 +102,18 @@ public class HistoryManager implements OnMenuItemClickListener {
}
/**
+ * Removes the HistoryItem from the history backend and the HistoryAdapter.
+ * @param item The HistoryItem to remove.
+ */
+ public void removeItem(HistoryItem item) {
+ if (mSelectionDelegate.isItemSelected(item)) {
+ mSelectionDelegate.toggleSelectionForItem(item);
+ }
+ mHistoryAdapter.markItemForRemoval(item);
+ mHistoryAdapter.removeItems();
+ }
+
+ /**
* Open the history item.
* @param url The URL of the history item.
* @param isIncognito Whether to open the history item in an incognito tab. If null, the tab

Powered by Google App Engine
This is Rietveld 408576698