Index: chrome/browser/resources/chromeos/login/oobe_screen_update.js |
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_update.js b/chrome/browser/resources/chromeos/login/oobe_screen_update.js |
index 0e390ed9a874cbe55ba4d71026a6d14765a4ed3d..34c9f036184672ca7dad60eef239af4915a71f72 100644 |
--- a/chrome/browser/resources/chromeos/login/oobe_screen_update.js |
+++ b/chrome/browser/resources/chromeos/login/oobe_screen_update.js |
@@ -9,7 +9,14 @@ |
login.createScreen('UpdateScreen', 'update', function() { |
return { |
EXTERNAL_API: [ |
- 'enableUpdateCancel' |
+ 'enableUpdateCancel', |
+ 'setUpdateProgress', |
+ 'showEstimatedTimeLeft', |
+ 'setEstimatedTimeLeft', |
+ 'showProgressMessage', |
+ 'setProgressMessage', |
+ 'setUpdateMessage', |
+ 'showUpdateCurtain' |
], |
/** |
@@ -37,7 +44,81 @@ login.createScreen('UpdateScreen', 'update', function() { |
*/ |
enableUpdateCancel: function() { |
$('update-cancel-hint').hidden = false; |
+ }, |
+ |
+ /** |
+ * Sets update's progress bar value. |
+ * @param {number} progress Percentage of the progress bar. |
+ */ |
+ setUpdateProgress: function(progress) { |
+ $('update-progress-bar').value = progress; |
+ }, |
+ |
+ /** |
+ * Shows or hides downloading ETA message. |
+ * @param {boolean} visible Are ETA message visible? |
+ */ |
+ showEstimatedTimeLeft: function(visible) { |
+ $('progress-message').hidden = visible; |
+ $('estimated-time-left').hidden = !visible; |
+ }, |
+ |
+ /** |
+ * Sets estimated time left until download will complete. |
+ * @param {number} seconds Time left in seconds. |
+ */ |
+ setEstimatedTimeLeft: function(seconds) { |
+ var minutes = Math.ceil(seconds / 60); |
+ var message = ''; |
+ if (minutes > 60) { |
+ message = loadTimeData.getString('downloadingTimeLeftLong'); |
+ } else if (minutes > 55) { |
+ message = loadTimeData.getString('downloadingTimeLeftStatusOneHour'); |
+ } else if (minutes > 20) { |
+ message = loadTimeData.getStringF('downloadingTimeLeftStatusMinutes', |
+ Math.ceil(minutes / 5) * 5); |
+ } else if (minutes > 1) { |
+ message = loadTimeData.getStringF('downloadingTimeLeftStatusMinutes', |
+ minutes); |
+ } else { |
+ message = loadTimeData.getString('downloadingTimeLeftSmall'); |
+ } |
+ $('estimated-time-left').textContent = |
+ loadTimeData.getStringF('downloading', message); |
+ }, |
+ |
+ /** |
+ * Shows or hides info message below progress bar. |
+ * @param {boolean} visible Are message visible? |
+ */ |
+ showProgressMessage: function(visible) { |
+ $('estimated-time-left').hidden = visible; |
+ $('progress-message').hidden = !visible; |
+ }, |
+ |
+ /** |
+ * Sets message below progress bar. |
+ * @param {string} message Message that should be shown. |
+ */ |
+ setProgressMessage: function(message) { |
+ $('progress-message').innerText = message; |
+ }, |
+ |
+ /** |
+ * Sets update message, which is shown above the progress bar. |
+ * @param {text} message Message which is shown by the label. |
+ */ |
+ setUpdateMessage: function(message) { |
+ $('update-upper-label').textContent = message; |
+ }, |
+ |
+ /** |
+ * Shows or hides update curtain. |
+ * @param {boolean} visible Are curtains visible? |
+ */ |
+ showUpdateCurtain: function(visible) { |
+ $('update-screen-curtain').hidden = !visible; |
+ $('update-screen-main').hidden = visible; |
} |
}; |
}); |
- |