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

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

Issue 158953002: Spoken feedback sounds for user photo capture/discard at image picker added. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PlaySystemSound... functions introduced according to latest changes. Created 6 years, 9 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 Locally managed user creation flow screen. 6 * @fileoverview Locally managed user creation flow screen.
7 */ 7 */
8 8
9 login.createScreen('LocallyManagedUserCreationScreen', 9 login.createScreen('LocallyManagedUserCreationScreen',
10 'managed-user-creation', function() { 10 'managed-user-creation', function() {
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 loadTimeData.getString('takePhoto'), 539 loadTimeData.getString('takePhoto'),
540 loadTimeData.getString('photoFromCamera')); 540 loadTimeData.getString('photoFromCamera'));
541 541
542 this.getScreenElement('take-photo').addEventListener( 542 this.getScreenElement('take-photo').addEventListener(
543 'click', this.handleTakePhoto_.bind(this)); 543 'click', this.handleTakePhoto_.bind(this));
544 this.getScreenElement('discard-photo').addEventListener( 544 this.getScreenElement('discard-photo').addEventListener(
545 'click', this.handleDiscardPhoto_.bind(this)); 545 'click', this.handleDiscardPhoto_.bind(this));
546 546
547 // Toggle 'animation' class for the duration of WebKit transition. 547 // Toggle 'animation' class for the duration of WebKit transition.
548 this.getScreenElement('flip-photo').addEventListener( 548 this.getScreenElement('flip-photo').addEventListener(
549 'click', function(e) { 549 'click', this.handleFlipPhoto_.bind(this));
550 previewElement.classList.add('animation');
551 imageGrid.flipPhoto = !imageGrid.flipPhoto;
552 });
553 this.getScreenElement('image-stream-crop').addEventListener( 550 this.getScreenElement('image-stream-crop').addEventListener(
554 'webkitTransitionEnd', function(e) { 551 'webkitTransitionEnd', function(e) {
555 previewElement.classList.remove('animation'); 552 previewElement.classList.remove('animation');
556 }); 553 });
557 this.getScreenElement('image-preview-img').addEventListener( 554 this.getScreenElement('image-preview-img').addEventListener(
558 'webkitTransitionEnd', function(e) { 555 'webkitTransitionEnd', function(e) {
559 previewElement.classList.remove('animation'); 556 previewElement.classList.remove('animation');
560 }); 557 });
561 }, 558 },
562 559
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 }); 1436 });
1440 } else { 1437 } else {
1441 $('managed-user-creation-image-preview-img').classList.toggle( 1438 $('managed-user-creation-image-preview-img').classList.toggle(
1442 'animated-transform', false); 1439 'animated-transform', false);
1443 imageGrid.stopCamera(); 1440 imageGrid.stopCamera();
1444 } 1441 }
1445 } 1442 }
1446 }, 1443 },
1447 1444
1448 /** 1445 /**
1446 * Handle camera-photo flip.
1447 */
1448 handleFlipPhoto_: function() {
1449 var imageGrid = this.getScreenElement('image-grid');
1450 imageGrid.previewElement.classList.add('animation');
1451 imageGrid.flipPhoto = !imageGrid.flipPhoto;
1452 var flipMessageId = imageGrid.flipPhoto ?
1453 'photoFlippedAccessibleText' : 'photoFlippedBackAccessibleText';
1454 this.announceAccessibleMessage_(
1455 loadTimeData.getString(flipMessageId));
1456 },
1457
1458 /**
1449 * Handle photo capture from the live camera stream. 1459 * Handle photo capture from the live camera stream.
1450 */ 1460 */
1451 handleTakePhoto_: function(e) { 1461 handleTakePhoto_: function(e) {
1452 this.getScreenElement('image-grid').takePhoto(); 1462 this.getScreenElement('image-grid').takePhoto();
1463 chrome.send('takePhoto');
1453 }, 1464 },
1454 1465
1455 handlePhotoTaken_: function(e) { 1466 handlePhotoTaken_: function(e) {
1456 chrome.send('supervisedUserPhotoTaken', [e.dataURL]); 1467 chrome.send('supervisedUserPhotoTaken', [e.dataURL]);
1457 }, 1468 },
1458 1469
1459 /** 1470 /**
1460 * Handle photo updated event. 1471 * Handle photo updated event.
1461 * @param {Event} e Event with 'dataURL' property containing a data URL. 1472 * @param {Event} e Event with 'dataURL' property containing a data URL.
1462 */ 1473 */
1463 handlePhotoUpdated_: function(e) { 1474 handlePhotoUpdated_: function(e) {
1464 chrome.send('supervisedUserPhotoTaken', [e.dataURL]); 1475 chrome.send('supervisedUserPhotoTaken', [e.dataURL]);
1465 }, 1476 },
1466 1477
1467 /** 1478 /**
1468 * Handle discarding the captured photo. 1479 * Handle discarding the captured photo.
1469 */ 1480 */
1470 handleDiscardPhoto_: function(e) { 1481 handleDiscardPhoto_: function(e) {
1471 var imageGrid = this.getScreenElement('image-grid'); 1482 var imageGrid = this.getScreenElement('image-grid');
1472 imageGrid.discardPhoto(); 1483 imageGrid.discardPhoto();
1484 chrome.send('discardPhoto');
1473 }, 1485 },
1474 1486
1487 /**
1488 * Add an accessible message to the page that will be announced to
1489 * users who have spoken feedback on, but will be invisible to all
1490 * other users. It's removed right away so it doesn't clutter the DOM.
1491 */
1492 announceAccessibleMessage_: function(msg) {
1493 var element = document.createElement('div');
1494 element.setAttribute('aria-live', 'polite');
1495 element.style.position = 'relative';
1496 element.style.left = '-9999px';
1497 element.style.height = '0px';
1498 element.innerText = msg;
1499 document.body.appendChild(element);
1500 window.setTimeout(function() {
1501 document.body.removeChild(element);
1502 }, 0);
1503 },
1504
1505
1475 setCameraPresent: function(present) { 1506 setCameraPresent: function(present) {
1476 this.getScreenElement('image-grid').cameraPresent = present; 1507 this.getScreenElement('image-grid').cameraPresent = present;
1477 }, 1508 },
1478 1509
1479 setExistingManagedUsers: function(users) { 1510 setExistingManagedUsers: function(users) {
1480 var userList = users; 1511 var userList = users;
1481 1512
1482 userList.sort(function(a, b) { 1513 userList.sort(function(a, b) {
1483 // Put existing users last. 1514 // Put existing users last.
1484 if (a.exists != b.exists) 1515 if (a.exists != b.exists)
1485 return a.exists ? 1 : -1; 1516 return a.exists ? 1 : -1;
1486 // Sort rest by name. 1517 // Sort rest by name.
1487 return a.name.localeCompare(b.name, [], {sensitivity: 'base'}); 1518 return a.name.localeCompare(b.name, [], {sensitivity: 'base'});
1488 }); 1519 });
1489 1520
1490 this.importList_.clearPods(); 1521 this.importList_.clearPods();
1491 for (var i = 0; i < userList.length; ++i) 1522 for (var i = 0; i < userList.length; ++i)
1492 this.importList_.addPod(userList[i]); 1523 this.importList_.addPod(userList[i]);
1493 1524
1494 if (userList.length == 1) 1525 if (userList.length == 1)
1495 this.importList_.selectPod(this.managerList_.pods[0]); 1526 this.importList_.selectPod(this.managerList_.pods[0]);
1496 1527
1497 if (userList.length > 0 && this.currentPage_ == 'username') 1528 if (userList.length > 0 && this.currentPage_ == 'username')
1498 this.getScreenElement('import-link').hidden = false; 1529 this.getScreenElement('import-link').hidden = false;
1499 }, 1530 },
1500 }; 1531 };
1501 }); 1532 });
1502 1533
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698