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

Unified Diff: chrome/browser/resources/ntp_search/new_tab.js

Issue 11428075: NTP5: Implementing two rows option for Apps. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: NTP5: Implementing two rows option for Apps Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/ntp_search/new_tab.html ('k') | chrome/browser/resources/ntp_search/tile_page.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp_search/new_tab.js
diff --git a/chrome/browser/resources/ntp_search/new_tab.js b/chrome/browser/resources/ntp_search/new_tab.js
index b6daae5fd3f996d306454584c109ef8b3bcb8cee..a8659bc7cedd0bdf1129feee2394457bd6eafb4d 100644
--- a/chrome/browser/resources/ntp_search/new_tab.js
+++ b/chrome/browser/resources/ntp_search/new_tab.js
@@ -37,7 +37,7 @@ cr.define('ntp', function() {
* @type {number}
* @const
*/
- var HEIGHT_FOR_BOTTOM_PANEL = 558;
+ var HEIGHT_FOR_BOTTOM_PANEL = 531;
/**
* The Bottom Panel width required to show 6 cols of Tiles, which is used
@@ -75,6 +75,12 @@ cr.define('ntp', function() {
*/
var NORMAL_BOTTOM_PANEL_WIDTH = 500;
+ /**
+ * @type {number}
+ * @const
+ */
+ var TILE_ROW_HEIGHT = 100;
+
//----------------------------------------------------------------------------
/**
@@ -112,6 +118,27 @@ cr.define('ntp', function() {
var startTime;
/**
+ * The top position of the Bottom Panel.
+ * @type {number|undefined}
+ * @private
+ */
+ var bottomPanelOffsetTop;
+
+ /**
+ * The height of the Bottom Panel Header, in pixels.
+ * @type {number|undefined}
+ * @private
+ */
+ var headerHeight;
+
+ /**
+ * The height of the Bottom Panel Footer, in pixels.
+ * @type {number|undefined}
+ * @private
+ */
+ var footerHeight;
+
+ /**
* The time in milliseconds for most transitions. This should match what's
* in new_tab.css. Unfortunately there's no better way to try to time
* something to occur until after a transition has completed.
@@ -713,10 +740,29 @@ cr.define('ntp', function() {
// Finally, dispatch the layout method to the current page.
var currentPage = opt_page || this.cardSlider.currentCardValue;
+
+ var contentHeight = TILE_ROW_HEIGHT;
+ if (!opt_page && currentPage.config.scrollable) {
+ contentHeight = viewHeight - bottomPanelOffsetTop -
+ headerHeight - footerHeight;
+ contentHeight = Math.max(TILE_ROW_HEIGHT, contentHeight);
+ contentHeight = Math.min(2 * TILE_ROW_HEIGHT, contentHeight);
+ }
+ this.contentHeight_ = contentHeight;
+
+ $('card-slider-frame').style.height = contentHeight + 'px';
+
currentPage.layout(opt_animate);
},
/**
+ * @return {number} The height of the Bottom Panel's content.
+ */
+ get contentHeight() {
+ return this.contentHeight_;
+ },
+
+ /**
* @return {number} The width of the Bottom Panel's content.
*/
get contentWidth() {
@@ -768,6 +814,10 @@ cr.define('ntp', function() {
newTabView = new NewTabView();
+ bottomPanelOffsetTop = $('bottom-panel').offsetTop;
+ headerHeight = $('bottom-panel-header').offsetHeight;
+ footerHeight = $('bottom-panel-footer').offsetHeight;
+
notificationContainer = getRequiredElement('notification-container');
notificationContainer.addEventListener(
'webkitTransitionEnd', onNotificationTransitionEnd);
@@ -1074,6 +1124,10 @@ cr.define('ntp', function() {
newTabView.layout(opt_animate);
}
+ function getContentHeight() {
+ return newTabView.contentHeight;
+ }
+
function getContentWidth() {
return newTabView.contentWidth;
}
@@ -1081,12 +1135,14 @@ cr.define('ntp', function() {
// Return an object with all the exports
return {
APP_LAUNCH: APP_LAUNCH,
+ TILE_ROW_HEIGHT: TILE_ROW_HEIGHT,
appAdded: appAdded,
appMoved: appMoved,
appRemoved: appRemoved,
appsPrefChangeCallback: appsPrefChangeCallback,
getAppsCallback: getAppsCallback,
getCardSlider: getCardSlider,
+ getContentHeight: getContentHeight,
getContentWidth: getContentWidth,
getThumbnailUrl: getThumbnailUrl,
incrementHoveredThumbnailCount: incrementHoveredThumbnailCount,
« no previous file with comments | « chrome/browser/resources/ntp_search/new_tab.html ('k') | chrome/browser/resources/ntp_search/tile_page.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698