OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Display manager for WebUI OOBE and login. | 6 * @fileoverview Display manager for WebUI OOBE and login. |
7 */ | 7 */ |
8 | 8 |
9 // TODO(xiyuan): Find a better to share those constants. | 9 // TODO(xiyuan): Find a better to share those constants. |
10 /** @const */ var SCREEN_OOBE_NETWORK = 'connect'; | 10 /** @const */ var SCREEN_OOBE_NETWORK = 'connect'; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 * @type {boolean} | 171 * @type {boolean} |
172 */ | 172 */ |
173 forceKeyboardFlow_: false, | 173 forceKeyboardFlow_: false, |
174 | 174 |
175 /** | 175 /** |
176 * Type of UI. | 176 * Type of UI. |
177 * @type {string} | 177 * @type {string} |
178 */ | 178 */ |
179 displayType_: DISPLAY_TYPE.UNKNOWN, | 179 displayType_: DISPLAY_TYPE.UNKNOWN, |
180 | 180 |
181 /** | |
182 * Error message (bubble) was shown. This is checked in tests. | |
183 */ | |
184 errorMessageWasShownForTesting_: false, | |
185 | |
186 get displayType() { | 181 get displayType() { |
187 return this.displayType_; | 182 return this.displayType_; |
188 }, | 183 }, |
189 | 184 |
190 set displayType(displayType) { | 185 set displayType(displayType) { |
191 this.displayType_ = displayType; | 186 this.displayType_ = displayType; |
192 document.documentElement.setAttribute('screen', displayType); | 187 document.documentElement.setAttribute('screen', displayType); |
193 }, | 188 }, |
194 | 189 |
195 get newKioskUI() { | 190 get newKioskUI() { |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 helpLink.href = '#'; | 869 helpLink.href = '#'; |
875 helpLink.textContent = link; | 870 helpLink.textContent = link; |
876 helpLink.addEventListener('click', function(e) { | 871 helpLink.addEventListener('click', function(e) { |
877 chrome.send('launchHelpApp', [helpId]); | 872 chrome.send('launchHelpApp', [helpId]); |
878 e.preventDefault(); | 873 e.preventDefault(); |
879 }); | 874 }); |
880 error.appendChild(helpLink); | 875 error.appendChild(helpLink); |
881 } | 876 } |
882 | 877 |
883 var currentScreen = Oobe.getInstance().currentScreen; | 878 var currentScreen = Oobe.getInstance().currentScreen; |
884 if (currentScreen && typeof currentScreen.showErrorBubble === 'function') { | 879 if (currentScreen && typeof currentScreen.showErrorBubble === 'function') |
885 currentScreen.showErrorBubble(loginAttempts, error); | 880 currentScreen.showErrorBubble(loginAttempts, error); |
886 this.errorMessageWasShownForTesting_ = true; | |
887 } | |
888 }; | 881 }; |
889 | 882 |
890 /** | 883 /** |
891 * Shows password changed screen that offers migration. | 884 * Shows password changed screen that offers migration. |
892 * @param {boolean} showError Whether to show the incorrect password error. | 885 * @param {boolean} showError Whether to show the incorrect password error. |
893 */ | 886 */ |
894 DisplayManager.showPasswordChangedScreen = function(showError) { | 887 DisplayManager.showPasswordChangedScreen = function(showError) { |
895 login.PasswordChangedScreen.show(showError); | 888 login.PasswordChangedScreen.show(showError); |
896 }; | 889 }; |
897 | 890 |
898 /** | 891 /** |
899 * Shows dialog to create managed user. | 892 * Shows dialog to create managed user. |
900 */ | 893 */ |
901 DisplayManager.showManagedUserCreationScreen = function() { | 894 DisplayManager.showManagedUserCreationScreen = function() { |
902 login.ManagedUserCreationScreen.show(); | 895 login.ManagedUserCreationScreen.show(); |
903 }; | 896 }; |
904 | 897 |
905 /** | 898 /** |
906 * Shows TPM error screen. | 899 * Shows TPM error screen. |
907 */ | 900 */ |
908 DisplayManager.showTpmError = function() { | 901 DisplayManager.showTpmError = function() { |
909 login.TPMErrorMessageScreen.show(); | 902 login.TPMErrorMessageScreen.show(); |
910 }; | 903 }; |
911 | 904 |
912 /** | 905 /** |
913 * Clears error bubble. | 906 * Clears error bubble. |
914 */ | 907 */ |
915 DisplayManager.clearErrors = function() { | 908 DisplayManager.clearErrors = function() { |
916 $('bubble').hide(); | 909 $('bubble').hide(); |
917 this.errorMessageWasShownForTesting_ = false; | |
918 }; | 910 }; |
919 | 911 |
920 /** | 912 /** |
921 * Sets text content for a div with |labelId|. | 913 * Sets text content for a div with |labelId|. |
922 * @param {string} labelId Id of the label div. | 914 * @param {string} labelId Id of the label div. |
923 * @param {string} labelText Text for the label. | 915 * @param {string} labelText Text for the label. |
924 */ | 916 */ |
925 DisplayManager.setLabelText = function(labelId, labelText) { | 917 DisplayManager.setLabelText = function(labelId, labelText) { |
926 $(labelId).textContent = labelText; | 918 $(labelId).textContent = labelText; |
927 }; | 919 }; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 */ | 953 */ |
962 DisplayManager.refocusCurrentPod = function() { | 954 DisplayManager.refocusCurrentPod = function() { |
963 $('pod-row').refocusCurrentPod(); | 955 $('pod-row').refocusCurrentPod(); |
964 }; | 956 }; |
965 | 957 |
966 // Export | 958 // Export |
967 return { | 959 return { |
968 DisplayManager: DisplayManager | 960 DisplayManager: DisplayManager |
969 }; | 961 }; |
970 }); | 962 }); |
OLD | NEW |