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

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

Issue 8038035: ntp4: re-enable bookmark pane (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.css ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 bubbleContent.hidden = false; 201 bubbleContent.hidden = false;
202 202
203 var learnMoreLink = infoBubble.querySelector('a'); 203 var learnMoreLink = infoBubble.querySelector('a');
204 learnMoreLink.href = localStrings.getString('ntp4_intro_url'); 204 learnMoreLink.href = localStrings.getString('ntp4_intro_url');
205 learnMoreLink.onclick = infoBubble.hide.bind(infoBubble); 205 learnMoreLink.onclick = infoBubble.hide.bind(infoBubble);
206 206
207 infoBubble.show(); 207 infoBubble.show();
208 chrome.send('introMessageSeen'); 208 chrome.send('introMessageSeen');
209 } 209 }
210 210
211 /*
212 bookmarksPage = new ntp4.BookmarksPage(); 211 bookmarksPage = new ntp4.BookmarksPage();
213 appendTilePage(bookmarksPage, localStrings.getString('bookmarksPage')); 212 appendTilePage(bookmarksPage, localStrings.getString('bookmarksPage'));
214 chrome.send('getBookmarksData'); 213 chrome.send('getBookmarksData');
215 */
216 214
217 var serverpromo = localStrings.getString('serverpromo'); 215 var serverpromo = localStrings.getString('serverpromo');
218 if (serverpromo) { 216 if (serverpromo) {
219 showNotification(parseHtmlSubset(serverpromo), [], function() { 217 showNotification(parseHtmlSubset(serverpromo), [], function() {
220 chrome.send('closePromo'); 218 chrome.send('closePromo');
221 }, 60000); 219 }, 60000);
222 } 220 }
223 } 221 }
224 222
225 /** 223 /**
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 * applications. 409 * applications.
412 */ 410 */
413 function appsPrefChangeCallback(data) { 411 function appsPrefChangeCallback(data) {
414 for (var i = 0; i < data.apps.length; ++i) { 412 for (var i = 0; i < data.apps.length; ++i) {
415 $(data.apps[i].id).appData = data.apps[i]; 413 $(data.apps[i].id).appData = data.apps[i];
416 } 414 }
417 415
418 // Set the App dot names. Skip the first and last dots (Most Visited and 416 // Set the App dot names. Skip the first and last dots (Most Visited and
419 // Bookmarks). 417 // Bookmarks).
420 var dots = dotList.getElementsByClassName('dot'); 418 var dots = dotList.getElementsByClassName('dot');
421 for (var i = 1; i < dots.length - 1; ++i) { 419 for (var i = 1; i < dots.length - 2; ++i) {
422 dots[i].displayTitle = data.appPageNames[i - 1] || ''; 420 dots[i].displayTitle = data.appPageNames[i - 1] || '';
423 } 421 }
424 } 422 }
425 423
426 /** 424 /**
427 * Listener for offline status change events. Updates apps that are 425 * Listener for offline status change events. Updates apps that are
428 * not offline-enabled to be grayscale if the browser is offline. 426 * not offline-enabled to be grayscale if the browser is offline.
429 */ 427 */
430 function updateOfflineEnabledApps() { 428 function updateOfflineEnabledApps() {
431 var apps = document.querySelectorAll('.app'); 429 var apps = document.querySelectorAll('.app');
(...skipping 10 matching lines...) Expand all
442 } 440 }
443 441
444 /** 442 /**
445 * Invoked whenever the pages in apps-page-list have changed so that 443 * Invoked whenever the pages in apps-page-list have changed so that
446 * the Slider knows about the new elements. 444 * the Slider knows about the new elements.
447 */ 445 */
448 function updateSliderCards() { 446 function updateSliderCards() {
449 var pageNo = Math.min(cardSlider.currentCard, tilePages.length - 1); 447 var pageNo = Math.min(cardSlider.currentCard, tilePages.length - 1);
450 cardSlider.setCards(Array.prototype.slice.call(tilePages), pageNo); 448 cardSlider.setCards(Array.prototype.slice.call(tilePages), pageNo);
451 switch (shownPage) { 449 switch (shownPage) {
452 case templateData['bookmarks_page_id']:
453 case templateData['apps_page_id']: 450 case templateData['apps_page_id']:
454 cardSlider.selectCardByValue( 451 cardSlider.selectCardByValue(
455 appsPages[Math.min(shownPageIndex, appsPages.length - 1)]); 452 appsPages[Math.min(shownPageIndex, appsPages.length - 1)]);
456 break; 453 break;
457 /* 454 case templateData['bookmarks_page_id']:
458 cardSlider.selectCardByValue(bookmarksPage); 455 cardSlider.selectCardByValue(bookmarksPage);
459 break; 456 break;
460 */
461 case templateData['most_visited_page_id']: 457 case templateData['most_visited_page_id']:
462 cardSlider.selectCardByValue(mostVisitedPage); 458 cardSlider.selectCardByValue(mostVisitedPage);
463 break; 459 break;
464 } 460 }
465 } 461 }
466 462
467 /** 463 /**
468 * Appends a tile page (for bookmarks or most visited). 464 * Appends a tile page (for bookmarks or most visited).
469 * 465 *
470 * @param {TilePage} page The page element. 466 * @param {TilePage} page The page element.
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 var assert = ntp4.assert; 862 var assert = ntp4.assert;
867 var getAppsCallback = ntp4.getAppsCallback; 863 var getAppsCallback = ntp4.getAppsCallback;
868 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback; 864 var appsPrefChangeCallback = ntp4.appsPrefChangeCallback;
869 var themeChanged = ntp4.themeChanged; 865 var themeChanged = ntp4.themeChanged;
870 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs; 866 var recentlyClosedTabs = ntp4.setRecentlyClosedTabs;
871 var setMostVisitedPages = ntp4.setMostVisitedPages; 867 var setMostVisitedPages = ntp4.setMostVisitedPages;
872 868
873 document.addEventListener('DOMContentLoaded', ntp4.initialize); 869 document.addEventListener('DOMContentLoaded', ntp4.initialize);
874 window.addEventListener('online', ntp4.updateOfflineEnabledApps); 870 window.addEventListener('online', ntp4.updateOfflineEnabledApps);
875 window.addEventListener('offline', ntp4.updateOfflineEnabledApps); 871 window.addEventListener('offline', ntp4.updateOfflineEnabledApps);
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab.css ('k') | chrome/browser/ui/webui/ntp/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698