Chromium Code Reviews| 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..3e0fe2ef78c22bada8c7938b1360b74d6f7739ab 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 |
| + * MostVisitedTileType. |
|
Ted C
2015/09/28 23:08:45
for this and below, I would {@link them}
|
| + */ |
| + public int getTileType() { |
| + return mTileType; |
| + } |
| + |
| + /** |
| + * Sets the visual type of this most visited item. Valid values are listed in |
| + * MostVisitedTileType. |
| + */ |
| + public void setTileType(int type) { |
| + mTileType = type; |
| + } |
| + |
| @Override |
| public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { |
| mManager.onCreateContextMenu(menu, this); |