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 $('inner-container').classList.add('new-gaia-flow'); | 181 $('inner-container').classList.add('new-gaia-flow'); |
181 var gaiaParams = {}; | 182 var gaiaParams = {}; |
182 gaiaParams.gaiaUrl = data.gaiaUrl; | 183 gaiaParams.gaiaUrl = data.gaiaUrl; |
183 gaiaParams.gaiaPath = 'embedded/setup/chromeos'; | 184 gaiaParams.gaiaPath = 'embedded/setup/chromeos'; |
184 gaiaParams.isNewGaiaFlowChromeOS = true; | 185 gaiaParams.isNewGaiaFlowChromeOS = true; |
185 gaiaParams.needPassword = false; | 186 gaiaParams.needPassword = false; |
186 if (data.management_domain) { | 187 if (data.management_domain) { |
187 gaiaParams.enterpriseDomain = data.management_domain; | 188 gaiaParams.enterpriseDomain = data.management_domain; |
188 gaiaParams.emailDomain = data.management_domain; | 189 gaiaParams.emailDomain = data.management_domain; |
189 } | 190 } |
190 gaiaParams.flow = 'enterprise'; | 191 gaiaParams.flow = 'enterprise'; |
191 this.authenticator_.load(cr.login.Authenticator.AuthMode.DEFAULT, | 192 this.authenticator_.load(cr.login.Authenticator.AuthMode.DEFAULT, |
192 gaiaParams); | 193 gaiaParams); |
193 | 194 |
194 var modes = ['manual', 'forced', 'recovery']; | 195 var modes = ['manual', 'forced', 'recovery']; |
195 for (var i = 0; i < modes.length; ++i) { | 196 for (var i = 0; i < modes.length; ++i) { |
196 this.classList.toggle('mode-' + modes[i], | 197 this.classList.toggle('mode-' + modes[i], |
197 data.enrollment_mode == modes[i]); | 198 data.enrollment_mode == modes[i]); |
198 } | 199 } |
199 this.isCancelDisabled = true; | 200 this.isCancelDisabled = true; |
200 this.showStep(STEP_SIGNIN); | 201 this.showStep(STEP_SIGNIN); |
201 }, | 202 }, |
202 | 203 |
| 204 onBeforeHide: function() { |
| 205 $('login-header-bar').signinUIState = SIGNIN_UI_STATE.HIDDEN; |
| 206 }, |
| 207 |
203 /** | 208 /** |
204 * Shows attribute-prompt step with pre-filled asset ID and | 209 * Shows attribute-prompt step with pre-filled asset ID and |
205 * location. | 210 * location. |
206 */ | 211 */ |
207 showAttributePromptStep: function(annotated_asset_id, annotated_location) { | 212 showAttributePromptStep: function(annotated_asset_id, annotated_location) { |
208 $('oauth-enroll-asset-id').value = annotated_asset_id; | 213 $('oauth-enroll-asset-id').value = annotated_asset_id; |
209 $('oauth-enroll-location').value = annotated_location; | 214 $('oauth-enroll-location').value = annotated_location; |
210 $('oauth-enroll-back-button').hidden = true; | 215 $('oauth-enroll-back-button').hidden = true; |
211 | 216 |
212 this.showStep(STEP_ATTRIBUTE_PROMPT); | 217 this.showStep(STEP_ATTRIBUTE_PROMPT); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 * Uploads the device attributes to server. This goes to C++ side through | 290 * Uploads the device attributes to server. This goes to C++ side through |
286 * |chrome| and launches the device attribute update negotiation. | 291 * |chrome| and launches the device attribute update negotiation. |
287 */ | 292 */ |
288 onAttributesSubmitted: function() { | 293 onAttributesSubmitted: function() { |
289 chrome.send('oauthEnrollAttributes', | 294 chrome.send('oauthEnrollAttributes', |
290 [$('oauth-enroll-asset-id').value, | 295 [$('oauth-enroll-asset-id').value, |
291 $('oauth-enroll-location').value]); | 296 $('oauth-enroll-location').value]); |
292 } | 297 } |
293 }; | 298 }; |
294 }); | 299 }); |
OLD | NEW |