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

Side by Side Diff: chrome/browser/resources/ntp4/new_tab.js

Issue 1140813003: NTP Zombie Code Slayer III, The Saga Continues: Foreign Sessions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@suggestions-page
Patch Set: Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 */ 49 */
50 var loginBubble; 50 var loginBubble;
51 51
52 /** 52 /**
53 * true if |loginBubble| should be shown. 53 * true if |loginBubble| should be shown.
54 * @type {boolean} 54 * @type {boolean}
55 */ 55 */
56 var shouldShowLoginBubble = false; 56 var shouldShowLoginBubble = false;
57 57
58 /** 58 /**
59 * The 'other-sessions-menu-button' element.
60 * @type {!ntp.OtherSessionsMenuButton|undefined}
61 */
62 var otherSessionsButton;
63
64 /**
65 * The time when all sections are ready. 59 * The time when all sections are ready.
66 * @type {number|undefined} 60 * @type {number|undefined}
67 * @private 61 * @private
68 */ 62 */
69 var startTime; 63 var startTime;
70 64
71 /** 65 /**
72 * The time in milliseconds for most transitions. This should match what's 66 * The time in milliseconds for most transitions. This should match what's
73 * in new_tab.css. Unfortunately there's no better way to try to time 67 * in new_tab.css. Unfortunately there's no better way to try to time
74 * something to occur until after a transition has completed. 68 * something to occur until after a transition has completed.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 135
142 // Load the current theme colors. 136 // Load the current theme colors.
143 themeChanged(); 137 themeChanged();
144 138
145 newTabView = new NewTabView(); 139 newTabView = new NewTabView();
146 140
147 notificationContainer = getRequiredElement('notification-container'); 141 notificationContainer = getRequiredElement('notification-container');
148 notificationContainer.addEventListener( 142 notificationContainer.addEventListener(
149 'webkitTransitionEnd', onNotificationTransitionEnd); 143 'webkitTransitionEnd', onNotificationTransitionEnd);
150 144
151 if (loadTimeData.getBoolean('showOtherSessionsMenu')) {
152 otherSessionsButton = /** @type {!ntp.OtherSessionsMenuButton} */(
153 getRequiredElement('other-sessions-menu-button'));
154 cr.ui.decorate(otherSessionsButton, ntp.OtherSessionsMenuButton);
155 otherSessionsButton.initialize(loadTimeData.getBoolean('isUserSignedIn'));
156 } else {
157 getRequiredElement('other-sessions-menu-button').hidden = true;
158 }
159
160 if (loadTimeData.getBoolean('showMostvisited')) { 145 if (loadTimeData.getBoolean('showMostvisited')) {
161 var mostVisited = new ntp.MostVisitedPage(); 146 var mostVisited = new ntp.MostVisitedPage();
162 // Move the footer into the most visited page if we are in "bare minimum" 147 // Move the footer into the most visited page if we are in "bare minimum"
163 // mode. 148 // mode.
164 if (document.body.classList.contains('bare-minimum')) 149 if (document.body.classList.contains('bare-minimum'))
165 mostVisited.appendFooter(getRequiredElement('footer')); 150 mostVisited.appendFooter(getRequiredElement('footer'));
166 newTabView.appendTilePage(mostVisited, 151 newTabView.appendTilePage(mostVisited,
167 loadTimeData.getString('mostvisited'), 152 loadTimeData.getString('mostvisited'),
168 false); 153 false);
169 chrome.send('getMostVisited'); 154 chrome.send('getMostVisited');
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 headerContainer.style.backgroundImage = iconURL ? url(iconURL) : 'none'; 553 headerContainer.style.backgroundImage = iconURL ? url(iconURL) : 'none';
569 } 554 }
570 555
571 if (shouldShowLoginBubble) { 556 if (shouldShowLoginBubble) {
572 window.setTimeout(loginBubble.show.bind(loginBubble), 0); 557 window.setTimeout(loginBubble.show.bind(loginBubble), 0);
573 chrome.send('loginMessageSeen'); 558 chrome.send('loginMessageSeen');
574 shouldShowLoginBubble = false; 559 shouldShowLoginBubble = false;
575 } else if (loginBubble) { 560 } else if (loginBubble) {
576 loginBubble.reposition(); 561 loginBubble.reposition();
577 } 562 }
578 if (otherSessionsButton) {
579 otherSessionsButton.updateSignInState(isUserSignedIn);
580 layoutFooter();
581 }
582 } 563 }
583 564
584 /** 565 /**
585 * Show the sync login UI. 566 * Show the sync login UI.
586 * @param {Event} e The click event. 567 * @param {Event} e The click event.
587 */ 568 */
588 function showSyncLoginUI(e) { 569 function showSyncLoginUI(e) {
589 var rect = e.currentTarget.getBoundingClientRect(); 570 var rect = e.currentTarget.getBoundingClientRect();
590 chrome.send('showSyncLoginUI', 571 chrome.send('showSyncLoginUI',
591 [rect.left, rect.top, rect.width, rect.height]); 572 [rect.left, rect.top, rect.width, rect.height]);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 638 }
658 639
659 /** 640 /**
660 * Called whenever tiles should be re-arranging themselves out of the way 641 * Called whenever tiles should be re-arranging themselves out of the way
661 * of a moving or insert tile. 642 * of a moving or insert tile.
662 */ 643 */
663 function enterRearrangeMode() { 644 function enterRearrangeMode() {
664 newTabView.enterRearrangeMode(); 645 newTabView.enterRearrangeMode();
665 } 646 }
666 647
667 function setForeignSessions(sessionList, isTabSyncEnabled) {
668 if (otherSessionsButton) {
669 otherSessionsButton.setForeignSessions(sessionList, isTabSyncEnabled);
670 layoutFooter();
671 }
672 }
673
674 /** 648 /**
675 * Callback invoked by chrome with the apps available. 649 * Callback invoked by chrome with the apps available.
676 * 650 *
677 * Note that calls to this function can occur at any time, not just in 651 * Note that calls to this function can occur at any time, not just in
678 * response to a getApps request. For example, when a user 652 * response to a getApps request. For example, when a user
679 * installs/uninstalls an app on another synchronized devices. 653 * installs/uninstalls an app on another synchronized devices.
680 * @param {Object} data An object with all the data on available 654 * @param {Object} data An object with all the data on available
681 * applications. 655 * applications.
682 */ 656 */
683 function getAppsCallback(data) { 657 function getAppsCallback(data) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 getAppsCallback: getAppsCallback, 703 getAppsCallback: getAppsCallback,
730 getAppsPageIndex: getAppsPageIndex, 704 getAppsPageIndex: getAppsPageIndex,
731 getCardSlider: getCardSlider, 705 getCardSlider: getCardSlider,
732 onLoad: onLoad, 706 onLoad: onLoad,
733 leaveRearrangeMode: leaveRearrangeMode, 707 leaveRearrangeMode: leaveRearrangeMode,
734 logTimeToClick: logTimeToClick, 708 logTimeToClick: logTimeToClick,
735 NtpFollowAction: NtpFollowAction, 709 NtpFollowAction: NtpFollowAction,
736 saveAppPageName: saveAppPageName, 710 saveAppPageName: saveAppPageName,
737 setAppToBeHighlighted: setAppToBeHighlighted, 711 setAppToBeHighlighted: setAppToBeHighlighted,
738 setBookmarkBarAttached: setBookmarkBarAttached, 712 setBookmarkBarAttached: setBookmarkBarAttached,
739 setForeignSessions: setForeignSessions,
740 setMostVisitedPages: setMostVisitedPages, 713 setMostVisitedPages: setMostVisitedPages,
741 setFaviconDominantColor: setFaviconDominantColor, 714 setFaviconDominantColor: setFaviconDominantColor,
742 showNotification: showNotification, 715 showNotification: showNotification,
743 themeChanged: themeChanged, 716 themeChanged: themeChanged,
744 updateLogin: updateLogin 717 updateLogin: updateLogin
745 }; 718 };
746 }); 719 });
747 720
748 document.addEventListener('DOMContentLoaded', ntp.onLoad); 721 document.addEventListener('DOMContentLoaded', ntp.onLoad);
749 722
750 var toCssPx = cr.ui.toCssPx; 723 var toCssPx = cr.ui.toCssPx;
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.html ('k') | chrome/browser/resources/ntp4/other_sessions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698