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

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

Issue 12387036: Bookmark manager: Handle "copy", "cut"and "paste" events only when list or tree pane active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/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 (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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 undoDelete(); 1690 undoDelete();
1691 break; 1691 break;
1692 } 1692 }
1693 } 1693 }
1694 1694
1695 // Execute the copy, cut and paste commands when those events are dispatched by 1695 // Execute the copy, cut and paste commands when those events are dispatched by
1696 // the browser. This allows us to rely on the browser to handle the keyboard 1696 // the browser. This allows us to rely on the browser to handle the keyboard
1697 // shortcuts for these commands. 1697 // shortcuts for these commands.
1698 function installEventHandlerForCommand(eventName, commandId) { 1698 function installEventHandlerForCommand(eventName, commandId) {
1699 function handle(e) { 1699 function handle(e) {
1700 if (document.activeElement != list || document.activeElement != tree)
1701 return;
1700 var command = $(commandId); 1702 var command = $(commandId);
1701 if (!command.disabled) { 1703 if (!command.disabled) {
1702 command.execute(); 1704 command.execute();
1703 if (e) 1705 if (e)
1704 e.preventDefault(); // Prevent the system beep. 1706 e.preventDefault(); // Prevent the system beep.
1705 } 1707 }
1706 } 1708 }
1707 if (eventName == 'paste') { 1709 if (eventName == 'paste') {
1708 // Paste is a bit special since we need to do an async call to see if we 1710 // Paste is a bit special since we need to do an async call to see if we
1709 // can paste because the paste command might not be up to date. 1711 // can paste because the paste command might not be up to date.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 }); 1814 });
1813 1815
1814 initializeSplitter(); 1816 initializeSplitter();
1815 bmm.addBookmarkModelListeners(); 1817 bmm.addBookmarkModelListeners();
1816 dnd.init(); 1818 dnd.init();
1817 tree.reload(); 1819 tree.reload();
1818 } 1820 }
1819 1821
1820 initializeBookmarkManager(); 1822 initializeBookmarkManager();
1821 })(); 1823 })();
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