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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/MostVisitedItem.java

Issue 2105933002: NTP: Fix metrics recording crash by plumbing the necessary data to Java. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address treib@ comments. Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698