| 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 * Displays error message. | 8 * Displays error message. |
| 9 * @param {string} message Message id. | 9 * @param {string} message Message id. |
| 10 */ | 10 */ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 * @param {Element} playerContainer Main container. | 43 * @param {Element} playerContainer Main container. |
| 44 * @param {Element} videoContainer Container for the video element. | 44 * @param {Element} videoContainer Container for the video element. |
| 45 * @param {Element} controlsContainer Container for video controls. | 45 * @param {Element} controlsContainer Container for video controls. |
| 46 * @constructor | 46 * @constructor |
| 47 */ | 47 */ |
| 48 function FullWindowVideoControls( | 48 function FullWindowVideoControls( |
| 49 playerContainer, videoContainer, controlsContainer) { | 49 playerContainer, videoContainer, controlsContainer) { |
| 50 VideoControls.call(this, | 50 VideoControls.call(this, |
| 51 controlsContainer, | 51 controlsContainer, |
| 52 onPlaybackError, | 52 onPlaybackError, |
| 53 loadTimeData.getString.wrap(loadTimeData), | 53 loadTimeData.getString.bind(loadTimeData), |
| 54 this.toggleFullScreen_.wrap(this), | 54 this.toggleFullScreen_.bind(this), |
| 55 videoContainer); | 55 videoContainer); |
| 56 | 56 |
| 57 this.playerContainer_ = playerContainer; | 57 this.playerContainer_ = playerContainer; |
| 58 | 58 |
| 59 this.updateStyle(); | 59 this.updateStyle(); |
| 60 window.addEventListener('resize', this.updateStyle.wrap(this)); | 60 window.addEventListener('resize', this.updateStyle.bind(this)); |
| 61 | 61 |
| 62 document.addEventListener('keydown', function(e) { | 62 document.addEventListener('keydown', function(e) { |
| 63 if (e.keyIdentifier == 'U+0020') { // Space | 63 if (e.keyIdentifier == 'U+0020') { // Space |
| 64 this.togglePlayStateWithFeedback(); | 64 this.togglePlayStateWithFeedback(); |
| 65 e.preventDefault(); | 65 e.preventDefault(); |
| 66 } | 66 } |
| 67 if (e.keyIdentifier == 'U+001B') { // Escape | 67 if (e.keyIdentifier == 'U+001B') { // Escape |
| 68 util.toggleFullScreen( | 68 util.toggleFullScreen( |
| 69 chrome.app.window.current(), | 69 chrome.app.window.current(), |
| 70 false); // Leave the full screen mode. | 70 false); // Leave the full screen mode. |
| 71 e.preventDefault(); | 71 e.preventDefault(); |
| 72 } | 72 } |
| 73 }.wrap(this)); | 73 }.bind(this)); |
| 74 | 74 |
| 75 // TODO(mtomasz): Simplify. crbug.com/254318. | 75 // TODO(mtomasz): Simplify. crbug.com/254318. |
| 76 videoContainer.addEventListener('click', function(e) { | 76 videoContainer.addEventListener('click', function(e) { |
| 77 if (e.ctrlKey) { | 77 if (e.ctrlKey) { |
| 78 this.toggleLoopedModeWithFeedback(true); | 78 this.toggleLoopedModeWithFeedback(true); |
| 79 if (!this.isPlaying()) | 79 if (!this.isPlaying()) |
| 80 this.togglePlayStateWithFeedback(); | 80 this.togglePlayStateWithFeedback(); |
| 81 } else { | 81 } else { |
| 82 this.togglePlayStateWithFeedback(); | 82 this.togglePlayStateWithFeedback(); |
| 83 } | 83 } |
| 84 }.wrap(this)); | 84 }.bind(this)); |
| 85 | 85 |
| 86 this.inactivityWatcher_ = new MouseInactivityWatcher(playerContainer); | 86 this.inactivityWatcher_ = new MouseInactivityWatcher(playerContainer); |
| 87 this.__defineGetter__('inactivityWatcher', function() { | 87 this.__defineGetter__('inactivityWatcher', function() { |
| 88 return this.inactivityWatcher_; | 88 return this.inactivityWatcher_; |
| 89 }); | 89 }); |
| 90 | 90 |
| 91 this.inactivityWatcher_.check(); | 91 this.inactivityWatcher_.check(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 FullWindowVideoControls.prototype = { __proto__: VideoControls.prototype }; | 94 FullWindowVideoControls.prototype = { __proto__: VideoControls.prototype }; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 appWindow.resizeTo(newWidth, newHeight); | 206 appWindow.resizeTo(newWidth, newHeight); |
| 207 appWindow.moveTo(oldLeft - (newWidth - oldWidth) / 2, | 207 appWindow.moveTo(oldLeft - (newWidth - oldWidth) / 2, |
| 208 oldTop - (newHeight - oldHeight) / 2); | 208 oldTop - (newHeight - oldHeight) / 2); |
| 209 appWindow.show(); | 209 appWindow.show(); |
| 210 | 210 |
| 211 video.play(); | 211 video.play(); |
| 212 }); | 212 }); |
| 213 } | 213 } |
| 214 | 214 |
| 215 util.addPageLoadHandler(loadVideoPlayer); | 215 util.addPageLoadHandler(loadVideoPlayer); |
| OLD | NEW |