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 595f4b46326b954d61275007926a49bf8cc8559d..aca7761c2e1c0e4d30ccb1a18190fd503bd456a6 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', |
], |
/** |
@@ -145,6 +147,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; |
}, |
@@ -168,10 +179,23 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
this.doReload(); |
this.learnMoreHelpTopicID_ = data.learn_more_help_topic_id; |
this.updateLocalizedContent(); |
+ |
Andrew T Wilson (Slow)
2015/03/12 17:07:17
nit:remove blank line
Polina Bondarenko
2015/03/13 12:56:01
Done.
|
this.showStep(STEP_SIGNIN); |
}, |
/** |
+ * 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() { |
@@ -181,16 +205,39 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
chrome.send('oauthEnrollClose', ['cancel']); |
}, |
+ isNamingError: function(step) { |
+ return this.currentStep_ == STEP_NAMING && step == STEP_ERROR; |
+ }, |
+ |
+ hideCancel: function(hide) { |
Andrew T Wilson (Slow)
2015/03/12 17:07:17
nit: name this hideCancelShowDone() for clarity?
Polina Bondarenko
2015/03/13 12:56:01
Done.
|
+ $('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); |
+ |
+ if (this.isNamingError(step)) { |
Andrew T Wilson (Slow)
2015/03/12 17:07:17
Explain what you are doing here in a comment?
Polina Bondarenko
2015/03/13 12:56:01
Done.
|
+ focusStep = STEP_SUCCESS; |
+ this.hideCancel(true); |
+ } else { |
+ if (step == STEP_ERROR) |
+ this.hideCancel(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(); |