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

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

Issue 1373983003: Add UMA stats for which icon types are shown and clicked on the NTP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed test Created 5 years, 3 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 | « chrome/android/BUILD.gn ('k') | 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 042c5c153f05f105ea4cb07c14f80c2d938adfd1..64b6b0cfb128e7a55382edf5c7c23433cbf02ddd 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
@@ -20,12 +20,6 @@ import android.view.View.OnCreateContextMenuListener;
public class MostVisitedItem implements OnCreateContextMenuListener,
MenuItem.OnMenuItemClickListener, OnClickListener {
- private MostVisitedItemManager mManager;
- private String mTitle;
- private String mUrl;
- private int mIndex;
- private View mView;
-
/**
* Interface for an object that handles callbacks from a MostVisitedItem.
*/
@@ -52,6 +46,13 @@ public class MostVisitedItem implements OnCreateContextMenuListener,
boolean onMenuItemClick(int menuId, MostVisitedItem item);
}
+ private MostVisitedItemManager mManager;
+ private String mTitle;
+ private String mUrl;
+ private int mIndex;
+ private int mTileType;
+ private View mView;
+
/**
* Constructs a MostVisitedItem with the given manager, title, URL, index, and view.
*
@@ -59,15 +60,21 @@ public class MostVisitedItem implements OnCreateContextMenuListener,
* @param title The title of the page.
* @param url The URL of the page.
* @param index The index of this item in the list of most visited items.
- * @param view The View that will display the item. The MostVisitedItem will handle clicks
- * on this view.
*/
- public MostVisitedItem(MostVisitedItemManager manager, String title, String url, int index,
- View view) {
+ public MostVisitedItem(MostVisitedItemManager manager, String title, String url, int index) {
mManager = manager;
mTitle = title;
mUrl = url;
mIndex = index;
+ mTileType = MostVisitedTileType.NONE;
+ }
+
+ /**
+ * Sets the view that will display this item. MostVisitedItem will handle clicks on the view.
+ * This should be called exactly once.
+ */
+ public void initView(View view) {
+ assert mView == null;
mView = view;
mView.setOnClickListener(this);
mView.setOnCreateContextMenuListener(this);
@@ -108,6 +115,22 @@ public class MostVisitedItem implements OnCreateContextMenuListener,
mIndex = index;
}
+ /**
+ * @return The visual type of this most visited item. Valid values are listed in
+ * {@link MostVisitedTileType}.
+ */
+ public int getTileType() {
+ return mTileType;
+ }
+
+ /**
+ * Sets the visual type of this most visited item. Valid values are listed in
+ * {@link MostVisitedTileType}.
+ */
+ public void setTileType(int type) {
+ mTileType = type;
+ }
+
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
mManager.onCreateContextMenu(menu, this);
« no previous file with comments | « chrome/android/BUILD.gn ('k') | 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