Chromium Code Reviews| 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..0a8fe315eb4c7b1dee3793cb2a2109727c7afe2b 100644 |
| --- a/chrome/browser/resources/bookmark_manager/js/main.js |
| +++ b/chrome/browser/resources/bookmark_manager/js/main.js |
| @@ -470,6 +470,18 @@ 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). |
|
Bernhard Bauer
2015/04/15 15:08:56
"Pass the delete and undo commands through".
Deepak
2015/04/15 15:20:38
Done.
|
| + e.canExecute = false; |
| + break; |
| + } |
| +} |
| + |
| function handleCanExecuteForDocument(e) { |
| var command = e.command; |
| switch (command.id) { |
| @@ -489,10 +501,8 @@ function handleCanExecuteForDocument(e) { |
| 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. |
| + // If search box is not active and the global undo command has no visible |
|
Bernhard Bauer
2015/04/15 15:08:56
You don't need to mention the part about the searc
Deepak
2015/04/15 15:20:38
Done.
|
| + // UI, always enable it, and just make it a no-op if undo is not possible. |
| e.canExecute = e.currentTarget.activeElement !== $('term'); |
| break; |
| @@ -1464,6 +1474,7 @@ function continueInitializeBookmarkManager(localizedStrings) { |
| }); |
| $('term').addEventListener('search', handleSearch); |
| + $('term').addEventListener('canExecute', handleCanExecuteForSearchBox); |
| $('folders-button').addEventListener('click', handleMenuButtonClicked); |
| $('organize-button').addEventListener('click', handleMenuButtonClicked); |