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

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

Issue 19054012: Reload Local NTP on default search provider change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years, 5 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 e8f23acba409eaaf5bbacf982b709a4ad4f5e9dd..1a930308df5d29190d690c36eac4a6bed60c4d45 100644
--- a/chrome/browser/resources/local_ntp/local_ntp.js
+++ b/chrome/browser/resources/local_ntp/local_ntp.js
@@ -9,10 +9,9 @@
/**
* Controls rendering the new tab page for InstantExtended.
- * @param {Object} location window.location or a mock.
* @return {Object} A limited interface for testing the local NTP.
*/
-function LocalNTP(location) {
+function LocalNTP() {
<include src="../../../../ui/webui/resources/js/assert.js">
@@ -572,7 +571,7 @@ function createTile(page, position) {
tileElement, 'div', CLASSES.BLACKLIST_BUTTON);
var blacklistFunction = generateBlacklistFunction(rid);
blacklistButton.addEventListener('click', blacklistFunction);
- blacklistButton.title = templateData.removeThumbnailTooltip;
+ blacklistButton.title = configData.translatedStrings.removeThumbnailTooltip;
// When a tile is focused, have delete also blacklist the page.
registerKeyHandler(tileElement, KEYCODE.DELETE, blacklistFunction);
@@ -883,16 +882,6 @@ function getEmbeddedSearchApiHandle() {
return null;
}
-
-/**
- * @return {boolean} True if this is a Google page and not some other search
- * provider. Used to determine whether to show the logo and fakebox.
- */
-function isGooglePage() {
- return location.href.indexOf('isGoogle') != -1;
-}
-
-
/**
* Extract the desired navigation behavior from a click button.
* @param {number} button The Event#button property of a click event.
@@ -923,7 +912,7 @@ function init() {
tilesContainer.appendChild(row);
}
- if (isGooglePage()) {
+ if (configData.isGooglePage) {
var logo = document.createElement('div');
logo.id = IDS.LOGO;
@@ -939,7 +928,7 @@ function init() {
document.body.classList.add(CLASSES.NON_GOOGLE_PAGE);
}
- var recentTabsText = templateData.recentTabs;
+ var recentTabsText = configData.translatedStrings.recentTabs;
if (recentTabsText) {
var recentTabsLink = document.createElement('span');
recentTabsLink.id = IDS.RECENT_TABS;
@@ -954,16 +943,19 @@ function init() {
}
var notificationMessage = $(IDS.NOTIFICATION_MESSAGE);
- notificationMessage.textContent = templateData.thumbnailRemovedNotification;
+ notificationMessage.textContent =
+ configData.translatedStrings.thumbnailRemovedNotification;
var undoLink = $(IDS.UNDO_LINK);
undoLink.addEventListener('click', onUndo);
registerKeyHandler(undoLink, KEYCODE.ENTER, onUndo);
- undoLink.textContent = templateData.undoThumbnailRemove;
+ undoLink.textContent = configData.translatedStrings.undoThumbnailRemove;
var restoreAllLink = $(IDS.RESTORE_ALL_LINK);
restoreAllLink.addEventListener('click', onRestoreAll);
registerKeyHandler(restoreAllLink, KEYCODE.ENTER, onUndo);
- restoreAllLink.textContent = templateData.restoreThumbnailsShort;
- $(IDS.ATTRIBUTION_TEXT).textContent = templateData.attributionIntro;
+ restoreAllLink.textContent =
+ configData.translatedStrings.restoreThumbnailsShort;
+ $(IDS.ATTRIBUTION_TEXT).textContent =
+ configData.translatedStrings.attributionIntro;
var notificationCloseButton = $(IDS.NOTIFICATION_CLOSE_BUTTON);
notificationCloseButton.addEventListener('click', hideNotification);
@@ -1025,5 +1017,5 @@ return {
}
if (!window.localNTPUnitTest) {
- LocalNTP(location).listen();
+ LocalNTP().listen();
}

Powered by Google App Engine
This is Rietveld 408576698