diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:38:31 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-20 00:38:31 +0000 |
commit | 09a9da72051e7543bd800167c88e5d56c523b5fe (patch) | |
tree | fef4e6a8108a6a4d4fed28260e7ff88271e09a78 | |
parent | 2899a5fb68f985f6565ab7b43c158a60ea0ed1ee (diff) | |
download | chromium_src-09a9da72051e7543bd800167c88e5d56c523b5fe.zip chromium_src-09a9da72051e7543bd800167c88e5d56c523b5fe.tar.gz chromium_src-09a9da72051e7543bd800167c88e5d56c523b5fe.tar.bz2 |
NTP: Fix context menu for apps in small and minimized mode.
BUG=63415
TEST=Install and App.
Go to the NTP
Right clicking on the app in expanded/small/minimized mode
This should bring up a context menu in all cases.
Review URL: http://codereview.chromium.org/5234005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66855 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/new_new_tab.html | 10 | ||||
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 19 |
2 files changed, 16 insertions, 13 deletions
diff --git a/chrome/browser/resources/new_new_tab.html b/chrome/browser/resources/new_new_tab.html index 001c378..bcf19b3 100644 --- a/chrome/browser/resources/new_new_tab.html +++ b/chrome/browser/resources/new_new_tab.html @@ -239,6 +239,11 @@ if ('mode' in hashParams) { <command id="apps-launch-type-fullscreen" i18n-values=".label:applaunchtypefullscreen" launch-type="2"> +<!-- These are populated dynamically --> +<menu id="apps-menu"></menu> +<menu id="most-visited-menu"></menu> +<menu id="recently-closed-menu"></menu> + <menu id="app-context-menu"> <button class="default" command="#apps-launch-command"></button> <hr> @@ -250,11 +255,6 @@ if ('mode' in hashParams) { <button command="#apps-uninstall-command"></button> </menu> -<!-- These are populated dynamically --> -<menu id="apps-menu"></menu> -<menu id="most-visited-menu"></menu> -<menu id="recently-closed-menu"></menu> - </body> <script src="shared/js/i18n_template.js"></script> diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 7069231..c8638c6 100644 --- a/chrome/browser/resources/ntp/apps.js +++ b/chrome/browser/resources/ntp/apps.js @@ -97,11 +97,6 @@ var apps = (function() { return div; } - function createContextMenu(app) { - var menu = new cr.ui.Menu; - var button = document.createElement(button); - } - function launchApp(appId) { var appsSection = $('apps'); var expanded = !appsSection.classList.contains('hidden'); @@ -174,10 +169,15 @@ var apps = (function() { $('apps-launch-command').label = app['name']; $('apps-options-command').canExecuteChange(); - var appLinkSel = '.app a[app-id=' + app['id'] + ']'; - var launchType = - el.querySelector(appLinkSel).getAttribute('launch-type'); + var launchTypeEl; + if (el.getAttribute('app-id') === app['id']) { + launchTypeEl = el; + } else { + appLinkSel = 'a[app-id=' + app['id'] + ']'; + launchTypeEl = el.querySelector(appLinkSel); + } + var launchType = launchTypeEl.getAttribute('launch-type'); var launchContainer = app['launch_container']; var isPanel = launchContainer == LaunchContainer.LAUNCH_PANEL; @@ -304,6 +304,9 @@ var apps = (function() { a.setAttribute('ping', PING_APP_LAUNCH_PREFIX + '+' + this.showPromo); a.style.backgroundImage = url(app['icon_small']); a.className = 'item'; + + addContextMenu(a, app); + return a; }, |