summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/ntp/most_visited.js
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-06 18:34:06 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-06 18:34:06 +0000
commit02b18209b05fc5c465d4518b9d7a4df1135c1a95 (patch)
tree1f79efbfd51b38a30f5441962e86752ea76956ca /chrome/browser/resources/ntp/most_visited.js
parent004f80b0ab3bc8467b4df5a15b3e2fe040569aee (diff)
downloadchromium_src-02b18209b05fc5c465d4518b9d7a4df1135c1a95.zip
chromium_src-02b18209b05fc5c465d4518b9d7a4df1135c1a95.tar.gz
chromium_src-02b18209b05fc5c465d4518b9d7a4df1135c1a95.tar.bz2
NTP: Adds a context menu to the apps section
This uses the cr Menu system and replaces the old options menu with a cr Menu. BUG=52446 TEST=Start chrome with enable-apps. Install some apps. Right clicking on an app should show a context menu. Clicking the wrench should show the same menu. Review URL: http://codereview.chromium.org/3315005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58648 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/ntp/most_visited.js')
-rw-r--r--chrome/browser/resources/ntp/most_visited.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/resources/ntp/most_visited.js b/chrome/browser/resources/ntp/most_visited.js
index 7dac8a4..bff2c1f 100644
--- a/chrome/browser/resources/ntp/most_visited.js
+++ b/chrome/browser/resources/ntp/most_visited.js
@@ -56,6 +56,10 @@ var MostVisited = (function() {
document.addEventListener('DOMContentLoaded',
bind(this.ensureSmallGridCorrect, this));
+ // Commands
+ document.addEventListener('command', bind(this.handleCommand_, this));
+ document.addEventListener('canExecute', bind(this.handleCanExecute_, this));
+
// DND
el.addEventListener('dragstart', bind(this.handleDragStart_, this));
el.addEventListener('dragenter', bind(this.handleDragEnter_, this));
@@ -300,6 +304,23 @@ var MostVisited = (function() {
return this.getMostVisitedLayoutRects_()[index];
},
+ // Commands
+
+ handleCommand_: function(e) {
+ var commandId = e.command.id;
+ switch (commandId) {
+ case 'clear-all-blacklisted':
+ this.clearAllBlacklisted();
+ chrome.send('getMostVisited');
+ break;
+ }
+ },
+
+ handleCanExecute_: function(e) {
+ if (e.command.id == 'clear-all-blacklisted')
+ e.canExecute = true;
+ },
+
// DND
currentOverItem_: null,