OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function() { | 5 (function() { |
6 /** @const */ var BookmarkList = bmm.BookmarkList; | 6 /** @const */ var BookmarkList = bmm.BookmarkList; |
7 /** @const */ var BookmarkTree = bmm.BookmarkTree; | 7 /** @const */ var BookmarkTree = bmm.BookmarkTree; |
8 /** @const */ var Command = cr.ui.Command; | 8 /** @const */ var Command = cr.ui.Command; |
9 /** @const */ var CommandBinding = cr.ui.CommandBinding; | 9 /** @const */ var CommandBinding = cr.ui.CommandBinding; |
10 /** @const */ var LinkKind = cr.LinkKind; | 10 /** @const */ var LinkKind = cr.LinkKind; |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 case 'export-menu-command': | 452 case 'export-menu-command': |
453 // We can always execute the export-menu command. | 453 // We can always execute the export-menu command. |
454 e.canExecute = true; | 454 e.canExecute = true; |
455 break; | 455 break; |
456 case 'sort-command': | 456 case 'sort-command': |
457 e.canExecute = !list.isSearch() && | 457 e.canExecute = !list.isSearch() && |
458 list.dataModel && list.dataModel.length > 1 && | 458 list.dataModel && list.dataModel.length > 1 && |
459 !isUnmodifiable(tree.getBookmarkNodeById(list.parentId)); | 459 !isUnmodifiable(tree.getBookmarkNodeById(list.parentId)); |
460 break; | 460 break; |
461 case 'undo-command': | 461 case 'undo-command': |
462 // The global undo command has no visible UI, so always enable it, and | 462 // If the search box is active, pass the undo command through |
| 463 // (fixes http://crbug.com/278112). Otherwise, because |
| 464 // the global undo command has no visible UI, always enable it, and |
463 // just make it a no-op if undo is not possible. | 465 // just make it a no-op if undo is not possible. |
464 e.canExecute = true; | 466 e.canExecute = e.currentTarget.activeElement !== $('term'); |
465 break; | 467 break; |
466 default: | 468 default: |
467 canExecuteForList(e); | 469 canExecuteForList(e); |
468 break; | 470 break; |
469 } | 471 } |
470 } | 472 } |
471 | 473 |
472 /** | 474 /** |
473 * Helper function for handling canExecute for the list and the tree. | 475 * Helper function for handling canExecute for the list and the tree. |
474 * @param {!Event} e Can execute event object. | 476 * @param {!Event} e Can execute event object. |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 | 1379 |
1378 cr.ui.FocusOutlineManager.forDocument(document); | 1380 cr.ui.FocusOutlineManager.forDocument(document); |
1379 initializeSplitter(); | 1381 initializeSplitter(); |
1380 bmm.addBookmarkModelListeners(); | 1382 bmm.addBookmarkModelListeners(); |
1381 dnd.init(selectItemsAfterUserAction); | 1383 dnd.init(selectItemsAfterUserAction); |
1382 tree.reload(); | 1384 tree.reload(); |
1383 } | 1385 } |
1384 | 1386 |
1385 initializeBookmarkManager(); | 1387 initializeBookmarkManager(); |
1386 })(); | 1388 })(); |
OLD | NEW |