Index: chrome/browser/resources/chromeos/login/oobe.js |
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js |
index 8c0ca09bbc4cc7b62addd39f6571302b3d865603..1b16c4df87af3399e368b47e1ad68e5aeaf0e1b7 100644 |
--- a/chrome/browser/resources/chromeos/login/oobe.js |
+++ b/chrome/browser/resources/chromeos/login/oobe.js |
@@ -151,6 +151,45 @@ cr.define('cr.ui', function() { |
}; |
/** |
+ * Sets estimated time left until download will complete. |
+ * @param {number} days Number of estimated days. |
+ * @param {number} hours Number of estimated hours. |
+ * @param {number} minutes Number of estimated minutes. |
+ * @param {number} seconds Number of estimated seconds. |
+ */ |
+ Oobe.setUpdateEstimatedTimeLeft = function(days, hours, minutes, seconds) { |
+ var units = ['days', 'hours', 'minutes', 'seconds']; |
Nikita (slow)
2012/05/10 16:04:31
These should be loaded from localizedStrings.
|
+ var values = [days, hours, minutes, seconds]; |
+ var unit = 0; |
+ while (units[unit + 1] && values[unit] == 0) |
+ ++unit; |
+ |
+ var text; |
+ if (!units[unit + 1] || values[unit] == 0) { |
Nikita (slow)
2012/05/10 16:04:31
Bad localization pattern.
String format itself sho
|
+ text = values[unit] + ' ' + units[unit]; |
+ } else { |
+ text = values[unit] + ' ' + units[unit] + ', ' + |
+ values[unit + 1] + ' ' + units[unit + 1]; |
+ } |
+ $('update-estimated-time-left').innerText = text; |
+ }; |
+ |
+ /** |
+ * Sets update's dowloading rate. |
+ * @param {number} dowloading rate in bytes/sec. |
+ */ |
+ Oobe.setUpdateDownloadingRate = function(rate) { |
+ var units = ['B/s', 'kB/s', 'MB/s', 'GB/s', 'TB/s', 'PB/s']; |
Nikita (slow)
2012/05/10 16:04:31
If we end up showing this to user than these shoul
|
+ var unit = 0; |
+ while (units[unit + 1] && rate >= 999) { |
+ rate /= 1024; |
+ ++unit; |
+ } |
+ var text = Math.round(rate) + ' ' + units[unit]; |
+ $('update-downloading-rate').innerText = text; |
+ }; |
+ |
+ /** |
* Sets update message, which is shown above the progress bar. |
* @param {text} message Message which is shown by the label. |
*/ |
@@ -168,6 +207,14 @@ cr.define('cr.ui', function() { |
}; |
/** |
+ * Shows or hides update downloading stats. |
+ * @param {boolean} enable Are stats shown? |
+ */ |
+ Oobe.showUpdateDownloadingStats = function(enable) { |
+ $('update-downloading-stats').hidden = !enable; |
+ }; |
+ |
+ /** |
* Sets TPM password. |
* @param {text} password TPM password to be shown. |
*/ |