Bug 795630 - Remove CapturePicker and related files. r=mbrubeck
authorJim Mathies <jmathies@mozilla.com>
Thu, 21 Mar 2013 09:23:13 -0500
changeset 125753 6adc6990dd8a2f62bf86f9596a4c115aee830caa
parent 125752 33db8e5b18ef6b6b82cedbe3e9ea8302e4f519c3
child 125754 6de905faa4dff855194473c0e3c9bac8078e0ac8
push id25095
push userjmathies@mozilla.com
push dateThu, 21 Mar 2013 14:23:37 +0000
treeherdermozilla-inbound@6adc6990dd8a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmbrubeck
bugs795630
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 795630 - Remove CapturePicker and related files. r=mbrubeck
browser/metro/base/content/browser-scripts.js
browser/metro/base/content/browser-ui.js
browser/metro/base/content/helperui/CaptureDialog.js
browser/metro/base/content/helperui/CapturePickerUI.js
browser/metro/base/content/prompt/CaptureDialog.xul
browser/metro/base/jar.mn
browser/metro/components/components.manifest
--- a/browser/metro/base/content/browser-scripts.js
+++ b/browser/metro/base/content/browser-scripts.js
@@ -84,17 +84,16 @@ Cu.import("resource://gre/modules/Geomet
  */
 let ScriptContexts = {};
 [
   ["WebProgress", "chrome://browser/content/WebProgress.js"],
   ["FindHelperUI", "chrome://browser/content/helperui/FindHelperUI.js"],
   ["FormHelperUI", "chrome://browser/content/helperui/FormHelperUI.js"],
   ["BrowserTouchHandler", "chrome://browser/content/BrowserTouchHandler.js"],
   ["AlertsHelper", "chrome://browser/content/helperui/AlertsHelper.js"],
-  ["CapturePickerUI", "chrome://browser/content/helperui/CapturePickerUI.js"],
   ["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"],
   ["MasterPasswordUI", "chrome://browser/content/helperui/MasterPasswordUI.js"],
   ["OfflineApps", "chrome://browser/content/helperui/OfflineApps.js"],
   ["SelectHelperUI", "chrome://browser/content/helperui/SelectHelperUI.js"],
--- a/browser/metro/base/content/browser-ui.js
+++ b/browser/metro/base/content/browser-ui.js
@@ -149,23 +149,16 @@ var BrowserUI = {
         PdfJs.init();
 #ifdef MOZ_SERVICES_SYNC
         WeaveGlue.init();
 #endif
       } catch(ex) {
         Util.dumpLn("Exception in delay load module:", ex.message);
       }
 
-      try {
-        // XXX This is currently failing
-        CapturePickerUI.init();
-      } catch(ex) {
-        Util.dumpLn("Exception in CapturePickerUI:", ex.message);
-      }
-
 #ifdef MOZ_UPDATER
       // Check for updates in progress
       let updatePrompt = Cc["@mozilla.org/updates/update-prompt;1"].createInstance(Ci.nsIUpdatePrompt);
       updatePrompt.checkForUpdates();
 #endif
 
       // check for left over crash reports and submit them if found.
       if (BrowserUI.startupCrashCheck()) {
deleted file mode 100644
--- a/browser/metro/base/content/helperui/CaptureDialog.js
+++ /dev/null
@@ -1,145 +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 CaptureDialog = {
-  _video: null,
-  _container: null,
-  _lastOrientationEvent: null,
-  
-  init: function() {
-    document.getElementsByAttribute('command', 'cmd_ok')[0].focus();
-    this._video = document.getElementById("capturepicker-video");
-    this._container = document.getElementById("capturepicker-container");
-    window.addEventListener("resize", this, false);
-    window.addEventListener("deviceorientation", this, false);
-    this.handleEvent({ type: "resize" });
-  },
-  
-  setPreviewOrientation: function(aEvent) {
-    if (window.innerWidth < window.innerHeight) {
-      if (aEvent.beta > 0)
-        this._video.style.MozTransform = "rotate(90deg)";
-      else
-        this._video.style.MozTransform = "rotate(-90deg)";
-      this._container.classList.add("vertical");
-    }
-    else {
-      if (aEvent.gamma > 0)
-        this._video.style.MozTransform = "rotate(180deg)";
-      else
-        this._video.style.MozTransform = "";
-      this._container.classList.remove("vertical");
-    }
-  },
-  
-  handleEvent: function(aEvent) {
-    if (aEvent.type == "deviceorientation") {
-      if (!this._lastOrientationEvent)
-        this.setPreviewOrientation(aEvent);
-      this._lastOrientationEvent = aEvent;
-    }
-    else if (aEvent.type == "resize") {
-      if (this._lastOrientationEvent)
-        this.setPreviewOrientation(this._lastOrientationEvent);
-    }
-  },
-  
-  cancel: function() {
-    this.doClose(false);
-  },
-  
-  capture: function() {
-    this.doClose(true);
-  },
-  
-  doClose: function(aResult) {
-    window.removeEventListener("resize", this, false);
-    window.removeEventListener("deviceorientation", this, false);
-    let dialog = document.getElementById("capturepicker-dialog");
-    dialog.arguments.result = aResult;
-    if (aResult)
-      dialog.arguments.path = this.saveFrame();
-    document.getElementById("capturepicker-video").setAttribute("src", "");
-    dialog.close();
-  },
-  
-  saveFrame: function() {
-    let Cc = Components.classes;
-    let Ci = Components.interfaces;
-    Components.utils.import("resource://gre/modules/Services.jsm");
-
-    let width = 320;
-    let height = 240;
-    let rotation = 0;
-
-    if (window.innerWidth < window.innerHeight) {
-      width = 240;
-      height = 320;
-      if (this._lastOrientationEvent.beta > 0)
-        rotation = Math.PI / 2;
-      else
-        rotation = -Math.PI / 2;
-    }
-    else {
-      if (this._lastOrientationEvent.gamma > 0)
-        rotation = Math.PI;
-    }
-
-    let canvas = document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
-    canvas.width = width;
-    canvas.height = height;
-    let ctx = canvas.getContext("2d");
-    ctx.clearRect(0, 0, canvas.width, canvas.height);
-    //ctx.save();
-    if (rotation != 0) {
-      if (rotation == Math.PI / 2)
-        ctx.translate(width, 0);
-      else if (rotation == -Math.PI / 2)
-        ctx.translate(-width, 0);
-      else
-        ctx.translate(width, height);
-      ctx.rotate(rotation);
-    }
-    ctx.drawImage(document.getElementById("capturepicker-video"), 0, 0, 320, 240);
-    //ctx.restore();
-    let url = canvas.toDataURL("image/png");
-    
-    let tmpDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
-    let file = tmpDir.clone();
-    file.append("capture.png");
-    file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
-    let persist = Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Ci.nsIWebBrowserPersist);
-  
-    persist.persistFlags = Ci.nsIWebBrowserPersist.PERSIST_FLAGS_REPLACE_EXISTING_FILES | Ci.nsIWebBrowserPersist.PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION;
-
-    let mDone = false;
-    let mFailed = false;
-
-    let progressListener = {
-      onProgressChange: function() {
-          /* Ignore progress callback */
-      },
-      onStateChange: function(aProgress, aRequest, aStateFlag, aStatus) {
-        if (aStateFlag & Ci.nsIWebProgressListener.STATE_STOP) {
-          mDone = true;
-        }
-      }
-    }
-    persist.progressListener = progressListener;
-
-    let source = Services.io.newURI(url, "UTF8", null);;
-    persist.saveURI(source, null, null, null, null, file);
-    
-    // don't wait more than 3 seconds for a successful save
-    window.setTimeout(function() {
-      mDone = true;
-      mFailed = true;
-    }, 3000);
-    
-    while (!mDone)
-      Services.tm.currentThread.processNextEvent(true);
-    
-    return (mFailed ? null : file.path);
-  }
-}
deleted file mode 100644
--- a/browser/metro/base/content/helperui/CapturePickerUI.js
+++ /dev/null
@@ -1,26 +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/. */
-
-/* appears to have something to do with capturing a camera image. tries to
- * create a dialog, which will fail. TBD. */
-var CapturePickerUI = {
-  init: function() {
-    this.messageManager = Cc["@mozilla.org/parentprocessmessagemanager;1"].getService(Ci.nsIFrameMessageManager);
-    this.messageManager.addMessageListener("CapturePicker:Show", this);
-  },
-  
-  receiveMessage: function(aMessage) {
-    switch (aMessage.name) {
-      case "CapturePicker:Show":
-        let params = { result: true };
-        let dialog = DialogUI.importModal(null, "chrome://browser/content/prompt/CaptureDialog.xul", params);
-        document.getElementById("capturepicker-title").appendChild(document.createTextNode(aMessage.json.title));
-        dialog.waitForClose();
-        return { value: params.result, path: params.path };
-        break;
-    }
-    // prevents warning from the script loader
-    return null;
-  }
-};
deleted file mode 100644
--- a/browser/metro/base/content/prompt/CaptureDialog.xul
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.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/. -->
-
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/prompt.dtd">
-<dialog id="capturepicker-dialog"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        onload="document.getElementById('capturepicker-dialog').CaptureDialog.init()"
-        script="chrome://browser/content/CaptureDialog.js">
-
-  <keyset>
-    <key keycode="VK_RETURN" command="cmd_ok"/>
-    <key keycode="VK_ESCAPE" command="cmd_cancel"/>
-  </keyset>
-
-  <commandset>
-    <command id="cmd_ok" oncommand="document.getElementById('capturepicker-dialog').CaptureDialog.capture();"/>
-    <command id="cmd_cancel" oncommand="document.getElementById('capturepicker-dialog').CaptureDialog.cancel();"/>
-  </commandset>
-
-  <vbox class="prompt-inner">
-    <vbox class="prompt-header" flex="1">
-      <description id="capturepicker-title" class="prompt-title" crop="center" flex="1"/>
-      <hbox flex="1" pack="center">
-        <vbox id="capturepicker-container" pack="center">
-          <video xmlns="http://www.w3.org/1999/xhtml" id="capturepicker-video"
-                 width="320" height="240"
-                 src="moz-device:?width=320&amp;height=240&amp;type=video/x-raw-yuv"
-                 autoplay="true"> </video>
-        </vbox>
-      </hbox>
-    </vbox>
-  
-    <hbox id="capturepicker-buttons-box" class="prompt-buttons">
-      <button class="prompt-button" label="&ok.label;" command="cmd_ok"/>
-      <button class="prompt-button" label="&cancel.label;" command="cmd_cancel"/>
-    </hbox>
-  </vbox>
-</dialog>
--- a/browser/metro/base/jar.mn
+++ b/browser/metro/base/jar.mn
@@ -25,29 +25,26 @@ chrome.jar:
   content/bindings/pageaction.xml              (content/bindings/pageaction.xml)
   content/bindings/arrowbox.xml                (content/bindings/arrowbox.xml)
   content/bindings/grid.xml                    (content/bindings/grid.xml)
   content/bindings/autocomplete.xml            (content/bindings/autocomplete.xml)
   content/bindings/appbar.xml                  (content/bindings/appbar.xml)
   content/bindings/flyoutpanel.xml             (content/bindings/flyoutpanel.xml)
   content/bindings/selectionoverlay.xml        (content/bindings/selectionoverlay.xml)
 
-  content/prompt/CaptureDialog.xul             (content/prompt/CaptureDialog.xul)
   content/prompt/alert.xul                     (content/prompt/alert.xul)
   content/prompt/confirm.xul                   (content/prompt/confirm.xul)
   content/prompt/prompt.xul                    (content/prompt/prompt.xul)
   content/prompt/promptPassword.xul            (content/prompt/promptPassword.xul)
   content/prompt/select.xul                    (content/prompt/select.xul)
   content/prompt/prompt.js                     (content/prompt/prompt.js)
   content/prompt/masterPassword.xul            (content/prompt/masterPassword.xul)
   content/prompt/removeMasterPassword.xul      (content/prompt/removeMasterPassword.xul)
 
   content/helperui/AlertsHelper.js             (content/helperui/AlertsHelper.js)
-  content/helperui/CaptureDialog.js            (content/helperui/CaptureDialog.js)
-  content/helperui/CapturePickerUI.js          (content/helperui/CapturePickerUI.js)
   content/helperui/IndexedDB.js                (content/helperui/IndexedDB.js)
   content/helperui/MasterPasswordUI.js         (content/helperui/MasterPasswordUI.js)
   content/helperui/MenuUI.js                   (content/helperui/MenuUI.js)
   content/helperui/OfflineApps.js              (content/helperui/OfflineApps.js)
   content/helperui/SelectHelperUI.js           (content/helperui/SelectHelperUI.js)
   content/helperui/SelectionHelperUI.js        (content/helperui/SelectionHelperUI.js)
   content/helperui/FormHelperUI.js             (content/helperui/FormHelperUI.js)
   content/helperui/FindHelperUI.js             (content/helperui/FindHelperUI.js)
--- a/browser/metro/components/components.manifest
+++ b/browser/metro/components/components.manifest
@@ -88,13 +88,8 @@ contract @mozilla.org/safebrowsing/appli
 category app-startup SafeBrowsing service,@mozilla.org/safebrowsing/application;1
 #endif
 
 #ifdef MOZ_UPDATER
 # UpdatePrompt.js
 component {88b3eb21-d072-4e3b-886d-f89d8c49fe59} UpdatePrompt.js
 contract @mozilla.org/updates/update-prompt;1 {88b3eb21-d072-4e3b-886d-f89d8c49fe59}
 #endif
-
-# CapturePicker.js
-component {cb5a47f0-b58c-4fc3-b61a-358ee95f8238} CapturePicker.js
-contract @mozilla.org/capturepicker;1 {cb5a47f0-b58c-4fc3-b61a-358ee95f8238}
-