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

Unified Diff: chrome/browser/resources/chromeos/login/oobe_screen_user_image.js

Issue 7792036: [cros] User image selection with keyboard arrows works. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/login/oobe_screen_user_image.js
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js b/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js
index bf52557127b8f103ac3ac87f487a744827ca1e47..aad9f7053964f6cbd9f61930480e524c3d7a0633 100644
--- a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js
+++ b/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js
@@ -125,10 +125,20 @@ cr.define('oobe', function() {
userImageList.addEventListener('keydown', function(e) {
var prevIndex = userImageScreen.selectedUserImage_;
var len = userImageList.children.length;
+ var nextIndex;
if (e.keyCode == 39 || e.keyCode == 40) // right or down
- UserImageScreen.selectUserImage((prevIndex + 1) % len);
+ nextIndex = (prevIndex + 1) % len;
else if (e.keyCode == 37 || e.keyCode == 38) // left or up
- UserImageScreen.selectUserImage((prevIndex - 1 + len) % len);
+ nextIndex = (prevIndex - 1 + len) % len;
+ else if (e.keyCode == 13 && prevIndex == 0)
+ // Enter pressed while "Take photo" button active.
+ chrome.send('takePhoto');
+ if (nextIndex == 0)
+ // "Take photo" button: don't send a selection event to Chrome,
+ // just focus element and update selected index.
+ UserImageScreen.selectUserImage(0);
+ else if (nextIndex)
+ chrome.send('selectImage', [userImageList.children[nextIndex].src]);
e.stopPropagation();
});
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698