OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 Oobe signin screen implementation. | 6 * @fileoverview Oobe signin screen implementation. |
7 */ | 7 */ |
8 | 8 |
9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { | 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
10 // Gaia loading time after which error message must be displayed and | 10 // Gaia loading time after which error message must be displayed and |
11 // lazy portal check should be fired. | 11 // lazy portal check should be fired. |
12 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; | 12 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; |
13 | 13 |
14 // Maximum Gaia loading time in seconds. | 14 // Maximum Gaia loading time in seconds. |
15 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; | 15 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; |
16 | 16 |
17 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; | 17 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; |
18 | 18 |
19 return { | 19 return { |
20 EXTERNAL_API: [ | 20 EXTERNAL_API: [ |
21 'loadAuthExtension', | 21 'loadAuthExtension', |
22 'updateAuthExtension', | 22 'updateAuthExtension', |
23 'doReload', | 23 'doReload', |
24 'onWebviewError', | 24 'onWebviewError', |
25 'onFrameError', | 25 'onFrameError', |
26 'updateCancelButtonState' | 26 'updateCancelButtonState', |
| 27 'showWhitelistCheckFailedError' |
27 ], | 28 ], |
28 | 29 |
29 /** | 30 /** |
30 * Frame loading error code (0 - no error). | 31 * Frame loading error code (0 - no error). |
31 * @type {number} | 32 * @type {number} |
32 * @private | 33 * @private |
33 */ | 34 */ |
34 error_: 0, | 35 error_: 0, |
35 | 36 |
36 /** | 37 /** |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 // no other screen to show. If user is in middle of a saml flow, | 744 // no other screen to show. If user is in middle of a saml flow, |
744 // reset signin screen to get out of the saml flow. | 745 // reset signin screen to get out of the saml flow. |
745 if (this.isSAML()) | 746 if (this.isSAML()) |
746 Oobe.resetSigninUI(true); | 747 Oobe.resetSigninUI(true); |
747 | 748 |
748 return; | 749 return; |
749 } | 750 } |
750 | 751 |
751 $('pod-row').loadLastWallpaper(); | 752 $('pod-row').loadLastWallpaper(); |
752 Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER}); | 753 Oobe.showScreen({id: SCREEN_ACCOUNT_PICKER}); |
| 754 this.classList.remove('whitelist-error'); |
753 Oobe.resetSigninUI(true); | 755 Oobe.resetSigninUI(true); |
754 }, | 756 }, |
755 | 757 |
756 /** | 758 /** |
757 * Handler for iframe's error notification coming from the outside. | 759 * Handler for iframe's error notification coming from the outside. |
758 * For more info see C++ class 'WebUILoginView' which calls this method. | 760 * For more info see C++ class 'WebUILoginView' which calls this method. |
759 * @param {number} error Error code. | 761 * @param {number} error Error code. |
760 * @param {string} url The URL that failed to load. | 762 * @param {string} url The URL that failed to load. |
761 */ | 763 */ |
762 onFrameError: function(error, url) { | 764 onFrameError: function(error, url) { |
763 this.error_ = error; | 765 this.error_ = error; |
764 chrome.send('frameLoadingCompleted', [this.error_]); | 766 chrome.send('frameLoadingCompleted', [this.error_]); |
765 }, | 767 }, |
766 | 768 |
767 /** | 769 /** |
768 * Handler for webview error handling. | 770 * Handler for webview error handling. |
769 * @param {!Object} data Additional information about error event like: | 771 * @param {!Object} data Additional information about error event like: |
770 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED". | 772 * {string} error Error code such as "ERR_INTERNET_DISCONNECTED". |
771 * {string} url The URL that failed to load. | 773 * {string} url The URL that failed to load. |
772 */ | 774 */ |
773 onWebviewError: function(data) { | 775 onWebviewError: function(data) { |
774 chrome.send('webviewLoadAborted', [data.error]); | 776 chrome.send('webviewLoadAborted', [data.error]); |
775 }, | 777 }, |
| 778 |
| 779 /** |
| 780 * Show/Hide error when user is not in whitelist. When UI is hidden |
| 781 * GAIA is reloaded. |
| 782 * @param {boolean} show Show/hide error UI. |
| 783 * @param {!Object} opt_data Optional additional information. |
| 784 */ |
| 785 showWhitelistCheckFailedError: function(show, opt_data) { |
| 786 if (opt_data) { |
| 787 $('gaia-whitelist-error').enterpriseManaged = |
| 788 opt_data.enterpriseManaged; |
| 789 } |
| 790 |
| 791 this.classList.toggle('whitelist-error', show); |
| 792 this.loading = !show; |
| 793 |
| 794 if (!show) |
| 795 Oobe.showSigninUI(); |
| 796 }, |
776 }; | 797 }; |
777 }); | 798 }); |
OLD | NEW |