| 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 login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { | 5 login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| 6 /** @const */ var STEP_SIGNIN = 'signin'; | 6 /** @const */ var STEP_SIGNIN = 'signin'; |
| 7 /** @const */ var STEP_WORKING = 'working'; | 7 /** @const */ var STEP_WORKING = 'working'; |
| 8 /** @const */ var STEP_ERROR = 'error'; | 8 /** @const */ var STEP_ERROR = 'error'; |
| 9 /** @const */ var STEP_EXPLAIN = 'explain'; | 9 /** @const */ var STEP_EXPLAIN = 'explain'; |
| 10 /** @const */ var STEP_SUCCESS = 'success'; | 10 /** @const */ var STEP_SUCCESS = 'success'; |
| 11 | 11 |
| 12 /** @const */ var HELP_TOPIC_ENROLLMENT = 4631259; | 12 /** @const */ var HELP_TOPIC_ENROLLMENT = 4631259; |
| 13 | 13 |
| 14 return { | 14 return { |
| 15 EXTERNAL_API: [ | 15 EXTERNAL_API: [ |
| 16 'showStep', | 16 'showStep', |
| 17 'showError', | 17 'showError', |
| 18 'showWorking', | 18 'showWorking', |
| 19 'setAuthenticatedUserEmail', | 19 'setAuthenticatedUserEmail', |
| 20 'doReload', |
| 20 ], | 21 ], |
| 21 | 22 |
| 22 /** | 23 /** |
| 23 * URL to load in the sign in frame. | 24 * URL to load in the sign in frame. |
| 24 */ | 25 */ |
| 25 signInUrl_: null, | 26 signInUrl_: null, |
| 26 | 27 |
| 27 /** | 28 /** |
| 28 * Dialog to confirm that auto-enrollment should really be cancelled. | 29 * Dialog to confirm that auto-enrollment should really be cancelled. |
| 29 * This is only created the first time it's used. | 30 * This is only created the first time it's used. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 setAuthenticatedUserEmail: function(attemptToken, email) { | 217 setAuthenticatedUserEmail: function(attemptToken, email) { |
| 217 if (this.attemptToken_ != attemptToken) | 218 if (this.attemptToken_ != attemptToken) |
| 218 return; | 219 return; |
| 219 | 220 |
| 220 if (!email) | 221 if (!email) |
| 221 this.showError(loadTimeData.getString('fatalEnrollmentError'), false); | 222 this.showError(loadTimeData.getString('fatalEnrollmentError'), false); |
| 222 else | 223 else |
| 223 chrome.send('oauthEnrollCompleteLogin', [email]); | 224 chrome.send('oauthEnrollCompleteLogin', [email]); |
| 224 }, | 225 }, |
| 225 | 226 |
| 227 doReload: function() { |
| 228 $('oauth-enroll-signin-frame').contentWindow.location.href = |
| 229 this.signInUrl_; |
| 230 }, |
| 231 |
| 226 /** | 232 /** |
| 227 * Handler for cancellations of an enforced auto-enrollment. | 233 * Handler for cancellations of an enforced auto-enrollment. |
| 228 */ | 234 */ |
| 229 cancelAutoEnrollment: function() { | 235 cancelAutoEnrollment: function() { |
| 230 // Only to be activated for the explain step in auto-enrollment. | 236 // Only to be activated for the explain step in auto-enrollment. |
| 231 if (this.currentStep_ !== STEP_EXPLAIN) | 237 if (this.currentStep_ !== STEP_EXPLAIN) |
| 232 return; | 238 return; |
| 233 | 239 |
| 234 if (!this.confirmDialog_) { | 240 if (!this.confirmDialog_) { |
| 235 this.confirmDialog_ = new cr.ui.dialogs.ConfirmDialog(document.body); | 241 this.confirmDialog_ = new cr.ui.dialogs.ConfirmDialog(document.body); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 [msg.attemptToken]); | 303 [msg.attemptToken]); |
| 298 } | 304 } |
| 299 | 305 |
| 300 if (msg.method == 'authPageLoaded' && this.currentStep_ == STEP_SIGNIN) { | 306 if (msg.method == 'authPageLoaded' && this.currentStep_ == STEP_SIGNIN) { |
| 301 if (msg.isSAML) { | 307 if (msg.isSAML) { |
| 302 $('oauth-saml-notice-message').textContent = loadTimeData.getStringF( | 308 $('oauth-saml-notice-message').textContent = loadTimeData.getStringF( |
| 303 'samlNotice', | 309 'samlNotice', |
| 304 msg.domain); | 310 msg.domain); |
| 305 } | 311 } |
| 306 this.classList.toggle('saml', msg.isSAML); | 312 this.classList.toggle('saml', msg.isSAML); |
| 313 chrome.send('frameLoadingCompleted', [0]); |
| 307 } | 314 } |
| 308 | 315 |
| 309 if (msg.method == 'insecureContentBlocked') { | 316 if (msg.method == 'insecureContentBlocked') { |
| 310 this.showError( | 317 this.showError( |
| 311 loadTimeData.getStringF('insecureURLEnrollmentError', msg.url), | 318 loadTimeData.getStringF('insecureURLEnrollmentError', msg.url), |
| 312 false); | 319 false); |
| 313 } | 320 } |
| 314 } | 321 } |
| 315 }; | 322 }; |
| 316 }); | 323 }); |
| 317 | 324 |
| OLD | NEW |