Mercurial > ambnews-firefox
comparison ambnews/components/about.js @ 2:88b12596346d
Added an about:news handler and made the default page for new tabs about:news.
| author | Atul Varma <varmaa@toolness.com> |
|---|---|
| date | Thu, 21 Aug 2008 17:00:35 -0700 |
| parents | |
| children | f259d52d361e |
comparison
equal
deleted
inserted
replaced
| 1:44bcb4975ead | 2:88b12596346d |
|---|---|
| 1 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); | |
| 2 | |
| 3 const Cc = Components.classes; | |
| 4 const Ci = Components.interfaces; | |
| 5 | |
| 6 function AmbNewsAboutHandler() { | |
| 7 } | |
| 8 | |
| 9 AmbNewsAboutHandler.prototype = { | |
| 10 newChannel : function(aURI) { | |
| 11 var ios = Cc["@mozilla.org/network/io-service;1"]. | |
| 12 getService(Ci.nsIIOService); | |
| 13 | |
| 14 var channel = ios.newChannel( | |
| 15 "chrome://ambnews/content/blank.html", | |
| 16 null, | |
| 17 null | |
| 18 ); | |
| 19 | |
| 20 channel.originalURI = aURI; | |
| 21 return channel; | |
| 22 }, | |
| 23 | |
| 24 getURIFlags: function(aURI) { | |
| 25 return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT; | |
| 26 }, | |
| 27 | |
| 28 classDescription: "Ambient News Page", | |
| 29 classID: Components.ID("0e6d5f40-6fdc-11dd-ad8b-0800200c9a66"), | |
| 30 contractID: "@mozilla.org/network/protocol/about;1?what=news", | |
| 31 QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]) | |
| 32 }; | |
| 33 | |
| 34 function NSGetModule(aCompMgr, aFileSpec) { | |
| 35 return XPCOMUtils.generateModule([AmbNewsAboutHandler]); | |
| 36 } |
