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

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

Issue 5804005: Enable default apps by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 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/profiles/profile_impl.cc ('k') | chrome/common/chrome_switches.h » ('j') | 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 41a5ebf0d81cf18145c470d15d61b4fe6ae7fba0..2be85fa3b32bcd6cac8768dc0d077d24c036ea34 100644
--- a/chrome/browser/resources/ntp/apps.js
+++ b/chrome/browser/resources/ntp/apps.js
@@ -25,7 +25,7 @@ function getAppsCallback(data) {
var appsMiniview = appsSection.getElementsByClassName('miniview')[0];
var appsPromo = $('apps-promo');
var appsPromoPing = PING_WEBSTORE_LAUNCH_PREFIX + '+' + apps.showPromo;
- var webStoreEntry;
+ var webStoreEntry, webStoreMiniEntry;
// Hide menu options that are not supported on the OS or windowing system.
@@ -45,26 +45,28 @@ function getAppsCallback(data) {
});
clearClosedMenu(apps.menu);
- if (data.apps.length == 0 && !data.showLauncher) {
- appsSection.classList.add('disabled');
- layoutSections();
- } else {
- data.apps.forEach(function(app) {
- appsSectionContent.appendChild(apps.createElement(app));
- });
+ data.apps.forEach(function(app) {
+ appsSectionContent.appendChild(apps.createElement(app));
+ });
- webStoreEntry = apps.createWebStoreElement();
- webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
- appsSectionContent.appendChild(webStoreEntry);
+ webStoreEntry = apps.createWebStoreElement();
+ webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
+ appsSectionContent.appendChild(webStoreEntry);
- data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
- appsMiniview.appendChild(apps.createMiniviewElement(app));
- addClosedMenuEntryWithLink(apps.menu, apps.createClosedMenuElement(app));
- });
+ data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
+ appsMiniview.appendChild(apps.createMiniviewElement(app));
+ addClosedMenuEntryWithLink(apps.menu, apps.createClosedMenuElement(app));
+ });
+ if (data.apps.length < MAX_MINIVIEW_ITEMS) {
+ webStoreMiniEntry = apps.createWebStoreMiniElement();
+ webStoreEntry.querySelector('a').setAttribute('ping', appsPromoPing);
+ appsMiniview.appendChild(webStoreMiniEntry);
+ addClosedMenuEntryWithLink(apps.menu,
+ apps.createWebStoreClosedMenuElement());
+ }
- if (!(shownSections & MINIMIZED_APPS)) {
- appsSection.classList.remove('disabled');
- }
+ if (!(shownSections & MINIMIZED_APPS)) {
+ appsSection.classList.remove('disabled');
}
addClosedMenuFooter(apps.menu, 'apps', MINIMIZED_APPS, Section.APPS);
@@ -338,6 +340,21 @@ var apps = (function() {
});
elm.setAttribute('app-id', 'web-store-entry');
return elm;
+ },
+
+ createWebStoreMiniElement: function() {
+ var span = document.createElement('span');
+ span.appendChild(this.createWebStoreClosedMenuElement());
+ return span;
+ },
+
+ createWebStoreClosedMenuElement: function() {
+ var a = document.createElement('a');
+ a.textContent = localStrings.getString('web_store_title');
+ a.href = localStrings.getString('web_store_url');
+ a.style.backgroundImage = url('chrome://theme/IDR_PRODUCT_LOGO_16');
+ a.className = 'item';
+ return a;
}
};
})();
« no previous file with comments | « chrome/browser/profiles/profile_impl.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698