Chromium Code Reviews| Index: chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment_webview.js |
| diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment_webview.js b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment_webview.js |
| index 999f3a960220a3170df70dc430d21ccb55aebcad..4a427cf2eb49d737a93fe33bfac55388c5626a16 100644 |
| --- a/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment_webview.js |
| +++ b/chrome/browser/resources/chromeos/login/oobe_screen_oauth_enrollment_webview.js |
| @@ -5,6 +5,7 @@ |
| login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| /** @const */ var STEP_SIGNIN = 'signin'; |
| /** @const */ var STEP_WORKING = 'working'; |
| + /** @const */ var STEP_ATTRIBUTE_PROMPT = 'attribute-prompt'; |
| /** @const */ var STEP_ERROR = 'error'; |
| /** @const */ var STEP_SUCCESS = 'success'; |
| @@ -15,6 +16,7 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| 'showStep', |
| 'showError', |
| 'doReload', |
| + 'showAttributePromptStep', |
| ], |
| /** |
| @@ -147,6 +149,16 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| chrome.send('oauthEnrollClose', ['done']); |
| }); |
| + makeButton( |
| + 'oauth-enroll-continue-button', |
| + ['oauth-enroll-focus-on-attribute-prompt'], |
| + loadTimeData.getString('oauthEnrollContinue'), |
| + function() { |
| + chrome.send('oauthEnrollAttributes', |
| + [$('oauth-enroll-asset-id').value, |
| + $('oauth-enroll-location').value]); |
| + }); |
| + |
| return buttons; |
| }, |
| @@ -179,6 +191,20 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| }, |
| /** |
| + * Shows attribute-prompt step with pre-filled asset ID and |
| + * location. |
| + */ |
| + showAttributePromptStep: function(annotated_asset_id, annotated_location) { |
| + $('oauth-enroll-attribute-prompt-message').innerHTML = |
| + loadTimeData.getString('oauthEnrollAttributes'); |
| + |
| + $('oauth-enroll-asset-id').value = annotated_asset_id; |
| + $('oauth-enroll-location').value = annotated_location; |
| + |
| + this.showStep(STEP_ATTRIBUTE_PROMPT); |
| + }, |
| + |
| + /** |
| * Cancels enrollment and drops the user back to the login screen. |
| */ |
| cancel: function() { |
| @@ -189,13 +215,48 @@ login.createScreen('OAuthEnrollmentScreen', 'oauth-enrollment', function() { |
| }, |
| /** |
| + * Returns whether |step| is the device attribute update error or |
| + * not. |
| + */ |
| + isAttributeUpdateError: function(step) { |
| + return this.currentStep_ == STEP_ATTRIBUTE_PROMPT && step == STEP_ERROR; |
| + }, |
| + |
| + /** |
| + * Shows cancel or done button. |
| + */ |
| + 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". |
| + * "attribute-prompt", "error", "success". |
| */ |
| showStep: function(step) { |
| + var focusSTep = step; |
|
dzhioev (left Google)
2015/04/14 15:48:19
Misprint, should be 'focusStep'.
Anyway, is this v
Polina Bondarenko
2015/04/14 16:14:32
Thanks, it is also a bug. It should be used instea
|
| + |
| this.classList.toggle('oauth-enroll-state-' + this.currentStep_, false); |
| this.classList.toggle('oauth-enroll-state-' + step, true); |
| + |
| + /** |
| + * In case of device attribute update error done button should be shown |
| + * instead of cancel button and focus on success, |
| + * because enrollment has completed |
| + */ |
| + if (this.isAttributeUpdateError(step)) { |
| + focusStep = STEP_SUCCESS; |
| + this.hideCancelShowDone(true); |
| + } else { |
| + if (step == STEP_ERROR) |
| + this.hideCancelShowDone(false); |
| + } |
| + |
| var focusElements = |
| this.querySelectorAll('.oauth-enroll-focus-on-' + step); |
| for (var i = 0; i < focusElements.length; ++i) { |