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

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

Issue 2542203002: [Android History] Add Android history manager UI and bridge (Closed)
Patch Set: Rebase, drop changes to time.* 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.history;
6
7 import android.text.TextUtils;
8
9 import org.chromium.chrome.browser.widget.DateDividedAdapter.TimedItem;
10
11 /** Contains information about a single browsing history item. */
12 public class HistoryItem extends TimedItem {
13 private final String mUrl;
14 private final String mDomain;
15 private final String mTitle;
16 private final long mTimestamp;
17 private Long mStableId;
18
19 /**
20 * @param url The url for this item.
21 * @param domain The string to display for the item's domain.
22 * @param title The string to display for the item's title.
23 * @param timestamp The timestamp for this item.
24 */
25 public HistoryItem(String url, String domain, String title, long timestamp) {
26 mUrl = url;
27 mDomain = domain;
28 mTitle = TextUtils.isEmpty(title) ? url : title;
29 mTimestamp = timestamp;
30 }
31
32 /** @return The string to display for the item's domain. */
33 public String getDomain() {
34 return mDomain;
35 }
36
37 /** @return The string to display for the item's title. */
38 public String getTitle() {
39 return mTitle;
40 }
41
42 @Override
43 public long getTimestamp() {
44 return mTimestamp;
45 }
46
47 @Override
48 public long getStableId() {
49 if (mStableId == null) {
50 // Generate a stable ID that combines the timestamp and the URL.
51 mStableId = (long) mUrl.hashCode();
52 mStableId = (mStableId << 32) + (getTimestamp() & 0x0FFFFFFFF);
53 }
54 return mStableId;
55 }
56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698