| 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 <include src="../../gaia_auth_host/gaia_auth_host.js"> | |
| 10 | |
| 11 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { | 9 login.createScreen('GaiaSigninScreen', 'gaia-signin', function() { |
| 12 // Gaia loading time after which error message must be displayed and | 10 // Gaia loading time after which error message must be displayed and |
| 13 // lazy portal check should be fired. | 11 // lazy portal check should be fired. |
| 14 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; | 12 /** @const */ var GAIA_LOADING_PORTAL_SUSSPECT_TIME_SEC = 7; |
| 15 | 13 |
| 16 // Maximum Gaia loading time in seconds. | 14 // Maximum Gaia loading time in seconds. |
| 17 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; | 15 /** @const */ var MAX_GAIA_LOADING_TIME_SEC = 60; |
| 18 | 16 |
| 19 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; | 17 /** @const */ var HELP_TOPIC_ENTERPRISE_REPORTING = 2535613; |
| 20 | 18 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 * @private | 80 * @private |
| 83 */ | 81 */ |
| 84 isShowUsers_: undefined, | 82 isShowUsers_: undefined, |
| 85 | 83 |
| 86 /** | 84 /** |
| 87 * SAML password confirmation attempt count. | 85 * SAML password confirmation attempt count. |
| 88 * @type {number} | 86 * @type {number} |
| 89 */ | 87 */ |
| 90 samlPasswordConfirmAttempt_: 0, | 88 samlPasswordConfirmAttempt_: 0, |
| 91 | 89 |
| 90 /** |
| 91 * Whether we should show webview based signin. |
| 92 * @type {boolean} |
| 93 * @private |
| 94 */ |
| 95 isWebviewSignin: false, |
| 96 |
| 92 /** @override */ | 97 /** @override */ |
| 93 decorate: function() { | 98 decorate: function() { |
| 94 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); | 99 this.isWebviewSignin = loadTimeData.getValue('isWebviewSignin'); |
| 100 if (this.isWebviewSignin) { |
| 101 /** |
| 102 * A listener class for authentication events from GaiaAuthHost. |
| 103 * @constructor |
| 104 * @implements {cr.login.GaiaAuthHost.Listener} |
| 105 */ |
| 106 function GaiaAuthHostListener(gaia_screen) { |
| 107 this.gaia_screen_ = gaia_screen; |
| 108 } |
| 109 |
| 110 /** @override */ |
| 111 GaiaAuthHostListener.prototype.onSuccess = function(credentials) { |
| 112 this.gaia_screen_.onAuthCompleted_(credentials); |
| 113 }; |
| 114 |
| 115 /** @override */ |
| 116 GaiaAuthHostListener.prototype.onReady = function(e) { |
| 117 this.gaia_screen_.onAuthReady_(); |
| 118 }; |
| 119 |
| 120 // Replace iframe with webview. |
| 121 var webview = this.ownerDocument.createElement('webview'); |
| 122 webview.id = 'signin-frame'; |
| 123 webview.name = 'signin-frame'; |
| 124 // TODO(dpolukhin): webview doesn't load page in hidden state, |
| 125 // use curtain instead. |
| 126 $('signin-frame').parentNode.replaceChild(webview, $('signin-frame')); |
| 127 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost( |
| 128 webview, new GaiaAuthHostListener(this)); |
| 129 } else { |
| 130 this.gaiaAuthHost_ = new cr.login.GaiaAuthHost($('signin-frame')); |
| 131 } |
| 95 this.gaiaAuthHost_.addEventListener( | 132 this.gaiaAuthHost_.addEventListener( |
| 96 'ready', this.onAuthReady_.bind(this)); | 133 'ready', this.onAuthReady_.bind(this)); |
| 97 this.gaiaAuthHost_.confirmPasswordCallback = | 134 this.gaiaAuthHost_.confirmPasswordCallback = |
| 98 this.onAuthConfirmPassword_.bind(this); | 135 this.onAuthConfirmPassword_.bind(this); |
| 99 this.gaiaAuthHost_.noPasswordCallback = | 136 this.gaiaAuthHost_.noPasswordCallback = |
| 100 this.onAuthNoPassword_.bind(this); | 137 this.onAuthNoPassword_.bind(this); |
| 101 this.gaiaAuthHost_.insecureContentBlockedCallback = | 138 this.gaiaAuthHost_.insecureContentBlockedCallback = |
| 102 this.onInsecureContentBlocked_.bind(this); | 139 this.onInsecureContentBlocked_.bind(this); |
| 103 this.gaiaAuthHost_.missingGaiaInfoCallback = | 140 this.gaiaAuthHost_.missingGaiaInfoCallback = |
| 104 this.missingGaiaInfo_.bind(this); | 141 this.missingGaiaInfo_.bind(this); |
| 105 this.gaiaAuthHost_.samlApiUsedCallback = | 142 this.gaiaAuthHost_.samlApiUsedCallback = |
| 106 this.samlApiUsed_.bind(this); | 143 this.samlApiUsed_.bind(this); |
| 107 this.gaiaAuthHost_.addEventListener('authFlowChange', | 144 this.gaiaAuthHost_.addEventListener('authFlowChange', |
| 108 this.onAuthFlowChange_.bind(this)); | 145 this.onAuthFlowChange_.bind(this)); |
| 109 | 146 |
| 110 $('enterprise-info-hint-link').addEventListener('click', function(e) { | 147 $('enterprise-info-hint-link').addEventListener('click', function(e) { |
| 111 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); | 148 chrome.send('launchHelpApp', [HELP_TOPIC_ENTERPRISE_REPORTING]); |
| 112 e.preventDefault(); | 149 e.preventDefault(); |
| 113 }); | 150 }); |
| 114 | 151 |
| 115 | |
| 116 this.updateLocalizedContent(); | 152 this.updateLocalizedContent(); |
| 117 }, | 153 }, |
| 118 | 154 |
| 119 /** | 155 /** |
| 120 * Header text of the screen. | 156 * Header text of the screen. |
| 121 * @type {string} | 157 * @type {string} |
| 122 */ | 158 */ |
| 123 get header() { | 159 get header() { |
| 124 return loadTimeData.getString('signinScreenTitle'); | 160 return loadTimeData.getString('signinScreenTitle'); |
| 125 }, | 161 }, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 141 chrome.send('updateOfflineLogin', [value]); | 177 chrome.send('updateOfflineLogin', [value]); |
| 142 }, | 178 }, |
| 143 | 179 |
| 144 /** | 180 /** |
| 145 * Shows/hides loading UI. | 181 * Shows/hides loading UI. |
| 146 * @param {boolean} show True to show loading UI. | 182 * @param {boolean} show True to show loading UI. |
| 147 * @private | 183 * @private |
| 148 */ | 184 */ |
| 149 showLoadingUI_: function(show) { | 185 showLoadingUI_: function(show) { |
| 150 $('gaia-loading').hidden = !show; | 186 $('gaia-loading').hidden = !show; |
| 151 this.gaiaAuthHost_.frame.hidden = show; | 187 if (!this.isWebviewSignin) { |
| 188 // TODO(dpolukhin): proper implement curtain for webview signin. |
| 189 this.gaiaAuthHost_.frame.hidden = show; |
| 190 } |
| 152 $('signin-right').hidden = show; | 191 $('signin-right').hidden = show; |
| 153 $('enterprise-info-container').hidden = show; | 192 $('enterprise-info-container').hidden = show; |
| 154 $('gaia-signin-divider').hidden = show; | 193 $('gaia-signin-divider').hidden = show; |
| 155 }, | 194 }, |
| 156 | 195 |
| 157 /** | 196 /** |
| 158 * Handler for Gaia loading suspiciously long timeout. | 197 * Handler for Gaia loading suspiciously long timeout. |
| 159 * @private | 198 * @private |
| 160 */ | 199 */ |
| 161 onLoadingSuspiciouslyLong_: function() { | 200 onLoadingSuspiciouslyLong_: function() { |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 * For more info see C++ class 'WebUILoginView' which calls this method. | 679 * For more info see C++ class 'WebUILoginView' which calls this method. |
| 641 * @param {number} error Error code. | 680 * @param {number} error Error code. |
| 642 * @param {string} url The URL that failed to load. | 681 * @param {string} url The URL that failed to load. |
| 643 */ | 682 */ |
| 644 onFrameError: function(error, url) { | 683 onFrameError: function(error, url) { |
| 645 this.error_ = error; | 684 this.error_ = error; |
| 646 chrome.send('frameLoadingCompleted', [this.error_]); | 685 chrome.send('frameLoadingCompleted', [this.error_]); |
| 647 }, | 686 }, |
| 648 }; | 687 }; |
| 649 }); | 688 }); |
| OLD | NEW |