Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java |
index 2cb6ca9315cd44bf409ecd3b078982fceb15fd3c..1eaecdbd1d95fa949803987388d8fd82a0919e3b 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java |
@@ -53,6 +53,8 @@ public class MostVisitedItem implements OnCreateContextMenuListener, |
private boolean mOfflineAvailable; |
private int mIndex; |
private int mTileType; |
+ private int mSource; |
+ private int mProviderIndex; |
private View mView; |
/** |
@@ -66,9 +68,13 @@ public class MostVisitedItem implements OnCreateContextMenuListener, |
* visited item. Empty otherwise. |
* @param offlineAvailable Whether there is an offline copy of the URL available. |
* @param index The index of this item in the list of most visited items. |
+ * @param source The {@link MostVisitedSource} that generated this item. |
+ * @param providerIndex If this item comes from {@code MostVisitedSource.SUGGESTIONS_SERVICE}, |
+ * this is the index of the source of the suggestion. |
*/ |
public MostVisitedItem(MostVisitedItemManager manager, String title, String url, |
- String whitelistIconPath, boolean offlineAvailable, int index) { |
+ String whitelistIconPath, boolean offlineAvailable, int index, int source, |
+ int providerIndex) { |
mManager = manager; |
mTitle = title; |
mUrl = url; |
@@ -76,6 +82,8 @@ public class MostVisitedItem implements OnCreateContextMenuListener, |
mOfflineAvailable = offlineAvailable; |
mIndex = index; |
mTileType = MostVisitedTileType.NONE; |
+ mSource = source; |
+ mProviderIndex = index; |
} |
/** |
@@ -154,6 +162,21 @@ public class MostVisitedItem implements OnCreateContextMenuListener, |
mTileType = type; |
} |
+ /** |
+ * @return The source of this item. Used for metrics tracking. Valid values are listed in |
+ * {@link MostVisitedSource}. |
+ */ |
+ public int getSource() { |
+ return mSource; |
+ } |
+ |
+ /** |
+ * @return The provider index of this item. Used for metrics tracking. |
+ */ |
+ public int getProviderIndex() { |
+ return mProviderIndex; |
+ } |
+ |
@Override |
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { |
mManager.onCreateContextMenu(menu, this); |