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

Unified Diff: chrome/browser/resources/options2/chromeos/change_picture_options.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: 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
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 66c302113f239a6d45b3f8f0c6871ad6b8c7155b..2404337c9164c0ca999becb51878f2fa89ade3d0 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 || '';
}
},
};

Powered by Google App Engine
This is Rietveld 408576698