summaryrefslogtreecommitdiff
path: root/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/webui/resources/cr_elements/chromeos/cr_picture')
-rw-r--r--chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.js6
-rw-r--r--chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_list.js16
-rw-r--r--chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_pane.js10
3 files changed, 26 insertions, 6 deletions
diff --git a/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.js b/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.js
index 8aa5711083a..3cf81741476 100644
--- a/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.js
+++ b/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_camera.js
@@ -84,6 +84,12 @@ Polymer({
this.stopCamera();
},
+ /** Only focuses the button if it's not disabled. */
+ focusTakePhotoButton: function() {
+ if (this.cameraOnline_)
+ this.$.takePhoto.focus();
+ },
+
/**
* Performs photo capture from the live camera stream. A 'photo-taken' event
* will be fired as soon as captured photo is available, with the
diff --git a/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_list.js b/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_list.js
index 285e937dbc6..04e3c806486 100644
--- a/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_list.js
+++ b/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_list.js
@@ -230,10 +230,15 @@ Polymer({
this.cameraSelected_ =
selected.dataset.type == CrPicture.SelectionTypes.CAMERA;
this.selectedItem = selected;
- if (activate && selected.dataset.type == CrPicture.SelectionTypes.OLD)
- this.fire('discard-image');
- else if (activate || selected.dataset.type != CrPicture.SelectionTypes.FILE)
+
+ if (selected.dataset.type == CrPicture.SelectionTypes.OLD ||
+ selected.dataset.type == CrPicture.SelectionTypes.CAMERA) {
+ if (activate)
+ this.fire('focus-action', selected);
+ } else if (
+ activate || selected.dataset.type != CrPicture.SelectionTypes.FILE) {
this.fire('image-activate', selected);
+ }
},
/**
@@ -242,8 +247,9 @@ Polymer({
*/
onIronActivate_: function(event) {
var type = event.detail.item.dataset.type;
- // When clicking on the 'old' (current) image, do not activate (discard) it.
- var activate = type != CrPicture.SelectionTypes.OLD;
+ // Don't change focus when activating the camera or current image via mouse.
+ var activate = type != CrPicture.SelectionTypes.OLD &&
+ type != CrPicture.SelectionTypes.CAMERA;
this.selectImage_(event.detail.item, activate);
},
diff --git a/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_pane.js b/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_pane.js
index d8a830cfd35..38b64b6bf64 100644
--- a/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_pane.js
+++ b/chromium/ui/webui/resources/cr_elements/chromeos/cr_picture/cr_picture_pane.js
@@ -63,11 +63,19 @@ Polymer({
camera.takePhoto();
},
+ /** Tells the pane to focus the main action button. */
+ focusActionButton: function() {
+ if (this.showDiscard_())
+ this.$.discardImage.focus();
+ else if (this.cameraActive_)
+ this.$$('#camera').focusTakePhotoButton();
+ },
+
/**
* @return {boolean}
* @private
*/
- getCameraActive_() {
+ getCameraActive_: function() {
return this.cameraPresent &&
this.imageType == CrPicture.SelectionTypes.CAMERA;
},