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 /** | 5 /** |
6 * Display error message. | 6 * Display error message. |
7 * @param {string} message Message id. | 7 * @param {string} message Message id. |
8 */ | 8 */ |
9 function showErrorMessage(message) { | 9 function showErrorMessage(message) { |
10 var errorBanner = document.querySelector('#error'); | 10 var errorBanner = document.querySelector('#error'); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 onPlaybackError, | 51 onPlaybackError, |
52 function() { chrome.fileBrowserPrivate.toggleFullscreen() }, | 52 function() { chrome.fileBrowserPrivate.toggleFullscreen() }, |
53 videoContainer); | 53 videoContainer); |
54 | 54 |
55 this.playerContainer_ = playerContainer; | 55 this.playerContainer_ = playerContainer; |
56 | 56 |
57 this.updateStyle(); | 57 this.updateStyle(); |
58 window.addEventListener('resize', this.updateStyle.bind(this)); | 58 window.addEventListener('resize', this.updateStyle.bind(this)); |
59 | 59 |
60 document.addEventListener('keydown', function(e) { | 60 document.addEventListener('keydown', function(e) { |
61 if (e.keyIdentifier == 'U+0020') { | 61 if (e.keyIdentifier == 'U+0020') { // Space |
62 this.togglePlayStateWithFeedback(); | 62 this.togglePlayStateWithFeedback(); |
63 e.preventDefault(); | 63 e.preventDefault(); |
64 } | 64 } |
| 65 if (e.keyIdentifier == 'U+001B') { // Escape |
| 66 chrome.fileBrowserPrivate.isFullscreen(function(enabled) { |
| 67 if (enabled) |
| 68 chrome.fileBrowserPrivate.toggleFullscreen(); |
| 69 }); |
| 70 e.preventDefault(); |
| 71 } |
65 }.bind(this)); | 72 }.bind(this)); |
66 | 73 |
67 util.disableBrowserShortcutKeys(document); | 74 util.disableBrowserShortcutKeys(document); |
68 | 75 |
69 videoContainer.addEventListener('click', | 76 videoContainer.addEventListener('click', |
70 this.togglePlayStateWithFeedback.bind(this)); | 77 this.togglePlayStateWithFeedback.bind(this)); |
71 | 78 |
72 this.inactivityWatcher_ = new MouseInactivityWatcher(playerContainer); | 79 this.inactivityWatcher_ = new MouseInactivityWatcher(playerContainer); |
73 this.__defineGetter__('inactivityWatcher', function() { | 80 this.__defineGetter__('inactivityWatcher', function() { |
74 return this.inactivityWatcher_; | 81 return this.inactivityWatcher_; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 webkitResolveLocalFileSystemURL(src, | 262 webkitResolveLocalFileSystemURL(src, |
256 function(entry) { | 263 function(entry) { |
257 var video = document.querySelector('video'); | 264 var video = document.querySelector('video'); |
258 if (video.src != src) return; | 265 if (video.src != src) return; |
259 selectedItemFilesystemPath = entry.fullPath; | 266 selectedItemFilesystemPath = entry.fullPath; |
260 }); | 267 }); |
261 }); | 268 }); |
262 } | 269 } |
263 | 270 |
264 util.addPageLoadHandler(loadVideoPlayer); | 271 util.addPageLoadHandler(loadVideoPlayer); |
OLD | NEW |