| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ActionItem.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ActionItem.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ActionItem.java
|
| index 3e6922451d613e60c0a0956f48809d0e15298c52..ddcb2e39c31511cd87f43811ee618b27b1b0cf46 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ActionItem.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/ActionItem.java
|
| @@ -20,24 +20,22 @@
|
|
|
| /**
|
| * Item that allows the user to perform an action on the NTP.
|
| - * Note: Use {@link #refreshVisibility()} to update the visibility of the button instead of calling
|
| - * {@link #setVisible(boolean)} directly.
|
| */
|
| public class ActionItem extends OptionalLeaf {
|
| - @IntDef({ACTION_NONE, ACTION_VIEW_ALL, ACTION_FETCH_MORE, ACTION_RELOAD})
|
| + @IntDef({ACTION_NONE, ACTION_VIEW_ALL, ACTION_FETCH})
|
| @Retention(RetentionPolicy.SOURCE)
|
| public @interface Action {}
|
| public static final int ACTION_NONE = 0;
|
| public static final int ACTION_VIEW_ALL = 1;
|
| - public static final int ACTION_FETCH_MORE = 2;
|
| - public static final int ACTION_RELOAD = 3;
|
| + public static final int ACTION_FETCH = 2;
|
|
|
| private final SuggestionsCategoryInfo mCategoryInfo;
|
| private final SuggestionsSection mParentSection;
|
| private final SuggestionsRanker mSuggestionsRanker;
|
|
|
| @Action
|
| - private int mCurrentAction = ACTION_NONE;
|
| + private final int mCurrentAction;
|
| +
|
| private boolean mImpressionTracked;
|
| private int mPerSectionRank = -1;
|
|
|
| @@ -45,10 +43,6 @@ public ActionItem(SuggestionsSection section, SuggestionsRanker ranker) {
|
| mCategoryInfo = section.getCategoryInfo();
|
| mParentSection = section;
|
| mSuggestionsRanker = ranker;
|
| - }
|
| -
|
| - /** Call this instead of {@link #setVisible(boolean)} to update the visibility. */
|
| - public void refreshVisibility() {
|
| mCurrentAction = findAppropriateAction();
|
| setVisible(mCurrentAction != ACTION_NONE);
|
| }
|
| @@ -86,8 +80,7 @@ void performAction(SuggestionsUiDelegate uiDelegate) {
|
| case ACTION_VIEW_ALL:
|
| mCategoryInfo.performViewAllAction(uiDelegate.getNavigationDelegate());
|
| return;
|
| - case ACTION_FETCH_MORE:
|
| - case ACTION_RELOAD:
|
| + case ACTION_FETCH:
|
| uiDelegate.getSuggestionsSource().fetchSuggestions(
|
| mCategoryInfo.getCategory(), mParentSection.getDisplayedSuggestionIds());
|
| mParentSection.onFetchStarted();
|
| @@ -101,10 +94,8 @@ void performAction(SuggestionsUiDelegate uiDelegate) {
|
|
|
| @Action
|
| private int findAppropriateAction() {
|
| - boolean hasSuggestions = mParentSection.hasSuggestions();
|
| if (mCategoryInfo.hasViewAllAction()) return ACTION_VIEW_ALL;
|
| - if (hasSuggestions && mCategoryInfo.hasFetchMoreAction()) return ACTION_FETCH_MORE;
|
| - if (!hasSuggestions && mCategoryInfo.hasReloadAction()) return ACTION_RELOAD;
|
| + if (mCategoryInfo.hasFetchAction()) return ACTION_FETCH;
|
| return ACTION_NONE;
|
| }
|
|
|
|
|