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

Side by Side Diff: chrome/browser/resources/ntp_search/page_list_view.js

Issue 10829131: Refactoring NTP5: new implementation of TilePage and MostVisitedPage (which now inherits from Thumb… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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 PageListView implementation. 6 * @fileoverview PageListView implementation.
7 * PageListView manages page list, dot list, switcher buttons and handles apps 7 * PageListView manages page list, dot list, switcher buttons and handles apps
8 * pages callbacks from backend. 8 * pages callbacks from backend.
9 * 9 *
10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. 10 * Note that you need to have AppLauncherHandler in your WebUI to use this code.
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (this.suggestionsPage) 495 if (this.suggestionsPage)
496 this.cardSlider.selectCardByValue(this.suggestionsPage); 496 this.cardSlider.selectCardByValue(this.suggestionsPage);
497 break; 497 break;
498 } 498 }
499 }, 499 },
500 500
501 /** 501 /**
502 * Called whenever tiles should be re-arranging themselves out of the way 502 * Called whenever tiles should be re-arranging themselves out of the way
503 * of a moving or insert tile. 503 * of a moving or insert tile.
504 */ 504 */
505 // TODO(xci) delete
505 enterRearrangeMode: function() { 506 enterRearrangeMode: function() {
507 return;
506 if (loadTimeData.getBoolean('showApps')) { 508 if (loadTimeData.getBoolean('showApps')) {
507 var tempPage = new ntp.AppsPage(); 509 var tempPage = new ntp.AppsPage();
508 tempPage.classList.add('temporary'); 510 tempPage.classList.add('temporary');
509 var pageName = loadTimeData.getString('appDefaultPageName'); 511 var pageName = loadTimeData.getString('appDefaultPageName');
510 this.appendTilePage(tempPage, pageName, true); 512 this.appendTilePage(tempPage, pageName, true);
511 } 513 }
512 514
513 if (ntp.getCurrentlyDraggingTile().firstChild.canBeRemoved()) 515 if (ntp.getCurrentlyDraggingTile().firstChild.canBeRemoved())
514 $('footer').classList.add('showing-trash-mode'); 516 $('footer').classList.add('showing-trash-mode');
515 517
516 document.documentElement.classList.add('dragging-mode'); 518 document.documentElement.classList.add('dragging-mode');
517 }, 519 },
518 520
519 /** 521 /**
520 * Invoked whenever some app is released 522 * Invoked whenever some app is released
521 */ 523 */
524 // TODO(xci) delete
522 leaveRearrangeMode: function() { 525 leaveRearrangeMode: function() {
526 return;
523 var tempPage = document.querySelector('.tile-page.temporary'); 527 var tempPage = document.querySelector('.tile-page.temporary');
524 if (tempPage) { 528 if (tempPage) {
525 var dot = tempPage.navigationDot; 529 var dot = tempPage.navigationDot;
526 if (!tempPage.tileCount && 530 if (!tempPage.tileCount &&
527 tempPage != this.cardSlider.currentCardValue) { 531 tempPage != this.cardSlider.currentCardValue) {
528 this.removeTilePageAndDot_(tempPage, true); 532 this.removeTilePageAndDot_(tempPage, true);
529 } else { 533 } else {
530 tempPage.classList.remove('temporary'); 534 tempPage.classList.remove('temporary');
531 this.saveAppPageName(tempPage, 535 this.saveAppPageName(tempPage,
532 loadTimeData.getString('appDefaultPageName')); 536 loadTimeData.getString('appDefaultPageName'));
(...skipping 15 matching lines...) Expand all
548 } 552 }
549 553
550 this.updatePageSwitchers(); 554 this.updatePageSwitchers();
551 }, 555 },
552 556
553 /** 557 /**
554 * Adjusts the size and position of the page switchers according to the 558 * Adjusts the size and position of the page switchers according to the
555 * layout of the current card. 559 * layout of the current card.
556 */ 560 */
557 updatePageSwitchers: function() { 561 updatePageSwitchers: function() {
562 return; // TODO(xci) delete
558 if (!this.pageSwitcherStart || !this.pageSwitcherEnd) 563 if (!this.pageSwitcherStart || !this.pageSwitcherEnd)
559 return; 564 return;
560 565
561 var page = this.cardSlider.currentCardValue; 566 var page = this.cardSlider.currentCardValue;
562 567
563 this.pageSwitcherStart.hidden = !page || 568 this.pageSwitcherStart.hidden = !page ||
564 (this.cardSlider.currentCard == 0); 569 (this.cardSlider.currentCard == 0);
565 this.pageSwitcherEnd.hidden = !page || 570 this.pageSwitcherEnd.hidden = !page ||
566 (this.cardSlider.currentCard == this.cardSlider.cardCount - 1); 571 (this.cardSlider.currentCard == this.cardSlider.cardCount - 1);
567 572
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 if (page.navigationDot) 763 if (page.navigationDot)
759 page.navigationDot.remove(opt_animate); 764 page.navigationDot.remove(opt_animate);
760 this.cardSlider.removeCard(page); 765 this.cardSlider.removeCard(page);
761 }, 766 },
762 }; 767 };
763 768
764 return { 769 return {
765 PageListView: PageListView 770 PageListView: PageListView
766 }; 771 };
767 }); 772 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698