| Index: chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
|
| diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
|
| index 6a0cc9601b76fd63b81231fdde1c1bf884d6524c..066b97c7c29ca2360d6fb2991705577b8ae197cc 100644
|
| --- a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
|
| +++ b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment.js
|
| @@ -5,6 +5,7 @@
|
| login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
|
| /** @const */ var STEP_SIGNIN = 'signin';
|
| /** @const */ var STEP_WORKING = 'working';
|
| + /** @const */ var STEP_NAMING = 'naming';
|
| /** @const */ var STEP_ERROR = 'error';
|
| /** @const */ var STEP_SUCCESS = 'success';
|
|
|
| @@ -15,6 +16,7 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
|
| 'showStep',
|
| 'showError',
|
| 'doReload',
|
| + 'onBeforeShowNaming',
|
| ],
|
|
|
| /**
|
| @@ -133,6 +135,15 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
|
| chrome.send('oauthEnrollClose', ['done']);
|
| });
|
|
|
| + makeButton(
|
| + 'oauth-enroll-continue-button',
|
| + ['oauth-enroll-focus-on-naming'],
|
| + loadTimeData.getString('oauthEnrollContinue'),
|
| + function() {
|
| + chrome.send('oauthEnrollNaming', [$('oauth-enroll-asset-id').value,
|
| + $('oauth-enroll-location').value]);
|
| + });
|
| +
|
| return buttons;
|
| },
|
|
|
| @@ -160,6 +171,18 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
|
| },
|
|
|
| /**
|
| + * Invoked just before the device naming step showing,
|
| + * init pre-filled naming fields.
|
| + */
|
| + onBeforeShowNaming: function(data) {
|
| + $('oauth-enroll-naming-message').innerHTML =
|
| + loadTimeData.getString('oauthEnrollNaming');
|
| +
|
| + $('oauth-enroll-asset-id').value = data.device_asset_id;
|
| + $('oauth-enroll-location').value = data.device_location;
|
| + },
|
| +
|
| + /**
|
| * Cancels enrollment and drops the user back to the login screen.
|
| */
|
| cancel: function() {
|
| @@ -169,16 +192,44 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() {
|
| chrome.send('oauthEnrollClose', ['cancel']);
|
| },
|
|
|
| + isNamingError: function(step) {
|
| + return this.currentStep_ == STEP_NAMING && step == STEP_ERROR;
|
| + },
|
| +
|
| + hideCancelShowDone: function(hide) {
|
| + $('oauth-enroll-cancel-button').hidden = hide;
|
| + $('oauth-enroll-cancel-button').disabled = hide;
|
| +
|
| + $('oauth-enroll-done-button').hidden = !hide;
|
| + $('oauth-enroll-done-button').disabled = !hide;
|
| + },
|
| +
|
| /**
|
| * Switches between the different steps in the enrollment flow.
|
| * @param {string} step the steps to show, one of "signin", "working",
|
| - * "error", "success".
|
| + * "naming", "error", "success".
|
| */
|
| showStep: function(step) {
|
| + var focusStep = step;
|
| +
|
| this.classList.toggle('oauth-enroll-state-' + this.currentStep_, false);
|
| this.classList.toggle('oauth-enroll-state-' + step, true);
|
| +
|
| + /**
|
| + * In case of device naming error done button should be shown
|
| + * instead of cancel button and focus on success,
|
| + * because enrollment has completed
|
| + */
|
| + if (this.isNamingError(step)) {
|
| + focusStep = STEP_SUCCESS;
|
| + this.hideCancelShowDone(true);
|
| + } else {
|
| + if (step == STEP_ERROR)
|
| + this.hideCancelShowDone(false);
|
| + }
|
| +
|
| var focusElements =
|
| - this.querySelectorAll('.oauth-enroll-focus-on-' + step);
|
| + this.querySelectorAll('.oauth-enroll-focus-on-' + focusStep);
|
| for (var i = 0; i < focusElements.length; ++i) {
|
| if (getComputedStyle(focusElements[i])['display'] != 'none') {
|
| focusElements[i].focus();
|
|
|