Index: chrome/browser/resources/options2/chromeos/change_picture_options.js |
diff --git a/chrome/browser/resources/options2/chromeos/change_picture_options.js b/chrome/browser/resources/options2/chromeos/change_picture_options.js |
index 70b8d78f4208ea4de920e14a016d9c5d6cdee0bf..3bac30653647cb571c9678d4784dbb83566cd02b 100644 |
--- a/chrome/browser/resources/options2/chromeos/change_picture_options.js |
+++ b/chrome/browser/resources/options2/chromeos/change_picture_options.js |
@@ -240,13 +240,14 @@ cr.define('options', function() { |
/** |
* Appends default images to the image grid. Should only be called once. |
- * @param {Array.<string>} images An array of URLs to default images. |
+ * @param {Array.<{url: string, author: string, website: string}>} images |
+ * An array of default images data, including URL, author and website. |
* @private |
*/ |
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); |
} |
}, |
}; |
@@ -389,6 +390,13 @@ cr.define('options', function() { |
url != ButtonImages.TAKE_PHOTO && url != ButtonImages.CHOOSE_FILE) { |
chrome.send('selectImage', [url]); |
} |
+ // Update image attribution text. |
+ var image = imageGrid.selectedItem; |
+ $('user-image-author-name').textContent = image.author; |
+ $('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'; |
}, |
/** |
@@ -461,13 +469,17 @@ cr.define('options', function() { |
/** |
* Appends default images to the image grid. Should only be called once. |
- * @param {Array.<string>} images An array of URLs to default images. |
+ * @param {Array.<{url: string, author: string, website: string}>} images |
+ * An array of default images data, including URL, author and website. |
* @private |
*/ |
- setDefaultImages_: 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; |
+ item.website = data.website; |
} |
}, |
}; |