16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* ***** BEGIN LICENSE BLOCK *****
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * Version: MPL 1.1/GPL 2.0/LGPL 2.1
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * The contents of this file are subject to the Mozilla Public License Version
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * 1.1 (the "License"); you may not use this file except in compliance with
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * the License. You may obtain a copy of the License at
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * http://www.mozilla.org/MPL/
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * Software distributed under the License is distributed on an "AS IS" basis,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * for the specific language governing rights and limitations under the
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * License.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * The Original Code is the Python XPCOM language bindings.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * The Initial Developer of the Original Code is
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * ActiveState Tool Corp.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * Portions created by the Initial Developer are Copyright (C) 2000
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * the Initial Developer. All Rights Reserved.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * Contributor(s):
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * Mark Hammond <mhammond@skippinet.com.au> (original author)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * Alternatively, the contents of this file may be used under the terms of
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * either the GNU General Public License Version 2 or later (the "GPL"), or
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * in which case the provisions of the GPL or the LGPL are applicable instead
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * of those above. If you wish to allow use of your version of this file only
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * under the terms of either the GPL or the LGPL, and not to allow others to
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * use your version of this file under the terms of the MPL, indicate your
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * decision by deleting the provisions above and replace them with the notice
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * and other provisions required by the GPL or the LGPL. If you do not delete
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * the provisions above, a recipient may use your version of this file under
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * the terms of any one of the MPL, the GPL or the LGPL.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync * ***** END LICENSE BLOCK ***** */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync//
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// This code is part of the XPCOM extensions for Python.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync//
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// Written May 2000 by Mark Hammond.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync//
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// Based heavily on the Python COM support, which is
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// (c) Mark Hammond and Greg Stein.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync//
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// (c) 2000, ActiveState corp.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// Unfortunately, we can not use an XPConnect object for
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// the nsiModule and nsiComponentLoader interfaces.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// As XPCOM shuts down, it shuts down the interface manager before
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// it releases all the modules. This is a bit of a problem for
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// us, as it means we can't get runtime info on the interface at shutdown time.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync#include "PyXPCOM_std.h"
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync#include <nsIModule.h>
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync#include <nsIComponentLoader.h>
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncclass PyG_nsIModule : public PyG_Base, public nsIModule
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncpublic:
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyG_nsIModule(PyObject *instance) : PyG_Base(instance, NS_GET_IID(nsIModule)) {;}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PYGATEWAY_BASE_SUPPORT(nsIModule, PyG_Base);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_DECL_NSIMODULE
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync};
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncPyG_Base *MakePyG_nsIModule(PyObject *instance)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return new PyG_nsIModule(instance);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync// Create a factory object for creating instances of aClass.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncPyG_nsIModule::GetClassObject(nsIComponentManager *aCompMgr,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const nsCID& aClass,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const nsIID& aIID,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync void** r_classObj)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_PRECONDITION(r_classObj, "null pointer");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *r_classObj = nsnull;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *cm = PyObject_FromNSInterface(aCompMgr, NS_GET_IID(nsIComponentManager));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *iid = Py_nsIID::PyObjectFromIID(aIID);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *clsid = Py_nsIID::PyObjectFromIID(aClass);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "getClassObject";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *ret = NULL;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "OOO", cm, clsid, iid);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(cm);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(iid);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(clsid);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (NS_SUCCEEDED(nr)) {
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nr = Py_nsISupports::InterfaceFromPyObject(ret, aIID, (nsISupports **)r_classObj, PR_FALSE);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (PyErr_Occurred())
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nr = HandleNativeGatewayError(methodName);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync }
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (NS_FAILED(nr)) {
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_ABORT_IF_FALSE(*r_classObj==NULL, "returning error result with an interface - probable leak!");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync }
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncPyG_nsIModule::RegisterSelf(nsIComponentManager *aCompMgr,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsIFile* aPath,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char* registryLocation,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char* componentType)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_PRECONDITION(aCompMgr, "null pointer");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_PRECONDITION(aPath, "null pointer");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *cm = PyObject_FromNSInterface(aCompMgr, NS_GET_IID(nsIComponentManager));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *path = PyObject_FromNSInterface(aPath, NS_GET_IID(nsIFile));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "registerSelf";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "OOzz", cm, path, registryLocation, componentType);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(cm);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(path);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncPyG_nsIModule::UnregisterSelf(nsIComponentManager* aCompMgr,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsIFile* aPath,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char* registryLocation)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_PRECONDITION(aCompMgr, "null pointer");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_PRECONDITION(aPath, "null pointer");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *cm = PyObject_FromNSInterface(aCompMgr, NS_GET_IID(nsIComponentManager));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *path = PyObject_FromNSInterface(aPath, NS_GET_IID(nsIFile));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "unregisterSelf";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "OOz", cm, path, registryLocation);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(cm);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(path);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncPyG_nsIModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_PRECONDITION(aCompMgr, "null pointer");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_PRECONDITION(okToUnload, "null pointer");
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync // we are shutting down - don't ask for a nice wrapped object.
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *cm = PyObject_FromNSInterface(aCompMgr, NS_GET_IID(nsIComponentManager), PR_FALSE);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "canUnload";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *ret = NULL;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "O", cm);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(cm);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (NS_SUCCEEDED(nr)) {
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *okToUnload = PyInt_AsLong(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (PyErr_Occurred())
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nr = HandleNativeGatewayError(methodName);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync }
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync///////////////////////////////////////////////////////////////////////////////////
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncclass PyG_nsIComponentLoader : public PyG_Base, public nsIComponentLoader
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncpublic:
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyG_nsIComponentLoader(PyObject *instance) : PyG_Base(instance, NS_GET_IID(nsIComponentLoader)) {;}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PYGATEWAY_BASE_SUPPORT(nsIComponentLoader, PyG_Base);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync NS_DECL_NSICOMPONENTLOADER
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync};
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncPyG_Base *MakePyG_nsIComponentLoader(PyObject *instance)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return new PyG_nsIComponentLoader(instance);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* nsIFactory getFactory (in nsIIDRef aCID, in string aLocation, in string aType); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::GetFactory(const nsIID & aCID, const char *aLocation, const char *aType, nsIFactory **_retval)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "getFactory";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *iid = Py_nsIID::PyObjectFromIID(aCID);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *ret = NULL;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "Ozz",
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync iid,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aLocation,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aType);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(iid);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (NS_SUCCEEDED(nr)) {
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_nsISupports::InterfaceFromPyObject(ret, NS_GET_IID(nsIFactory), (nsISupports **)_retval, PR_FALSE);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (PyErr_Occurred())
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nr = HandleNativeGatewayError(methodName);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync }
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* void init (in nsIComponentManager aCompMgr, in nsISupports aRegistry); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::Init(nsIComponentManager *aCompMgr, nsISupports *aRegistry)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "init";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *c = PyObject_FromNSInterface(aCompMgr, NS_GET_IID(nsIComponentManager));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *r = PyObject_FromNSInterface(aRegistry, NS_GET_IID(nsISupports));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "OO", c, r);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(c);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(r);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* void onRegister (in nsIIDRef aCID, in string aType, in string aClassName, in string aContractID, in string aLocation, in boolean aReplace, in boolean aPersist); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::OnRegister(const nsIID & aCID, const char *aType, const char *aClassName, const char *aContractID, const char *aLocation, PRBool aReplace, PRBool aPersist)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "onRegister";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *iid = Py_nsIID::PyObjectFromIID(aCID);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "Ossssii",
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync iid,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aType,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aClassName,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aContractID,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aLocation,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aReplace,
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync aPersist);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(iid);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* void autoRegisterComponents (in long aWhen, in nsIFile aDirectory); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::AutoRegisterComponents(PRInt32 aWhen, nsIFile *aDirectory)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "autoRegisterComponents";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *c = PyObject_FromNSInterface(aDirectory, NS_GET_IID(nsIFile));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, NULL, "iO", aWhen, c);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(c);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* boolean autoRegisterComponent (in long aWhen, in nsIFile aComponent); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::AutoRegisterComponent(PRInt32 aWhen, nsIFile *aComponent, PRBool *_retval)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "autoRegisterComponent";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *ret = NULL;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *c = PyObject_FromNSInterface(aComponent, NS_GET_IID(nsIFile));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "iO", aWhen, c);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(c);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (NS_SUCCEEDED(nr)) {
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *_retval = PyInt_AsLong(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (PyErr_Occurred())
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nr = HandleNativeGatewayError(methodName);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync }
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* boolean autoUnregisterComponent (in long aWhen, in nsIFile aComponent); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::AutoUnregisterComponent(PRInt32 aWhen, nsIFile *aComponent, PRBool *_retval)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "autoUnregisterComponent";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *ret = NULL;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *c = PyObject_FromNSInterface(aComponent, NS_GET_IID(nsIFile));
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "iO", aWhen, c);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(c);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (NS_SUCCEEDED(nr)) {
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *_retval = PyInt_AsLong(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (PyErr_Occurred())
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nr = HandleNativeGatewayError(methodName);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync }
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* boolean registerDeferredComponents (in long aWhen); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::RegisterDeferredComponents(PRInt32 aWhen, PRBool *_retval)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "registerDeferredComponents";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync PyObject *ret = NULL;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nsresult nr = InvokeNativeViaPolicy(methodName, &ret, "i", aWhen);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (NS_SUCCEEDED(nr)) {
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync *_retval = PyInt_AsLong(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync if (PyErr_Occurred())
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync nr = HandleNativeGatewayError(methodName);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync }
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync Py_XDECREF(ret);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return nr;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync/* void unloadAll (in long aWhen); */
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsyncNS_IMETHODIMP PyG_nsIComponentLoader::UnloadAll(PRInt32 aWhen)
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync{
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync CEnterLeavePython _celp;
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync const char *methodName = "unloadAll";
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync return InvokeNativeViaPolicy(methodName, NULL, "i", aWhen);
16a8d09569a2ebd598cef72fa605be6fb4563607vboxsync}