diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 23:58:13 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 23:58:13 +0000 |
commit | 6d9f4e810c1ac13e46b0fdd1c2ca64d8a64488ba (patch) | |
tree | 50b3473b2f8b286e0b6c73ad308f8f2325c6aaec /chrome/browser/resources/ntp/apps.js | |
parent | 73c4532bd7f5b84bc822a4acca5c5b8affef4129 (diff) | |
download | chromium_src-6d9f4e810c1ac13e46b0fdd1c2ca64d8a64488ba.zip chromium_src-6d9f4e810c1ac13e46b0fdd1c2ca64d8a64488ba.tar.gz chromium_src-6d9f4e810c1ac13e46b0fdd1c2ca64d8a64488ba.tar.bz2 |
Make it possible to hide "most visited" on nnnnnnntp
This implements http://folder/glen/chrome/spec/101_ntp/8_wish&sidebar mocks 2, 5, 6
It's a bit lame to use a bit in the "sections" bitmask to serialize the "should show?" information, but the damage here was done when someone decided to that "THUBMS bit missing" should mean "show a list instead" (instead of adding another bit for that).
BUG=55148
TEST=Hover "Most Visited" bar. Close button should appear. Clicking it should hide "Most Visited" area and add a button at the window edge. That button should have a menu that makes it possible to make the "Most Visited" area visible again. Also do this while multiple NTPs are open; the changes made in the front NTP should be synced to the background NTPs.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=61095
Review URL: http://codereview.chromium.org/3455007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61259 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/ntp/apps.js')
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 68a1be6..70018aa 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', |