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

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

Issue 7610014: [ntp4] Bookmarks page implementation, first-pass. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Code tweak for rebase. Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 182
183 cr.ui.decorate($('recently-closed-menu-button'), ntp4.RecentMenuButton); 183 cr.ui.decorate($('recently-closed-menu-button'), ntp4.RecentMenuButton);
184 chrome.send('getRecentlyClosedTabs'); 184 chrome.send('getRecentlyClosedTabs');
185 185
186 mostVisitedPage = new ntp4.MostVisitedPage(); 186 mostVisitedPage = new ntp4.MostVisitedPage();
187 appendTilePage(mostVisitedPage, localStrings.getString('mostvisited')); 187 appendTilePage(mostVisitedPage, localStrings.getString('mostvisited'));
188 chrome.send('getMostVisited'); 188 chrome.send('getMostVisited');
189 189
190 bookmarksPage = new ntp4.BookmarksPage(); 190 bookmarksPage = new ntp4.BookmarksPage();
191 appendTilePage(bookmarksPage, localStrings.getString('bookmarksPage')); 191 appendTilePage(bookmarksPage, localStrings.getString('bookmarksPage'));
192 chrome.send('getBookmarks'); 192 // TODO(csilv): persist last folder
193 chrome.send('getBookmarksData', ['0']);
Evan Stade 2011/08/12 21:13:30 you should make it pass no arguments for the root
arv (Not doing code reviews) 2011/08/13 01:02:07 Bookmark IDs are int64 so this needs to be done as
csilv 2011/08/13 01:09:21 Done.
193 } 194 }
194 195
195 /** 196 /**
196 * Simple common assertion API 197 * Simple common assertion API
197 * @param {*} condition The condition to test. Note that this may be used to 198 * @param {*} condition The condition to test. Note that this may be used to
198 * test whether a value is defined or not, and we don't want to force a 199 * test whether a value is defined or not, and we don't want to force a
199 * cast to Boolean. 200 * cast to Boolean.
200 * @param {string=} opt_message A message to use in any error. 201 * @param {string=} opt_message A message to use in any error.
201 */ 202 */
202 function assert(condition, opt_message) { 203 function assert(condition, opt_message) {
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 } 664 }
664 665
665 function setRecentlyClosedTabs(dataItems) { 666 function setRecentlyClosedTabs(dataItems) {
666 $('recently-closed-menu-button').dataItems = dataItems; 667 $('recently-closed-menu-button').dataItems = dataItems;
667 } 668 }
668 669
669 function setMostVisitedPages(data, hasBlacklistedUrls) { 670 function setMostVisitedPages(data, hasBlacklistedUrls) {
670 mostVisitedPage.data = data; 671 mostVisitedPage.data = data;
671 } 672 }
672 673
674 function setBookmarksData(data) {
675 bookmarksPage.data = data;
676 }
677
673 /** 678 /**
674 * Check the directionality of the page. 679 * Check the directionality of the page.
675 * @return {boolean} True if Chrome is running an RTL UI. 680 * @return {boolean} True if Chrome is running an RTL UI.
676 */ 681 */
677 function isRTL() { 682 function isRTL() {
678 return document.documentElement.dir == 'rtl'; 683 return document.documentElement.dir == 'rtl';
679 } 684 }
680 685
681 /* 686 /*
682 * Save the name of an app page. 687 * Save the name of an app page.
(...skipping 16 matching lines...) Expand all
699 enterRearrangeMode: enterRearrangeMode, 704 enterRearrangeMode: enterRearrangeMode,
700 getAppsCallback: getAppsCallback, 705 getAppsCallback: getAppsCallback,
701 getCardSlider: getCardSlider, 706 getCardSlider: getCardSlider,
702 getAppsPageIndex: getAppsPageIndex, 707 getAppsPageIndex: getAppsPageIndex,
703 initialize: initialize, 708 initialize: initialize,
704 isRTL: isRTL, 709 isRTL: isRTL,
705 leaveRearrangeMode: leaveRearrangeMode, 710 leaveRearrangeMode: leaveRearrangeMode,
706 themeChanged: themeChanged, 711 themeChanged: themeChanged,
707 setRecentlyClosedTabs: setRecentlyClosedTabs, 712 setRecentlyClosedTabs: setRecentlyClosedTabs,
708 setMostVisitedPages: setMostVisitedPages, 713 setMostVisitedPages: setMostVisitedPages,
714 setBookmarksData: setBookmarksData,
Evan Stade 2011/08/12 21:13:30 can you alphabetize this list
csilv 2011/08/13 01:09:21 Done.
709 showNotification: showNotification, 715 showNotification: showNotification,
710 saveAppPageName: saveAppPageName 716 saveAppPageName: saveAppPageName
711 }; 717 };
712 }); 718 });
713 719
714 // publish ntp globals 720 // publish ntp globals
715 // TODO(estade): update the content handlers to use ntp namespace instead of 721 // TODO(estade): update the content handlers to use ntp namespace instead of
716 // making these global. 722 // making these global.
717 var assert = ntp4.assert; 723 var assert = ntp4.assert;
718 var getAppsCallback = ntp4.getAppsCallback; 724 var getAppsCallback = ntp4.getAppsCallback;
719 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; 725 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback;
720 var themeChanged = ntp4.themeChanged; 726 var themeChanged = ntp4.themeChanged;
721 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; 727 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs;
722 var setMostVisitedPages = ntp4.setMostVisitedPages; 728 var setMostVisitedPages = ntp4.setMostVisitedPages;
723 729
724 document.addEventListener('DOMContentLoaded', ntp4.initialize); 730 document.addEventListener('DOMContentLoaded', ntp4.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698