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

Unified Diff: chrome/browser/resources/chromeos/login/oobe_screen_user_image.js

Issue 10850036: [cros] Add attribution (author & website) strings to stock user images. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile fix 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
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 cb782ee1c733a3ee9a3ee21d50f827c2a9955525..6b0edbca53d01e6eab433cb69bf11d91db310693 100644
--- a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js
+++ b/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js
@@ -284,14 +284,16 @@ cr.define('oobe', function() {
},
/**
- * Appends received images to the list.
- * @param {Array.<string>} images An array of URLs to user images.
+ * Appends default images to the image grid. Should only be called once.
+ * @param {Array.<{url: string, author: string, website: string}>} images
+ * An array of default images data, including URL, author and website.
* @private
*/
- setUserImages_: function(images) {
+ setDefaultImages_: function(images) {
var imageGrid = $('user-image-grid');
- for (var i = 0, url; url = images[i]; i++)
- imageGrid.addItem(url);
+ for (var i = 0, data; data = imagesData[i]; i++) {
+ imageGrid.addItem(data.url);
+ }
},
/**
@@ -471,6 +473,13 @@ cr.define('oobe', function() {
chrome.send('selectImage', [imageGrid.selectedItemUrl]);
}
this.updateCaption_();
+ // Update image attribution text.
+ var image = imageGrid.selectedItem;
+ $('user-image-author-name').textContent = image.author;
Nikita (slow) 2012/08/03 17:52:54 image.author / image.website might be undefined fo
Ivan Korotkov 2012/08/03 20:13:41 Done.
+ $('user-image-author-website').textContent = image.website;
+ $('user-image-author-website').href = image.website;
+ $('user-image-attribution').style.visibility =
+ (image.author || image.website) ? 'visible' : 'hidden';
},
/**
@@ -531,14 +540,19 @@ cr.define('oobe', function() {
},
/**
- * Appends received images to the list.
- * @param {Array.<string>} images An array of URLs to user images.
+ * Appends default images to the image grid. Should only be called once.
+ * @param {Array.<{url: string, author: string, website: string}>} images
+ * An array of default images data, including URL, author and website.
* @private
*/
- setUserImages_: function(images) {
+ setDefaultImages_: function(imagesData) {
var imageGrid = $('user-image-grid');
- for (var i = 0, url; url = images[i]; i++)
- imageGrid.addItem(url).type = 'default';
+ for (var i = 0, data; data = imagesData[i]; i++) {
+ var item = imageGrid.addItem(data.url);
+ item.type = 'default';
+ item.author = data.author;
Nikita (slow) 2012/08/03 17:52:54 Add check that data.author / data.website is defin
Ivan Korotkov 2012/08/03 20:13:41 Done.
+ item.website = data.website;
+ }
},
/**
@@ -581,10 +595,10 @@ cr.define('oobe', function() {
// Forward public APIs to private implementations.
[
+ 'setDefaultImages',
'setCameraPresent',
'setProfileImage',
'setSelectedImage',
- 'setUserImages',
'setUserPhoto',
].forEach(function(name) {
UserImageScreen[name] = function(value) {

Powered by Google App Engine
This is Rietveld 408576698