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

Unified Diff: chrome/browser/resources/settings/people_page/change_picture.js

Issue 1610973002: Settings People Revamp: Implement Change People preview pane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0072-settings-add-tests-for-cros-choose-picture
Patch Set: Created 4 years, 11 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
Index: chrome/browser/resources/settings/people_page/change_picture.js
diff --git a/chrome/browser/resources/settings/people_page/change_picture.js b/chrome/browser/resources/settings/people_page/change_picture.js
index 3127373a7654abd7eb6e59a1b28497c8f45f3f12..c51d39b274ae9115efdbb9dd60bfde89039b5c3b 100644
--- a/chrome/browser/resources/settings/people_page/change_picture.js
+++ b/chrome/browser/resources/settings/people_page/change_picture.js
@@ -39,6 +39,36 @@ Polymer({
},
/**
+ * True only if the user has selected the camera icon. Old photos captured
+ * from the camera are represented as the 'old' image.
+ * @private {boolean}
+ */
+ cameraActive_: {
+ type: Boolean,
+ value: false,
+ },
+
+ /**
+ * This differs from its default value only if the user has just captured
+ * a new photo from the camera.
+ * @private {string}
+ */
+ cameraImageUrl_: {
+ type: String,
+ value: settings.ChangePicturePrivateApi.ButtonImages.TAKE_PHOTO,
+ },
+
+ /**
+ * This differs from its default value only if the user has just captured
+ * a new photo from the camera.
+ * @private {string}
+ */
+ cameraImageTitle_: {
+ type: String,
+ value: function() { return loadTimeData.getString('takePhoto'); },
+ },
+
+ /**
* The url of the 'old' image, which is the existing image sourced from
* the camera, a file, or a deprecated default image.
* @private {string}
@@ -81,6 +111,7 @@ Polymer({
* @param {string} imageUrl
*/
receiveSelectedImage: function(imageUrl) {
+ this.cameraActive_ = false;
this.selectedImageUrl_ = imageUrl;
}.bind(this),
@@ -92,6 +123,7 @@ Polymer({
* @param {string} imageUrl
*/
receiveOldImage: function(imageUrl) {
+ this.cameraActive_ = false;
this.oldImageUrl_ = imageUrl;
this.selectedImageUrl_ = imageUrl;
}.bind(this),
@@ -103,8 +135,10 @@ Polymer({
*/
receiveProfileImage: function(imageUrl, selected) {
this.profileImageUrl_ = imageUrl;
- if (selected)
+ if (selected) {
+ this.cameraActive_ = false;
this.selectedImageUrl_ = imageUrl;
+ }
}.bind(this),
/**
@@ -127,6 +161,15 @@ Polymer({
},
/**
+ * Handler for when the user clicks the camera image.
+ * @private
+ * @param {!Event} event
+ */
+ onCameraImageTap_: function(event) {
+ this.cameraActive_ = true;
+ },
+
+ /**
* Handler for when the user clicks a new profile image.
* @private
* @param {!Event} event
@@ -176,7 +219,7 @@ Polymer({
* @param {string} selectedImageUrl
* @return {boolean}
*/
- isActiveImage_: function(imageUrl, selectedImageUrl) {
- return imageUrl == selectedImageUrl;
+ isActiveImage_: function(cameraActive, imageUrl, selectedImageUrl) {
+ return !cameraActive && (imageUrl == selectedImageUrl);
},
});

Powered by Google App Engine
This is Rietveld 408576698