Bug 842130 - Fix fullscreen video which currently isn't working. r=mbrubeck
☠☠ backed out by 85eedb253f25 ☠ ☠
authorBrian R. Bondy <netzen@gmail.com>
Thu, 28 Mar 2013 21:29:55 -0400
changeset 126660 9eb6532ccfc3f0072dbaac5e60a6c62e3b587e11
parent 126659 b420dcf17910b4150402127de32281a46cca8490
child 126661 d2225846e42c281efe8142acddc121d51db34fc0
push id25578
push userbbondy@mozilla.com
push dateFri, 29 Mar 2013 01:30:06 +0000
treeherdermozilla-inbound@9eb6532ccfc3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs842130
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 842130 - Fix fullscreen video which currently isn't working. r=mbrubeck
browser/metro/base/content/ContextCommands.js
browser/metro/base/content/browser-scripts.js
browser/metro/base/content/browser-ui.js
browser/metro/base/content/contenthandlers/ContextMenuHandler.js
browser/metro/base/content/pages/fullscreen-video.xhtml
browser/metro/base/content/video.js
browser/metro/base/jar.mn
browser/metro/modules/Makefile.in
browser/metro/modules/video.jsm
--- a/browser/metro/base/content/ContextCommands.js
+++ b/browser/metro/base/content/ContextCommands.js
@@ -211,21 +211,16 @@ var ContextCommands = {
     this.clipboard.copyString(ContextMenuUI.popupState.mediaURL,
                               this.docRef);
   },
 
   openVideoInNewTab: function cc_openVideoInNewTab() {
     BrowserUI.newTab(ContextMenuUI.popupState.mediaURL, Browser.selectedTab);
   },
 
