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

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

Issue 2644143003: [Content suggestions] Never update snippets after FetchMore (Closed)
Patch Set: Further comments #2 Created 3 years, 11 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/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.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/cards/SuggestionsSection.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
index 156bb65ee6dcc678dc30af589299af3b27a91409..399edd8bae77d67ca562526a5b09b8cbfd242bc6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSection.java
@@ -47,11 +47,20 @@ public class SuggestionsSection extends InnerNode {
private boolean mIsNtpDestroyed;
- // Keep track of how many suggestions have been seen by the user so that we replace only
- // suggestions that have not been seen, yet.
+ /**
+ * Keeps track of how many suggestions have been seen by the user so that we replace only
+ * suggestions that have not been seen, yet.
+ */
private int mNumberOfSuggestionsSeen;
/**
+ * Stores whether any suggestions have been appended to the list. In this case the list can
+ * generally be longer than what is served by the Source. Thus, the list should never be
+ * replaced again.
+ */
+ private boolean mHasAppended;
+
+ /**
* Delegate interface that allows dismissing this section without introducing
* a circular dependency.
*/
@@ -324,6 +333,8 @@ public class SuggestionsSection extends InnerNode {
mSuggestionsList.getItemCount(), replaceExisting);
if (!SnippetsBridge.isCategoryStatusAvailable(status)) mSuggestionsList.clear();
+ if (!replaceExisting) mHasAppended = true;
+
// Remove suggestions to be replaced.
if (replaceExisting && hasSuggestions()) {
if (CardsVariationParameters.ignoreUpdatesForExistingSuggestions()) {
@@ -332,7 +343,7 @@ public class SuggestionsSection extends InnerNode {
return;
}
- if (mNumberOfSuggestionsSeen >= getSuggestionsCount()) {
+ if (mNumberOfSuggestionsSeen >= getSuggestionsCount() || mHasAppended) {
Log.d(TAG, "setSuggestions: replacing existing suggestion not possible, all seen");
NewTabPageUma.recordUIUpdateResult(NewTabPageUma.UI_UPDATE_FAIL_ALL_SEEN);
return;
« no previous file with comments | « no previous file | chrome/android/junit/src/org/chromium/chrome/browser/ntp/cards/SuggestionsSectionTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698