OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Out of the box experience flow (OOBE). | 6 * @fileoverview Out of the box experience flow (OOBE). |
7 * This is the main code for the OOBE WebUI implementation. | 7 * This is the main code for the OOBE WebUI implementation. |
8 */ | 8 */ |
9 | 9 |
10 <include src="login_common.js"></include> | 10 <include src="login_common.js"></include> |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 setOemEulaUrl: function(oemEulaUrl) { | 174 setOemEulaUrl: function(oemEulaUrl) { |
175 if (oemEulaUrl) { | 175 if (oemEulaUrl) { |
176 $('oem-eula-frame').src = oemEulaUrl; | 176 $('oem-eula-frame').src = oemEulaUrl; |
177 $('eulas').classList.remove('one-column'); | 177 $('eulas').classList.remove('one-column'); |
178 } else { | 178 } else { |
179 $('eulas').classList.add('one-column'); | 179 $('eulas').classList.add('one-column'); |
180 } | 180 } |
181 }, | 181 }, |
182 | 182 |
183 /** | 183 /** |
184 * Sets update's progress bar value. | |
185 * @param {number} progress Percentage of the progress bar. | |
186 */ | |
187 setUpdateProgress: function(progress) { | |
188 $('update-progress-bar').value = progress; | |
189 }, | |
190 | |
191 /** | |
192 * Shows or hides downloading ETA message. | |
193 * @param {boolean} visible Are ETA message visible? | |
194 */ | |
195 showEstimatedTimeLeft: function(visible) { | |
196 $('progress-message').hidden = visible; | |
197 $('estimated-time-left').hidden = !visible; | |
198 }, | |
199 | |
200 /** | |
201 * Sets estimated time left until download will complete. | |
202 * @param {number} seconds Time left in seconds. | |
203 */ | |
204 setEstimatedTimeLeft: function(seconds) { | |
205 var minutes = Math.ceil(seconds / 60); | |
206 var message = ''; | |
207 if (minutes > 60) { | |
208 message = loadTimeData.getString('downloadingTimeLeftLong'); | |
209 } else if (minutes > 55) { | |
210 message = loadTimeData.getString('downloadingTimeLeftStatusOneHour'); | |
211 } else if (minutes > 20) { | |
212 message = loadTimeData.getStringF('downloadingTimeLeftStatusMinutes', | |
213 Math.ceil(minutes / 5) * 5); | |
214 } else if (minutes > 1) { | |
215 message = loadTimeData.getStringF('downloadingTimeLeftStatusMinutes', | |
216 minutes); | |
217 } else { | |
218 message = loadTimeData.getString('downloadingTimeLeftSmall'); | |
219 } | |
220 $('estimated-time-left').textContent = | |
221 loadTimeData.getStringF('downloading', message); | |
222 }, | |
223 | |
224 /** | |
225 * Shows or hides info message below progress bar. | |
226 * @param {boolean} visible Are message visible? | |
227 */ | |
228 showProgressMessage: function(visible) { | |
229 $('estimated-time-left').hidden = visible; | |
230 $('progress-message').hidden = !visible; | |
231 }, | |
232 | |
233 /** | |
234 * Sets message below progress bar. | |
235 * @param {string} message Message that should be shown. | |
236 */ | |
237 setProgressMessage: function(message) { | |
238 $('progress-message').innerText = message; | |
239 }, | |
240 | |
241 /** | |
242 * Sets update message, which is shown above the progress bar. | |
243 * @param {text} message Message which is shown by the label. | |
244 */ | |
245 setUpdateMessage: function(message) { | |
246 $('update-upper-label').textContent = message; | |
247 }, | |
248 | |
249 /** | |
250 * Shows or hides update curtain. | |
251 * @param {boolean} visible Are curtains visible? | |
252 */ | |
253 showUpdateCurtain: function(visible) { | |
254 $('update-screen-curtain').hidden = !visible; | |
255 $('update-screen-main').hidden = visible; | |
256 }, | |
257 | |
258 /** | |
259 * Sets TPM password. | 184 * Sets TPM password. |
260 * @param {text} password TPM password to be shown. | 185 * @param {text} password TPM password to be shown. |
261 */ | 186 */ |
262 setTpmPassword: function(password) { | 187 setTpmPassword: function(password) { |
263 $('tpm-busy').hidden = true; | 188 $('tpm-busy').hidden = true; |
264 | 189 |
265 if (password.length) { | 190 if (password.length) { |
266 $('tpm-password').textContent = password; | 191 $('tpm-password').textContent = password; |
267 $('tpm-password').hidden = false; | 192 $('tpm-password').hidden = false; |
268 } else { | 193 } else { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 /** | 228 /** |
304 * Updates localized content of the screens. | 229 * Updates localized content of the screens. |
305 * Should be executed on language change. | 230 * Should be executed on language change. |
306 */ | 231 */ |
307 updateLocalizedContent: function() { | 232 updateLocalizedContent: function() { |
308 // Buttons, headers and links. | 233 // Buttons, headers and links. |
309 Oobe.getInstance().updateLocalizedContent_(); | 234 Oobe.getInstance().updateLocalizedContent_(); |
310 } | 235 } |
311 }; | 236 }; |
312 }); | 237 }); |
OLD | NEW |