-  openVideoInFullscreen: function cc_openVideoInFullscreen() {
-    // XXX currently isn't working.
-    this.sendCommand('videotab');
-  },
-
   // Bookmarks
 
   editBookmark: function cc_editBookmark() {
     let target = ContextMenuUI.popupState.target;
     target.startEditing();
   },
 
   removeBookmark: function cc_removeBookmark() {
--- a/browser/metro/base/content/browser-scripts.js
+++ b/browser/metro/base/content/browser-scripts.js
@@ -101,17 +101,16 @@ let ScriptContexts = {};
   ["AutofillMenuUI", "chrome://browser/content/helperui/MenuUI.js"],
   ["ContextMenuUI", "chrome://browser/content/helperui/MenuUI.js"],
   ["MenuControlUI", "chrome://browser/content/helperui/MenuUI.js"],
   ["MenuPopup", "chrome://browser/content/helperui/MenuUI.js"],
   ["IndexedDB", "chrome://browser/content/helperui/IndexedDB.js"],
   ["OfflineApps", "chrome://browser/content/helperui/OfflineApps.js"],
   ["SelectHelperUI", "chrome://browser/content/helperui/SelectHelperUI.js"],
   ["SelectionHelperUI", "chrome://browser/content/helperui/SelectionHelperUI.js"],
-  ["FullScreenVideo", "chrome://browser/content/video.js"],
   ["AnimatedZoom", "chrome://browser/content/AnimatedZoom.js"],
   ["CommandUpdater", "chrome://browser/content/commandUtil.js"],
   ["ContextCommands", "chrome://browser/content/ContextCommands.js"],
   ["Bookmarks", "chrome://browser/content/bookmarks.js"],
   ["Downloads", "chrome://browser/content/downloads.js"],
   ["BookmarksPanelView", "chrome://browser/content/bookmarks.js"],
   ["ConsolePanelView", "chrome://browser/content/console.js"],
   ["DownloadsPanelView", "chrome://browser/content/downloads.js"],
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -140,17 +140,16 @@ var BrowserUI = {
       messageManager.addMessageListener("Browser:MozApplicationManifest", OfflineApps);
 
       try {
         BrowserUI._updateTabsOnly();
         Downloads.init();
         DialogUI.init();
         FormHelperUI.init();
         FindHelperUI.init();
-        FullScreenVideo.init();
         PdfJs.init();
 #ifdef MOZ_SERVICES_SYNC
         WeaveGlue.init();
 #endif
       } catch(ex) {
         Util.dumpLn("Exception in delay load module:", ex.message);
       }
 
--- a/browser/metro/base/content/contenthandlers/ContextMenuHandler.js
+++ b/browser/metro/base/content/contenthandlers/ContextMenuHandler.js
@@ -64,31 +64,16 @@ var ContextMenuHandler = {
       case "copy":
         this._onCopy();
         break;
 
       case "paste":
         this._onPaste();
         break;
 
-      case "play":
-      case "pause":
-        if (node instanceof Ci.nsIDOMHTMLMediaElement)
-          node[command]();
-        break;
-
-      case "videotab":
-        if (node instanceof Ci.nsIDOMHTMLVideoElement) {
-          node.pause();
-          Cu.import("resource:///modules/video.jsm");
-          Video.fullScreenSourceElement = node;
-          sendAsyncMessage("Browser:FullScreenVideo:Start");
-        }
-        break;
-
       case "select-all":
         this._onSelectAll();
         break;
 
       case "copy-image-contents":
         this._onCopyImage();
         break;
     }
deleted file mode 100644
--- a/browser/metro/base/content/pages/fullscreen-video.xhtml
+++ /dev/null
@@ -1,154 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html>
-<!--
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" accelerated="11">
-<head>
-
-<style type="text/css"><![CDATA[
-  html,
-  body,
-  video {
-    height: 100%;
-  }
-    
-  body {
-    margin: 0;
-    background: black;
-    overflow: -moz-hidden-unscrollable;
-  }
-    
-  video {
-    width: 100%;
-    max-height: 100%;
-  }
-]]></style>
-
-<script type="application/javascript;version=1.8"><![CDATA[
-
-var TheaterTab = {
-  videoElement: null,
-  idleTimer: 0,
-
-  init: function init() {
-    this.videoElement = document.querySelector("video");
-
-    /*
-     * video events
-     */
-
-    this.videoElement.addEventListener("loadeddata", TheaterTab.loadDataCallback, false);
-    this.videoElement.addEventListener("seeked", TheaterTab.seekComplete, false);
-    this.videoElement.addEventListener("pause", TheaterTab.pauseCallback, false);
-    this.videoElement.addEventListener("play", TheaterTab.playCallback, false);
-    this.videoElement.addEventListener("ended", TheaterTab.endedCallback, false);
-
-    /*
-     * window events
-     */
-
-    window.addEventListener("click", function () {
-      TheaterTab.togglePlay();
-      TheaterTab.resetIdleTimer();
-    }, false);
-
-    window.addEventListener("unload", function () {
-      if (TheaterTab.videoElement.currentSrc) {
-        contentVideo.currentTime = TheaterTab.videoElement.currentTime;
-        contentVideo.volume = TheaterTab.videoElement.volume;
-        contentVideo.muted = TheaterTab.videoElement.muted;
-        if (!TheaterTab.videoElement.paused && !TheaterTab.videoElement.ended) {
-          TheaterTab.videoElement.pause();
-        }
-      }
-    }, false);
-
-    window.addEventListener("keypress", function (event) {
-      TheaterTab.resetIdleTimer();
-    }, false);
-
-
-    // Load the video up and play it
-    this.videoElement.mozLoadFrom(contentVideo);
-  },
-
-  /*
-   * Video element callbacks
-   */
-
-  loadDataCallback: function loadDataCallback() {
-    dump("loadDataCallback()\n");
-    TheaterTab.videoElement.removeEventListener("loadeddata", arguments.callee, false);
-    TheaterTab.videoElement.volume = contentVideo.volume;
-    TheaterTab.videoElement.muted = contentVideo.muted;
-    TheaterTab.videoElement.poster = contentVideo.poster;
-
-    // If we are starting from mid stream, wait until we have
-    // seeked to the start location.
-    dump(contentVideo + "\n");
-    if (contentVideo.currentTime && !contentVideo.ended) {
-      // set up callback to play
-      TheaterTab.videoElement.addEventListener("seeked", function () {
-        TheaterTab.videoElement.removeEventListener("seeked", arguments.callee, false);
-          TheaterTab.seekComplete();
-        }, false);
-      // seek
-      TheaterTab.videoElement.currentTime = contentVideo.currentTime;
-      return;
-    }
-    TheaterTab.play();
-  },
-
-  seekComplete: function seekComplete() {
-    TheaterTab.play();
-  },
-
-  pauseCallback: function pauseCallback() {
-  },
-
-  playCallback: function playCallback() {
-  },
-
-  endedCallback: function endedCallback() {
-  },
-
-  /*
-   * Video control
-   */
-
-  play: function play() {
-    this.videoElement.play();
-  },
-
-  pause: function pause() {
-    this.videoElement.pause();
-  },
-
-  togglePlay: function togglePlay() {
-    if (this.videoElement.paused) {
-      this.play();
-    } else {
-      this.pause();
-    }
-  },
-
-};
-
-Components.utils.import("resource:///modules/video.jsm");
-
-// The video in the content tab we launched from
-var contentVideo = Video.fullScreenSourceElement;
-
-// ??
-Video.fullScreenSourceElement = null;
-
-]]></script>
-</head>
-
-<body onload="TheaterTab.init();">
-  <video controls="true"/>
-</body>
-</html>
deleted file mode 100644
--- a/browser/metro/base/content/video.js
+++ /dev/null
@@ -1,66 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-var FullScreenVideo = {
-  _tab: null,
-
-  init: function fsv_init() {
-    // These come in from content.js, currently we only use Start.
-    messageManager.addMessageListener("Browser:FullScreenVideo:Start", this.show.bind(this));
-    messageManager.addMessageListener("Browser:FullScreenVideo:Close", this.hide.bind(this));
-    messageManager.addMessageListener("Browser:FullScreenVideo:Play", this.play.bind(this));
-    messageManager.addMessageListener("Browser:FullScreenVideo:Pause", this.pause.bind(this));
-
-    // If the screen supports brightness locks, we will utilize that, see checkBrightnessLocking()
-    try {
-      this.screen = null;
-      let screenManager = Cc["@mozilla.org/gfx/screenmanager;1"].getService(Ci.nsIScreenManager);
-      this.screen = screenManager.primaryScreen;
-    }
-    catch (e) {} // The screen does not support brightness locks
-  },
-
-  play: function() {
-    this.playing = true;
-    this.checkBrightnessLocking();
-  },
-
-  pause: function() {
-    this.playing = false;
-    this.checkBrightnessLocking();
-  },
-
-  checkBrightnessLocking: function() {
-    // screen manager support for metro: bug 776113
-    var shouldLock = !!this.screen && !!window.fullScreen && !!this.playing;
-    var locking = !!this.brightnessLocked;
-    if (shouldLock == locking)
-      return;
-
-    if (shouldLock)
-      this.screen.lockMinimumBrightness(this.screen.BRIGHTNESS_FULL);
-    else
-      this.screen.unlockMinimumBrightness(this.screen.BRIGHTNESS_FULL);
-    this.brightnessLocked = shouldLock;
-  },
-
-  show: function fsv_show() {
-    this.createTab();
-    this.checkBrightnessLocking();
-  },
-
-  hide: function fsv_hide() {
-    this.checkBrightnessLocking();
-    this.destroyTab();
-  },
-
-  createTab: function fsv_createBrowser() {
-    this._tab = BrowserUI.newTab("chrome://browser/content/fullscreen-video.xhtml");
-  },
-
-  destroyTab: function fsv_destroyBrowser() {
-    Browser.closeTab(this._tab);
-    this._tab = null;
-  }
-};
--- a/browser/metro/base/jar.mn
+++ b/browser/metro/base/jar.mn
@@ -6,17 +6,16 @@
 
 chrome.jar:
 % content browser %content/
 
   content/aboutCertError.xhtml                 (content/pages/aboutCertError.xhtml)
   content/aboutRights.xhtml                    (content/pages/aboutRights.xhtml)
   content/aboutCrash.xhtml                     (content/pages/aboutCrash.xhtml)
   content/blockedSite.xhtml                    (content/pages/blockedSite.xhtml)
-  content/fullscreen-video.xhtml               (content/pages/fullscreen-video.xhtml)
   content/netError.xhtml                       (content/pages/netError.xhtml)
 
   content/bindings/bindings.xml                (content/bindings/bindings.xml)
   content/bindings/tabs.xml                    (content/bindings/tabs.xml)
   content/bindings/toggleswitch.xml            (content/bindings/toggleswitch.xml)
   content/bindings/browser.xml                 (content/bindings/browser.xml)
   content/bindings/browser.js                  (content/bindings/browser.js)
   content/bindings/downloads.xml               (content/bindings/downloads.xml)
@@ -80,16 +79,15 @@ chrome.jar:
   content/exceptions.js                        (content/exceptions.js)
   content/downloads.js                         (content/downloads.js)
   content/history.js                           (content/history.js)
   content/Site.js                              (content/Site.js)
   content/TopSites.js                          (content/TopSites.js)
   content/console.js                           (content/console.js)
   content/AnimatedZoom.js                      (content/AnimatedZoom.js)
   content/LoginManagerChild.js                 (content/LoginManagerChild.js)
-  content/video.js                             (content/video.js)
 #ifdef MOZ_SERVICES_SYNC
 * content/sync.js                              (content/sync.js)
   content/RemoteTabs.js                        (content/RemoteTabs.js)
 #endif
 
 % override chrome://global/content/config.xul chrome://browser/content/config.xul
 % override chrome://global/content/netError.xhtml chrome://browser/content/netError.xhtml
--- a/browser/metro/modules/Makefile.in
+++ b/browser/metro/modules/Makefile.in
@@ -5,13 +5,9 @@
 DEPTH      = @DEPTH@
 topsrcdir  = @top_srcdir@
 srcdir     = @srcdir@
 VPATH      = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/config.mk
 
-EXTRA_JS_MODULES = \
-  video.jsm \
-  $(NULL)
-
 include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/browser/metro/modules/video.jsm
+++ /dev/null
@@ -1,9 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-this.EXPORTED_SYMBOLS = ["Video"];
-
-this.Video = {
-  fullScreenSourceElement: null
-};