| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 Locally managed user creation flow screen. | 6 * @fileoverview Locally managed user creation flow screen. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 cr.define('login', function() { | 9 cr.define('login', function() { |
| 10 | 10 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 Oobe.getInstance().registerScreen(screen); | 204 Oobe.getInstance().registerScreen(screen); |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 LocallyManagedUserCreationScreen.prototype = { | 207 LocallyManagedUserCreationScreen.prototype = { |
| 208 __proto__: HTMLDivElement.prototype, | 208 __proto__: HTMLDivElement.prototype, |
| 209 | 209 |
| 210 lastVerifiedName_: null, | 210 lastVerifiedName_: null, |
| 211 lastIncorrectUserName_: null, | 211 lastIncorrectUserName_: null, |
| 212 managerList_: null, | 212 managerList_: null, |
| 213 | 213 |
| 214 currentPage_: null, |
| 215 |
| 214 /** @override */ | 216 /** @override */ |
| 215 decorate: function() { | 217 decorate: function() { |
| 216 this.managerList_ = new ManagerPodList(); | 218 this.managerList_ = new ManagerPodList(); |
| 217 $('managed-user-creation-flow-managers-pane'). | 219 $('managed-user-creation-flow-managers-pane'). |
| 218 appendChild(this.managerList_); | 220 appendChild(this.managerList_); |
| 219 | 221 |
| 220 var userNameField = $('managed-user-creation-flow-name'); | 222 var userNameField = $('managed-user-creation-flow-name'); |
| 221 var passwordField = $('managed-user-creation-flow-password'); | 223 var passwordField = $('managed-user-creation-flow-password'); |
| 222 var password2Field = $('managed-user-creation-flow-password-confirm'); | 224 var password2Field = $('managed-user-creation-flow-password-confirm'); |
| 223 | 225 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 }); | 317 }); |
| 316 proceedButton.addEventListener('click', function(e) { | 318 proceedButton.addEventListener('click', function(e) { |
| 317 creationFlowScreen.proceedFlow_(); | 319 creationFlowScreen.proceedFlow_(); |
| 318 e.stopPropagation(); | 320 e.stopPropagation(); |
| 319 }); | 321 }); |
| 320 retryButton.addEventListener('click', function(e) { | 322 retryButton.addEventListener('click', function(e) { |
| 321 creationFlowScreen.retryFlow_(); | 323 creationFlowScreen.retryFlow_(); |
| 322 e.stopPropagation(); | 324 e.stopPropagation(); |
| 323 }); | 325 }); |
| 324 cancelButton.addEventListener('click', function(e) { | 326 cancelButton.addEventListener('click', function(e) { |
| 325 creationFlowScreen.abortFlow_(); | 327 creationFlowScreen.cancel(); |
| 326 e.stopPropagation(); | 328 e.stopPropagation(); |
| 327 }); | 329 }); |
| 328 | 330 |
| 329 return buttons; | 331 return buttons; |
| 330 }, | 332 }, |
| 331 | 333 |
| 332 /** | 334 /** |
| 333 * Does sanity check and calls backend with current user name/password pair | 335 * Does sanity check and calls backend with current user name/password pair |
| 334 * to create a user. May result in showPasswordError. | 336 * to create a user. May result in showPasswordError. |
| 335 * @private | 337 * @private |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 * 'error', 'success') | 519 * 'error', 'success') |
| 518 * @private | 520 * @private |
| 519 */ | 521 */ |
| 520 setVisiblePage_: function(visiblePage) { | 522 setVisiblePage_: function(visiblePage) { |
| 521 var screenNames = ['initial', 'progress', 'error', 'success']; | 523 var screenNames = ['initial', 'progress', 'error', 'success']; |
| 522 for (i in screenNames) { | 524 for (i in screenNames) { |
| 523 var screenName = screenNames[i]; | 525 var screenName = screenNames[i]; |
| 524 var screen = $('managed-user-creation-flow-' + screenName); | 526 var screen = $('managed-user-creation-flow-' + screenName); |
| 525 screen.hidden = (screenName != visiblePage); | 527 screen.hidden = (screenName != visiblePage); |
| 526 } | 528 } |
| 529 this.currentPage_ = visiblePage; |
| 527 }, | 530 }, |
| 528 | 531 |
| 529 /** | 532 /** |
| 530 * Enables specific control buttons. | 533 * Enables specific control buttons. |
| 531 * @param {List of strings} buttonsList - list of buttons to display (values | 534 * @param {List of strings} buttonsList - list of buttons to display (values |
| 532 * can be 'retry', 'finish', 'cancel') | 535 * can be 'retry', 'finish', 'cancel') |
| 533 * @private | 536 * @private |
| 534 */ | 537 */ |
| 535 setVisibleButtons_: function(buttonsList) { | 538 setVisibleButtons_: function(buttonsList) { |
| 536 var buttonNames = ['proceed', 'retry', 'finish', 'cancel']; | 539 var buttonNames = ['proceed', 'retry', 'finish', 'cancel']; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 553 | 556 |
| 554 proceedFlow_: function() { | 557 proceedFlow_: function() { |
| 555 this.validateInputAndStartFlow_(); | 558 this.validateInputAndStartFlow_(); |
| 556 }, | 559 }, |
| 557 | 560 |
| 558 retryFlow_: function() { | 561 retryFlow_: function() { |
| 559 this.setVisiblePage_('progress'); | 562 this.setVisiblePage_('progress'); |
| 560 chrome.send('retryLocalManagedUserCreation'); | 563 chrome.send('retryLocalManagedUserCreation'); |
| 561 }, | 564 }, |
| 562 | 565 |
| 563 abortFlow_: function() { | |
| 564 chrome.send('abortLocalManagedUserCreation'); | |
| 565 }, | |
| 566 | |
| 567 /** | 566 /** |
| 568 * Updates state of login header so that necessary buttons are displayed. | 567 * Updates state of login header so that necessary buttons are displayed. |
| 569 **/ | 568 **/ |
| 570 onBeforeShow: function(data) { | 569 onBeforeShow: function(data) { |
| 571 $('login-header-bar').signinUIState = | 570 $('login-header-bar').signinUIState = |
| 572 SIGNIN_UI_STATE.MANAGED_USER_CREATION_FLOW; | 571 SIGNIN_UI_STATE.MANAGED_USER_CREATION_FLOW; |
| 573 if (data['managers']) { | 572 if (data['managers']) { |
| 574 this.loadManagers(data['managers']); | 573 this.loadManagers(data['managers']); |
| 575 } | 574 } |
| 576 }, | 575 }, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 * @param {Array} userList - list of users that can be managers. | 612 * @param {Array} userList - list of users that can be managers. |
| 614 */ | 613 */ |
| 615 loadManagers: function(userList) { | 614 loadManagers: function(userList) { |
| 616 $('managed-user-creation-flow-managers-block').hidden = false; | 615 $('managed-user-creation-flow-managers-block').hidden = false; |
| 617 this.managerList_.clearPods(); | 616 this.managerList_.clearPods(); |
| 618 for (var i = 0; i < userList.length; ++i) | 617 for (var i = 0; i < userList.length; ++i) |
| 619 this.managerList_.addPod(userList[i]); | 618 this.managerList_.addPod(userList[i]); |
| 620 if (userList.length > 0) | 619 if (userList.length > 0) |
| 621 this.managerList_.selectPod(this.managerList_.pods[0]); | 620 this.managerList_.selectPod(this.managerList_.pods[0]); |
| 622 }, | 621 }, |
| 622 |
| 623 /** |
| 624 * Cancels user creation and drops to user screen (either sign). |
| 625 */ |
| 626 cancel: function() { |
| 627 var notSignedInScreens = ['initial']; |
| 628 if (notSignedInScreens.indexOf(this.currentPage_) >= 0) { |
| 629 // Make sure no manager password is kept: |
| 630 this.managerList_.clearPods(); |
| 631 |
| 632 $('pod-row').loadLastWallpaper(); |
| 633 |
| 634 Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER}); |
| 635 Oobe.resetSigninUI(true); |
| 636 return; |
| 637 } |
| 638 chrome.send('abortLocalManagedUserCreation'); |
| 639 }, |
| 623 }; | 640 }; |
| 624 | 641 |
| 625 LocallyManagedUserCreationScreen.showProgressScreen = function() { | 642 LocallyManagedUserCreationScreen.showProgressScreen = function() { |
| 626 var screen = $('managed-user-creation-flow'); | 643 var screen = $('managed-user-creation-flow'); |
| 627 screen.disabled = false; | 644 screen.disabled = false; |
| 628 screen.setVisiblePage_('progress'); | 645 screen.setVisiblePage_('progress'); |
| 629 screen.setVisibleButtons_(['cancel']); | 646 screen.setVisibleButtons_(['cancel']); |
| 630 }; | 647 }; |
| 631 | 648 |
| 632 LocallyManagedUserCreationScreen.showIntialScreen = function() { | 649 LocallyManagedUserCreationScreen.showIntialScreen = function() { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | 701 |
| 685 LocallyManagedUserCreationScreen.loadManagers = function(userList) { | 702 LocallyManagedUserCreationScreen.loadManagers = function(userList) { |
| 686 var screen = $('managed-user-creation-flow'); | 703 var screen = $('managed-user-creation-flow'); |
| 687 screen.loadManagers(userList); | 704 screen.loadManagers(userList); |
| 688 }; | 705 }; |
| 689 | 706 |
| 690 return { | 707 return { |
| 691 LocallyManagedUserCreationScreen: LocallyManagedUserCreationScreen | 708 LocallyManagedUserCreationScreen: LocallyManagedUserCreationScreen |
| 692 }; | 709 }; |
| 693 }); | 710 }); |
| 694 | |
| OLD | NEW |