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

Side by Side Diff: chrome/browser/resources/bookmark_manager/js/main.js

Issue 12566031: Merge 186312 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1410/src/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** @const */ var BookmarkList = bmm.BookmarkList; 5 /** @const */ var BookmarkList = bmm.BookmarkList;
6 /** @const */ var BookmarkTree = bmm.BookmarkTree; 6 /** @const */ var BookmarkTree = bmm.BookmarkTree;
7 /** @const */ var Command = cr.ui.Command; 7 /** @const */ var Command = cr.ui.Command;
8 /** @const */ var CommandBinding = cr.ui.CommandBinding; 8 /** @const */ var CommandBinding = cr.ui.CommandBinding;
9 /** @const */ var LinkKind = cr.LinkKind; 9 /** @const */ var LinkKind = cr.LinkKind;
10 /** @const */ var ListItem = cr.ui.ListItem; 10 /** @const */ var ListItem = cr.ui.ListItem;
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1737 cr.isMac ? 'Enter' : 'F2'; 1737 cr.isMac ? 'Enter' : 'F2';
1738 1738
1739 document.addEventListener('command', handleCommand); 1739 document.addEventListener('command', handleCommand);
1740 1740
1741 // Execute the copy, cut and paste commands when those events are dispatched by 1741 // Execute the copy, cut and paste commands when those events are dispatched by
1742 // the browser. This allows us to rely on the browser to handle the keyboard 1742 // the browser. This allows us to rely on the browser to handle the keyboard
1743 // shortcuts for these commands. 1743 // shortcuts for these commands.
1744 (function() { 1744 (function() {
1745 function handle(id) { 1745 function handle(id) {
1746 return function(e) { 1746 return function(e) {
1747 if (document.activeElement != list && document.activeElement != tree)
1748 return;
1747 var command = $(id); 1749 var command = $(id);
1748 if (!command.disabled) { 1750 if (!command.disabled) {
1749 command.execute(); 1751 command.execute();
1750 if (e) e.preventDefault(); // Prevent the system beep. 1752 if (e) e.preventDefault(); // Prevent the system beep.
1751 } 1753 }
1752 }; 1754 };
1753 } 1755 }
1754 1756
1755 // Listen to copy, cut and paste events and execute the associated commands. 1757 // Listen to copy, cut and paste events and execute the associated commands.
1756 document.addEventListener('copy', handle('copy-command')); 1758 document.addEventListener('copy', handle('copy-command'));
1757 document.addEventListener('cut', handle('cut-command')); 1759 document.addEventListener('cut', handle('cut-command'));
1758 1760
1759 var pasteHandler = handle('paste-from-organize-menu-command'); 1761 var pasteHandler = handle('paste-from-organize-menu-command');
1760 document.addEventListener('paste', function(e) { 1762 document.addEventListener('paste', function(e) {
1761 // Paste is a bit special since we need to do an async call to see if we can 1763 // Paste is a bit special since we need to do an async call to see if we can
1762 // paste because the paste command might not be up to date. 1764 // paste because the paste command might not be up to date.
1763 updatePasteCommand(pasteHandler); 1765 updatePasteCommand(pasteHandler);
1764 }); 1766 });
1765 })(); 1767 })();
OLDNEW
« 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