OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_ATTRIBUTE_PROMPT = 'attribute-prompt'; | 8 /** @const */ var STEP_ATTRIBUTE_PROMPT = 'attribute-prompt'; |
9 /** @const */ var STEP_ERROR = 'error'; | 9 /** @const */ var STEP_ERROR = 'error'; |
10 /** @const */ var STEP_SUCCESS = 'success'; | 10 /** @const */ var STEP_SUCCESS = 'success'; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 170 |
171 return buttons; | 171 return buttons; |
172 }, | 172 }, |
173 | 173 |
174 /** | 174 /** |
175 * Event handler that is invoked just before the frame is shown. | 175 * Event handler that is invoked just before the frame is shown. |
176 * @param {Object} data Screen init payload, contains the signin frame | 176 * @param {Object} data Screen init payload, contains the signin frame |
177 * URL. | 177 * URL. |
178 */ | 178 */ |
179 onBeforeShow: function(data) { | 179 onBeforeShow: function(data) { |
| 180 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.ENROLLMENT; |
180 var gaiaParams = {}; | 181 var gaiaParams = {}; |
181 gaiaParams.gaiaUrl = data.gaiaUrl; | 182 gaiaParams.gaiaUrl = data.gaiaUrl; |
182 gaiaParams.gaiaPath = 'embedded/setup/chromeos'; | 183 gaiaParams.gaiaPath = 'embedded/setup/chromeos'; |
183 gaiaParams.isNewGaiaFlowChromeOS = true; | 184 gaiaParams.isNewGaiaFlowChromeOS = true; |
184 gaiaParams.needPassword = false; | 185 gaiaParams.needPassword = false; |
185 if (data.management_domain) { | 186 if (data.management_domain) { |
186 gaiaParams.enterpriseDomain = data.management_domain; | 187 gaiaParams.enterpriseDomain = data.management_domain; |
187 gaiaParams.emailDomain = data.management_domain; | 188 gaiaParams.emailDomain = data.management_domain; |
188 } | 189 } |
189 gaiaParams.flow = 'enterprise'; | 190 gaiaParams.flow = 'enterprise'; |
190 this.authenticator_.load(cr.login.Authenticator.AuthMode.DEFAULT, | 191 this.authenticator_.load(cr.login.Authenticator.AuthMode.DEFAULT, |
191 gaiaParams); | 192 gaiaParams); |
192 | 193 |
193 var modes = ['manual', 'forced', 'recovery']; | 194 var modes = ['manual', 'forced', 'recovery']; |
194 for (var i = 0; i < modes.length; ++i) { | 195 for (var i = 0; i < modes.length; ++i) { |
195 this.classList.toggle('mode-' + modes[i], | 196 this.classList.toggle('mode-' + modes[i], |
196 data.enrollment_mode == modes[i]); | 197 data.enrollment_mode == modes[i]); |
197 } | 198 } |
198 this.isCancelDisabled = true; | 199 this.isCancelDisabled = true; |
199 this.showStep(STEP_SIGNIN); | 200 this.showStep(STEP_SIGNIN); |
200 }, | 201 }, |
201 | 202 |
| 203 onBeforeHide: function() { |
| 204 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.HIDDEN; |
| 205 }, |
| 206 |
202 /** | 207 /** |
203 * Shows attribute-prompt step with pre-filled asset ID and | 208 * Shows attribute-prompt step with pre-filled asset ID and |
204 * location. | 209 * location. |
205 */ | 210 */ |
206 showAttributePromptStep: function(annotated_asset_id, annotated_location) { | 211 showAttributePromptStep: function(annotated_asset_id, annotated_location) { |
207 $('oauth-enroll-asset-id').value = annotated_asset_id; | 212 $('oauth-enroll-asset-id').value = annotated_asset_id; |
208 $('oauth-enroll-location').value = annotated_location; | 213 $('oauth-enroll-location').value = annotated_location; |
209 $('oauth-enroll-back-button').hidden = true; | 214 $('oauth-enroll-back-button').hidden = true; |
210 | 215 |
211 this.showStep(STEP_ATTRIBUTE_PROMPT); | 216 this.showStep(STEP_ATTRIBUTE_PROMPT); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 * Uploads the device attributes to server. This goes to C++ side through | 289 * Uploads the device attributes to server. This goes to C++ side through |
285 * |chrome| and launches the device attribute update negotiation. | 290 * |chrome| and launches the device attribute update negotiation. |
286 */ | 291 */ |
287 onAttributesSubmitted: function() { | 292 onAttributesSubmitted: function() { |
288 chrome.send('oauthEnrollAttributes', | 293 chrome.send('oauthEnrollAttributes', |
289 [$('oauth-enroll-asset-id').value, | 294 [$('oauth-enroll-asset-id').value, |
290 $('oauth-enroll-location').value]); | 295 $('oauth-enroll-location').value]); |
291 } | 296 } |
292 }; | 297 }; |
293 }); | 298 }); |
OLD | NEW |