xpinstall/src/nsInstallTrigger.h
author Boris Zbarsky <bzbarsky@mit.edu>
Wed, 09 Nov 2011 16:11:39 -0500
changeset 80106 5636969704cdf56c5918f655e051cd7c38cd1c34
parent 78840 ec7577dec4fceef0ac2717416d9c48289402d935
child 105676 f93960a93ad97a56d308bd9ce25d97cbc175d524
permissions -rw-r--r--
Bug 699528. Make pausing/unpausing JSD try to turn off/on debug mode as needed. r=sfink The new boolean argument to SetDebugModeWhenPossible is needed because if we allow sync-disable of debug mode we seem to crash when loading pages with Firebug active.

#ifndef __NS_INSTALLTRIGGER_H__
#define __NS_INSTALLTRIGGER_H__

#include "nscore.h"
#include "nsString.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsIScriptObjectOwner.h"

#include "prtypes.h"
#include "nsHashtable.h"

#include "nsIDOMInstallTriggerGlobal.h"
#include "nsXPITriggerInfo.h"

#include "nsIContentHandler.h"

#define NOT_CHROME          0
#define CHROME_SKIN         1
#define CHROME_LOCALE       2
#define CHROME_SAFEMAX      CHROME_SKIN
#define CHROME_CONTENT      4
#define CHROME_ALL          (CHROME_SKIN | CHROME_LOCALE | CHROME_CONTENT)
#define CHROME_PROFILE      8
#define CHROME_DELAYED      0x10
#define CHROME_SELECT       0x20

#define XPI_PERMISSION      "install"

#define XPI_WHITELIST       true
#define XPI_GLOBAL          false

#define XPINSTALL_ENABLE_PREF            "xpinstall.enabled"
#define XPINSTALL_WHITELIST_ADD          "xpinstall.whitelist.add"
#define XPINSTALL_WHITELIST_ADD_36       "xpinstall.whitelist.add.36"
#define XPINSTALL_WHITELIST_REQUIRED     "xpinstall.whitelist.required"
#define XPINSTALL_BLACKLIST_ADD          "xpinstall.blacklist.add"

class nsInstallTrigger: public nsIScriptObjectOwner,
                        public nsIDOMInstallTriggerGlobal,
                        public nsIContentHandler
{
    public:
        nsInstallTrigger();
        virtual ~nsInstallTrigger();

        NS_DECL_ISUPPORTS
        NS_DECL_NSICONTENTHANDLER

        NS_IMETHOD    GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
        NS_IMETHOD    SetScriptObject(void* aScriptObject);

        NS_IMETHOD    GetOriginatingURI(nsIScriptGlobalObject* aGlobalObject, nsIURI * *aUri);
        NS_IMETHOD    UpdateEnabled(nsIScriptGlobalObject* aGlobalObject, bool aUseWhitelist, bool* aReturn);
        NS_IMETHOD    UpdateEnabled(nsIURI* aURI, bool aUseWhitelist, bool* aReturn);
        NS_IMETHOD    StartInstall(nsIXPIInstallInfo* aInstallInfo, bool* aReturn);


    private:
        bool    AllowInstall(nsIURI* aLaunchURI);
        void *mScriptObject;
};

#define NS_INSTALLTRIGGERCOMPONENT_CONTRACTID "@mozilla.org/xpinstall/installtrigger;1"
#endif