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

Unified Diff: chrome/browser/resources/ntp/apps.js

Issue 3747007: Reserve right-most column of apps grid for web store icon. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: different approach Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/ntp/apps.css ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/ntp/apps.js
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js
index da91af7e8ce2737f6c9b517c09ee58864288a1f9..f925b85dfbfc152311d45e6e933b73b423706d8d 100644
--- a/chrome/browser/resources/ntp/apps.js
+++ b/chrome/browser/resources/ntp/apps.js
@@ -2,16 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+var MAX_APPS_PER_ROW = [];
+MAX_APPS_PER_ROW[LayoutMode.SMALL] = 4;
+MAX_APPS_PER_ROW[LayoutMode.NORMAL] = 6;
+
function getAppsCallback(data) {
logEvent('received apps');
var appsSection = $('apps');
- var appsSectionContent = $('apps-maxiview');
+ var appsSectionContent = $('apps-content');
var appsMiniview = appsSection.getElementsByClassName('miniview')[0];
var appsPromo = $('apps-promo');
+ var webStoreEntry = null;
arv (Not doing code reviews) 2010/10/15 22:33:36 do you really need to assign null here?
appsMiniview.textContent = '';
- while (appsSectionContent.lastChild != appsPromo) {
- appsSectionContent.removeChild(appsSectionContent.lastChild);
+ while (appsSectionContent.firstChild) {
arv (Not doing code reviews) 2010/10/15 22:33:36 Since you are now removing all of them you can jus
+ appsSectionContent.removeChild(appsSectionContent.firstChild);
}
data.apps.sort(function(a,b) {
@@ -24,10 +29,11 @@ function getAppsCallback(data) {
layoutSections();
} else {
data.apps.forEach(function(app) {
- appsSectionContent.appendChild(apps.createElement(app));
+ appsSectionContent.appendChild(apps.createElement(app));
});
- appsSectionContent.appendChild(apps.createWebStoreElement());
+ webStoreEntry = apps.createWebStoreElement();
+ appsSectionContent.appendChild(webStoreEntry);
data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
appsMiniview.appendChild(apps.createMiniviewElement(app));
@@ -48,6 +54,11 @@ function getAppsCallback(data) {
maybeDoneLoading();
if (data.apps.length > 0 && isDoneLoading()) {
+ if (!data.showPromo && data.apps.length >= MAX_APPS_PER_ROW[layoutMode])
+ webStoreEntry.classList.add('loner');
+ else
+ webStoreEntry.classList.remove('loner');
+
updateMiniviewClipping(appsMiniview);
layoutSections();
}
« no previous file with comments | « chrome/browser/resources/ntp/apps.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698