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

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

Issue 11953021: Don't show the apps page on the NTP if the app launcher is installed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make shouldShowApps a pref Created 7 years, 11 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 | Annotate | Revision Log
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 /** @override */ 104 /** @override */
105 appendTilePage: function(page, title, titleIsEditable, opt_refNode) { 105 appendTilePage: function(page, title, titleIsEditable, opt_refNode) {
106 ntp.PageListView.prototype.appendTilePage.apply(this, arguments); 106 ntp.PageListView.prototype.appendTilePage.apply(this, arguments);
107 107
108 if (promoBubble) 108 if (promoBubble)
109 window.setTimeout(promoBubble.reposition.bind(promoBubble), 0); 109 window.setTimeout(promoBubble.reposition.bind(promoBubble), 0);
110 } 110 }
111 }; 111 };
112 112
113 function gotShouldShowApps(shouldShowApps) {
114 if (shouldShowApps != loadTimeData.getBoolean('showApps')) {
115 // TODO(jeremya): update the UI in-place instead of reloading.
116 window.location.reload();
117 return;
118 }
119 }
120
113 /** 121 /**
114 * Invoked at startup once the DOM is available to initialize the app. 122 * Invoked at startup once the DOM is available to initialize the app.
115 */ 123 */
116 function onLoad() { 124 function onLoad() {
117 sectionsToWaitFor = loadTimeData.getBoolean('showApps') ? 2 : 1; 125 sectionsToWaitFor = loadTimeData.getBoolean('showApps') ? 2 : 1;
118 if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled')) 126 if (loadTimeData.getBoolean('isDiscoveryInNTPEnabled'))
119 sectionsToWaitFor++; 127 sectionsToWaitFor++;
120 measureNavDots(); 128 measureNavDots();
121 129
122 // Load the current theme colors. 130 // Load the current theme colors.
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 return { 629 return {
622 appAdded: appAdded, 630 appAdded: appAdded,
623 appMoved: appMoved, 631 appMoved: appMoved,
624 appRemoved: appRemoved, 632 appRemoved: appRemoved,
625 appsPrefChangeCallback: appsPrefChangeCallback, 633 appsPrefChangeCallback: appsPrefChangeCallback,
626 enterRearrangeMode: enterRearrangeMode, 634 enterRearrangeMode: enterRearrangeMode,
627 getAppsCallback: getAppsCallback, 635 getAppsCallback: getAppsCallback,
628 getAppsPageIndex: getAppsPageIndex, 636 getAppsPageIndex: getAppsPageIndex,
629 getCardSlider: getCardSlider, 637 getCardSlider: getCardSlider,
630 onLoad: onLoad, 638 onLoad: onLoad,
639 gotShouldShowApps: gotShouldShowApps,
631 leaveRearrangeMode: leaveRearrangeMode, 640 leaveRearrangeMode: leaveRearrangeMode,
632 logTimeToClick: logTimeToClick, 641 logTimeToClick: logTimeToClick,
633 NtpFollowAction: NtpFollowAction, 642 NtpFollowAction: NtpFollowAction,
634 saveAppPageName: saveAppPageName, 643 saveAppPageName: saveAppPageName,
635 setAppToBeHighlighted: setAppToBeHighlighted, 644 setAppToBeHighlighted: setAppToBeHighlighted,
636 setBookmarkBarAttached: setBookmarkBarAttached, 645 setBookmarkBarAttached: setBookmarkBarAttached,
637 setForeignSessions: setForeignSessions, 646 setForeignSessions: setForeignSessions,
638 setMostVisitedPages: setMostVisitedPages, 647 setMostVisitedPages: setMostVisitedPages,
639 setSuggestionsPages: setSuggestionsPages, 648 setSuggestionsPages: setSuggestionsPages,
640 setRecentlyClosedTabs: setRecentlyClosedTabs, 649 setRecentlyClosedTabs: setRecentlyClosedTabs,
641 setFaviconDominantColor: setFaviconDominantColor, 650 setFaviconDominantColor: setFaviconDominantColor,
642 showNotification: showNotification, 651 showNotification: showNotification,
643 themeChanged: themeChanged, 652 themeChanged: themeChanged,
644 updateLogin: updateLogin 653 updateLogin: updateLogin
645 }; 654 };
646 }); 655 });
647 656
657 // This will end up calling ntp.gotShouldShowApps.
658 chrome.send('getShouldShowApps');
Evan Stade 2013/01/23 23:34:24 this should probably be a part of onLoad
jeremya 2013/01/24 02:40:04 Why's that?
Evan Stade 2013/01/24 18:40:16 well, my thinking was that if gotShouldShowApps we
jeremya 2013/01/25 00:06:19 Right, that makes sense -- if we get the gotShould
648 document.addEventListener('DOMContentLoaded', ntp.onLoad); 659 document.addEventListener('DOMContentLoaded', ntp.onLoad);
649 660
650 var toCssPx = cr.ui.toCssPx; 661 var toCssPx = cr.ui.toCssPx;
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/ntp/app_launcher_handler.h » ('j') | chrome/browser/ui/webui/ntp/app_launcher_handler.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698