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

Side by Side Diff: ui/file_manager/video_player/js/video_player.js

Issue 1994563002: Remove the use of KeyEvent.keyIdentifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * @param {!HTMLElement} playerContainer Main container. 6 * @param {!HTMLElement} playerContainer Main container.
7 * @param {!HTMLElement} videoContainer Container for the video element. 7 * @param {!HTMLElement} videoContainer Container for the video element.
8 * @param {!HTMLElement} controlsContainer Container for video controls. 8 * @param {!HTMLElement} controlsContainer Container for video controls.
9 * @constructor 9 * @constructor
10 * @struct 10 * @struct
(...skipping 12 matching lines...) Expand all
23 23
24 this.casting = false; 24 this.casting = false;
25 25
26 var currentWindow = chrome.app.window.current(); 26 var currentWindow = chrome.app.window.current();
27 currentWindow.onFullscreened.addListener( 27 currentWindow.onFullscreened.addListener(
28 this.onFullScreenChanged.bind(this, true)); 28 this.onFullScreenChanged.bind(this, true));
29 currentWindow.onRestored.addListener( 29 currentWindow.onRestored.addListener(
30 this.onFullScreenChanged.bind(this, false)); 30 this.onFullScreenChanged.bind(this, false));
31 document.addEventListener('keydown', function(e) { 31 document.addEventListener('keydown', function(e) {
32 this.inactivityWatcher_.kick(); 32 this.inactivityWatcher_.kick();
33 switch (util.getKeyModifiers(e) + e.keyIdentifier) { 33 switch (util.getKeyModifiers(e) + e.key) {
34 // Handle debug shortcut keys. 34 // Handle debug shortcut keys.
35 case 'Ctrl-Shift-U+0049': // Ctrl+Shift+I 35 case 'Ctrl-Shift-I': // Ctrl+Shift+I
36 chrome.fileManagerPrivate.openInspector('normal'); 36 chrome.fileManagerPrivate.openInspector('normal');
37 break; 37 break;
38 case 'Ctrl-Shift-U+004A': // Ctrl+Shift+J 38 case 'Ctrl-Shift-J': // Ctrl+Shift+J
39 chrome.fileManagerPrivate.openInspector('console'); 39 chrome.fileManagerPrivate.openInspector('console');
40 break; 40 break;
41 case 'Ctrl-Shift-U+0043': // Ctrl+Shift+C 41 case 'Ctrl-Shift-C': // Ctrl+Shift+C
42 chrome.fileManagerPrivate.openInspector('element'); 42 chrome.fileManagerPrivate.openInspector('element');
43 break; 43 break;
44 case 'Ctrl-Shift-U+0042': // Ctrl+Shift+B 44 case 'Ctrl-Shift-B': // Ctrl+Shift+B
45 chrome.fileManagerPrivate.openInspector('background'); 45 chrome.fileManagerPrivate.openInspector('background');
46 break; 46 break;
47 47
48 case 'U+0020': // Space 48 case ' ': // Space
49 case 'U+004B': // K 49 case 'k':
50 case 'MediaPlayPause': 50 case 'MediaPlayPause':
51 if (!e.target.classList.contains('menu-button')) 51 if (!e.target.classList.contains('menu-button'))
52 this.togglePlayStateWithFeedback(); 52 this.togglePlayStateWithFeedback();
53 break; 53 break;
54 case 'U+001B': // Escape 54 case 'Escape':
55 util.toggleFullScreen( 55 util.toggleFullScreen(
56 chrome.app.window.current(), 56 chrome.app.window.current(),
57 false); // Leave the full screen mode. 57 false); // Leave the full screen mode.
58 break; 58 break;
59 case 'MediaNextTrack': 59 case 'MediaTrackNext':
60 player.advance_(1); 60 player.advance_(1);
61 break; 61 break;
62 case 'MediaPreviousTrack': 62 case 'MediaTrackPrevious':
63 player.advance_(0); 63 player.advance_(0);
64 break; 64 break;
65 case 'Right': 65 case 'ArrowRight':
66 if (!e.target.classList.contains('volume')) 66 if (!e.target.classList.contains('volume'))
67 this.smallSkip(true); 67 this.smallSkip(true);
68 break; 68 break;
69 case 'Left': 69 case 'ArrowLeft':
70 if (!e.target.classList.contains('volume')) 70 if (!e.target.classList.contains('volume'))
71 this.smallSkip(false); 71 this.smallSkip(false);
72 break; 72 break;
73 case 'U+004C': // L 73 case 'l':
74 this.bigSkip(true); 74 this.bigSkip(true);
75 break; 75 break;
76 case 'U+004A': // J 76 case 'j':
77 this.bigSkip(false); 77 this.bigSkip(false);
78 break; 78 break;
79 case 'MediaStop': 79 case 'MediaStop':
80 // TODO: Define "Stop" behavior. 80 // TODO: Define "Stop" behavior.
81 break; 81 break;
82 } 82 }
83 }.wrap(this)); 83 }.wrap(this));
84 document.addEventListener('keypress', function(e) { 84 document.addEventListener('keypress', function(e) {
85 this.inactivityWatcher_.kick(); 85 this.inactivityWatcher_.kick();
86 }.wrap(this)); 86 }.wrap(this));
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 return new Promise(function(fulfill, reject) { 813 return new Promise(function(fulfill, reject) {
814 util.URLsToEntries(window.appState.items, function(entries) { 814 util.URLsToEntries(window.appState.items, function(entries) {
815 metrics.recordOpenVideoPlayerAction(); 815 metrics.recordOpenVideoPlayerAction();
816 metrics.recordNumberOfOpenedFiles(entries.length); 816 metrics.recordNumberOfOpenedFiles(entries.length);
817 817
818 player.prepare(entries); 818 player.prepare(entries);
819 player.playFirstVideo(player, fulfill); 819 player.playFirstVideo(player, fulfill);
820 }.wrap()); 820 }.wrap());
821 }.wrap()); 821 }.wrap());
822 }.wrap()); 822 }.wrap());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698