~ubuntu-branches/ubuntu/natty/mozvoikko/natty-proposed

« back to all changes in this revision

Viewing changes to src/nsMozvoikkoHelper.js

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2011-12-20 00:19:52 UTC
  • mfrom: (18.1.3 natty-security)
  • Revision ID: package-import@ubuntu.com-20111220001952-kgbjh71gwu6l8023
Tags: 1.10.0-0ubuntu0.11.04.4
* Update for Firefox 9 (LP: #906389)
  - update debian/patches/port_to_latest_firefox.patch for
    mozISpellCheckingEngine changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
2
 
 
3
 
const nsIMozvoikkoHelper = Components.interfaces.nsIMozvoikkoHelper;
4
 
const CLASS_ID = Components.ID("{aae2f310-dd4b-11df-937b-0800200c9a66}");
5
 
const CLASS_NAME = "Mozvoikko Helper";
6
 
const CONTRACT_ID = "@mozilla.org/mozvoikkohelper;1";
7
 
 
8
 
function MozvoikkoHelper() { }
9
 
 
10
 
MozvoikkoHelper.prototype =
11
 
{
12
 
    classDescription: CLASS_NAME,
13
 
    classID: CLASS_ID,
14
 
    contracyID: CONTRACT_ID,
15
 
 
16
 
    QueryInterface: XPCOMUtils.generateQI([nsIMozvoikkoHelper],
17
 
                           Components.interfaces.nsISupports),
18
 
    
19
 
    get componentFile() {
20
 
        return __LOCATION__;
21
 
    },
22
 
    
23
 
    get componentsDir() {
24
 
        return __LOCATION__.parent;
25
 
    },
26
 
    
27
 
    get extensionDir() {
28
 
        return __LOCATION__.parent.parent;
29
 
    }
30
 
 
31
 
}
32
 
 
33
 
/***********************************************************
34
 
module definition (xpcom registration)
35
 
***********************************************************/
36
 
var MozvoikkoHelperFactory =
37
 
{
38
 
    registerSelf: function(aCompMgr, aFileSpec, aLocation, aType)
39
 
    {
40
 
        aCompMgr = aCompMgr.
41
 
            QueryInterface(Components.interfaces.nsIComponentRegistrar);
42
 
        aCompMgr.registerFactoryLocation(
43
 
            CLASS_ID, CLASS_NAME,
44
 
            CONTRACT_ID, aFileSpec, aLocation, aType);
45
 
    },
46
 
 
47
 
    unregisterSelf: function(aCompMgr, aLocation, aType)
48
 
    {
49
 
        aCompMgr = aCompMgr.
50
 
            QueryInterface(Components.interfaces.nsIComponentRegistrar);
51
 
        aCompMgr.unregisterFactoryLocation(CLASS_ID, aLocation);
52
 
    },
53
 
 
54
 
    getClassObject: function(aCompMgr, aCID, aIID)
55
 
    {
56
 
        if (!aIID.equals(Components.interfaces.nsIFactory))
57
 
            throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
58
 
 
59
 
        if (aCID.equals(CLASS_ID))
60
 
            return this.MozvoikkoHelperFactory;
61
 
        
62
 
        throw Components.results.NS_ERROR_NO_INTERFACE;
63
 
    },
64
 
 
65
 
    canUnload: function(aCompMgr)
66
 
    {
67
 
        return true;
68
 
    },
69
 
 
70
 
    /***********************************************************
71
 
        class factory
72
 
 
73
 
        This object is a member of the global-scope Components.classes.
74
 
        It is keyed off of the contract ID. Eg:
75
 
 
76
 
        myHelloWorld = Components.classes["@dietrich.ganx4.com/helloworld;1"].
77
 
                          createInstance(Components.interfaces.nsIHelloWorld);
78
 
 
79
 
    ***********************************************************/
80
 
    MozvoikkoHelperFactory:
81
 
    {
82
 
        createInstance: function(aOuter, aIID)
83
 
        {
84
 
            if (aOuter != null)
85
 
                throw Components.results.NS_ERROR_NO_AGGREGATION;
86
 
 
87
 
            return (new MozvoikkoHelper()).QueryInterface(aIID);
88
 
        }
89
 
    }
90
 
};
91
 
 
92
 
// FF 2
93
 
/***********************************************************
94
 
module initialization
95
 
 
96
 
When the application registers the component, this function
97
 
is called.
98
 
***********************************************************/
99
 
function NSGetModule(aCompMgr, aFileSpec)
100
 
{
101
 
        return MozvoikkoHelperFactory;
102
 
}
103
 
 
104
 
// FF 4+
105
 
if (typeof XPCOMUtils != "undefined")
106
 
{
107
 
        if (XPCOMUtils.generateNSGetFactory) {
108
 
                // FF 4+
109
 
                var NSGetFactory = XPCOMUtils.generateNSGetFactory([MozvoikkoHelper]);
110
 
        }
111
 
}