1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview Oobe update screen implementation.
9 login.createScreen('UpdateScreen', 'update', function() {
14 'showEstimatedTimeLeft',
15 'setEstimatedTimeLeft',
16 'showProgressMessage',
23 * Header text of the screen.
27 return loadTimeData.getString('updateScreenTitle');
34 // It's safe to act on the accelerator even if it's disabled on official
35 // builds, since Chrome will just ignore the message in that case.
36 var updateCancelHint = $('update-cancel-hint').firstElementChild;
37 updateCancelHint.textContent =
38 loadTimeData.getString('cancelledUpdateMessage');
39 chrome.send('cancelUpdate');
43 * Makes 'press Escape to cancel update' hint visible.
45 enableUpdateCancel: function() {
46 $('update-cancel-hint').hidden = false;
50 * Sets update's progress bar value.
51 * @param {number} progress Percentage of the progress bar.
53 setUpdateProgress: function(progress) {
54 $('update-progress-bar').value = progress;
58 * Shows or hides downloading ETA message.
59 * @param {boolean} visible Are ETA message visible?
61 showEstimatedTimeLeft: function(visible) {
62 $('progress-message').hidden = visible;
63 $('estimated-time-left').hidden = !visible;
67 * Sets estimated time left until download will complete.
68 * @param {number} seconds Time left in seconds.
70 setEstimatedTimeLeft: function(seconds) {
71 var minutes = Math.ceil(seconds / 60);
74 message = loadTimeData.getString('downloadingTimeLeftLong');
75 } else if (minutes > 55) {
76 message = loadTimeData.getString('downloadingTimeLeftStatusOneHour');
77 } else if (minutes > 20) {
78 message = loadTimeData.getStringF('downloadingTimeLeftStatusMinutes',
79 Math.ceil(minutes / 5) * 5);
80 } else if (minutes > 1) {
81 message = loadTimeData.getStringF('downloadingTimeLeftStatusMinutes',
84 message = loadTimeData.getString('downloadingTimeLeftSmall');
86 $('estimated-time-left').textContent =
87 loadTimeData.getStringF('downloading', message);
91 * Shows or hides info message below progress bar.
92 * @param {boolean} visible Are message visible?
94 showProgressMessage: function(visible) {
95 $('estimated-time-left').hidden = visible;
96 $('progress-message').hidden = !visible;
100 * Sets message below progress bar.
101 * @param {string} message Message that should be shown.
103 setProgressMessage: function(message) {
104 $('progress-message').innerText = message;
108 * Sets update message, which is shown above the progress bar.
109 * @param {text} message Message which is shown by the label.
111 setUpdateMessage: function(message) {
112 $('update-upper-label').textContent = message;
116 * Shows or hides update curtain.
117 * @param {boolean} visible Are curtains visible?
119 showUpdateCurtain: function(visible) {
120 $('update-screen-curtain').hidden = !visible;
121 $('update-screen-main').hidden = visible;