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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/suggestions/Tile.java

Issue 2710473003: 📰 Ensure NTP Tiles keep tracking recent data (Closed)
Patch Set: Add OWNERS file for new test folder Created 3 years, 10 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
Index: chrome/android/java/src/org/chromium/chrome/browser/suggestions/Tile.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/Tile.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/Tile.java
index 48a9d3a5bdac0f8fd21fdbaff5ab959bf6411198..6b9e3bffcb776cf5db7abf06efada42385d92464 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/Tile.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/Tile.java
@@ -50,6 +50,31 @@ public Tile(String title, String url, String whitelistIconPath, boolean offlineA
}
/**
+ * Imports transient data from an old tile, and reports whether there is a significant
+ * difference between the two that would require a redraw.
+ * Assumes that the current tile and the old tile (if provided) both describe the same site,
+ * so the URLs have to be the same.
+ */
+ public boolean importData(@Nullable Tile tile) {
+ if (tile == null) return true;
+
+ assert tile.getUrl().equals(mUrl);
+
+ mType = tile.getType();
+ mIcon = tile.getIcon();
+
+ if (!tile.getTitle().equals(mTitle)) return true;
+ if (tile.isOfflineAvailable() != mOfflineAvailable) return true;
+ if (tile.getIndex() != mIndex) return true;
+
+ // Ignore the whitelist changes when we already have an icon, since we won't need to reload
+ // it. We also omit requesting a redraw when |mSource| changes, as it only affects UMA.
+ if (!tile.getWhitelistIconPath().equals(mWhitelistIconPath) && mIcon == null) return true;
+
+ return false;
+ }
+
+ /**
* @return The site URL of this tile.
*/
public String getUrl() {

Powered by Google App Engine
This is Rietveld 408576698