| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * @fileoverview The local InstantExtended NTP. | 7 * @fileoverview The local InstantExtended NTP. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 | 10 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 if (configData.translatedStrings.searchboxPlaceholder) { | 333 if (configData.translatedStrings.searchboxPlaceholder) { |
| 334 fakeboxText.textContent = | 334 fakeboxText.textContent = |
| 335 configData.translatedStrings.searchboxPlaceholder; | 335 configData.translatedStrings.searchboxPlaceholder; |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 var info = ntpApiHandle.themeBackgroundInfo; | 339 var info = ntpApiHandle.themeBackgroundInfo; |
| 340 var isThemeDark = getIsThemeDark(info); | 340 var isThemeDark = getIsThemeDark(info); |
| 341 ntpContents.classList.toggle(CLASSES.DARK, isThemeDark); | 341 ntpContents.classList.toggle(CLASSES.DARK, isThemeDark); |
| 342 if (!info) { | 342 if (!info) { |
| 343 titleColor = NTP_DESIGN.titleColor; | 343 titleColor = convertToRRGGBBAAColor(NTP_DESIGN.titleColor); |
| 344 return; | 344 return; |
| 345 } | 345 } |
| 346 | 346 |
| 347 if (!info.usingDefaultTheme && info.textColorRgba) { | 347 if (!info.usingDefaultTheme && info.textColorRgba) { |
| 348 titleColor = convertToRRGGBBAAColor(info.textColorRgba); | 348 titleColor = convertToRRGGBBAAColor(info.textColorRgba); |
| 349 } else { | 349 } else { |
| 350 titleColor = isThemeDark ? | 350 titleColor = convertToRRGGBBAAColor(isThemeDark ? |
| 351 NTP_DESIGN.titleColorAgainstDark : NTP_DESIGN.titleColor; | 351 NTP_DESIGN.titleColorAgainstDark : NTP_DESIGN.titleColor); |
| 352 } | 352 } |
| 353 | 353 |
| 354 var background = [convertToRGBAColor(info.backgroundColorRgba), | 354 var background = [convertToRGBAColor(info.backgroundColorRgba), |
| 355 info.imageUrl, | 355 info.imageUrl, |
| 356 info.imageTiling, | 356 info.imageTiling, |
| 357 info.imageHorizontalAlignment, | 357 info.imageHorizontalAlignment, |
| 358 info.imageVerticalAlignment].join(' ').trim(); | 358 info.imageVerticalAlignment].join(' ').trim(); |
| 359 | 359 |
| 360 document.body.style.background = background; | 360 document.body.style.background = background; |
| 361 document.body.classList.toggle(CLASSES.ALTERNATE_LOGO, info.alternateLogo); | 361 document.body.classList.toggle(CLASSES.ALTERNATE_LOGO, info.alternateLogo); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 | 639 |
| 640 /** | 640 /** |
| 641 * Builds a URL to display a most visited tile thumbnail in an iframe. | 641 * Builds a URL to display a most visited tile thumbnail in an iframe. |
| 642 * @param {number} rid The restricted ID. | 642 * @param {number} rid The restricted ID. |
| 643 * @param {number} position The position of the iframe in the UI. | 643 * @param {number} position The position of the iframe in the UI. |
| 644 * @return {string} An URL to display the most visited thumbnail in an iframe. | 644 * @return {string} An URL to display the most visited thumbnail in an iframe. |
| 645 */ | 645 */ |
| 646 function getMostVisitedThumbnailIframeUrl(rid, position) { | 646 function getMostVisitedThumbnailIframeUrl(rid, position) { |
| 647 var url = 'chrome-search://most-visited/' + | 647 var url = 'chrome-search://most-visited/' + |
| 648 encodeURIComponent(MOST_VISITED_THUMBNAIL_IFRAME); | 648 encodeURIComponent(MOST_VISITED_THUMBNAIL_IFRAME); |
| 649 var colorString = convertToRRGGBBAAColor(NTP_DESIGN.thumbnailTextColor); |
| 649 var params = [ | 650 var params = [ |
| 650 'rid=' + encodeURIComponent(rid), | 651 'rid=' + encodeURIComponent(rid), |
| 651 'f=' + encodeURIComponent(NTP_DESIGN.fontFamily), | 652 'f=' + encodeURIComponent(NTP_DESIGN.fontFamily), |
| 652 'fs=' + encodeURIComponent(NTP_DESIGN.fontSize), | 653 'fs=' + encodeURIComponent(NTP_DESIGN.fontSize), |
| 653 'c=' + encodeURIComponent(NTP_DESIGN.thumbnailTextColor), | 654 'c=' + encodeURIComponent(colorString), |
| 654 'pos=' + encodeURIComponent(position)]; | 655 'pos=' + encodeURIComponent(position)]; |
| 655 if (NTP_DESIGN.thumbnailFallback) | 656 if (NTP_DESIGN.thumbnailFallback) |
| 656 params.push('etfb=1'); | 657 params.push('etfb=1'); |
| 657 return url + '?' + params.join('&'); | 658 return url + '?' + params.join('&'); |
| 658 } | 659 } |
| 659 | 660 |
| 660 | 661 |
| 661 /** | 662 /** |
| 662 * Creates a Tile with the specified page data. If no data is provided, a | 663 * Creates a Tile with the specified page data. If no data is provided, a |
| 663 * filler Tile is created. | 664 * filler Tile is created. |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 | 1207 |
| 1207 return { | 1208 return { |
| 1208 init: init, | 1209 init: init, |
| 1209 listen: listen | 1210 listen: listen |
| 1210 }; | 1211 }; |
| 1211 } | 1212 } |
| 1212 | 1213 |
| 1213 if (!window.localNTPUnitTest) { | 1214 if (!window.localNTPUnitTest) { |
| 1214 LocalNTP().listen(); | 1215 LocalNTP().listen(); |
| 1215 } | 1216 } |
| OLD | NEW |