| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * @fileoverview New tab page | 6 * @fileoverview New tab page |
| 7 * This is the main code for the new tab page used by touch-enabled Chrome | 7 * This is the main code for the new tab page used by touch-enabled Chrome |
| 8 * browsers. For now this is still a prototype. | 8 * browsers. For now this is still a prototype. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 chrome.send('showAdvancedLoginUI'); | 174 chrome.send('showAdvancedLoginUI'); |
| 175 }; | 175 }; |
| 176 $('login-status-dismiss').onclick = loginBubble.hide.bind(loginBubble); | 176 $('login-status-dismiss').onclick = loginBubble.hide.bind(loginBubble); |
| 177 | 177 |
| 178 var bubbleContent = $('login-status-bubble-contents'); | 178 var bubbleContent = $('login-status-bubble-contents'); |
| 179 loginBubble.content = bubbleContent; | 179 loginBubble.content = bubbleContent; |
| 180 | 180 |
| 181 // The anchor node won't be updated until updateLogin is called so don't | 181 // The anchor node won't be updated until updateLogin is called so don't |
| 182 // show the bubble yet. | 182 // show the bubble yet. |
| 183 shouldShowLoginBubble = true; | 183 shouldShowLoginBubble = true; |
| 184 } else if (loadTimeData.valueExists('ntp4_intro_message')) { | |
| 185 infoBubble = new cr.ui.Bubble; | |
| 186 infoBubble.anchorNode = newTabView.mostVisitedPage.navigationDot; | |
| 187 infoBubble.setArrowLocation(cr.ui.ArrowLocation.BOTTOM_START); | |
| 188 infoBubble.handleCloseEvent = function() { | |
| 189 this.hide(); | |
| 190 chrome.send('introMessageDismissed'); | |
| 191 }; | |
| 192 | |
| 193 var bubbleContent = $('ntp4-intro-bubble-contents'); | |
| 194 infoBubble.content = bubbleContent; | |
| 195 | |
| 196 bubbleContent.querySelector('div > div').innerHTML = | |
| 197 loadTimeData.getString('ntp4_intro_message'); | |
| 198 | |
| 199 var learnMoreLink = bubbleContent.querySelector('a'); | |
| 200 learnMoreLink.href = loadTimeData.getString('ntp4_intro_url'); | |
| 201 learnMoreLink.onclick = infoBubble.hide.bind(infoBubble); | |
| 202 | |
| 203 infoBubble.show(); | |
| 204 chrome.send('introMessageSeen'); | |
| 205 } | 184 } |
| 206 | 185 |
| 207 var loginContainer = getRequiredElement('login-container'); | 186 var loginContainer = getRequiredElement('login-container'); |
| 208 loginContainer.addEventListener('click', showSyncLoginUI); | 187 loginContainer.addEventListener('click', showSyncLoginUI); |
| 209 chrome.send('initializeSyncLogin'); | 188 chrome.send('initializeSyncLogin'); |
| 210 | 189 |
| 211 doWhenAllSectionsReady(function() { | 190 doWhenAllSectionsReady(function() { |
| 212 // Tell the slider about the pages. | 191 // Tell the slider about the pages. |
| 213 newTabView.updateSliderCards(); | 192 newTabView.updateSliderCards(); |
| 214 // Mark the current page. | 193 // Mark the current page. |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 setStripeColor: setStripeColor, | 586 setStripeColor: setStripeColor, |
| 608 showNotification: showNotification, | 587 showNotification: showNotification, |
| 609 themeChanged: themeChanged, | 588 themeChanged: themeChanged, |
| 610 updateLogin: updateLogin | 589 updateLogin: updateLogin |
| 611 }; | 590 }; |
| 612 }); | 591 }); |
| 613 | 592 |
| 614 document.addEventListener('DOMContentLoaded', ntp.onLoad); | 593 document.addEventListener('DOMContentLoaded', ntp.onLoad); |
| 615 | 594 |
| 616 var toCssPx = cr.ui.toCssPx; | 595 var toCssPx = cr.ui.toCssPx; |
| OLD | NEW |