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

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

Issue 2555273002: [Android History] Add support for removing items (Closed)
Patch Set: Rebase 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/HistoryItem.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItem.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItem.java
index 3ddc16ec13e272b22af504aa81151e9b86c63020..277279bc82faebaabb1901519997b7191db500ea 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItem.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItem.java
@@ -8,12 +8,16 @@ import android.text.TextUtils;
import org.chromium.chrome.browser.widget.DateDividedAdapter.TimedItem;
+import java.util.Arrays;
+
+
gone 2016/12/08 21:21:56 one less newline?
Theresa 2016/12/08 21:51:15 Done.
/** Contains information about a single browsing history item. */
public class HistoryItem extends TimedItem {
private final String mUrl;
private final String mDomain;
private final String mTitle;
private final long mTimestamp;
+ private final long[] mTimestampList;
private Long mStableId;
private HistoryManager mManager;
@@ -22,13 +26,16 @@ public class HistoryItem extends TimedItem {
* @param url The url for this item.
* @param domain The string to display for the item's domain.
* @param title The string to display for the item's title.
- * @param timestamp The timestamp for this item.
+ * @param timestamps The list of timestamps for this item.
*/
- public HistoryItem(String url, String domain, String title, long timestamp) {
+ public HistoryItem(String url, String domain, String title, long[] timestamps) {
mUrl = url;
mDomain = domain;
mTitle = TextUtils.isEmpty(title) ? url : title;
- mTimestamp = timestamp;
+ mTimestampList = Arrays.copyOf(timestamps, timestamps.length);
+
+ // The last timestamp in the list is the most recent visit.
+ mTimestamp = mTimestampList[mTimestampList.length - 1];
}
/** @return The url for this item. */
@@ -51,6 +58,13 @@ public class HistoryItem extends TimedItem {
return mTimestamp;
}
+ /**
+ * @return An array of timestamps representing visits to this item's url.
+ */
+ public long[] getTimestamps() {
+ return Arrays.copyOf(mTimestampList, mTimestampList.length);
+ }
+
@Override
public long getStableId() {
if (mStableId == null) {
@@ -74,4 +88,11 @@ public class HistoryItem extends TimedItem {
public void open() {
if (mManager != null) mManager.openItem(mUrl, null, false);
}
+
+ /**
+ * Removes this item.
+ */
+ public void remove() {
+ if (mManager != null) mManager.removeItem(this);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698