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

Unified Diff: chrome/browser/resources/ntp4/new_tab.js

Issue 10911196: Support for ntp promo bubble. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: allow BR in parseHtmlSubset Created 8 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/new_tab_page_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp4/new_tab.js
===================================================================
--- chrome/browser/resources/ntp4/new_tab.js (revision 155564)
+++ chrome/browser/resources/ntp4/new_tab.js (working copy)
@@ -31,7 +31,7 @@
* navigation dot UI.
* @type {!Element|undefined}
*/
- var infoBubble;
+ var promoBubble;
/**
* If non-null, an bubble confirming that the user has signed into sync. It
@@ -98,8 +98,8 @@
appendTilePage: function(page, title, titleIsEditable, opt_refNode) {
ntp.PageListView.prototype.appendTilePage.apply(this, arguments);
- if (infoBubble)
- window.setTimeout(infoBubble.reposition.bind(infoBubble), 0);
+ if (promoBubble)
+ window.setTimeout(promoBubble.reposition.bind(promoBubble), 0);
}
};
@@ -183,6 +183,23 @@
shouldShowLoginBubble = true;
}
+ if (loadTimeData.valueExists('bubblePromoText')) {
+ promoBubble = new cr.ui.Bubble;
+ promoBubble.anchorNode = getRequiredElement('logo-img');
+ promoBubble.setArrowLocation(cr.ui.ArrowLocation.BOTTOM_START);
+ promoBubble.bubbleAlignment =
+ cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE;
+ promoBubble.deactivateToDismissDelay = 2000;
+ promoBubble.content = parseHtmlSubset(loadTimeData.getString(
+ 'bubblePromoText'), ['BR']);
+ promoBubble.handleCloseEvent = function() {
+ promoBubble.hide();
+ chrome.send('bubblePromoClosed');
+ };
+ promoBubble.show();
+ chrome.send('bubblePromoViewed');
+ }
+
var loginContainer = getRequiredElement('login-container');
loginContainer.addEventListener('click', showSyncLoginUI);
chrome.send('initializeSyncLogin');
@@ -194,8 +211,8 @@
newTabView.cardSlider.currentCardValue.navigationDot.classList.add(
'selected');
- if (loadTimeData.valueExists('serverpromo')) {
- var promo = loadTimeData.getString('serverpromo');
+ if (loadTimeData.valueExists('notificationPromoText')) {
+ var promo = loadTimeData.getString('notificationPromoText');
var tags = ['IMG'];
var attrs = {
src: function(node, value) {
@@ -204,7 +221,7 @@
},
};
showNotification(parseHtmlSubset(promo, tags, attrs), [], function() {
- chrome.send('closeNotificationPromo');
+ chrome.send('notificationPromoClosed');
}, 60000);
chrome.send('notificationPromoViewed');
}
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/new_tab_page_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698