Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1099)

Side by Side Diff: chrome/browser/resources/chromeos/login/login_shared.js

Issue 1767443002: Add enterprise enrollment support for fake users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Check instance before derefing it Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 /** 5 /**
6 * @fileoverview Common OOBE controller methods. This method is shared between 6 * @fileoverview Common OOBE controller methods. This method is shared between
7 * OOBE, login, and the lock screen. Add only methods that need to be shared 7 * OOBE, login, and the lock screen. Add only methods that need to be shared
8 * between all *three* screens here, as each additional method increases the 8 * between all *three* screens here, as each additional method increases the
9 * time it takes to show the lock screen. 9 * time it takes to show the lock screen.
10 * 10 *
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 * @param {boolean} show True if version label should be visible. 84 * @param {boolean} show True if version label should be visible.
85 */ 85 */
86 Oobe.showVersion = function(show) { 86 Oobe.showVersion = function(show) {
87 Oobe.getInstance().showVersion(show); 87 Oobe.getInstance().showVersion(show);
88 }; 88 };
89 89
90 /** 90 /**
91 * Update body class to switch between OOBE UI and Login UI. 91 * Update body class to switch between OOBE UI and Login UI.
92 */ 92 */
93 Oobe.showOobeUI = function(showOobe) { 93 Oobe.showOobeUI = function(showOobe) {
94 console.log('Oobe.showOobeUI(' + showOobe + ')');
95 if (showOobe) { 94 if (showOobe) {
96 document.body.classList.add('oobe-display'); 95 document.body.classList.add('oobe-display');
97 96
98 // Callback to animate the header bar in. 97 // Callback to animate the header bar in.
99 var showHeaderBar = function() { 98 var showHeaderBar = function() {
100 login.HeaderBar.animateIn(false, function() { 99 login.HeaderBar.animateIn(false, function() {
101 chrome.send('headerBarVisible'); 100 chrome.send('headerBarVisible');
102 }); 101 });
103 }; 102 };
104 // Start asynchronously so the OOBE network screen comes in first. 103 // Start asynchronously so the OOBE network screen comes in first.
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 */ 278 */
280 Oobe.skipToLoginForTesting = function() { 279 Oobe.skipToLoginForTesting = function() {
281 Oobe.disableSigninUI(); 280 Oobe.disableSigninUI();
282 chrome.send('skipToLoginForTesting'); 281 chrome.send('skipToLoginForTesting');
283 }; 282 };
284 283
285 /** 284 /**
286 * Login for telemetry. 285 * Login for telemetry.
287 * @param {string} username Login username. 286 * @param {string} username Login username.
288 * @param {string} password Login password. 287 * @param {string} password Login password.
288 * @param {boolean} enterpriseEnroll Login as an enterprise enrollment?
289 */ 289 */
290 Oobe.loginForTesting = function(username, password, gaia_id) { 290 Oobe.loginForTesting = function(username, password, gaia_id,
291 enterpriseEnroll = false) {
292 // Helper method that runs |fn| after |screenName| is visible.
293 function waitForOobeScreen(screenName, fn) {
294 if (Oobe.getInstance().currentScreen &&
295 Oobe.getInstance().currentScreen.id === screenName) {
296 fn();
297 } else {
298 $('oobe').addEventListener('screenchanged', function handler(e) {
299 if (e.detail == screenName) {
300 $('oobe').removeEventListener('screenchanged', handler);
301 fn();
302 }
303 });
304 }
305 }
306
291 Oobe.disableSigninUI(); 307 Oobe.disableSigninUI();
292 chrome.send('skipToLoginForTesting', [username]); 308 chrome.send('skipToLoginForTesting', [username]);
293 chrome.send('completeLogin', [gaia_id, username, password, false]); 309
310 if (!enterpriseEnroll) {
311 chrome.send('completeLogin', [gaia_id, username, password, false]);
312 } else {
313 waitForOobeScreen('gaia-signin', function() {
314 chrome.send('toggleEnrollmentScreen');
315 chrome.send('toggleFakeEnrollment');
316 });
317
318 waitForOobeScreen('oauth-enrollment', function() {
319 chrome.send('oauthEnrollCompleteLogin', [username, 'authcode']);
320 chrome.send('completeLogin', [gaia_id, username, password, false]);
321 });
322 }
294 }; 323 };
295 324
296 /** 325 /**
297 * Guest login for telemetry. 326 * Guest login for telemetry.
298 */ 327 */
299 Oobe.guestLoginForTesting = function() { 328 Oobe.guestLoginForTesting = function() {
300 Oobe.skipToLoginForTesting(); 329 Oobe.skipToLoginForTesting();
301 chrome.send('launchIncognito'); 330 chrome.send('launchIncognito');
302 }; 331 };
303 332
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 423
395 424
396 (function() { 425 (function() {
397 'use strict'; 426 'use strict';
398 427
399 document.addEventListener('DOMContentLoaded', function() { 428 document.addEventListener('DOMContentLoaded', function() {
400 Oobe.initialize(); 429 Oobe.initialize();
401 }); 430 });
402 })(); 431 })();
403 432
OLDNEW
« no previous file with comments | « chrome/browser/policy/test/policy_testserver.py ('k') | chrome/browser/ui/webui/chromeos/login/enrollment_screen_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698