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

Unified Diff: chrome/browser/resources/file_manager/js/util.js

Issue 12381076: Files.app: Disables browser shortcut keys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « chrome/browser/resources/file_manager/js/photo/gallery.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/util.js
diff --git a/chrome/browser/resources/file_manager/js/util.js b/chrome/browser/resources/file_manager/js/util.js
index 97999b3a5c4032f25adab33ce07e3131fc09ce60..3879358657c10401d8c88039d2dc07885da06678 100644
--- a/chrome/browser/resources/file_manager/js/util.js
+++ b/chrome/browser/resources/file_manager/js/util.js
@@ -1247,3 +1247,18 @@ util.boardIs = function(boardPrefix) {
var pattern = new RegExp('^' + boardPrefix, 'i');
return board.match(pattern) != null;
};
+
+/**
+ * Disabled browser shortcus key events on the given document.
+ * @param {Element} element Element to be disabled browser shortcut keys on.
+ */
+util.disableBrowserShortcutKeys = function(element) {
+ element.addEventListener('keydown', function(e) {
+ switch (util.getKeyModifiers(e) + e.keyCode) {
+ case 'Ctrl-79': // Disable native Ctrl-O (open file).
+ case 'Ctrl-83': // Disable native Ctrl-S (save as).
+ case 'Ctrl-85': // Disable native Ctrl-U (view source).
+ e.preventDefault();
+ }
+ });
+};
« no previous file with comments | « chrome/browser/resources/file_manager/js/photo/gallery.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698