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 login.createScreen('LocallyManagedUserCreationScreen', | 9 login.createScreen('LocallyManagedUserCreationScreen', |
10 'managed-user-creation', function() { | 10 'managed-user-creation', function() { |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 'next', | 466 'next', |
467 'managedUserCreationFlow', | 467 'managedUserCreationFlow', |
468 this.nextButtonPressed_.bind(this), | 468 this.nextButtonPressed_.bind(this), |
469 ['manager', 'username'], | 469 ['manager', 'username'], |
470 [])); | 470 [])); |
471 | 471 |
472 buttons.push(this.makeButton( | 472 buttons.push(this.makeButton( |
473 'gotit', | 473 'gotit', |
474 'managedUserCreationFlow', | 474 'managedUserCreationFlow', |
475 this.gotItButtonPressed_.bind(this), | 475 this.gotItButtonPressed_.bind(this), |
476 ['created-1'], | 476 ['created'], |
477 ['custom-appearance', 'button-fancy', 'button-blue'])); | 477 ['custom-appearance', 'button-fancy', 'button-blue'])); |
478 return buttons; | 478 return buttons; |
479 }, | 479 }, |
480 | 480 |
481 /** | 481 /** |
482 * Does sanity check and calls backend with current user name/password pair | 482 * Does sanity check and calls backend with current user name/password pair |
483 * to authenticate manager. May result in showManagerPasswordError. | 483 * to authenticate manager. May result in showManagerPasswordError. |
484 * @private | 484 * @private |
485 */ | 485 */ |
486 validateAndLogInAsManager_: function() { | 486 validateAndLogInAsManager_: function() { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 * @param {string} visiblePage - name of subpage. | 666 * @param {string} visiblePage - name of subpage. |
667 * @private | 667 * @private |
668 */ | 668 */ |
669 setVisiblePage_: function(visiblePage) { | 669 setVisiblePage_: function(visiblePage) { |
670 this.disabled = false; | 670 this.disabled = false; |
671 this.updateText_(); | 671 this.updateText_(); |
672 var pageNames = ['intro', | 672 var pageNames = ['intro', |
673 'manager', | 673 'manager', |
674 'username', | 674 'username', |
675 'error', | 675 'error', |
676 'created-1']; | 676 'created']; |
677 var pageButtons = {'intro' : 'start', | 677 var pageButtons = {'intro' : 'start', |
678 'error' : 'error', | 678 'error' : 'error', |
679 'created-1' : 'gotit'}; | 679 'created' : 'gotit'}; |
680 this.hideStatus_(); | 680 this.hideStatus_(); |
681 for (i in pageNames) { | 681 for (i in pageNames) { |
682 var pageName = pageNames[i]; | 682 var pageName = pageNames[i]; |
683 var page = $('managed-user-creation-' + pageName); | 683 var page = $('managed-user-creation-' + pageName); |
684 page.hidden = (pageName != visiblePage); | 684 page.hidden = (pageName != visiblePage); |
685 if (pageName == visiblePage) | 685 if (pageName == visiblePage) |
686 $('step-logo').hidden = page.classList.contains('step-no-logo'); | 686 $('step-logo').hidden = page.classList.contains('step-no-logo'); |
687 } | 687 } |
688 | 688 |
689 for (i in this.buttonIds) { | 689 for (i in this.buttonIds) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 this.managerList_.addPod(userList[i]); | 834 this.managerList_.addPod(userList[i]); |
835 if (userList.length == 1) | 835 if (userList.length == 1) |
836 this.managerList_.selectPod(this.managerList_.pods[0]); | 836 this.managerList_.selectPod(this.managerList_.pods[0]); |
837 }, | 837 }, |
838 | 838 |
839 /** | 839 /** |
840 * Cancels user creation and drops to user screen (either sign). | 840 * Cancels user creation and drops to user screen (either sign). |
841 */ | 841 */ |
842 cancel: function() { | 842 cancel: function() { |
843 var notSignedInPages = ['intro', 'manager']; | 843 var notSignedInPages = ['intro', 'manager']; |
844 var postCreationPages = ['created-1']; | 844 var postCreationPages = ['created']; |
845 if (notSignedInPages.indexOf(this.currentPage_) >= 0) { | 845 if (notSignedInPages.indexOf(this.currentPage_) >= 0) { |
846 // Make sure no manager password is kept: | 846 // Make sure no manager password is kept: |
847 this.managerList_.clearPods(); | 847 this.managerList_.clearPods(); |
848 | 848 |
849 $('pod-row').loadLastWallpaper(); | 849 $('pod-row').loadLastWallpaper(); |
850 | 850 |
851 Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER}); | 851 Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER}); |
852 Oobe.resetSigninUI(true); | 852 Oobe.resetSigninUI(true); |
853 return; | 853 return; |
854 } | 854 } |
855 if (postCreationPages.indexOf(this.currentPage_) >= 0) { | 855 if (postCreationPages.indexOf(this.currentPage_) >= 0) { |
856 chrome.send('finishLocalManagedUserCreation'); | 856 chrome.send('finishLocalManagedUserCreation'); |
857 return; | 857 return; |
858 } | 858 } |
859 chrome.send('abortLocalManagedUserCreation'); | 859 chrome.send('abortLocalManagedUserCreation'); |
860 }, | 860 }, |
861 | 861 |
862 updateText_: function() { | 862 updateText_: function() { |
863 var managerDisplayId = this.context_.managerDisplayId; | 863 var managerDisplayId = this.context_.managerDisplayId; |
864 this.updateElementText_('intro-alternate-text', | 864 this.updateElementText_('intro-alternate-text', |
865 'createManagedUserIntroAlternateText'); | 865 'createManagedUserIntroAlternateText'); |
866 this.updateElementText_('created-1-text-1', | 866 this.updateElementText_('created-text-1', |
867 'createManagedUserCreated1Text1', | 867 'createManagedUserCreatedText1', |
868 this.context_.managedName); | 868 this.context_.managedName); |
869 // TODO(antrim): Move wrapping with strong in grd file, and eliminate this | 869 // TODO(antrim): Move wrapping with strong in grd file, and eliminate this |
870 //call. | 870 //call. |
871 this.updateElementText_('created-1-text-2', | 871 this.updateElementText_('created-text-2', |
872 'createManagedUserCreated1Text2', | 872 'createManagedUserCreatedText2', |
873 this.wrapStrong( | 873 this.wrapStrong( |
874 loadTimeData.getString('managementURL')), | 874 loadTimeData.getString('managementURL')), |
875 this.context_.managedName); | 875 this.context_.managedName); |
876 this.updateElementText_('created-1-text-3', | 876 this.updateElementText_('created-text-3', |
877 'createManagedUserCreated1Text3', | 877 'createManagedUserCreatedText3', |
878 managerDisplayId); | 878 managerDisplayId); |
879 this.updateElementText_('name-explanation', | 879 this.updateElementText_('name-explanation', |
880 'createManagedUserNameExplanation', | 880 'createManagedUserNameExplanation', |
881 managerDisplayId); | 881 managerDisplayId); |
882 }, | 882 }, |
883 | 883 |
884 wrapStrong: function(original) { | 884 wrapStrong: function(original) { |
885 if (original == undefined) | 885 if (original == undefined) |
886 return original; | 886 return original; |
887 return '<strong>' + original + '</strong>'; | 887 return '<strong>' + original + '</strong>'; |
(...skipping 22 matching lines...) Expand all Loading... |
910 | 910 |
911 showManagerPage: function() { | 911 showManagerPage: function() { |
912 this.setVisiblePage_('manager'); | 912 this.setVisiblePage_('manager'); |
913 }, | 913 }, |
914 | 914 |
915 showUsernamePage: function() { | 915 showUsernamePage: function() { |
916 this.setVisiblePage_('username'); | 916 this.setVisiblePage_('username'); |
917 }, | 917 }, |
918 | 918 |
919 showTutorialPage: function() { | 919 showTutorialPage: function() { |
920 this.setVisiblePage_('created-1'); | 920 this.setVisiblePage_('created'); |
921 }, | 921 }, |
922 | 922 |
923 showErrorPage: function(errorTitle, errorText, errorButtonText) { | 923 showErrorPage: function(errorTitle, errorText, errorButtonText) { |
924 this.disabled = false; | 924 this.disabled = false; |
925 $('managed-user-creation-error-title').innerHTML = errorTitle; | 925 $('managed-user-creation-error-title').innerHTML = errorTitle; |
926 $('managed-user-creation-error-text').innerHTML = errorText; | 926 $('managed-user-creation-error-text').innerHTML = errorText; |
927 $('managed-user-creation-error-button').textContent = errorButtonText; | 927 $('managed-user-creation-error-button').textContent = errorButtonText; |
928 this.setVisiblePage_('error'); | 928 this.setVisiblePage_('error'); |
929 }, | 929 }, |
930 | 930 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 var imageGrid = this.getScreenElement('image-grid'); | 1010 var imageGrid = this.getScreenElement('image-grid'); |
1011 imageGrid.discardPhoto(); | 1011 imageGrid.discardPhoto(); |
1012 }, | 1012 }, |
1013 | 1013 |
1014 setCameraPresent: function(present) { | 1014 setCameraPresent: function(present) { |
1015 this.getScreenElement('image-grid').cameraPresent = present; | 1015 this.getScreenElement('image-grid').cameraPresent = present; |
1016 }, | 1016 }, |
1017 }; | 1017 }; |
1018 }); | 1018 }); |
1019 | 1019 |
OLD | NEW |