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

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

Issue 1161393003: Media player: Add shortcut keys (Ctrl+Shift+I/J/C/B) to media players for debug. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | ui/file_manager/video_player/js/video_player.js » ('j') | 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 * 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 this.errorString_ = strings['AUDIO_ERROR']; 60 this.errorString_ = strings['AUDIO_ERROR'];
61 this.offlineString_ = strings['AUDIO_OFFLINE']; 61 this.offlineString_ = strings['AUDIO_OFFLINE'];
62 AudioPlayer.TrackInfo.DEFAULT_ARTIST = 62 AudioPlayer.TrackInfo.DEFAULT_ARTIST =
63 strings['AUDIO_PLAYER_DEFAULT_ARTIST']; 63 strings['AUDIO_PLAYER_DEFAULT_ARTIST'];
64 }.bind(this)); 64 }.bind(this));
65 65
66 this.volumeManager_.addEventListener('externally-unmounted', 66 this.volumeManager_.addEventListener('externally-unmounted',
67 this.onExternallyUnmounted_.bind(this)); 67 this.onExternallyUnmounted_.bind(this));
68 68
69 window.addEventListener('resize', this.onResize_.bind(this)); 69 window.addEventListener('resize', this.onResize_.bind(this));
70 document.addEventListener('keydown', this.onKeyDown_.bind(this));
70 71
71 // Show the window after DOM is processed. 72 // Show the window after DOM is processed.
72 var currentWindow = chrome.app.window.current(); 73 var currentWindow = chrome.app.window.current();
73 if (currentWindow) 74 if (currentWindow)
74 setTimeout(currentWindow.show.bind(currentWindow), 0); 75 setTimeout(currentWindow.show.bind(currentWindow), 0);
75 }.bind(this), 0); 76 }.bind(this), 0);
76 } 77 }
77 78
78 /** 79 /**
79 * Initial load method (static). 80 * Initial load method (static).
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 window.innerHeight >= AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { 285 window.innerHeight >= AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) {
285 this.isExpanded_ = true; 286 this.isExpanded_ = true;
286 this.model_.expanded = true; 287 this.model_.expanded = true;
287 } else if (this.isExpanded_ && 288 } else if (this.isExpanded_ &&
288 window.innerHeight < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) { 289 window.innerHeight < AudioPlayer.EXPANDED_MODE_MIN_HEIGHT) {
289 this.isExpanded_ = false; 290 this.isExpanded_ = false;
290 this.model_.expanded = false; 291 this.model_.expanded = false;
291 } 292 }
292 }; 293 };
293 294
295 /**
296 * Handles keydown event to open inspector with shortcut keys.
297 *
298 * @param {Event} event KeyDown event.
299 * @private
300 */
301 AudioPlayer.prototype.onKeyDown_ = function(event) {
302 switch (util.getKeyModifiers(event) + event.keyIdentifier) {
303 // Handle debug shortcut keys.
304 case 'Ctrl-Shift-U+0049': // Ctrl+Shift+I
305 chrome.fileManagerPrivate.openInspector('normal');
306 break;
307 case 'Ctrl-Shift-U+004A': // Ctrl+Shift+J
308 chrome.fileManagerPrivate.openInspector('console');
309 break;
310 case 'Ctrl-Shift-U+0043': // Ctrl+Shift+C
311 chrome.fileManagerPrivate.openInspector('element');
312 break;
313 case 'Ctrl-Shift-U+0042': // Ctrl+Shift+B
314 chrome.fileManagerPrivate.openInspector('background');
315 break;
316 }
317 };
318
294 /* Keep the below constants in sync with the CSS. */ 319 /* Keep the below constants in sync with the CSS. */
295 320
296 /** 321 /**
297 * Window header size in pixels. 322 * Window header size in pixels.
298 * @type {number} 323 * @type {number}
299 * @const 324 * @const
300 */ 325 */
301 AudioPlayer.HEADER_HEIGHT = 33; // 32px + border 1px 326 AudioPlayer.HEADER_HEIGHT = 33; // 32px + border 1px
302 327
303 /** 328 /**
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // TODO(yoshiki): Handle error in better way. 452 // TODO(yoshiki): Handle error in better way.
428 // TODO(yoshiki): implement artwork (metadata.thumbnail) 453 // TODO(yoshiki): implement artwork (metadata.thumbnail)
429 this.title = metadata.mediaTitle || this.getDefaultTitle(); 454 this.title = metadata.mediaTitle || this.getDefaultTitle();
430 this.artist = error || metadata.mediaArtist || this.getDefaultArtist(); 455 this.artist = error || metadata.mediaArtist || this.getDefaultArtist();
431 }; 456 };
432 457
433 // Starts loading the audio player. 458 // Starts loading the audio player.
434 window.addEventListener('polymer-ready', function(e) { 459 window.addEventListener('polymer-ready', function(e) {
435 AudioPlayer.load(); 460 AudioPlayer.load();
436 }); 461 });
OLDNEW
« no previous file with comments | « no previous file | ui/file_manager/video_player/js/video_player.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698