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

Side by Side 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, 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 | « chrome/browser/resources/file_manager/js/photo/gallery.js ('k') | 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 /** 5 /**
6 * Namespace for utility functions. 6 * Namespace for utility functions.
7 */ 7 */
8 var util = {}; 8 var util = {};
9 9
10 /** 10 /**
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 * suffix like "x86-mario-something". 1240 * suffix like "x86-mario-something".
1241 * @return {boolean} True if the board of the device matches the given prefix. 1241 * @return {boolean} True if the board of the device matches the given prefix.
1242 */ 1242 */
1243 util.boardIs = function(boardPrefix) { 1243 util.boardIs = function(boardPrefix) {
1244 // The board name should be lower-cased, but making it case-insensitive for 1244 // The board name should be lower-cased, but making it case-insensitive for
1245 // backward compatibility just in case. 1245 // backward compatibility just in case.
1246 var board = str('CHROMEOS_RELEASE_BOARD'); 1246 var board = str('CHROMEOS_RELEASE_BOARD');
1247 var pattern = new RegExp('^' + boardPrefix, 'i'); 1247 var pattern = new RegExp('^' + boardPrefix, 'i');
1248 return board.match(pattern) != null; 1248 return board.match(pattern) != null;
1249 }; 1249 };
1250
1251 /**
1252 * Disabled browser shortcus key events on the given document.
1253 * @param {Element} element Element to be disabled browser shortcut keys on.
1254 */
1255 util.disableBrowserShortcutKeys = function(element) {
1256 element.addEventListener('keydown', function(e) {
1257 switch (util.getKeyModifiers(e) + e.keyCode) {
1258 case 'Ctrl-79': // Disable native Ctrl-O (open file).
1259 case 'Ctrl-83': // Disable native Ctrl-S (save as).
1260 case 'Ctrl-85': // Disable native Ctrl-U (view source).
1261 e.preventDefault();
1262 }
1263 });
1264 };
OLDNEW
« 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