Back to index

lightning-sunbird  0.9+nobinonly
nsIExtensionManager.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Extension Manager.
00016  *
00017  * The Initial Developer of the Original Code is Ben Goodger.
00018  * Portions created by the Initial Developer are Copyright (C) 2004
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *  Ben Goodger <ben@mozilla.org> (Google Inc.)
00023  *  Robert Strong <robert.bugzilla@gmail.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 
00040 #include "nsISupports.idl"
00041 
00042 interface nsIFile;
00043 interface nsIRDFDataSource;
00044 interface nsIUpdateItem;
00045 interface nsIAddonUpdateListener;
00046 interface nsIAddonUpdateCheckListener;
00047 interface nsICommandLine;
00048 interface nsISimpleEnumerator;
00049 interface nsIDirectoryEnumerator;
00050 
00055 [scriptable, uuid(D3D4DADA-C6EB-11D9-A68F-001124787B2E)]
00056 interface nsIInstallLocation : nsISupports
00057 {
00061   readonly attribute AString name;
00062   
00070   readonly attribute nsIDirectoryEnumerator itemLocations;
00071 
00079   readonly attribute nsIFile location;
00080 
00087   readonly attribute boolean restricted;
00088 
00095   readonly attribute boolean canAccess;
00096 
00107   const unsigned long PRIORITY_APP_PROFILE        = 0;
00108   const unsigned long PRIORITY_APP_SYSTEM_USER    = 10;
00109   const unsigned long PRIORITY_XRE_SYSTEM_USER    = 100;
00110   const unsigned long PRIORITY_APP_SYSTEM_GLOBAL  = 1000;
00111   const unsigned long PRIORITY_XRE_SYSTEM_GLOBAL  = 10000;
00112     
00116   readonly attribute long priority;
00117   
00124   nsIFile getItemLocation(in AString id);
00125 
00135   AString getIDForLocation(in nsIFile file);
00136 
00146   nsIFile getItemFile(in AString id, in AString path);
00147 
00159   boolean itemIsManagedIndependently(in AString id);
00160 };
00161 
00169 [scriptable, uuid(a3f5396c-a6e8-414a-8fbc-c8d831746328)]
00170 interface nsIExtensionManager : nsISupports
00171 {
00181   boolean start(in nsICommandLine commandLine);
00182 
00190   boolean checkForMismatches();
00191 
00200   void handleCommandLineArgs(in nsICommandLine cmdline);
00201 
00208   nsIInstallLocation getInstallLocation(in AString id);
00209 
00213   readonly attribute nsISimpleEnumerator installLocations;
00214 
00225   void installItemFromFile(in nsIFile xpiFile, in AString installLocationKey);
00226 
00232   void uninstallItem(in AString id);
00233 
00239   void enableItem(in AString id);
00240 
00246   void disableItem(in AString id);
00247 
00265    void update([array, size_is(itemCount)] in nsIUpdateItem items,
00266                in unsigned long itemCount, 
00267                in unsigned long versionUpdateOnly,
00268                in nsIAddonUpdateCheckListener listener);
00269 
00276   nsIUpdateItem getItemForID(in AString id);
00277 
00290   void getItemList(in unsigned long type, out unsigned long itemCount,
00291                    [retval, array, size_is(itemCount)] out nsIUpdateItem items);
00292 
00309   void getIncompatibleItemList(in AString id, 
00310                                in AString version,
00311                                in unsigned long type,
00312                                in boolean includeDisabled,
00313                                out unsigned long itemCount,
00314                                [retval, array, size_is(itemCount)] out nsIUpdateItem items);
00315 
00322   readonly attribute nsIRDFDataSource datasource;
00323 
00334   void addDownloads([array, size_is(itemCount)] in nsIUpdateItem items,
00335                     in unsigned long itemCount, in boolean fromChrome);
00336 
00342   void removeDownload(in AString url);
00343 
00351   long addUpdateListener(in nsIAddonUpdateListener listener);
00352 
00358   void removeUpdateListenerAt(in long index);
00359 
00367   void moveToIndexOf(in AString movingID, in AString destinationID);
00368 };
00369 
00375 [scriptable, uuid(0fd5caa9-1ffc-42b1-aea1-3fbe73116070)]
00376 interface nsIExtensionManager_MOZILLA_1_8_BRANCH : nsIExtensionManager
00377 {
00383   void cancelUninstallItem(in AString id);
00384 
00397   void getDependentItemListForID(in AString id,
00398                                  in boolean includeDisabled,
00399                                  out unsigned long itemCount,
00400                                  [retval, array, size_is(itemCount)] out nsIUpdateItem items);
00401 
00411   void checkForBlocklistChanges();
00412 
00424   void sortTypeByProperty(in unsigned long type, in AString propertyName, in boolean isAscending);
00425 };
00426 
00433 [scriptable, uuid(7f952767-427f-402b-8114-f80c95d1980d)]
00434 interface nsIUpdateItem : nsISupports
00435 {
00439   readonly attribute AString  id;
00440 
00444   readonly attribute AString  version;
00445 
00450   readonly attribute AString  minAppVersion;
00451 
00456   readonly attribute AString  maxAppVersion;
00457 
00461   readonly attribute AString  installLocationKey;
00462 
00466   readonly attribute AString  name;
00467 
00471   readonly attribute AString  xpiURL;
00472 
00478   readonly attribute AString  xpiHash;
00479 
00483   readonly attribute AString  iconURL;
00484 
00488   readonly attribute AString  updateRDF;
00489   
00490   const unsigned long TYPE_APP         = 0x01;
00491   const unsigned long TYPE_EXTENSION   = 0x02;
00492   const unsigned long TYPE_THEME       = 0x04;
00493   const unsigned long TYPE_LOCALE      = 0x08;
00494   const unsigned long TYPE_PLUGIN      = 0x10;
00495   const unsigned long TYPE_MULTI_XPI   = 0x20;
00496   const unsigned long TYPE_ADDON       = TYPE_EXTENSION + TYPE_THEME + TYPE_LOCALE + TYPE_PLUGIN;
00497   const unsigned long TYPE_ANY         = TYPE_APP + TYPE_ADDON;
00498 
00502   readonly attribute long type;
00503 
00507   void init(in AString id, in AString version, 
00508             in AString installLocationKey, in AString minAppVersion, 
00509             in AString maxAppVersion, in AString name,
00510             in AString downloadURL, in AString xpiHash, in AString iconURL,
00511             in AString updateURL, in long type);
00512 
00516   readonly attribute AString objectSource;
00517 };
00518 
00523 [scriptable, uuid(bb86037c-98c1-4c22-8e03-1e4c9fc89a8e)]
00524 interface nsIAddonUpdateListener : nsISupports
00525 {
00535   void onStateChange(in nsIUpdateItem addon, in short state, in long value);
00536 
00546   void onProgress(in nsIUpdateItem addon, in unsigned long value, 
00547                   in unsigned long maxValue);
00548 };
00549 
00553 [scriptable, uuid(c946119f-9e7c-41aa-a794-803148045350)]
00554 interface nsIAddonUpdateCheckListener : nsISupports
00555 {
00559   void onUpdateStarted();
00560 
00561   const unsigned long STATUS_NONE = 0;
00562   const unsigned long STATUS_UPDATE = 1;
00563   const unsigned long STATUS_VERSIONINFO = 2;
00564   const unsigned long STATUS_DATA_FOUND = 
00565     STATUS_UPDATE + STATUS_VERSIONINFO;
00566   const unsigned long STATUS_FAILURE = 4;
00567   const unsigned long STATUS_NO_UPDATE = 8;
00568   const unsigned long STATUS_DISABLED = 16;
00569   const unsigned long STATUS_APP_MANAGED = 32;
00570   const unsigned long STATUS_READ_ONLY = 64;
00571   const unsigned long STATUS_PENDING_OP = 128;
00572   const unsigned long STATUS_NOT_MANAGED = 256;
00573   const unsigned long STATUS_DISALLOWED =
00574     STATUS_DISABLED + STATUS_APP_MANAGED + STATUS_READ_ONLY +
00575     STATUS_PENDING_OP + STATUS_NOT_MANAGED;
00576 
00580   void onUpdateEnded();
00581 
00587   void onAddonUpdateStarted(in nsIUpdateItem addon);
00588 
00596   void onAddonUpdateEnded(in nsIUpdateItem addon, in long status);
00597 };
00598 
00599 %{ C++
00603 #define NS_INSTALL_LOCATION_APPGLOBAL NS_LITERAL_STRING("app-global")
00604 
00608 #define NS_INSTALL_LOCATION_APPPROFILE NS_LITERAL_STRING("app-profile")
00609 
00614 #define CATEGORY_INSTALL_LOCATIONS "extension-install-locations"
00615 
00620 #define EM_ACTION_REQUESTED_TOPIC "em-action-requested"
00621 
00622 #define EM_ITEM_INSTALLED   "item-installed"
00623 #define EM_ITEM_UPGRADED    "item-upgraded"
00624 #define EM_ITEM_UNINSTALLED "item-uninstalled"
00625 #define EM_ITEM_ENABLED     "item-enabled"
00626 #define EM_ITEM_DISABLED    "item-disabled"
00627 #define EM_ITEM_CANCEL      "item-cancel-action"
00628 
00629 %}
00630