| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Legacy supervised user creation flow screen. | 6 * @fileoverview Legacy supervised user creation flow screen. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 login.createScreen('SupervisedUserCreationScreen', | 9 login.createScreen('SupervisedUserCreationScreen', |
| 10 'supervised-user-creation', function() { | 10 'supervised-user-creation', function() { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 screen.configureTextInput( | 46 screen.configureTextInput( |
| 47 this.passwordElement, | 47 this.passwordElement, |
| 48 screen.updateNextButtonForManager_.bind(screen), | 48 screen.updateNextButtonForManager_.bind(screen), |
| 49 screen.validIfNotEmpty_.bind(screen), | 49 screen.validIfNotEmpty_.bind(screen), |
| 50 function(element) { | 50 function(element) { |
| 51 screen.getScreenButton('next').focus(); | 51 screen.getScreenButton('next').focus(); |
| 52 }, | 52 }, |
| 53 hideManagerPasswordError); | 53 hideManagerPasswordError); |
| 54 | 54 |
| 55 this.passwordElement.addEventListener('keydown', function(e) { | 55 this.passwordElement.addEventListener('keydown', function(e) { |
| 56 switch (e.keyIdentifier) { | 56 switch (e.key) { |
| 57 case 'Up': | 57 case 'ArrowUp': |
| 58 managerPodList.selectNextPod(-1); | 58 managerPodList.selectNextPod(-1); |
| 59 e.stopPropagation(); | 59 e.stopPropagation(); |
| 60 break; | 60 break; |
| 61 case 'Down': | 61 case 'ArrowDown': |
| 62 managerPodList.selectNextPod(+1); | 62 managerPodList.selectNextPod(+1); |
| 63 e.stopPropagation(); | 63 e.stopPropagation(); |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 }); | 66 }); |
| 67 }, | 67 }, |
| 68 | 68 |
| 69 /** | 69 /** |
| 70 * Updates UI elements from user data. | 70 * Updates UI elements from user data. |
| 71 */ | 71 */ |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 var screen = $('supervised-user-creation'); | 338 var screen = $('supervised-user-creation'); |
| 339 | 339 |
| 340 this.addEventListener('focus', function(e) { | 340 this.addEventListener('focus', function(e) { |
| 341 if (importList.selectedPod_ == null) { | 341 if (importList.selectedPod_ == null) { |
| 342 if (importList.pods.length > 0) | 342 if (importList.pods.length > 0) |
| 343 importList.selectPod(importList.pods[0]); | 343 importList.selectPod(importList.pods[0]); |
| 344 } | 344 } |
| 345 }); | 345 }); |
| 346 | 346 |
| 347 this.addEventListener('keydown', function(e) { | 347 this.addEventListener('keydown', function(e) { |
| 348 switch (e.keyIdentifier) { | 348 switch (e.key) { |
| 349 case 'Up': | 349 case 'ArrowUp': |
| 350 importList.selectNextPod(-1); | 350 importList.selectNextPod(-1); |
| 351 e.stopPropagation(); | 351 e.stopPropagation(); |
| 352 break; | 352 break; |
| 353 case 'Enter': | 353 case 'Enter': |
| 354 if (importList.selectedPod_ != null) | 354 if (importList.selectedPod_ != null) |
| 355 screen.importSupervisedUser_(); | 355 screen.importSupervisedUser_(); |
| 356 e.stopPropagation(); | 356 e.stopPropagation(); |
| 357 break; | 357 break; |
| 358 case 'Down': | 358 case 'ArrowDown': |
| 359 importList.selectNextPod(+1); | 359 importList.selectNextPod(+1); |
| 360 e.stopPropagation(); | 360 e.stopPropagation(); |
| 361 break; | 361 break; |
| 362 } | 362 } |
| 363 }); | 363 }); |
| 364 }, | 364 }, |
| 365 | 365 |
| 366 /** | 366 /** |
| 367 * Returns all the pods in this pod list. | 367 * Returns all the pods in this pod list. |
| 368 * @type {NodeList} | 368 * @type {NodeList} |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 * element and move focus to it. | 675 * element and move focus to it. |
| 676 * @param {function(element)} errorHider - function that is called upon | 676 * @param {function(element)} errorHider - function that is called upon |
| 677 * every button press, so that any associated error can be hidden. | 677 * every button press, so that any associated error can be hidden. |
| 678 */ | 678 */ |
| 679 configureTextInput: function(element, | 679 configureTextInput: function(element, |
| 680 inputChangeListener, | 680 inputChangeListener, |
| 681 validator, | 681 validator, |
| 682 moveFocus, | 682 moveFocus, |
| 683 errorHider) { | 683 errorHider) { |
| 684 element.addEventListener('keydown', function(e) { | 684 element.addEventListener('keydown', function(e) { |
| 685 if (e.keyIdentifier == 'Enter') { | 685 if (e.key == 'Enter') { |
| 686 var dataValid = true; | 686 var dataValid = true; |
| 687 if (validator) | 687 if (validator) |
| 688 dataValid = validator(element); | 688 dataValid = validator(element); |
| 689 if (!dataValid) { | 689 if (!dataValid) { |
| 690 element.focus(); | 690 element.focus(); |
| 691 } else { | 691 } else { |
| 692 if (moveFocus) | 692 if (moveFocus) |
| 693 moveFocus(element); | 693 moveFocus(element); |
| 694 } | 694 } |
| 695 e.stopPropagation(); | 695 e.stopPropagation(); |
| (...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 | 1582 |
| 1583 if (selectedIndex >= 0) | 1583 if (selectedIndex >= 0) |
| 1584 this.importList_.selectPod(this.importList_.pods[selectedIndex]); | 1584 this.importList_.selectPod(this.importList_.pods[selectedIndex]); |
| 1585 | 1585 |
| 1586 if (this.currentPage_ == 'username') | 1586 if (this.currentPage_ == 'username') |
| 1587 this.getScreenElement('import-link').hidden = (userList.length == 0); | 1587 this.getScreenElement('import-link').hidden = (userList.length == 0); |
| 1588 }, | 1588 }, |
| 1589 }; | 1589 }; |
| 1590 }); | 1590 }); |
| 1591 | 1591 |
| OLD | NEW |