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

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: 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..44ad3bd9b10ed79ec6bc3e5596632f57b89e4282 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,21 @@ 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) {
whywhat 2011/08/30 12:03:14 nit: be consistent when using {}: I'd use it in bo
Ivan Korotkov 2011/08/30 12:16:40 Done.
+ 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