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 var localStrings = new LocalStrings(); | 10 var localStrings = new LocalStrings(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 /** | 151 /** |
152 * Sets update's progress bar value. | 152 * Sets update's progress bar value. |
153 * @param {number} progress Percentage of the progress bar. | 153 * @param {number} progress Percentage of the progress bar. |
154 */ | 154 */ |
155 Oobe.setUpdateProgress = function(progress) { | 155 Oobe.setUpdateProgress = function(progress) { |
156 $('update-progress-bar').value = progress; | 156 $('update-progress-bar').value = progress; |
157 }; | 157 }; |
158 | 158 |
159 /** | 159 /** |
160 * Shows estimated time left status. | 160 * Shows or hides downloading ETA message. |
161 * @param {boolean} enable Are time left status show? | 161 * @param {boolean} visible Are ETA message visible? |
162 */ | 162 */ |
163 Oobe.showUpdateEstimatedTimeLeft = function(enable) { | 163 Oobe.showEstimatedTimeLeft = function(visible) { |
164 $('update-estimated-time-left').hidden = !enable; | 164 $('progress-message').hidden = visible; |
| 165 $('estimated-time-left').hidden = !visible; |
165 }; | 166 }; |
166 | 167 |
167 /** | 168 /** |
168 * Sets estimated time left until download will complete. | 169 * Sets estimated time left until download will complete. |
169 * @param {number} seconds Time left in seconds. | 170 * @param {number} seconds Time left in seconds. |
170 */ | 171 */ |
171 Oobe.setUpdateEstimatedTimeLeft = function(seconds) { | 172 Oobe.setEstimatedTimeLeft = function(seconds) { |
172 var minutes = Math.ceil(seconds / 60); | 173 var minutes = Math.ceil(seconds / 60); |
173 var message = ''; | 174 var message = ''; |
174 if (minutes > 60) { | 175 if (minutes > 60) { |
175 message = localStrings.getString('downloadingTimeLeftLong'); | 176 message = localStrings.getString('downloadingTimeLeftLong'); |
176 } else if (minutes > 55) { | 177 } else if (minutes > 55) { |
177 message = localStrings.getString('downloadingTimeLeftStatusOneHour'); | 178 message = localStrings.getString('downloadingTimeLeftStatusOneHour'); |
178 } else if (minutes > 20) { | 179 } else if (minutes > 20) { |
179 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', | 180 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', |
180 Math.ceil(minutes / 5) * 5); | 181 Math.ceil(minutes / 5) * 5); |
181 } else if (minutes > 1) { | 182 } else if (minutes > 1) { |
182 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', | 183 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', |
183 minutes); | 184 minutes); |
184 } else { | 185 } else { |
185 message = localStrings.getString('downloadingTimeLeftSmall'); | 186 message = localStrings.getString('downloadingTimeLeftSmall'); |
186 } | 187 } |
187 $('update-estimated-time-left').textContent = message; | 188 $('estimated-time-left').textContent = |
| 189 localStrings.getStringF('downloading', message); |
188 }; | 190 }; |
189 | 191 |
190 /** | 192 /** |
| 193 * Shows or hides info message below progress bar. |
| 194 * @param {boolean} visible Are message visible? |
| 195 */ |
| 196 Oobe.showProgressMessage = function(visible) { |
| 197 $('estimated-time-left').hidden = visible; |
| 198 $('progress-message').hidden = !visible; |
| 199 }; |
| 200 |
| 201 /** |
| 202 * Sets message below progress bar. |
| 203 * @param {string} message Message that should be shown. |
| 204 */ |
| 205 Oobe.setProgressMessage = function(message) { |
| 206 $('progress-message').innerText = message; |
| 207 }; |
| 208 |
| 209 /** |
191 * Sets update message, which is shown above the progress bar. | 210 * Sets update message, which is shown above the progress bar. |
192 * @param {text} message Message which is shown by the label. | 211 * @param {text} message Message which is shown by the label. |
193 */ | 212 */ |
194 Oobe.setUpdateMessage = function(message) { | 213 Oobe.setUpdateMessage = function(message) { |
195 $('update-upper-label').textContent = message; | 214 $('update-upper-label').textContent = message; |
196 }; | 215 }; |
197 | 216 |
198 /** | 217 /** |
199 * Shows or hides update curtain. | 218 * Shows or hides update curtain. |
200 * @param {boolean} enable Are curtains shown? | 219 * @param {boolean} visible Are curtains visible? |
201 */ | 220 */ |
202 Oobe.showUpdateCurtain = function(enable) { | 221 Oobe.showUpdateCurtain = function(visible) { |
203 $('update-screen-curtain').hidden = !enable; | 222 $('update-screen-curtain').hidden = !visible; |
204 $('update-screen-main').hidden = enable; | 223 $('update-screen-main').hidden = visible; |
205 }; | 224 }; |
206 | 225 |
207 /** | 226 /** |
208 * Sets TPM password. | 227 * Sets TPM password. |
209 * @param {text} password TPM password to be shown. | 228 * @param {text} password TPM password to be shown. |
210 */ | 229 */ |
211 Oobe.setTpmPassword = function(password) { | 230 Oobe.setTpmPassword = function(password) { |
212 $('tpm-busy').hidden = true; | 231 $('tpm-busy').hidden = true; |
213 $('tpm-password').textContent = password; | 232 $('tpm-password').textContent = password; |
214 $('tpm-password').hidden = false; | 233 $('tpm-password').hidden = false; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // Allow selection events on components with editable text (password field) | 356 // Allow selection events on components with editable text (password field) |
338 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 357 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
339 disableTextSelectAndDrag(function(e) { | 358 disableTextSelectAndDrag(function(e) { |
340 var src = e.target; | 359 var src = e.target; |
341 return src instanceof HTMLTextAreaElement || | 360 return src instanceof HTMLTextAreaElement || |
342 src instanceof HTMLInputElement && | 361 src instanceof HTMLInputElement && |
343 /text|password|search/.test(src.type); | 362 /text|password|search/.test(src.type); |
344 }); | 363 }); |
345 | 364 |
346 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); | 365 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); |
OLD | NEW |