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

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

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