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

Side by Side Diff: chrome/browser/resources/ntp_search/new_tab.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: Removing a trailing whitespace 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 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 function NewTabView() { 80 function NewTabView() {
81 var pageSwitcherStart = null; 81 var pageSwitcherStart = null;
82 var pageSwitcherEnd = null; 82 var pageSwitcherEnd = null;
83 if (loadTimeData.getValue('showApps')) { 83 if (loadTimeData.getValue('showApps')) {
84 pageSwitcherStart = getRequiredElement('page-switcher-start'); 84 pageSwitcherStart = getRequiredElement('page-switcher-start');
85 pageSwitcherEnd = getRequiredElement('page-switcher-end'); 85 pageSwitcherEnd = getRequiredElement('page-switcher-end');
86 } 86 }
87 this.initialize(getRequiredElement('page-list'), 87 this.initialize(getRequiredElement('page-list'),
88 getRequiredElement('dot-list'), 88 getRequiredElement('dot-list'),
89 getRequiredElement('card-slider-frame'), 89 getRequiredElement('card-slider-frame'),
90 // TODO(xci): remove the Trash component.
90 getRequiredElement('trash'), 91 getRequiredElement('trash'),
92 // TODO(xci): remove page switchers.
91 pageSwitcherStart, pageSwitcherEnd); 93 pageSwitcherStart, pageSwitcherEnd);
92 } 94 }
93 95
94 NewTabView.prototype = { 96 NewTabView.prototype = {
95 __proto__: ntp.PageListView.prototype, 97 __proto__: ntp.PageListView.prototype,
96 98
97 /** @inheritDoc */ 99 /** @inheritDoc */
98 appendTilePage: function(page, title, titleIsEditable, opt_refNode) { 100 appendTilePage: function(page, title, titleIsEditable, opt_refNode) {
99 ntp.PageListView.prototype.appendTilePage.apply(this, arguments); 101 ntp.PageListView.prototype.appendTilePage.apply(this, arguments);
100 102
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 440
439 function setMostVisitedPages(data, hasBlacklistedUrls) { 441 function setMostVisitedPages(data, hasBlacklistedUrls) {
440 newTabView.mostVisitedPage.data = data; 442 newTabView.mostVisitedPage.data = data;
441 cr.dispatchSimpleEvent(document, 'sectionready', true, true); 443 cr.dispatchSimpleEvent(document, 'sectionready', true, true);
442 } 444 }
443 445
444 function setSuggestionsPages(data, hasBlacklistedUrls) { 446 function setSuggestionsPages(data, hasBlacklistedUrls) {
445 newTabView.suggestionsPage.data = data; 447 newTabView.suggestionsPage.data = data;
446 } 448 }
447 449
448 /** 450 function getThumbnailUrl(url) {
449 * Set the dominant color for a node. This will be called in response to 451 return 'chrome://thumb/' + url;
450 * getFaviconDominantColor. The node represented by |id| better have a setter
451 * for stripeColor.
452 * @param {string} id The ID of a node.
453 * @param {string} color The color represented as a CSS string.
454 */
455 function setStripeColor(id, color) {
456 var node = $(id);
457 if (node)
458 node.stripeColor = color;
459 } 452 }
460 453
461 /** 454 /**
462 * Updates the text displayed in the login container. If there is no text then 455 * Updates the text displayed in the login container. If there is no text then
463 * the login container is hidden. 456 * the login container is hidden.
464 * @param {string} loginHeader The first line of text. 457 * @param {string} loginHeader The first line of text.
465 * @param {string} loginSubHeader The second line of text. 458 * @param {string} loginSubHeader The second line of text.
466 * @param {string} iconURL The url for the login status icon. If this is null 459 * @param {string} iconURL The url for the login status icon. If this is null
467 then the login status icon is hidden. 460 then the login status icon is hidden.
468 * @param {boolean} isUserSignedIn Indicates if the user is signed in or not. 461 * @param {boolean} isUserSignedIn Indicates if the user is signed in or not.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 // Return an object with all the exports 559 // Return an object with all the exports
567 return { 560 return {
568 appAdded: appAdded, 561 appAdded: appAdded,
569 appMoved: appMoved, 562 appMoved: appMoved,
570 appRemoved: appRemoved, 563 appRemoved: appRemoved,
571 appsPrefChangeCallback: appsPrefChangeCallback, 564 appsPrefChangeCallback: appsPrefChangeCallback,
572 enterRearrangeMode: enterRearrangeMode, 565 enterRearrangeMode: enterRearrangeMode,
573 getAppsCallback: getAppsCallback, 566 getAppsCallback: getAppsCallback,
574 getAppsPageIndex: getAppsPageIndex, 567 getAppsPageIndex: getAppsPageIndex,
575 getCardSlider: getCardSlider, 568 getCardSlider: getCardSlider,
569 getThumbnailUrl: getThumbnailUrl,
576 onLoad: onLoad, 570 onLoad: onLoad,
577 leaveRearrangeMode: leaveRearrangeMode, 571 leaveRearrangeMode: leaveRearrangeMode,
578 NtpFollowAction: NtpFollowAction, 572 NtpFollowAction: NtpFollowAction,
579 saveAppPageName: saveAppPageName, 573 saveAppPageName: saveAppPageName,
580 setAppToBeHighlighted: setAppToBeHighlighted, 574 setAppToBeHighlighted: setAppToBeHighlighted,
581 setBookmarkBarAttached: setBookmarkBarAttached, 575 setBookmarkBarAttached: setBookmarkBarAttached,
582 setForeignSessions: setForeignSessions, 576 setForeignSessions: setForeignSessions,
583 setMostVisitedPages: setMostVisitedPages, 577 setMostVisitedPages: setMostVisitedPages,
584 setSuggestionsPages: setSuggestionsPages, 578 setSuggestionsPages: setSuggestionsPages,
585 setRecentlyClosedTabs: setRecentlyClosedTabs, 579 setRecentlyClosedTabs: setRecentlyClosedTabs,
586 setStripeColor: setStripeColor,
587 showNotification: showNotification, 580 showNotification: showNotification,
588 themeChanged: themeChanged, 581 themeChanged: themeChanged,
589 updateLogin: updateLogin 582 updateLogin: updateLogin
590 }; 583 };
591 }); 584 });
592 585
593 document.addEventListener('DOMContentLoaded', ntp.onLoad); 586 document.addEventListener('DOMContentLoaded', ntp.onLoad);
594 587
595 var toCssPx = cr.ui.toCssPx; 588 var toCssPx = cr.ui.toCssPx;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698