Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @param {Element} playerContainer Main container. | 8 * @param {Element} playerContainer Main container. |
| 9 * @param {Element} videoContainer Container for the video element. | 9 * @param {Element} videoContainer Container for the video element. |
| 10 * @param {Element} controlsContainer Container for video controls. | 10 * @param {Element} controlsContainer Container for video controls. |
| 11 * @constructor | 11 * @constructor |
| 12 */ | 12 */ |
| 13 function FullWindowVideoControls( | 13 function FullWindowVideoControls( |
| 14 playerContainer, videoContainer, controlsContainer) { | 14 playerContainer, videoContainer, controlsContainer) { |
| 15 VideoControls.call(this, | 15 VideoControls.call(this, |
| 16 controlsContainer, | 16 controlsContainer, |
| 17 this.onPlaybackError_.wrap(this), | 17 this.onPlaybackError_.wrap(this), |
| 18 loadTimeData.getString.wrap(loadTimeData), | 18 loadTimeData.getString.wrap(loadTimeData), |
| 19 this.toggleFullScreen_.wrap(this), | 19 this.toggleFullScreen_.wrap(this), |
| 20 videoContainer); | 20 videoContainer); |
| 21 | 21 |
| 22 this.playerContainer_ = playerContainer; | 22 this.playerContainer_ = playerContainer; |
| 23 this.decodeErrorOccured = false; | 23 this.decodeErrorOccured = false; |
| 24 | 24 |
| 25 this.updateStyle(); | 25 this.updateStyle(); |
| 26 window.addEventListener('resize', this.updateStyle.wrap(this)); | 26 window.addEventListener('resize', this.updateStyle.wrap(this)); |
| 27 document.addEventListener('keydown', function(e) { | 27 document.addEventListener('keydown', function(e) { |
| 28 if (e.keyIdentifier == 'U+0020') { // Space | 28 switch (e.keyIdentifier) { |
| 29 this.togglePlayStateWithFeedback(); | 29 case 'U+0020': // Space |
| 30 e.preventDefault(); | 30 case 'MediaPlayPause': |
| 31 this.togglePlayStateWithFeedback(); | |
| 32 break; | |
| 33 case 'U+001B': // Escape | |
| 34 util.toggleFullScreen( | |
| 35 chrome.app.window.current(), | |
| 36 false); // Leave the full screen mode. | |
| 37 break; | |
| 38 case 'Right': | |
| 39 case 'MediaNextTrack': | |
| 40 player.advance_(1); | |
| 41 break; | |
| 42 case 'Left': | |
| 43 case 'MediaPreviousTrack': | |
| 44 player.advance_(0); | |
| 45 break; | |
| 46 case 'MediaStop': | |
| 47 //TODO: Define "Stop" behavior. | |
|
yoshiki
2014/07/14 23:48:39
nit: add a space before 'TODO'.
etrunko
2014/07/15 13:31:14
Done.
| |
| 48 break; | |
| 31 } | 49 } |
| 32 if (e.keyIdentifier == 'U+001B') { // Escape | 50 e.preventDefault(); |
| 33 util.toggleFullScreen( | |
| 34 chrome.app.window.current(), | |
| 35 false); // Leave the full screen mode. | |
| 36 e.preventDefault(); | |
| 37 } | |
| 38 }.wrap(this)); | 51 }.wrap(this)); |
| 39 | 52 |
| 40 // TODO(mtomasz): Simplify. crbug.com/254318. | 53 // TODO(mtomasz): Simplify. crbug.com/254318. |
| 41 videoContainer.addEventListener('click', function(e) { | 54 videoContainer.addEventListener('click', function(e) { |
| 42 if (e.ctrlKey) { | 55 if (e.ctrlKey) { |
| 43 this.toggleLoopedModeWithFeedback(true); | 56 this.toggleLoopedModeWithFeedback(true); |
| 44 if (!this.isPlaying()) | 57 if (!this.isPlaying()) |
| 45 this.togglePlayStateWithFeedback(); | 58 this.togglePlayStateWithFeedback(); |
| 46 } else { | 59 } else { |
| 47 this.togglePlayStateWithFeedback(); | 60 this.togglePlayStateWithFeedback(); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 var initPromise = Promise.all( | 429 var initPromise = Promise.all( |
| 417 [new Promise(initVideos.wrap(null)), | 430 [new Promise(initVideos.wrap(null)), |
| 418 new Promise(initStrings.wrap(null)), | 431 new Promise(initStrings.wrap(null)), |
| 419 new Promise(util.addPageLoadHandler.wrap(null))]); | 432 new Promise(util.addPageLoadHandler.wrap(null))]); |
| 420 | 433 |
| 421 initPromise.then(function(results) { | 434 initPromise.then(function(results) { |
| 422 var videos = results[0]; | 435 var videos = results[0]; |
| 423 player.prepare(videos); | 436 player.prepare(videos); |
| 424 return new Promise(player.playFirstVideo.wrap(player)); | 437 return new Promise(player.playFirstVideo.wrap(player)); |
| 425 }.wrap(null)); | 438 }.wrap(null)); |
| OLD | NEW |