| OLD | NEW |
| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Display error message. | 8 * Display 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.bind(loadTimeData), |
| 53 this.toggleFullScreen_.bind(this), | 54 this.toggleFullScreen_.bind(this), |
| 54 videoContainer); | 55 videoContainer); |
| 55 | 56 |
| 56 this.playerContainer_ = playerContainer; | 57 this.playerContainer_ = playerContainer; |
| 57 | 58 |
| 58 this.updateStyle(); | 59 this.updateStyle(); |
| 59 window.addEventListener('resize', this.updateStyle.bind(this)); | 60 window.addEventListener('resize', this.updateStyle.bind(this)); |
| 60 | 61 |
| 61 document.addEventListener('keydown', function(e) { | 62 document.addEventListener('keydown', function(e) { |
| 62 if (e.keyIdentifier == 'U+0020') { // Space | 63 if (e.keyIdentifier == 'U+0020') { // Space |
| 63 this.togglePlayStateWithFeedback(); | 64 this.togglePlayStateWithFeedback(); |
| 64 e.preventDefault(); | 65 e.preventDefault(); |
| 65 } | 66 } |
| 66 if (e.keyIdentifier == 'U+001B') { // Escape | 67 if (e.keyIdentifier == 'U+001B') { // Escape |
| 67 util.toggleFullScreen( | 68 util.toggleFullScreen( |
| 68 chrome.app.window.current(), | 69 chrome.app.window.current(), |
| 69 false); // Leave the full screen mode. | 70 false); // Leave the full screen mode. |
| 70 e.preventDefault(); | 71 e.preventDefault(); |
| 71 } | 72 } |
| 72 }.bind(this)); | 73 }.bind(this)); |
| 73 | 74 |
| 74 videoContainer.addEventListener('click', | 75 videoContainer.addEventListener('click', function(e) { |
| 75 this.togglePlayStateWithFeedback.bind(this)); | 76 if (event.ctrlKey) { |
| 77 this.toggleLoopedModeWithFeedback(true); |
| 78 if (!this.isPlaying()) |
| 79 this.togglePlayStateWithFeedback(); |
| 80 } else { |
| 81 this.togglePlayStateWithFeedback(); |
| 82 } |
| 83 }.bind(this)); |
| 76 | 84 |
| 77 this.inactivityWatcher_ = new MouseInactivityWatcher(playerContainer); | 85 this.inactivityWatcher_ = new MouseInactivityWatcher(playerContainer); |
| 78 this.__defineGetter__('inactivityWatcher', function() { | 86 this.__defineGetter__('inactivityWatcher', function() { |
| 79 return this.inactivityWatcher_; | 87 return this.inactivityWatcher_; |
| 80 }); | 88 }); |
| 81 | 89 |
| 82 this.inactivityWatcher_.check(); | 90 this.inactivityWatcher_.check(); |
| 83 } | 91 } |
| 84 | 92 |
| 85 FullWindowVideoControls.prototype = { __proto__: VideoControls.prototype }; | 93 FullWindowVideoControls.prototype = { __proto__: VideoControls.prototype }; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 webkitResolveLocalFileSystemURL(src, | 269 webkitResolveLocalFileSystemURL(src, |
| 262 function(entry) { | 270 function(entry) { |
| 263 var video = document.querySelector('video'); | 271 var video = document.querySelector('video'); |
| 264 if (video.src != src) return; | 272 if (video.src != src) return; |
| 265 selectedItemFilesystemPath = entry.fullPath; | 273 selectedItemFilesystemPath = entry.fullPath; |
| 266 }); | 274 }); |
| 267 }); | 275 }); |
| 268 } | 276 } |
| 269 | 277 |
| 270 util.addPageLoadHandler(loadVideoPlayer); | 278 util.addPageLoadHandler(loadVideoPlayer); |
| OLD | NEW |