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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 $('oobe').className = nextStepId; | 149 $('oobe').className = nextStepId; |
150 }, | 150 }, |
151 | 151 |
152 /** | 152 /** |
153 * Show screen of given screen id. | 153 * Show screen of given screen id. |
154 * @param {Object} screen Screen params dict, | 154 * @param {Object} screen Screen params dict, |
155 * e.g. {id: screenId, data: data} | 155 * e.g. {id: screenId, data: data} |
156 */ | 156 */ |
157 showScreen: function(screen) { | 157 showScreen: function(screen) { |
158 var screenId = screen.id; | 158 var screenId = screen.id; |
| 159 |
| 160 // Show sign-in screen instead of account picker if pod row is empty. |
| 161 if (screenId == SCREEN_ACCOUNT_PICKER && $('pod-row').pods.length == 0) { |
| 162 Oobe.showSigninUI(); |
| 163 return; |
| 164 } |
| 165 |
159 var data = screen.data; | 166 var data = screen.data; |
160 var index = this.getScreenIndex_(screenId); | 167 var index = this.getScreenIndex_(screenId); |
161 if (index >= 0) | 168 if (index >= 0) |
162 this.toggleStep_(index, data); | 169 this.toggleStep_(index, data); |
163 $('offline-message').update(); | 170 $('offline-message').update(); |
164 }, | 171 }, |
165 | 172 |
166 /** | 173 /** |
167 * Gets index of given screen id in screens_. | 174 * Gets index of given screen id in screens_. |
168 * @param {string} screenId Id of the screen to look up. | 175 * @param {string} screenId Id of the screen to look up. |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 return !document.body.classList.contains('login-display'); | 448 return !document.body.classList.contains('login-display'); |
442 }; | 449 }; |
443 | 450 |
444 /** | 451 /** |
445 * Shows signin UI. | 452 * Shows signin UI. |
446 * @param {string} opt_email An optional email for signin UI. | 453 * @param {string} opt_email An optional email for signin UI. |
447 */ | 454 */ |
448 Oobe.showSigninUI = function(opt_email) { | 455 Oobe.showSigninUI = function(opt_email) { |
449 $('add-user-button').hidden = true; | 456 $('add-user-button').hidden = true; |
450 $('cancel-add-user-button').hidden = false; | 457 $('cancel-add-user-button').hidden = false; |
| 458 $('add-user-header-bar-item').hidden = $('pod-row').pods.length == 0; |
451 chrome.send('showAddUser', [opt_email]); | 459 chrome.send('showAddUser', [opt_email]); |
452 }; | 460 }; |
453 | 461 |
454 /** | 462 /** |
455 * Resets sign-in input fields. | 463 * Resets sign-in input fields. |
456 */ | 464 */ |
457 Oobe.resetSigninUI = function() { | 465 Oobe.resetSigninUI = function() { |
458 var currentScreenId = Oobe.getInstance().currentScreen.id; | 466 var currentScreenId = Oobe.getInstance().currentScreen.id; |
459 | 467 |
460 if (localStrings.getString('authType') == 'webui') | 468 if (localStrings.getString('authType') == 'webui') |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 document.onselectstart = function(e) { | 574 document.onselectstart = function(e) { |
567 e.preventDefault(); | 575 e.preventDefault(); |
568 } | 576 } |
569 | 577 |
570 // Disable dragging. | 578 // Disable dragging. |
571 document.ondragstart = function(e) { | 579 document.ondragstart = function(e) { |
572 e.preventDefault(); | 580 e.preventDefault(); |
573 } | 581 } |
574 | 582 |
575 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); | 583 document.addEventListener('DOMContentLoaded', cr.ui.Oobe.initialize); |
OLD | NEW |