home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Utils / Advanced SystemCare / asc-setup.exe / {app} / tb / components / ConduitToolbar.js < prev    next >
Encoding:
Text File  |  2009-12-23  |  3.2 KB  |  101 lines

  1. const Cc = Components.classes;
  2. const Ci = Components.interfaces;
  3. const CONDUIT_TOOLBAR_COMPONENT_ID = Components.ID("{31c7d459-9cc3-44f2-9dca-fc11795309b4}");
  4.  
  5. function loadJSFile(strFileName, bIsFromLibrary)
  6. {
  7.     var oFile;
  8.     if(bIsFromLibrary)
  9.     {
  10.         oFile = __LOCATION__.clone().parent.parent;
  11.         oFile.append("lib");
  12.         oFile.append(strFileName);
  13.     }
  14.     else
  15.     {
  16.         oFile = __LOCATION__.clone().parent;
  17.         oFile.append(strFileName);
  18.     }
  19.     
  20.     var oFilePath = Cc["@mozilla.org/network/protocol;1?name=file"].getService(Ci.nsIFileProtocolHandler).getURLSpecFromFile(oFile);
  21.     Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader).loadSubScript(oFilePath);
  22. }
  23.  
  24. loadJSFile("xpcom.js", true);
  25.  
  26. //main component
  27. function ConduitToolbar() {
  28.     this.wrappedJSObject = this;
  29.     this.chat = ChatXPCOM;
  30.     this.truste = TrusteXPCOM;
  31.     this.toolbarDataParsing = ToolbarDataParsingXPCOM;
  32.     this.alert = AlertXPCOM;
  33.     this.clientLog = ClientLogXPCOM;
  34.     this.uninstallLog = UninstallLogXPCOM;
  35.     this.toolbar = ToolbarManagerXPCOM;
  36.     this.fix404 = Fix404XPCOM;
  37.     this.keysStorage = KeysStorageXPCOM;
  38.     this.defaults = DefaultsXPCOM;
  39.     this.webProgress = WebProgressXPCOM;
  40.     this.twitter = TwitterXPCOM;
  41.     this.searchInNewTab = SearchInNewTabXPCOM;
  42.     this.prefs = ToolbarPrefsConsts;
  43.     this.toolbarFunctions = ToolbarFunctions;
  44.     this.facebook = FacebookXPCOM;
  45.     
  46.     this.QueryInterface = function (uuid) {
  47.         if (uuid.equals(Components.interfaces.nsIConduitToolbar_CT2384137) ||
  48.             uuid.equals(Components.interfaces.nsISupports)) {
  49.             return this;
  50.         }
  51.  
  52.         Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
  53.         return null;
  54.     };
  55.     
  56.     this.test = function(strOriginalCTID, strCurrentCTID)
  57.     {
  58.         alert("CT2384137");
  59.     };
  60. }
  61.  
  62. var ConduitToolbarModule = {
  63.     registerSelf: function (compMgr, fileSpec, location, type) {
  64.         compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
  65.         compMgr.registerFactoryLocation(CONDUIT_TOOLBAR_COMPONENT_ID,
  66.                                         "Conduit toolbar object",
  67.                                         "@conduit.com/toolbar;1=CT2384137",
  68.                                         fileSpec,
  69.                                         location,
  70.                                         type);
  71.     },
  72.     
  73.     unregisterSelf: function(aCompMgr, aLocation, aLoaderStr){
  74.  
  75.     },
  76.  
  77.     getClassObject: function (compMgr, cid, iid) {
  78.         if (!cid.equals(CONDUIT_TOOLBAR_COMPONENT_ID))
  79.             throw Components.results.NS_ERROR_NO_INTERFACE;
  80.         if (!iid.equals(Components.interfaces.nsIFactory))
  81.             throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  82.  
  83.         return ConduitToolbarFactory;
  84.     },
  85.  
  86.     canUnload: function(compMgr) {
  87.         return true;
  88.     }
  89. };
  90.  
  91. var ConduitToolbarFactory = {
  92.     createInstance: function (outer, iid) {
  93.         if (outer != null)
  94.             throw Components.results.NS_ERROR_NO_AGGREGATION;
  95.         return new ConduitToolbar().QueryInterface(iid);
  96.     }
  97. };
  98.  
  99. function NSGetModule(compMgr, fileSpec) {
  100.     return ConduitToolbarModule;
  101. }