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

Unified Diff: chrome/browser/resources/ntp4/most_visited_page.js

Issue 7031078: Retry r88137: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for test failures Created 9 years, 6 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/ntp4/most_visited_page.js
diff --git a/chrome/browser/resources/ntp4/most_visited_page.js b/chrome/browser/resources/ntp4/most_visited_page.js
index 06c8329ad360c8f50b7ac426907aef9a911f7fda..a684d772aa94603a8d76a7b6388bfae1ce95103d 100644
--- a/chrome/browser/resources/ntp4/most_visited_page.js
+++ b/chrome/browser/resources/ntp4/most_visited_page.js
@@ -8,6 +8,10 @@ cr.define('ntp4', function() {
var TilePage = ntp4.TilePage;
/**
+ */
+ var tileID = 0;
+
+ /**
* Creates a new Most Visited object for tiling.
* @constructor
* @extends {HTMLAnchorElement}
@@ -63,6 +67,7 @@ cr.define('ntp4', function() {
this.tabIndex = -1;
this.data_ = null;
+ this.removeAttribute('id');
},
/**
@@ -76,6 +81,8 @@ cr.define('ntp4', function() {
return;
}
+ var id = tileID++;
+ this.setAttribute('id', 'tile' + id);
this.data_ = data;
this.tabIndex = 0;
this.classList.remove('filler');
@@ -84,7 +91,10 @@ cr.define('ntp4', function() {
var faviconUrl = data.faviconUrl || 'chrome://favicon/' + data.url;
colorBar.style.backgroundImage = url(faviconUrl);
colorBar.dir = data.direction;
- // TODO(estade): add a band of color based on the favicon.
+ if (data.faviconDominantColor)
+ this.setBarColor(data.faviconDominantColor);
+ else
+ chrome.send('getFaviconDominantColor', [faviconUrl, id]);
var title = this.querySelector('.title');
title.textContent = data.title;
@@ -100,6 +110,14 @@ cr.define('ntp4', function() {
},
/**
+ * Sets the color of the favicon dominant color bar.
+ * @param {string} color The css-parsable value for the color.
+ */
+ setBarColor: function(color) {
+ // TODO(estade): use color.
+ },
+
+ /**
* Handles a click on the tile.
* @param {Event} e The click event.
*/
@@ -390,8 +408,15 @@ cr.define('ntp4', function() {
return oldData;
};
+ function setFaviconDominantColor(id, color) {
+ var tile = $('tile' + id);
+ if (tile)
+ tile.setBarColor(color);
+ };
+
return {
MostVisitedPage: MostVisitedPage,
refreshData: refreshData,
+ setFaviconDominantColor: setFaviconDominantColor,
};
});

Powered by Google App Engine
This is Rietveld 408576698