summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/new_new_tab.js
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 23:32:48 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-25 23:32:48 +0000
commit6a3d3e6c7511c586128b11901310b0475b2b982a (patch)
treef67617b0098c3fe64d7c9683cae8d1dc9858dfa8 /chrome/browser/resources/new_new_tab.js
parent8411ad62509db62b1bb5a1e4d4a3488e8c48f037 (diff)
downloadchromium_src-6a3d3e6c7511c586128b11901310b0475b2b982a.zip
chromium_src-6a3d3e6c7511c586128b11901310b0475b2b982a.tar.gz
chromium_src-6a3d3e6c7511c586128b11901310b0475b2b982a.tar.bz2
Hooks backend tip service into new tab page. Also changes tip service to load tips from popgadget, at http://www.google.com/labs/popgadget/world.
BUG= http://crbug.com/14962 TEST= Enable new tab page. See welcome message. On reload afterwards (and always after that, as long as preferences file isn't removed), see browsing recommendations appear in bottom right corner. Review URL: http://codereview.chromium.org/147109 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/new_new_tab.js')
-rw-r--r--chrome/browser/resources/new_new_tab.js42
1 files changed, 24 insertions, 18 deletions
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index c238b57..ccd6355 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -112,6 +112,12 @@ function saveShownSections() {
chrome.send('setShownSections', [String(shownSections)]);
}
+function tips(data) {
+ logEvent('received tips data');
+ data.length = Math.min(data.length, 5);
+ processData('#tip-items', data);
+}
+
function layoutMostVisited() {
var d0 = Date.now();
var mostVisitedElement = $('most-visited');
@@ -318,10 +324,10 @@ var Section = {
THUMB: 1,
LIST: 2,
RECENT: 4,
- RECOMMENDATIONS: 8
+ TIPS: 8
};
-var shownSections = Section.RECENT | Section.RECOMMENDATIONS;
+var shownSections = Section.RECENT | Section.TIPS;
function showSection(section) {
if (!(section & shownSections)) {
@@ -355,14 +361,14 @@ function hideSection(section) {
}
function notifyLowerSectionForChange(section, large) {
- // Notify recent and recommendations if they need to display more data.
- if (section == Section.RECENT || section == Section.RECOMMENDATIONS) {
+ // Notify recent and tips if they need to display more data.
+ if (section == Section.RECENT || section == Section.TIPS) {
// we are hiding one of them so if the other one is visible it is now
// {@code large}.
if (shownSections & Section.RECENT) {
recentChangedSize(large);
- } else if (shownSections & Section.RECOMMENDATIONS) {
- recommendationsChangedSize(large);
+ } else if (shownSections & Section.TIPS) {
+ tipsChangedSize(large);
}
}
}
@@ -526,7 +532,7 @@ function recentChangedSize(large) {
// TODO(arv): Implement
}
-function recommendationsChangedSize(large) {
+function tipsChangedSize(large) {
// TODO(arv): Implement
}
@@ -537,7 +543,7 @@ function layoutLowerSections() {
// width and opacity.
var lowerSectionsElement = $('lower-sections');
var recentElement = $('recent-activities');
- var recommendationsElement = $('recommendations');
+ var tipsElement = $('tips');
var spacer = recentElement.nextElementSibling;
var totalWidth = useSmallGrid() ? 692 : 940;
@@ -545,29 +551,29 @@ function layoutLowerSections() {
var rtl = document.documentElement.dir == 'rtl';
var recentShown = shownSections & Section.RECENT;
- var recommendationsShown = shownSections & Section.RECOMMENDATIONS;
+ var tipsShown = shownSections & Section.TIPS;
- if (recentShown || recommendationsShown) {
+ if (recentShown || tipsShown) {
lowerSectionsElement.style.height = '198px';
lowerSectionsElement.style.opacity = '';
} else {
lowerSectionsElement.style.height = lowerSectionsElement.style.opacity = 0;
}
- if (recentShown && recommendationsShown) {
+ if (recentShown && tipsShown) {
var w = (totalWidth - spacing) / 2;
- recentElement.style.width = recommendationsElement.style.width = w + 'px'
- recentElement.style.opacity = recommendationsElement.style.opacity = '';
+ recentElement.style.width = tipsElement.style.width = w + 'px'
+ recentElement.style.opacity = tipsElement.style.opacity = '';
spacer.style.width = spacing + 'px';
} else if (recentShown) {
recentElement.style.width = totalWidth + 'px';
recentElement.style.opacity = '';
- recommendationsElement.style.width =
- recommendationsElement.style.opacity = 0;
+ tipsElement.style.width =
+ tipsElement.style.opacity = 0;
spacer.style.width = 0;
- } else if (recommendationsShown) {
- recommendationsElement.style.width = totalWidth + 'px';
- recommendationsElement.style.opacity = '';
+ } else if (tipsShown) {
+ tipsElement.style.width = totalWidth + 'px';
+ tipsElement.style.opacity = '';
recentElement.style.width = recentElement.style.opacity = 0;
spacer.style.width = 0;
}