| 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 cr.define('oobe', function() { | 5 cr.define('oobe', function() { |
| 6 /** | 6 /** |
| 7 * Creates a new oobe screen div. | 7 * Creates a new oobe screen div. |
| 8 * @constructor | 8 * @constructor |
| 9 * @extends {HTMLDivElement} | 9 * @extends {HTMLDivElement} |
| 10 */ | 10 */ |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 /** | 78 /** |
| 79 * Dialog to confirm that auto-enrollment should really be cancelled. | 79 * Dialog to confirm that auto-enrollment should really be cancelled. |
| 80 * This is only created the first time it's used. | 80 * This is only created the first time it's used. |
| 81 */ | 81 */ |
| 82 confirmDialog_: null, | 82 confirmDialog_: null, |
| 83 | 83 |
| 84 /** @inheritDoc */ | 84 /** @inheritDoc */ |
| 85 decorate: function() { | 85 decorate: function() { |
| 86 $('oauth-enroll-error-retry').addEventListener('click', | 86 $('oauth-enroll-error-retry').addEventListener('click', |
| 87 this.doRetry_.bind(this)); | 87 this.doRetry_.bind(this)); |
| 88 $('oauth-enroll-cancel-auto-link').addEventListener( | |
| 89 'click', | |
| 90 this.confirmCancelAutoEnrollment_.bind(this)); | |
| 91 var links = document.querySelectorAll('.oauth-enroll-explain-link'); | 88 var links = document.querySelectorAll('.oauth-enroll-explain-link'); |
| 92 for (var i = 0; i < links.length; i++) { | 89 for (var i = 0; i < links.length; i++) { |
| 93 links[i].addEventListener('click', this.showStep.bind(this, 'explain')); | 90 links[i].addEventListener('click', this.showStep.bind(this, 'explain')); |
| 94 } | 91 } |
| 95 }, | 92 }, |
| 96 | 93 |
| 97 /** | 94 /** |
| 98 * Header text of the screen. | 95 * Header text of the screen. |
| 99 * @type {string} | 96 * @type {string} |
| 100 */ | 97 */ |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 /** | 242 /** |
| 246 * Sets a progressing message and switches to the working screen. | 243 * Sets a progressing message and switches to the working screen. |
| 247 * @param {string} message the progress message. | 244 * @param {string} message the progress message. |
| 248 */ | 245 */ |
| 249 showWorking: function(message) { | 246 showWorking: function(message) { |
| 250 $('oauth-enroll-working-message').textContent = message; | 247 $('oauth-enroll-working-message').textContent = message; |
| 251 this.showStep('working'); | 248 this.showStep('working'); |
| 252 }, | 249 }, |
| 253 | 250 |
| 254 /** | 251 /** |
| 255 * Retries the enrollment process after an error occurred in a previous | |
| 256 * attempt. This goes to the C++ side through |chrome| first to clean up the | |
| 257 * profile, so that the next attempt is performed with a clean state. | |
| 258 */ | |
| 259 doRetry_: function() { | |
| 260 chrome.send('oauthEnrollRetry'); | |
| 261 }, | |
| 262 | |
| 263 /** | |
| 264 * Handler for cancellations of an enforced auto-enrollment. | 252 * Handler for cancellations of an enforced auto-enrollment. |
| 265 */ | 253 */ |
| 266 confirmCancelAutoEnrollment_: function() { | 254 cancelAutoEnrollment: function() { |
| 267 if (!this.confirmDialog_) { | 255 if (!this.confirmDialog_) { |
| 268 this.confirmDialog_ = new cr.ui.dialogs.ConfirmDialog(document.body); | 256 this.confirmDialog_ = new cr.ui.dialogs.ConfirmDialog(document.body); |
| 269 this.confirmDialog_.setOkLabel( | 257 this.confirmDialog_.setOkLabel( |
| 270 localStrings.getString('oauthEnrollCancelAutoEnrollmentConfirm')); | 258 localStrings.getString('oauthEnrollCancelAutoEnrollmentConfirm')); |
| 271 this.confirmDialog_.setCancelLabel( | 259 this.confirmDialog_.setCancelLabel( |
| 272 localStrings.getString('oauthEnrollCancelAutoEnrollmentGoBack')); | 260 localStrings.getString('oauthEnrollCancelAutoEnrollmentGoBack')); |
| 273 this.confirmDialog_.setInitialFocusOnCancel(); | 261 this.confirmDialog_.setInitialFocusOnCancel(); |
| 274 } | 262 } |
| 275 this.confirmDialog_.show( | 263 this.confirmDialog_.show( |
| 276 localStrings.getString('oauthEnrollCancelAutoEnrollmentReally'), | 264 localStrings.getString('oauthEnrollCancelAutoEnrollmentReally'), |
| 277 this.onConfirmCancelAutoEnrollment_.bind(this)); | 265 this.onConfirmCancelAutoEnrollment_.bind(this)); |
| 278 }, | 266 }, |
| 279 | 267 |
| 280 /** | 268 /** |
| 269 * Retries the enrollment process after an error occurred in a previous |
| 270 * attempt. This goes to the C++ side through |chrome| first to clean up the |
| 271 * profile, so that the next attempt is performed with a clean state. |
| 272 */ |
| 273 doRetry_: function() { |
| 274 chrome.send('oauthEnrollRetry'); |
| 275 }, |
| 276 |
| 277 /** |
| 281 * Handler for confirmation of cancellation of auto-enrollment. | 278 * Handler for confirmation of cancellation of auto-enrollment. |
| 282 */ | 279 */ |
| 283 onConfirmCancelAutoEnrollment_: function() { | 280 onConfirmCancelAutoEnrollment_: function() { |
| 284 chrome.send('oauthEnrollClose', ['autocancel']); | 281 chrome.send('oauthEnrollClose', ['autocancel']); |
| 285 }, | 282 }, |
| 286 | 283 |
| 287 /** | 284 /** |
| 288 * Checks if a given HTML5 message comes from the URL loaded into the signin | 285 * Checks if a given HTML5 message comes from the URL loaded into the signin |
| 289 * frame. | 286 * frame. |
| 290 * @param {Object} m HTML5 message. | 287 * @param {Object} m HTML5 message. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 304 var msg = m.data; | 301 var msg = m.data; |
| 305 if (msg.method == 'completeLogin' && this.isSigninMessage_(m)) | 302 if (msg.method == 'completeLogin' && this.isSigninMessage_(m)) |
| 306 chrome.send('oauthEnrollCompleteLogin', [msg.email, msg.password]); | 303 chrome.send('oauthEnrollCompleteLogin', [msg.email, msg.password]); |
| 307 } | 304 } |
| 308 }; | 305 }; |
| 309 | 306 |
| 310 return { | 307 return { |
| 311 OAuthEnrollmentScreen: OAuthEnrollmentScreen | 308 OAuthEnrollmentScreen: OAuthEnrollmentScreen |
| 312 }; | 309 }; |
| 313 }); | 310 }); |
| OLD | NEW |