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

Unified Diff: chrome/browser/resources/chromeos/user_images_grid.js

Issue 10825319: [cros] OOBE avatar picker fixes and polishing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 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 | « chrome/browser/resources/chromeos/login/oobe_screen_user_image.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/user_images_grid.js
diff --git a/chrome/browser/resources/chromeos/user_images_grid.js b/chrome/browser/resources/chromeos/user_images_grid.js
index ad94315f060d5dd0ea227f7ca5ce672eec2a9ff7..cde2fc7a527b5af6f5e04dfa107551ee3aa74a72 100644
--- a/chrome/browser/resources/chromeos/user_images_grid.js
+++ b/chrome/browser/resources/chromeos/user_images_grid.js
@@ -188,7 +188,8 @@ cr.define('options', function() {
},
/**
- * @param {boolean} present Whether a camera is present or not.
+ * Whether a camera is present or not.
+ * @type {boolean}
*/
get cameraPresent() {
return this.cameraPresent_;
@@ -200,6 +201,15 @@ cr.define('options', function() {
},
/**
+ * Whether camera is actually streaming video. May be |false| even when
+ * camera is present and shown but still initializing.
+ * @type {boolean}
+ */
+ get cameraOnline() {
+ return this.previewElement.classList.contains('online');
+ },
+
+ /**
* Start camera presence check.
* @param {boolean} autoplay Whether to start capture immediately.
* @param {boolean} preselect Whether to select camera automatically.
@@ -439,8 +449,11 @@ cr.define('options', function() {
* Performs photo capture from the live camera stream.
* @param {function=} opt_callback Callback that receives taken photo as
* data URL.
+ * @return {boolean} Whether photo capture was successful.
*/
takePhoto: function(opt_callback) {
+ if (!this.cameraOnline)
+ return false;
var canvas = document.createElement('canvas');
canvas.width = CAPTURE_SIZE.width;
canvas.height = CAPTURE_SIZE.height;
@@ -456,6 +469,7 @@ cr.define('options', function() {
self.cameraImage = this.src;
});
previewImg.src = photoURL;
+ return true;
},
/**
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe_screen_user_image.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698