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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java

Issue 2716013003: Fixes to enable indication of bytes downloaded for Offline Pages in Download Home. (Closed)
Patch Set: fix build break 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryItemWrapper.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/download/DownloadUtils.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
index 95e15539b20546aa8b97e1b408a2ed3439161748..1b843659fd4ee2fb96ec8e786f5a1cf952eed62c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
@@ -576,7 +576,7 @@ public class DownloadUtils {
} else if (item.isIndeterminate()) {
// Count up the bytes.
long bytes = info.getBytesReceived();
- return DownloadUtils.getStringForBytes(context, BYTES_DOWNLOADED_STRINGS, bytes);
+ return DownloadUtils.getStringForDownloadedBytes(context, bytes);
} else {
// Count down the time.
long msRemaining = info.getTimeRemainingInMillis();
@@ -612,6 +612,17 @@ public class DownloadUtils {
/**
* Format the number of bytes into KB, or MB, or GB and return the corresponding string
+ * resource. Uses default download-related set of strings.
+ * @param context Context to use.
+ * @param bytes Number of bytes.
+ * @return A formatted string to be displayed.
+ */
+ public static String getStringForDownloadedBytes(Context context, long bytes) {
+ return getStringForBytes(context, BYTES_DOWNLOADED_STRINGS, bytes);
+ }
+
+ /**
+ * Format the number of bytes into KB, or MB, or GB and return the corresponding string
* resource.
* @param context Context to use.
* @param stringSet The string resources for displaying bytes in KB, MB and GB.
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadHistoryItemWrapper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698