OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 newStep.classList.remove('faded'); | 117 newStep.classList.remove('faded'); |
118 } | 118 } |
119 | 119 |
120 // Adjust inner container height based on new step's height. | 120 // Adjust inner container height based on new step's height. |
121 $('inner-container').style.height = newStep.offsetHeight + 'px'; | 121 $('inner-container').style.height = newStep.offsetHeight + 'px'; |
122 | 122 |
123 if (this.currentStep_ != nextStepIndex) { | 123 if (this.currentStep_ != nextStepIndex) { |
124 oldStep.addEventListener('webkitTransitionEnd', function f(e) { | 124 oldStep.addEventListener('webkitTransitionEnd', function f(e) { |
125 oldStep.removeEventListener('webkitTransitionEnd', f); | 125 oldStep.removeEventListener('webkitTransitionEnd', f); |
126 oldStep.classList.add('hidden'); | 126 oldStep.classList.add('hidden'); |
127 if (nextStepIndex == 0) | |
128 Oobe.refreshNetworkControl(); | |
129 }); | 127 }); |
130 } else { | 128 } else { |
131 // First screen on OOBE launch. | 129 // First screen on OOBE launch. |
132 newHeader.classList.remove('right'); | 130 newHeader.classList.remove('right'); |
133 if (nextStepIndex == 0) { | |
134 Oobe.refreshNetworkControl(); | |
135 } | |
136 } | 131 } |
137 this.currentStep_ = nextStepIndex; | 132 this.currentStep_ = nextStepIndex; |
138 $('oobe').className = nextStepId; | 133 $('oobe').className = nextStepId; |
139 }, | 134 }, |
140 | 135 |
141 /** | 136 /** |
142 * Show screen of given screen id. | 137 * Show screen of given screen id. |
143 * @param {Object} screen Screen params dict, | 138 * @param {Object} screen Screen params dict, |
144 * e.g. {id: screenId, data: data} | 139 * e.g. {id: screenId, data: data} |
145 */ | 140 */ |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 308 |
314 /** | 309 /** |
315 * Enables/disables continue button. | 310 * Enables/disables continue button. |
316 * @param {bool} enable Should the button be enabled? | 311 * @param {bool} enable Should the button be enabled? |
317 */ | 312 */ |
318 Oobe.enableContinueButton = function(enable) { | 313 Oobe.enableContinueButton = function(enable) { |
319 $('continue-button').disabled = !enable; | 314 $('continue-button').disabled = !enable; |
320 }; | 315 }; |
321 | 316 |
322 /** | 317 /** |
323 * Refreshes position of the network control (on connect screen). | |
324 */ | |
325 Oobe.refreshNetworkControl = function() { | |
326 var controlOffset = Oobe.getOffset($('network-control')); | |
327 chrome.send('networkControlPosition', | |
328 [controlOffset.left, controlOffset.top]); | |
329 }; | |
330 | |
331 /** | |
332 * Sets usage statistics checkbox. | 318 * Sets usage statistics checkbox. |
333 * @param {bool} checked Is the checkbox checked? | 319 * @param {bool} checked Is the checkbox checked? |
334 */ | 320 */ |
335 Oobe.setUsageStats = function(checked) { | 321 Oobe.setUsageStats = function(checked) { |
336 $('usage-stats').checked = checked; | 322 $('usage-stats').checked = checked; |
337 }; | 323 }; |
338 | 324 |
339 /** | 325 /** |
340 * Set OEM EULA URL. | 326 * Set OEM EULA URL. |
341 * @param {text} oemEulaUrl OEM EULA URL. | 327 * @param {text} oemEulaUrl OEM EULA URL. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 // Reload global local strings, process DOM tree again. | 379 // Reload global local strings, process DOM tree again. |
394 templateData = data; | 380 templateData = data; |
395 i18nTemplate.process(document, data); | 381 i18nTemplate.process(document, data); |
396 | 382 |
397 // Update language and input method menu lists. | 383 // Update language and input method menu lists. |
398 Oobe.setupSelect($('language-select'), data.languageList, ''); | 384 Oobe.setupSelect($('language-select'), data.languageList, ''); |
399 Oobe.setupSelect($('keyboard-select'), data.inputMethodsList, ''); | 385 Oobe.setupSelect($('keyboard-select'), data.inputMethodsList, ''); |
400 | 386 |
401 // Update headers & buttons. | 387 // Update headers & buttons. |
402 Oobe.updateHeadersAndButtons(); | 388 Oobe.updateHeadersAndButtons(); |
403 | |
404 // Update the network control position. | |
405 Oobe.refreshNetworkControl(); | |
406 } | 389 } |
407 | 390 |
408 /** | 391 /** |
409 * Updates headers and buttons of the screens. | 392 * Updates headers and buttons of the screens. |
410 * Should be executed on language change. | 393 * Should be executed on language change. |
411 */ | 394 */ |
412 Oobe.updateHeadersAndButtons = function() { | 395 Oobe.updateHeadersAndButtons = function() { |
413 Oobe.getInstance().updateHeadersAndButtons_(); | 396 Oobe.getInstance().updateHeadersAndButtons_(); |
414 }; | 397 }; |
415 | 398 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 document.onselectstart = function(e) { | 521 document.onselectstart = function(e) { |
539 e.preventDefault(); | 522 e.preventDefault(); |
540 } | 523 } |
541 | 524 |
542 // Disable dragging. | 525 // Disable dragging. |
543 document.ondragstart = function(e) { | 526 document.ondragstart = function(e) { |
544 e.preventDefault(); | 527 e.preventDefault(); |
545 } | 528 } |
546 | 529 |
547 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); | 530 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); |
OLD | NEW |