Commit 5cce7a0a authored by ivankr@chromium.org's avatar ivankr@chromium.org

[cros] OOBE avatar picker fixes and polishing.

*) Profile image spinner visible again.
*) Camera snapshot can no longer be taken while initializing.

BUG=141274

Review URL: https://chromiumcodereview.appspot.com/10825319

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151281 0039d316-1c4b-4281-b951-d872f2087c98
parent d06c1c51
...@@ -286,7 +286,6 @@ cr.define('oobe', function() { ...@@ -286,7 +286,6 @@ cr.define('oobe', function() {
}, },
/** /**
<<<<<<< HEAD
* Appends default images to the image grid. Should only be called once. * Appends default images to the image grid. Should only be called once.
* @param {Array.<{url: string, author: string, website: string, * @param {Array.<{url: string, author: string, website: string,
* title: string}>} images An array of default images data, * title: string}>} images An array of default images data,
...@@ -376,6 +375,7 @@ cr.define('oobe', function() { ...@@ -376,6 +375,7 @@ cr.define('oobe', function() {
el.id = 'profile-image'; el.id = 'profile-image';
}); });
this.profileImage_.type = 'profile'; this.profileImage_.type = 'profile';
this.profileImageLoading = true;
// Add camera stream element. // Add camera stream element.
imageGrid.cameraImage = null; imageGrid.cameraImage = null;
......
...@@ -188,7 +188,8 @@ cr.define('options', function() { ...@@ -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() { get cameraPresent() {
return this.cameraPresent_; return this.cameraPresent_;
...@@ -199,6 +200,15 @@ cr.define('options', function() { ...@@ -199,6 +200,15 @@ cr.define('options', function() {
this.cameraImage = null; this.cameraImage = null;
}, },
/**
* 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. * Start camera presence check.
* @param {boolean} autoplay Whether to start capture immediately. * @param {boolean} autoplay Whether to start capture immediately.
...@@ -439,8 +449,11 @@ cr.define('options', function() { ...@@ -439,8 +449,11 @@ cr.define('options', function() {
* Performs photo capture from the live camera stream. * Performs photo capture from the live camera stream.
* @param {function=} opt_callback Callback that receives taken photo as * @param {function=} opt_callback Callback that receives taken photo as
* data URL. * data URL.
* @return {boolean} Whether photo capture was successful.
*/ */
takePhoto: function(opt_callback) { takePhoto: function(opt_callback) {
if (!this.cameraOnline)
return false;
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
canvas.width = CAPTURE_SIZE.width; canvas.width = CAPTURE_SIZE.width;
canvas.height = CAPTURE_SIZE.height; canvas.height = CAPTURE_SIZE.height;
...@@ -456,6 +469,7 @@ cr.define('options', function() { ...@@ -456,6 +469,7 @@ cr.define('options', function() {
self.cameraImage = this.src; self.cameraImage = this.src;
}); });
previewImg.src = photoURL; previewImg.src = photoURL;
return true;
}, },
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment