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

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

Issue 1415953006: Fix accessibility issues in AudioPlayer and VideoPlayer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 10 matching lines...) Expand all
21 21
22 this.playerContainer_ = playerContainer; 22 this.playerContainer_ = playerContainer;
23 this.decodeErrorOccured = false; 23 this.decodeErrorOccured = false;
24 24
25 this.casting = false; 25 this.casting = false;
26 26
27 this.updateStyle(); 27 this.updateStyle();
28 window.addEventListener('resize', this.updateStyle.wrap(this)); 28 window.addEventListener('resize', this.updateStyle.wrap(this));
29 var currentWindow = chrome.app.window.current(); 29 var currentWindow = chrome.app.window.current();
30 currentWindow.onFullscreened.addListener( 30 currentWindow.onFullscreened.addListener(
31 this.onFullScreenChanged_.bind(this, true)); 31 this.onFullScreenChanged.bind(this, true));
32 currentWindow.onRestored.addListener( 32 currentWindow.onRestored.addListener(
33 this.onFullScreenChanged_.bind(this, false)); 33 this.onFullScreenChanged.bind(this, false));
34 document.addEventListener('keydown', function(e) { 34 document.addEventListener('keydown', function(e) {
35 switch (util.getKeyModifiers(e) + e.keyIdentifier) { 35 switch (util.getKeyModifiers(e) + e.keyIdentifier) {
36 // Handle debug shortcut keys. 36 // Handle debug shortcut keys.
37 case 'Ctrl-Shift-U+0049': // Ctrl+Shift+I 37 case 'Ctrl-Shift-U+0049': // Ctrl+Shift+I
38 chrome.fileManagerPrivate.openInspector('normal'); 38 chrome.fileManagerPrivate.openInspector('normal');
39 break; 39 break;
40 case 'Ctrl-Shift-U+004A': // Ctrl+Shift+J 40 case 'Ctrl-Shift-U+004A': // Ctrl+Shift+J
41 chrome.fileManagerPrivate.openInspector('console'); 41 chrome.fileManagerPrivate.openInspector('console');
42 break; 42 break;
43 case 'Ctrl-Shift-U+0043': // Ctrl+Shift+C 43 case 'Ctrl-Shift-U+0043': // Ctrl+Shift+C
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 /** 161 /**
162 * Toggles the full screen mode. 162 * Toggles the full screen mode.
163 * @private 163 * @private
164 */ 164 */
165 FullWindowVideoControls.prototype.toggleFullScreen_ = function() { 165 FullWindowVideoControls.prototype.toggleFullScreen_ = function() {
166 var appWindow = chrome.app.window.current(); 166 var appWindow = chrome.app.window.current();
167 util.toggleFullScreen(appWindow, !util.isFullScreen(appWindow)); 167 util.toggleFullScreen(appWindow, !util.isFullScreen(appWindow));
168 }; 168 };
169 169
170 /** 170 /**
171 * Updates video control when the window is fullscreened or restored.
172 * @param {boolean} fullscreen True if the window gets fullscreened.
173 * @private
174 */
175 FullWindowVideoControls.prototype.onFullScreenChanged_ = function(fullscreen) {
176 if (fullscreen) {
177 this.playerContainer_.setAttribute('fullscreen', '');
178 } else {
179 this.playerContainer_.removeAttribute('fullscreen');
180 }
181 };
182
183 /**
184 * Media completion handler. 171 * Media completion handler.
185 */ 172 */
186 FullWindowVideoControls.prototype.onMediaComplete = function() { 173 FullWindowVideoControls.prototype.onMediaComplete = function() {
187 VideoControls.prototype.onMediaComplete.apply(this, arguments); 174 VideoControls.prototype.onMediaComplete.apply(this, arguments);
188 if (!this.getMedia().loop) 175 if (!this.getMedia().loop)
189 player.advance_(1); 176 player.advance_(1);
190 }; 177 };
191 178
192 /** 179 /**
193 * Video Player 180 * Video Player
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 return new Promise(function(fulfill, reject) { 664 return new Promise(function(fulfill, reject) {
678 util.URLsToEntries(window.appState.items, function(entries) { 665 util.URLsToEntries(window.appState.items, function(entries) {
679 metrics.recordOpenVideoPlayerAction(); 666 metrics.recordOpenVideoPlayerAction();
680 metrics.recordNumberOfOpenedFiles(entries.length); 667 metrics.recordNumberOfOpenedFiles(entries.length);
681 668
682 player.prepare(entries); 669 player.prepare(entries);
683 player.playFirstVideo(player, fulfill); 670 player.playFirstVideo(player, fulfill);
684 }.wrap()); 671 }.wrap());
685 }.wrap()); 672 }.wrap());
686 }.wrap()); 673 }.wrap());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698