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

Unified Diff: chrome/browser/resources/bookmark_manager/js/main.js

Issue 1089163002: Pressing 'Delete' key in bookmark manager's search box deletes bookmark. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/bookmark_manager/js/main.js
diff --git a/chrome/browser/resources/bookmark_manager/js/main.js b/chrome/browser/resources/bookmark_manager/js/main.js
index acfc3d7db701566ae61ea65a88c2c33d5ebf04f4..84f06a9e80931df87989636c294c652dbd2ae40f 100644
--- a/chrome/browser/resources/bookmark_manager/js/main.js
+++ b/chrome/browser/resources/bookmark_manager/js/main.js
@@ -470,6 +470,20 @@ function updatePasteCommand(opt_f) {
});
}
+function handleCanExecuteForSearchBox(e) {
+ var command = e.command;
+ switch (command.id) {
+ case 'delete-command':
+ case 'undo-command':
+ // Do nothing when delete is selected in search box.
+ // Pass the undo command through (fixes http://crbug.com/278112).
+ // Otherwise, because the global undo command has no visible UI, always
Bernhard Bauer 2015/04/15 14:54:45 Remove this sentence (see my comment above).
Deepak 2015/04/15 15:04:15 Done.
+ // enable it, and just make it a no-op if undo is not possible.
+ e.canExecute = false;
+ break;
+ }
+}
+
function handleCanExecuteForDocument(e) {
var command = e.command;
switch (command.id) {
@@ -488,14 +502,6 @@ function handleCanExecuteForDocument(e) {
!isUnmodifiable(bmm.tree.getBookmarkNodeById(bmm.list.parentId));
break;
- case 'undo-command':
- // If the search box is active, pass the undo command through
- // (fixes http://crbug.com/278112). Otherwise, because
- // the global undo command has no visible UI, always enable it, and
- // just make it a no-op if undo is not possible.
- e.canExecute = e.currentTarget.activeElement !== $('term');
Bernhard Bauer 2015/04/15 14:54:45 For the undo command we need to keep the behavior
Deepak 2015/04/15 15:04:14 Done.
- break;
-
default:
canExecuteForList(e);
if (!e.defaultPrevented)
@@ -1464,6 +1470,7 @@ function continueInitializeBookmarkManager(localizedStrings) {
});
$('term').addEventListener('search', handleSearch);
+ $('term').addEventListener('canExecute', handleCanExecuteForSearchBox);
$('folders-button').addEventListener('click', handleMenuButtonClicked);
$('organize-button').addEventListener('click', handleMenuButtonClicked);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698