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 downloading estimated time left status. |
161 * @param {boolean} enable Are time left status show? | 161 * @param {boolean} enable Are time left status show? |
Ivan Korotkov
2012/08/24 09:01:36
Please fix this sentence
ygorshenin1
2012/08/27 12:54:16
Done.
| |
162 */ | 162 */ |
163 Oobe.showUpdateEstimatedTimeLeft = function(enable) { | 163 Oobe.showEstimatedTimeLeft = function(enable) { |
164 $('update-estimated-time-left').hidden = !enable; | 164 if (enable) |
165 $('progress-message').hidden = true; | |
Ivan Korotkov
2012/08/24 09:01:36
Is it ok that a further call with enable=false won
ygorshenin1
2012/08/27 12:54:16
Done.
| |
166 $('estimated-time-left').hidden = !enable; | |
165 }; | 167 }; |
166 | 168 |
167 /** | 169 /** |
168 * Sets estimated time left until download will complete. | 170 * Sets estimated time left until download will complete. |
169 * @param {number} seconds Time left in seconds. | 171 * @param {number} seconds Time left in seconds. |
170 */ | 172 */ |
171 Oobe.setUpdateEstimatedTimeLeft = function(seconds) { | 173 Oobe.setEstimatedTimeLeft = function(seconds) { |
172 var minutes = Math.ceil(seconds / 60); | 174 var minutes = Math.ceil(seconds / 60); |
173 var message = ''; | 175 var message = ''; |
174 if (minutes > 60) { | 176 if (minutes > 60) { |
175 message = localStrings.getString('downloadingTimeLeftLong'); | 177 message = localStrings.getString('downloadingTimeLeftLong'); |
176 } else if (minutes > 55) { | 178 } else if (minutes > 55) { |
177 message = localStrings.getString('downloadingTimeLeftStatusOneHour'); | 179 message = localStrings.getString('downloadingTimeLeftStatusOneHour'); |
178 } else if (minutes > 20) { | 180 } else if (minutes > 20) { |
179 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', | 181 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', |
180 Math.ceil(minutes / 5) * 5); | 182 Math.ceil(minutes / 5) * 5); |
181 } else if (minutes > 1) { | 183 } else if (minutes > 1) { |
182 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', | 184 message = localStrings.getStringF('downloadingTimeLeftStatusMinutes', |
183 minutes); | 185 minutes); |
184 } else { | 186 } else { |
185 message = localStrings.getString('downloadingTimeLeftSmall'); | 187 message = localStrings.getString('downloadingTimeLeftSmall'); |
186 } | 188 } |
187 $('update-estimated-time-left').textContent = message; | 189 $('estimated-time-left').textContent = |
190 localStrings.getStringF('downloading', message); | |
188 }; | 191 }; |
189 | 192 |
190 /** | 193 /** |
194 * Shows message below progress bar. | |
195 * @param {boolean} enable Are message should be shown? | |
Ivan Korotkov
2012/08/24 09:01:36
ditto
ygorshenin1
2012/08/27 12:54:16
Done.
| |
196 */ | |
197 Oobe.showProgressMessage = function(enable) { | |
198 if (enable) | |
Ivan Korotkov
2012/08/24 09:01:36
ditto
ygorshenin1
2012/08/27 12:54:16
Done.
| |
199 $('estimated-time-left').hidden = true; | |
200 $('progress-message').hidden = !enable; | |
201 }; | |
202 | |
203 /** | |
204 * Sets message below progress bar. | |
205 * @param {string} message Message that should be shown. | |
206 */ | |
207 Oobe.setProgressMessage = function(message) { | |
208 $('progress-message').innerText = message; | |
209 }; | |
210 | |
211 /** | |
191 * Sets update message, which is shown above the progress bar. | 212 * Sets update message, which is shown above the progress bar. |
192 * @param {text} message Message which is shown by the label. | 213 * @param {text} message Message which is shown by the label. |
193 */ | 214 */ |
194 Oobe.setUpdateMessage = function(message) { | 215 Oobe.setUpdateMessage = function(message) { |
195 $('update-upper-label').textContent = message; | 216 $('update-upper-label').textContent = message; |
196 }; | 217 }; |
197 | 218 |
198 /** | 219 /** |
199 * Shows or hides update curtain. | 220 * Shows or hides update curtain. |
200 * @param {boolean} enable Are curtains shown? | 221 * @param {boolean} enable Are curtains shown? |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 // Allow selection events on components with editable text (password field) | 358 // Allow selection events on components with editable text (password field) |
338 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) | 359 // bug (http://code.google.com/p/chromium/issues/detail?id=125863) |
339 disableTextSelectAndDrag(function(e) { | 360 disableTextSelectAndDrag(function(e) { |
340 var src = e.target; | 361 var src = e.target; |
341 return src instanceof HTMLTextAreaElement || | 362 return src instanceof HTMLTextAreaElement || |
342 src instanceof HTMLInputElement && | 363 src instanceof HTMLInputElement && |
343 /text|password|search/.test(src.type); | 364 /text|password|search/.test(src.type); |
344 }); | 365 }); |
345 | 366 |
346 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); | 367 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); |
OLD | NEW |