gmail-mode: remove gmail_focus_primary_frame
[conkeror.git] / components / download_manager_ui.js
blobc111ccb5c9431d6459dbc688007799382278df87
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  * (C) Copyright 2011 John Foerch
4  *
5  * Use, modification, and distribution are subject to the terms specified in the
6  * COPYING file.
7 **/
9 // Register the Conkeror download_manager_ui, which doesn't really do anything at all
11 const classID = Components.ID("{7770E0D0-C4A0-11DC-95FF-0800200C9A66}");
12 const classDescription = "Conkeror Download Manager UI";
13 const contractID = "@mozilla.org/download-manager-ui;1";
15 var module = {
17     /* This firstTime trick is used to delay the registration.  This
18      * is needed to ensure it overrides the built-in component for the
19      * same contractID (the built-in nsHelperAppDlg.js being
20      * overridden uses this as well, and as a result we have to). */
22     /* http://dietrich.ganx4.com/blog/?p=221#comment-14 */
23     /* https://bugzilla.mozilla.org/show_bug.cgi?id=253125 */
24     /* https://bugzilla.mozilla.org/show_bug.cgi?id=253136 */
26     /* We can't use XPCOMUtils because that doesn't provide this delay
27      * trick. */
29     firstTime: true,
31     // registerSelf: Register this component.
32     registerSelf: function (compMgr, fileSpec, location, type) {
33         if (this.firstTime) {
34             this.firstTime = false;
35             throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
36         }
37         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
39         compMgr.registerFactoryLocation( classID,
40                                          classDescription,
41                                          contractID,
42                                          fileSpec,
43                                          location,
44                                          type );
45     },
47     // getClassObject: Return this component's factory object.
48     getClassObject: function (compMgr, cid, iid) {
49         if (!cid.equals(classID)) {
50             throw Components.results.NS_ERROR_NO_INTERFACE;
51         }
53         if (!iid.equals(Components.interfaces.nsIFactory)) {
54             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
55         }
57         return this.factory;
58     },
60     /* factory object */
61     factory: {
62         createInstance: function (outer, iid) {
63             if (outer != null)
64                 throw Components.results.NS_ERROR_NO_AGGREGATION;
66             /* Return an instance of the Conkeror-scope download_helper object. */
67             var conkeror = Components.classes["@conkeror.mozdev.org/application;1"].getService().wrappedJSObject;
68             return (new conkeror.download_manager_ui()).QueryInterface(iid);
69         }
70     },
72     canUnload: function(compMgr) { return true; }
75 function NSGetFactory (cid) { // XULRunner 2.0
76     return module.factory;
79 function NSGetModule(compMgr, fileSpec) {
80     return module;