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

Unified Diff: chrome/browser/resources/local_ntp/local_ntp_fast.js

Issue 1011393004: Fast NTP support for themes, dark themes, favicons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/local_ntp/local_ntp_fast.js
diff --git a/chrome/browser/resources/local_ntp/local_ntp_fast.js b/chrome/browser/resources/local_ntp/local_ntp_fast.js
index 7caa5316157ffe5b58e5d56a44e6c3d7a825aaf0..664dd6f6b96c45ab27bde744e85f329f7947957c 100644
--- a/chrome/browser/resources/local_ntp/local_ntp_fast.js
+++ b/chrome/browser/resources/local_ntp/local_ntp_fast.js
@@ -184,13 +184,6 @@ var MIN_TOTAL_HORIZONTAL_PADDING = 200;
/**
- * The color of the title in RRGGBBAA format.
- * @type {?string}
- */
-var titleColor = null;
-
-
-/**
* Heuristic to determine whether a theme should be considered to be dark, so
* the colors of various UI elements can be adjusted.
* @param {ThemeBackgroundInfo|undefined} info Theme background information.
@@ -225,17 +218,9 @@ function renderTheme() {
var isThemeDark = getIsThemeDark(info);
ntpContents.classList.toggle(CLASSES.DARK, isThemeDark);
if (!info) {
- titleColor = NTP_DESIGN.titleColor;
return;
}
- if (!info.usingDefaultTheme && info.textColorRgba) {
- titleColor = convertToRRGGBBAAColor(info.textColorRgba);
- } else {
- titleColor = isThemeDark ?
- NTP_DESIGN.titleColorAgainstDark : NTP_DESIGN.titleColor;
- }
-
var background = [convertToRGBAColor(info.backgroundColorRgba),
info.imageUrl,
info.imageTiling,
@@ -246,6 +231,23 @@ function renderTheme() {
document.body.classList.toggle(CLASSES.ALTERNATE_LOGO, info.alternateLogo);
updateThemeAttribution(info.attributionUrl);
setCustomThemeStyle(info);
+
+ var themeinfo = {cmd: 'updateTheme'};
+ if (!info.usingDefaultTheme) {
+ themeinfo.tileBorderColor = convertToRGBAColor(info.sectionBorderColorRgba);
+ themeinfo.tileHoverBorderColor = convertToRGBAColor(info.headerColorRgba);
+ }
+ themeinfo.isThemeDark = isThemeDark;
+
+ var titleColor = NTP_DESIGN.titleColor;
+ if (!info.usingDefaultTheme && info.textColorRgba) {
+ titleColor = convertToRRGGBBAAColor(info.textColorRgba);
huangs 2015/03/19 23:45:01 Sorry should have caught this, too: Just assign
+ } else if (isThemeDark) {
+ NTP_DESIGN.titleColorAgainstDark;
huangs 2015/03/19 23:45:01 Assign to titleColor.
+ }
+ themeinfo.tileTitleColor = convertToRGBAColor(titleColor);
+
+ $('mv-single').contentWindow.postMessage(themeinfo, '*');
}
@@ -703,8 +705,6 @@ function init() {
if (ntpApiHandle.isInputInProgress)
onInputStart();
- renderTheme();
-
searchboxApiHandle = topLevelHandle.searchBox;
if (fakebox) {
@@ -770,6 +770,7 @@ function init() {
iframe.onload = function() {
reloadTiles();
+ renderTheme();
};
window.addEventListener('message', handlePostMessage);

Powered by Google App Engine
This is Rietveld 408576698