Index: chrome/browser/resources/chromeos/login/screen_locally_managed_user_creation.js |
diff --git a/chrome/browser/resources/chromeos/login/screen_locally_managed_user_creation.js b/chrome/browser/resources/chromeos/login/screen_locally_managed_user_creation.js |
index 5fd61df5d7fe11f68d5a2b26bc77d48c473b8a0b..eab470ffb9b906d5e19c3ca44c9ff9439c408a8a 100644 |
--- a/chrome/browser/resources/chromeos/login/screen_locally_managed_user_creation.js |
+++ b/chrome/browser/resources/chromeos/login/screen_locally_managed_user_creation.js |
@@ -546,10 +546,7 @@ login.createScreen('LocallyManagedUserCreationScreen', |
// Toggle 'animation' class for the duration of WebKit transition. |
this.getScreenElement('flip-photo').addEventListener( |
- 'click', function(e) { |
- previewElement.classList.add('animation'); |
- imageGrid.flipPhoto = !imageGrid.flipPhoto; |
- }); |
+ 'click', this.handleFlipPhoto_.bind(this)); |
this.getScreenElement('image-stream-crop').addEventListener( |
'webkitTransitionEnd', function(e) { |
previewElement.classList.remove('animation'); |
@@ -1446,10 +1443,24 @@ login.createScreen('LocallyManagedUserCreationScreen', |
}, |
/** |
+ * Handle camera-photo flip. |
+ */ |
+ handleFlipPhoto_: function() { |
+ var imageGrid = this.getScreenElement('image-grid'); |
+ imageGrid.previewElement.classList.add('animation'); |
+ imageGrid.flipPhoto = !imageGrid.flipPhoto; |
+ var flipMessageId = imageGrid.flipPhoto ? |
+ 'photoFlippedAccessibleText' : 'photoFlippedBackAccessibleText'; |
+ this.announceAccessibleMessage_( |
+ loadTimeData.getString(flipMessageId)); |
+ }, |
+ |
+ /** |
* Handle photo capture from the live camera stream. |
*/ |
handleTakePhoto_: function(e) { |
this.getScreenElement('image-grid').takePhoto(); |
+ chrome.send('takePhoto'); |
}, |
handlePhotoTaken_: function(e) { |
@@ -1470,8 +1481,28 @@ login.createScreen('LocallyManagedUserCreationScreen', |
handleDiscardPhoto_: function(e) { |
var imageGrid = this.getScreenElement('image-grid'); |
imageGrid.discardPhoto(); |
+ chrome.send('discardPhoto'); |
}, |
+ /** |
+ * Add an accessible message to the page that will be announced to |
+ * users who have spoken feedback on, but will be invisible to all |
+ * other users. It's removed right away so it doesn't clutter the DOM. |
+ */ |
+ announceAccessibleMessage_: function(msg) { |
+ var element = document.createElement('div'); |
+ element.setAttribute('aria-live', 'polite'); |
+ element.style.position = 'relative'; |
+ element.style.left = '-9999px'; |
+ element.style.height = '0px'; |
+ element.innerText = msg; |
+ document.body.appendChild(element); |
+ window.setTimeout(function() { |
+ document.body.removeChild(element); |
+ }, 0); |
+ }, |
+ |
+ |
setCameraPresent: function(present) { |
this.getScreenElement('image-grid').cameraPresent = present; |
}, |