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

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

Issue 2507793002: [NTP] Propagate OfflineId from C++ for Downloads. (Closed)
Patch Set: bauerb@ comments. Created 4 years, 1 month 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/ntp/snippets/SnippetArticle.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java
index eabe48c811c2d8834b867aababa4105059377bcf..8c94a2ade5b3576809d6485f3889cc7c82bb49b4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/snippets/SnippetArticle.java
@@ -75,9 +75,6 @@ public class SnippetArticle {
/** The tab id of the corresponding tab (only for recent tab articles). */
private String mRecentTabId;
- /** The offline page id (only for recent tab articles). */
- private String mRecentTabOfflinePageId;
-
/** The offline id of the corresponding offline page, if any. */
private Long mOfflinePageOfflineId;
@@ -176,6 +173,16 @@ public class SnippetArticle {
mDownloadAssetMimeType = mimeType;
}
+ /**
+ * Marks the article suggestion as a download offline page with the given id. May only be called
+ * if this snippet belongs to DOWNLOADS category.
+ */
+ public void setDownloadOfflinePageData(long offlinePageId) {
+ assert isDownload();
+ mIsDownloadedAsset = false;
+ setOfflinePageOfflineId(offlinePageId);
+ }
+
public boolean requiresExactOfflinePage() {
Bernhard Bauer 2016/11/16 17:44:35 Javadoc please.
vitaliii 2016/11/16 18:15:22 I will do this in the parent CL.
return isDownload() || isRecentTab();
}
@@ -194,22 +201,13 @@ public class SnippetArticle {
}
/**
- * @return the corresponding recent tab offline page id. May only be called if this snippet is a
- * recent tab article.
- */
- public String getRecentTabOfflinePageId() {
- assert isRecentTab();
- return mRecentTabOfflinePageId;
- }
-
- /**
* Sets tab id and offline page id for recent tab articles. May only be called if this snippet
* is a recent tab article.
*/
- public void setRecentTabData(String tabId, String offlinePageId) {
+ public void setRecentTabData(String tabId, long offlinePageId) {
assert isRecentTab();
mRecentTabId = tabId;
- mRecentTabOfflinePageId = offlinePageId;
+ setOfflinePageOfflineId(offlinePageId);
}
/** Sets offline id of the corresponding to the snippet offline page. Null to clear.*/

Powered by Google App Engine
This is Rietveld 408576698