Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/components/xulappinfo.js
blob: d472dd17c3b9bf0716e97013a8733b667d911227 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* FIXME: The values in the block below should be supplied by the activity. */
const APPLICATION_ID = '{ab9fc198-f515-477b-843f-8fb52810a3e0}'
const APPLICATION_VENDOR = 'Sugar'
const APPLICATION_NAME = 'Browser Activity'
const APPLICATION_VERSION = '0.4.7'
const APPLICATION_BUILD_ID = '2008072400'

const PLATFORM_VERSION = '1.9'
const PLATFORM_BUILD_ID = '2008072400'
const OS = 'linux-gnu'
const XPCOMABI = 'x86_64' + '-gcc3'


const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
const XULAPPINFO_CID = Components.ID("{18eec982-b411-4f07-9fca-79d33ee6e4b5}");

const nsIXULAppInfo = Components.interfaces.nsIXULAppInfo;
const nsIXULRuntime = Components.interfaces.nsIXULRuntime;
const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
const nsIFactory = Components.interfaces.nsIFactory;

function XULAppInfoService()
{}

XULAppInfoService.prototype.ID = APPLICATION_ID
XULAppInfoService.prototype.vendor = APPLICATION_VENDOR
XULAppInfoService.prototype.name = APPLICATION_NAME
XULAppInfoService.prototype.version = APPLICATION_VERSION
XULAppInfoService.prototype.appBuildID = APPLICATION_BUILD_ID
XULAppInfoService.prototype.platformVersion = PLATFORM_VERSION
XULAppInfoService.prototype.platformBuildID = PLATFORM_BUILD_ID
XULAppInfoService.prototype.inSafeMode = false
XULAppInfoService.prototype.logConsoleErrors = true
XULAppInfoService.prototype.OS = OS
XULAppInfoService.prototype.XPCOMABI = XPCOMABI

XULAppInfoService.prototype.QueryInterface =
function appinfo_QueryInterface(iid)
{
    if (!iid.equals(nsIXULAppInfo) &&
        !iid.equals(nsIXULRuntime) &&
        !iid.equals(nsISupports))
    {
        throw Components.results.NS_ERROR_NO_INTERFACE;
    }

    return this;
}

var XULAppInfoFactory = new Object();

XULAppInfoFactory.createInstance =
function(outer, iid)
{
    if (outer != null)
        throw Components.results.NS_ERROR_NO_AGGREGATION;

    if (!iid.equals(nsIXULAppInfo) && !iid.equals(nsISupports))
        throw Components.results.NS_ERROR_INVALID_ARG;

    return new XULAppInfoService();
}


var XULAppInfoModule = new Object();

XULAppInfoModule.registerSelf =
function mod_registerSelf(compMgr, fileSpec, location, type)
{
    compMgr = compMgr.QueryInterface(nsIComponentRegistrar);

    compMgr.registerFactoryLocation(XULAPPINFO_CID,
                                    "XUL AppInfo service",
                                    XULAPPINFO_CONTRACTID,
                                    fileSpec, location, type);
}

XULAppInfoModule.unregisterSelf =
function mod_unregisterSelf(compMgr, fileSpec, location)
{
}

XULAppInfoModule.getClassObject =
function mod_getClassObject(compMgr, cid, iid)
{
    if (cid.equals(XULAPPINFO_CID))
        return XULAppInfoFactory;

    if (!iid.equals(nsIFactory))
        throw Components.results.NS_ERROR_NOT_IMPLEMENTED;

    throw Components.results.NS_ERROR_NO_INTERFACE;
}

XULAppInfoModule.canUnload =
function mod_canUnload(compMgr)
{
    return true;
}

/* entrypoint */
function NSGetModule(compMgr, fileSpec)
{
    return XULAppInfoModule;
}