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

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

Issue 14685004: Add finch flag for rendering a recently closed link on the local ntp. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Respond to comments. Created 7 years, 8 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.js
diff --git a/chrome/browser/resources/local_ntp/local_ntp.js b/chrome/browser/resources/local_ntp/local_ntp.js
index cd5945f73fb5e6377d4f8c44800221dac41f5d99..b0a9e05d404e56770597da6895df8cb65c4021c7 100644
--- a/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -34,6 +34,7 @@ var CLASSES = {
FAVICON: 'mv-favicon',
FILLER: 'mv-filler', // filler tiles
GOOGLE_PAGE: 'google-page', // shows the Google logo and fakebox
+ HIDE_ATTRIBUTION: 'attribution-hide',
HIDE_BLACKLIST_BUTTON: 'mv-x-hide', // hides blacklist button during animation
HIDE_NOTIFICATION: 'mv-notice-hide',
HIDE_NTP: 'hide-ntp', // hides NTP and disables scrollbars
@@ -59,8 +60,10 @@ var CLASSES = {
*/
var IDS = {
ATTRIBUTION: 'attribution',
+ ATTRIBUTION_TEXT: 'attribution-text',
CURSOR: 'cursor',
FAKEBOX: 'fakebox',
+ FOOTER: 'footer',
LOGO: 'logo',
NOTIFICATION: 'mv-notice',
NOTIFICATION_CLOSE_BUTTON: 'mv-notice-x',
@@ -247,7 +250,7 @@ function onThemeChange() {
*/
function updateAttribution(url) {
if (!url) {
- attribution.hidden = true;
+ attribution.classList.add(CLASSES.HIDE_ATTRIBUTION);
return;
}
var attributionImage = new Image();
@@ -256,10 +259,10 @@ function updateAttribution(url) {
if (oldAttributionImage)
removeNode(oldAttributionImage);
attribution.appendChild(attributionImage);
- attribution.hidden = false;
+ attribution.classList.remove(CLASSES.HIDE_ATTRIBUTION);
};
attributionImage.onerror = function() {
- attribution.hidden = true;
+ attribution.classList.add(CLASSES.HIDE_ATTRIBUTION);
};
attributionImage.src = url;
}
@@ -1406,6 +1409,17 @@ function init() {
ntpContents.insertBefore(logo, ntpContents.firstChild);
}
+ var recentlyClosedText = templateData.recentlyClosed;
+ if (recentlyClosedText) {
+ var recentlyClosedLink = document.createElement('span');
+ recentlyClosedLink.id = 'recently-closed';
+ recentlyClosedLink.addEventListener('click', function() {
+ ntpApiHandle.navigateContentWindow('chrome://history');
+ });
+ recentlyClosedLink.textContent = recentlyClosedText;
+ var footer = $(IDS.FOOTER);
+ footer.insertBefore(recentlyClosedLink, footer.firstChild);
+ }
// TODO(jeremycho): i18n.
var notificationMessage = $(IDS.NOTIFICATION_MESSAGE);
@@ -1416,7 +1430,7 @@ function init() {
var restoreAllLink = $(IDS.RESTORE_ALL_LINK);
restoreAllLink.addEventListener('click', onRestoreAll);
restoreAllLink.innerText = 'Restore all';
- attribution.innerText = 'Theme created by';
+ $(IDS.ATTRIBUTION_TEXT).innerText = 'Theme created by';
var notificationCloseButton = $(IDS.NOTIFICATION_CLOSE_BUTTON);
notificationCloseButton.addEventListener('click', hideNotification);

Powered by Google App Engine
This is Rietveld 408576698