this.handleMouseDown_.bind(this));
var screen = $('managed-user-creation');
var managerPod = this;
+ var managerPodList = screen.managerList_;
var hideManagerPasswordError = function(element) {
managerPod.passwordElement.classList.remove('password-error');
$('bubble').hide();
screen.getScreenButton('next').focus();
},
hideManagerPasswordError);
+
+ this.passwordElement.addEventListener('keydown', function(e) {
+ switch (e.keyIdentifier) {
+ case 'Up':
+ managerPodList.selectNextPod(-1);
+ e.stopPropagation();
+ break;
+ case 'Down':
+ managerPodList.selectNextPod(+1);
+ e.stopPropagation();
+ break;
+ }
+ });
},
/**
chrome.send('managerSelectedOnLocallyManagedUserCreationFlow',
[podToSelect.user.username]);
},
+
+ /**
+ * Select pod next to currently selected one in given |direction|.
+ * @param {integer} direction - +1 for selecting pod below current, -1 for
+ * selecting pod above current.
+ * @type {boolean} returns if selected pod has changed.
+ */
+ selectNextPod: function(direction) {
+ if (!this.selectedPod_)
+ return false;
+ var index = -1;
+ for (var i = 0, pod; pod = this.pods[i]; ++i) {
+ if (pod == this.selectedPod_) {
+ index = i;
+ break;
+ }
+ }
+ if (-1 == index)
+ return false;
+ index = index + direction;
+ if (index < 0 || index >= this.pods.length)
+ return false;
+ this.selectPod(this.pods[index]);
+ return true;
+ }
};
var ImportPod = cr.ui.define(function() {
imageGrid.previewElement = previewElement;
imageGrid.selectionType = 'default';
+ imageGrid.flipPhotoElement = this.getScreenElement('flip-photo');
imageGrid.addEventListener('activate',
this.handleActivate_.bind(this));
this.setButtonDisabledStatus('import', !passwordOk);
return passwordOk;
}
+ var imageGrid = this.getScreenElement('image-grid');
+ var imageChosen = !(imageGrid.selectionType == 'camera' &&
+ imageGrid.cameraLive);
var canProceed =
passwordOk &&
(userName.length > 0) &&
- this.lastVerifiedName_ &&
- (userName == this.lastVerifiedName_);
+ this.lastVerifiedName_ &&
+ (userName == this.lastVerifiedName_) &&
+ imageChosen;
this.setButtonDisabledStatus('next', !canProceed);
return canProceed;
var pagesWithCancel = ['intro', 'manager', 'username', 'import-password',
'error', 'import'];
- var cancelButton = $('cancel-add-user-button');
- cancelButton.hidden = pagesWithCancel.indexOf(visiblePage) < 0;
- cancelButton.disabled = false;
+ $('login-header-bar').allowCancel =
+ pagesWithCancel.indexOf(visiblePage) > 0;
+ $('cancel-add-user-button').disabled = false;
this.getScreenElement('import-link').hidden = true;
this.getScreenElement('create-link').hidden = true;
if (visiblePage == 'manager' || visiblePage == 'intro') {
$('managed-user-creation-password').classList.remove('password-error');
- this.managerList_.selectPod(null);
- if (this.managerList_.pods.length == 1)
+ if (this.managerList_.pods.length > 0)
this.managerList_.selectPod(this.managerList_.pods[0]);
}
this.managerList_.clearPods();
for (var i = 0; i < userList.length; ++i)
this.managerList_.addPod(userList[i]);
- if (userList.length == 1)
+ if (userList.length > 0)
this.managerList_.selectPod(this.managerList_.pods[0]);
},
*/
handleSelect_: function(e) {
var imageGrid = this.getScreenElement('image-grid');
- if (!(imageGrid.selectionType == 'camera' && imageGrid.cameraLive)) {
+ this.updateNextButtonForUser_();
+
+ $('managed-user-creation-flip-photo').tabIndex =
+ (imageGrid.selectionType == 'camera') ? 0 : -1;
+ if (imageGrid.cameraLive || imageGrid.selectionType != 'camera')
+ imageGrid.previewElement.classList.remove('phototaken');
+ else
+ imageGrid.previewElement.classList.add('phototaken');
+
+ if (!imageGrid.cameraLive || imageGrid.selectionType != 'camera') {
this.context_.selectedImageUrl = imageGrid.selectedItemUrl;
chrome.send('supervisedUserSelectImage',
[imageGrid.selectedItemUrl, imageGrid.selectionType]);
imageGrid.startCamera(
function() {
// Start capture if camera is still the selected item.
+ $('managed-user-creation-image-preview-img').classList.toggle(
+ 'animated-transform', true);
return imageGrid.selectedItem == imageGrid.cameraImage;
});
} else {
+ $('managed-user-creation-image-preview-img').classList.toggle(
+ 'animated-transform', false);
imageGrid.stopCamera();
}
}