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

Side by Side Diff: ui/file_manager/audio_player/js/audio_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 (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 * Overrided metadata worker's path. 6 * Overrided metadata worker's path.
7 * @type {string} 7 * @type {string}
8 */ 8 */
9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js';
10 10
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 }; 344 };
345 345
346 /** 346 /**
347 * Handles keydown event to open inspector with shortcut keys. 347 * Handles keydown event to open inspector with shortcut keys.
348 * 348 *
349 * @param {Event} event KeyDown event. 349 * @param {Event} event KeyDown event.
350 * @private 350 * @private
351 */ 351 */
352 AudioPlayer.prototype.onKeyDown_ = function(event) { 352 AudioPlayer.prototype.onKeyDown_ = function(event) {
353 switch (util.getKeyModifiers(event) + event.keyIdentifier) { 353 switch (util.getKeyModifiers(event) + event.key) {
354 case 'Ctrl-U+0057': // Ctrl+W => Close the player. 354 case 'Ctrl-w': // Ctrl+W => Close the player.
355 chrome.app.window.current().close(); 355 chrome.app.window.current().close();
356 break; 356 break;
357 357
358 // Handle debug shortcut keys. 358 // Handle debug shortcut keys.
359 case 'Ctrl-Shift-U+0049': // Ctrl+Shift+I 359 case 'Ctrl-Shift-I': // Ctrl+Shift+I
360 chrome.fileManagerPrivate.openInspector('normal'); 360 chrome.fileManagerPrivate.openInspector('normal');
361 break; 361 break;
362 case 'Ctrl-Shift-U+004A': // Ctrl+Shift+J 362 case 'Ctrl-Shift-J': // Ctrl+Shift+J
363 chrome.fileManagerPrivate.openInspector('console'); 363 chrome.fileManagerPrivate.openInspector('console');
364 break; 364 break;
365 case 'Ctrl-Shift-U+0043': // Ctrl+Shift+C 365 case 'Ctrl-Shift-C': // Ctrl+Shift+C
366 chrome.fileManagerPrivate.openInspector('element'); 366 chrome.fileManagerPrivate.openInspector('element');
367 break; 367 break;
368 case 'Ctrl-Shift-U+0042': // Ctrl+Shift+B 368 case 'Ctrl-Shift-B': // Ctrl+Shift+B
369 chrome.fileManagerPrivate.openInspector('background'); 369 chrome.fileManagerPrivate.openInspector('background');
370 break; 370 break;
371 371
372 case 'U+0020': // Space 372 case ' ': // Space
373 case 'U+004B': // K 373 case 'k':
374 this.player_.dispatchEvent(new Event('toggle-pause-event')); 374 this.player_.dispatchEvent(new Event('toggle-pause-event'));
375 break; 375 break;
376 case 'Up': 376 case 'ArrowUp':
377 case 'Right': 377 case 'ArrowRight':
378 if (event.target.id !== 'volumeSlider') 378 if (event.target.id !== 'volumeSlider')
379 this.player_.dispatchEvent(new Event('small-forward-skip-event')); 379 this.player_.dispatchEvent(new Event('small-forward-skip-event'));
380 break; 380 break;
381 case 'Down': 381 case 'ArrowDown':
382 case 'Left': 382 case 'ArrowLeft':
383 if (event.target.id !== 'volumeSlider') 383 if (event.target.id !== 'volumeSlider')
384 this.player_.dispatchEvent(new Event('small-backword-skip-event')); 384 this.player_.dispatchEvent(new Event('small-backword-skip-event'));
385 break; 385 break;
386 case 'U+004C': // L 386 case 'l':
387 this.player_.dispatchEvent(new Event('big-forward-skip-event')); 387 this.player_.dispatchEvent(new Event('big-forward-skip-event'));
388 break; 388 break;
389 case 'U+004A': // J 389 case 'j':
390 this.player_.dispatchEvent(new Event('big-backword-skip-event')); 390 this.player_.dispatchEvent(new Event('big-backword-skip-event'));
391 break; 391 break;
392 } 392 }
393 }; 393 };
394 394
395 /* Keep the below constants in sync with the CSS. */ 395 /* Keep the below constants in sync with the CSS. */
396 396
397 /** 397 /**
398 * Window header size in pixels. 398 * Window header size in pixels.
399 * @type {number} 399 * @type {number}
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 // TODO(yoshiki): Handle error in better way. 608 // TODO(yoshiki): Handle error in better way.
609 this.title = metadata.mediaTitle || this.getDefaultTitle(); 609 this.title = metadata.mediaTitle || this.getDefaultTitle();
610 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); 610 this.artist = error || metadata.mediaArtist || this.getDefaultArtist();
611 this.artworkUrl = metadata.contentThumbnailUrl || ""; 611 this.artworkUrl = metadata.contentThumbnailUrl || "";
612 }; 612 };
613 613
614 // Starts loading the audio player. 614 // Starts loading the audio player.
615 window.addEventListener('DOMContentLoaded', function(e) { 615 window.addEventListener('DOMContentLoaded', function(e) {
616 AudioPlayer.load(); 616 AudioPlayer.load();
617 }); 617 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698