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

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

Issue 3455007: Make it possible to hide "most visited" on nnnnnnntp (Closed)
Patch Set: fix revert reasons Created 10 years, 3 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/new_tab_theme.css ('k') | chrome/browser/resources/ntp/most_visited.js » ('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 68a1be61ecebd8444af07cf08b601fcfe1805ab8..70018aa7e1eebbae0a895757881b059dd749415b 100644
--- a/chrome/browser/resources/ntp/apps.js
+++ b/chrome/browser/resources/ntp/apps.js
@@ -10,6 +10,7 @@ function getAppsCallback(data) {
appsSectionContent.textContent = '';
appsMiniview.textContent = '';
+ clearClosedMenu(apps.menu);
if (data.apps.length == 0) {
appsSection.classList.add('disabled');
layoutSections();
@@ -22,10 +23,14 @@ function getAppsCallback(data) {
data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) {
appsMiniview.appendChild(apps.createMiniviewElement(app));
+ addClosedMenuEntryWithLink(apps.menu, apps.createClosedMenuElement(app));
});
- appsSection.classList.remove('disabled');
+ if (!(shownSections & MINIMIZED_APPS)) {
+ appsSection.classList.remove('disabled');
+ }
}
+ addClosedMenuFooter(apps.menu, 'apps', MINIMIZED_APPS, Section.APPS);
apps.loaded = true;
maybeDoneLoading();
@@ -199,6 +204,8 @@ var apps = (function() {
return {
loaded: false,
+ menu: $('apps-menu'),
+
createElement: function(app) {
var div = createElement(app);
var a = div.firstChild;
@@ -221,7 +228,8 @@ var apps = (function() {
document.documentElement.setAttribute("install-animation-enabled",
"false");
});
- if ($('apps').classList.contains('hidden'))
+ if ($('apps').classList.contains('hidden') &&
+ !(shownSections & MINIMIZED_APPS))
toggleSectionVisibilityAndAnimate('APPS');
}
@@ -251,6 +259,17 @@ var apps = (function() {
return span;
},
+ createClosedMenuElement: function(app) {
+ var a = document.createElement('a');
+ a.setAttribute('app-id', app['id']);
+ a.textContent = app['name'];
+ a.href = app['launch_url'];
+ a.onclick = handleClick;
+ a.style.backgroundImage = url(app['icon_small']);
+ a.className = 'item';
+ return a;
+ },
+
createWebStoreElement: function() {
return createElement({
'id': 'web-store-entry',
« no previous file with comments | « chrome/browser/resources/new_tab_theme.css ('k') | chrome/browser/resources/ntp/most_visited.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698