mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 791148 - Remove the deprecated camera support [r=cjones]
This commit is contained in:
parent
1947539896
commit
e96bbbc31c
@ -1,11 +1,6 @@
|
||||
# Scrollbars
|
||||
category agent-style-sheets browser-content-stylesheet chrome://browser/content/content.css
|
||||
|
||||
# CameraContent.js
|
||||
component {eff4231b-abce-4f7f-a40a-d646e8fde3ce} CameraContent.js
|
||||
contract @mozilla.org/b2g-camera-content;1 {eff4231b-abce-4f7f-a40a-d646e8fde3ce}
|
||||
category JavaScript-navigator-property mozCamera @mozilla.org/b2g-camera-content;1
|
||||
|
||||
# AlertsService.js
|
||||
component {fe33c107-82a4-41d6-8c64-5353267e04c9} AlertsService.js
|
||||
contract @mozilla.org/system-alerts-service;1 {fe33c107-82a4-41d6-8c64-5353267e04c9}
|
||||
|
@ -1,83 +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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const kProtocolName = "b2g-camera:";
|
||||
|
||||
let CameraContent = function() {
|
||||
this.hasPrivileges = false;
|
||||
this.mapping = [];
|
||||
}
|
||||
|
||||
CameraContent.prototype = {
|
||||
getCameraURI: function(aOptions) {
|
||||
if (!this.hasPrivileges)
|
||||
return null;
|
||||
|
||||
let options = aOptions || { };
|
||||
if (!options.camera)
|
||||
options.camera = 0;
|
||||
if (!options.width)
|
||||
options.width = 320;
|
||||
if (!options.height)
|
||||
options.height = 240;
|
||||
|
||||
let uuid = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator).generateUUID().toString();
|
||||
uuid = uuid.substring(1, uuid.length - 2); // remove the brackets
|
||||
this.mapping.push(uuid);
|
||||
let uri = kProtocolName + "?camera=" + options.camera +
|
||||
"&width=" + options.width +
|
||||
"&height=" + options.height +
|
||||
"&type=video/x-raw-yuv";
|
||||
// XXX that's no e10s ready, but the camera inputstream itself is not...
|
||||
Services.prefs.setCharPref("b2g.camera." + kProtocolName + "?" + uuid, uri);
|
||||
return kProtocolName + "?" + uuid;
|
||||
},
|
||||
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "inner-window-destroyed") {
|
||||
let wId = aSubject.QueryInterface(Ci.nsISupportsPRUint64).data;
|
||||
if (wId == this.innerWindowID) {
|
||||
Services.obs.removeObserver(this, "inner-window-destroyed");
|
||||
for (let aId in this.mapping)
|
||||
Services.prefs.clearUserPref("b2g.camera." + kProtocolName + "?" + aId);
|
||||
this.mapping = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
init: function(aWindow) {
|
||||
let principal = aWindow.document.nodePrincipal;
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);
|
||||
|
||||
let perm = Services.perms.testExactPermissionFromPrincipal(principal, "content-camera");
|
||||
|
||||
//only pages with perm set and chrome pages can use the camera in content
|
||||
this.hasPrivileges = perm == Ci.nsIPermissionManager.ALLOW_ACTION;
|
||||
|
||||
Services.obs.addObserver(this, "inner-window-destroyed", false);
|
||||
let util = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
|
||||
this.innerWindowID = util.currentInnerWindowID;
|
||||
},
|
||||
|
||||
classID: Components.ID("{eff4231b-abce-4f7f-a40a-d646e8fde3ce}"),
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIB2GCameraContent, Ci.nsIDOMGlobalPropertyInitializer, Ci.nsIObserver]),
|
||||
|
||||
classInfo: XPCOMUtils.generateCI({classID: Components.ID("{eff4231b-abce-4f7f-a40a-d646e8fde3ce}"),
|
||||
contractID: "@mozilla.org/b2g-camera-content;1",
|
||||
interfaces: [Ci.nsIB2GCameraContent],
|
||||
flags: Ci.nsIClassInfo.DOM_OBJECT,
|
||||
classDescription: "B2G Camera Content Helper"})
|
||||
}
|
||||
|
||||
const NSGetFactory = XPCOMUtils.generateNSGetFactory([CameraContent]);
|
@ -20,7 +20,6 @@ EXTRA_PP_COMPONENTS = \
|
||||
ActivitiesGlue.js \
|
||||
AlertsService.js \
|
||||
B2GComponents.manifest \
|
||||
CameraContent.js \
|
||||
ContentHandler.js \
|
||||
ContentPermissionPrompt.js \
|
||||
DirectoryProvider.js \
|
||||
|
@ -689,17 +689,6 @@
|
||||
{0xae, 0xb7, 0xda, 0x62, 0xe7, 0x27, 0x3e, 0xd5} \
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#define NS_B2GPROTOCOLHANDLER_CLASSNAME \
|
||||
"nsB2GProtocolHandler"
|
||||
#define NS_B2GPROTOCOLHANDLER_CID \
|
||||
{ \
|
||||
/* {e50d101a-9db2-466f-977c-ae6af19e3b2f} */ \
|
||||
0x50d101a, 0x9db2, 0x466f, \
|
||||
{0x97, 0x7c, 0xae, 0x6a, 0xf1, 0x9e, 0x3b, 0x2f} \
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* netwerk/protocol/viewsource/ classes
|
||||
*/
|
||||
|
@ -235,10 +235,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsResURL)
|
||||
#ifdef NECKO_PROTOCOL_device
|
||||
#include "nsDeviceProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceProtocolHandler)
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsB2GProtocolHandler.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsB2GProtocolHandler)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef NECKO_PROTOCOL_viewsource
|
||||
@ -755,9 +751,6 @@ NS_DEFINE_NAMED_CID(NS_DATAPROTOCOLHANDLER_CID);
|
||||
#endif
|
||||
#ifdef NECKO_PROTOCOL_device
|
||||
NS_DEFINE_NAMED_CID(NS_DEVICEPROTOCOLHANDLER_CID);
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
NS_DEFINE_NAMED_CID(NS_B2GPROTOCOLHANDLER_CID);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NECKO_PROTOCOL_viewsource
|
||||
NS_DEFINE_NAMED_CID(NS_VIEWSOURCEHANDLER_CID);
|
||||
@ -890,9 +883,6 @@ static const mozilla::Module::CIDEntry kNeckoCIDs[] = {
|
||||
#endif
|
||||
#ifdef NECKO_PROTOCOL_device
|
||||
{ &kNS_DEVICEPROTOCOLHANDLER_CID, false, NULL, nsDeviceProtocolHandlerConstructor},
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
{ &kNS_B2GPROTOCOLHANDLER_CID, false, NULL, nsB2GProtocolHandlerConstructor},
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NECKO_PROTOCOL_viewsource
|
||||
{ &kNS_VIEWSOURCEHANDLER_CID, false, NULL, nsViewSourceHandlerConstructor },
|
||||
@ -1034,9 +1024,6 @@ static const mozilla::Module::ContractIDEntry kNeckoContracts[] = {
|
||||
#endif
|
||||
#ifdef NECKO_PROTOCOL_device
|
||||
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-device", &kNS_DEVICEPROTOCOLHANDLER_CID },
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "b2g-camera", &kNS_B2GPROTOCOLHANDLER_CID },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef NECKO_PROTOCOL_viewsource
|
||||
{ NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "view-source", &kNS_VIEWSOURCEHANDLER_CID },
|
||||
|
@ -35,7 +35,6 @@ endif
|
||||
|
||||
ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
|
||||
CPPSRCS += GonkCaptureProvider.cpp \
|
||||
nsB2GProtocolHandler.cpp \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -1,85 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "nsB2GProtocolHandler.h"
|
||||
#include "nsDeviceChannel.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsSimpleURI.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsB2GProtocolHandler,
|
||||
nsIProtocolHandler)
|
||||
|
||||
nsresult
|
||||
nsB2GProtocolHandler::Init(){
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsB2GProtocolHandler::GetScheme(nsACString &aResult)
|
||||
{
|
||||
aResult.AssignLiteral("b2g-camera");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsB2GProtocolHandler::GetDefaultPort(int32_t *aResult)
|
||||
{
|
||||
*aResult = -1; // no port for b2g-camera: URLs
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsB2GProtocolHandler::GetProtocolFlags(uint32_t *aResult)
|
||||
{
|
||||
*aResult = URI_NORELATIVE | URI_NOAUTH | URI_LOADABLE_BY_ANYONE | URI_IS_LOCAL_RESOURCE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsB2GProtocolHandler::NewURI(const nsACString &spec,
|
||||
const char *originCharset,
|
||||
nsIURI *baseURI,
|
||||
nsIURI **result)
|
||||
{
|
||||
nsRefPtr<nsSimpleURI> uri = new nsSimpleURI();
|
||||
nsresult rv;
|
||||
|
||||
// XXX get the "real" uri from the pref
|
||||
// should use ipdl when we'll use e10s
|
||||
nsCString key("b2g.camera.");
|
||||
key.Append(spec);
|
||||
nsCString pref;
|
||||
rv = mozilla::Preferences::GetCString(key.get(), &pref);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = uri->SetSpec(pref);
|
||||
mozilla::Preferences::ClearUser(key.BeginReading());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CallQueryInterface(uri, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsB2GProtocolHandler::NewChannel(nsIURI* aURI, nsIChannel **aResult)
|
||||
{
|
||||
nsRefPtr<nsDeviceChannel> channel = new nsDeviceChannel();
|
||||
nsresult rv = channel->Init(aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return CallQueryInterface(channel, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsB2GProtocolHandler::AllowPort(int32_t port,
|
||||
const char *scheme,
|
||||
bool *aResult)
|
||||
{
|
||||
// don't override anything.
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsB2GProtocolHandler_h_
|
||||
#define nsB2GProtocolHandler_h_
|
||||
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {e50d101a-9db2-466f-977c-ae6af19e3b2f}
|
||||
#define NS_B2GPROTOCOLHANDLER_CID \
|
||||
{ 0x50d101a, 0x9db2, 0x466f, \
|
||||
{0x97, 0x7c, 0xae, 0x6a, 0xf1, 0x9e, 0x3b, 0x2f} }
|
||||
|
||||
class nsB2GProtocolHandler : public nsIProtocolHandler {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
|
||||
nsB2GProtocolHandler() {}
|
||||
~nsB2GProtocolHandler() {}
|
||||
|
||||
nsresult Init();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user