Add new Update Manager interface and service to track current and past updates

This commit is contained in:
ben%bengoodger.com 2005-06-10 23:37:38 +00:00
Родитель e2586829cd
Коммит b42ec02ba4
5 изменённых файлов: 115 добавлений и 8 удалений

Просмотреть файл

@ -29,6 +29,8 @@
<!ENTITY checkNow.label "Check Now..."> <!ENTITY checkNow.label "Check Now...">
<!ENTITY appCheckNow.accesskey "C"> <!ENTITY appCheckNow.accesskey "C">
<!ENTITY extensionsCheckNow.accesskey "h"> <!ENTITY extensionsCheckNow.accesskey "h">
<!ENTITY showUpdates.label "Show Updates">
<!ENTITY showUpdates.accesskey "U">
<!ENTITY securityTab.label "Security"> <!ENTITY securityTab.label "Security">
<!ENTITY protocols.label "Protocols"> <!ENTITY protocols.label "Protocols">

Просмотреть файл

@ -265,6 +265,7 @@ var gDownloadingPage = {
update.setAttribute("name", "Firefox 1.0.4"); update.setAttribute("name", "Firefox 1.0.4");
update.setAttribute("status", "Blah"); update.setAttribute("status", "Blah");
update.setAttribute("url", "http://www.bengoodger.com/"); update.setAttribute("url", "http://www.bengoodger.com/");
update.setAttribute("mode", "normal");
update.id = "activeDownloadItem"; update.id = "activeDownloadItem";
var updatesView = document.getElementById("updatesView"); var updatesView = document.getElementById("updatesView");
updatesView.appendChild(update); updatesView.appendChild(update);

Просмотреть файл

@ -72,7 +72,7 @@
<xul:label class="update-item-name" xbl:inherits="value=name" crop="right" flex="1"/> <xul:label class="update-item-name" xbl:inherits="value=name" crop="right" flex="1"/>
<xul:link class="update-item-details" xbl:inherits="href=url" label="&details.link;"/> <xul:link class="update-item-details" xbl:inherits="href=url" label="&details.link;"/>
</xul:hbox> </xul:hbox>
<xul:progressmeter class="update-item-progress" xbl:inherits="value=progress"/> <xul:progressmeter class="update-item-progress" xbl:inherits="value=progress" mode="undetermined"/>
<xul:hbox align="center"> <xul:hbox align="center">
<xul:label class="update-item-status" xbl:inherits="value=status" flex="1" crop="right"/> <xul:label class="update-item-status" xbl:inherits="value=status" flex="1" crop="right"/>
<xul:button class="update-item-pause" <xul:button class="update-item-pause"

Просмотреть файл

@ -39,6 +39,7 @@
interface nsIRequest; interface nsIRequest;
interface nsIRequestObserver; interface nsIRequestObserver;
interface nsISimpleEnumerator;
interface nsITimerCallback; interface nsITimerCallback;
[scriptable, uuid(56863a67-bd69-42de-9f40-583e625b457d)] [scriptable, uuid(56863a67-bd69-42de-9f40-583e625b457d)]
@ -71,23 +72,36 @@ interface nsIUpdatePatch : nsISupports
interface nsIUpdate : nsISupports interface nsIUpdate : nsISupports
{ {
/** /**
* * The type of update:
* "major" A major new version of the Application
* "minor" A minor update to the Application (e.g. security update)
*/ */
attribute AString type; attribute AString type;
/** /**
* * The Application version of this update.
*/ */
attribute AString version; attribute AString version;
/** /**
* * The Addon version of this update. Used by the Extension System to track
* compatibility of installed addons with this update.
*/ */
attribute AString extensionversion; attribute AString extensionversion;
/** /**
* * The URL to a page which offers details about the content of this
* update. Ideally, this page is not the release notes but some other page
* that summarizes the differences between this update and the previous,
* which also links to the release notes.
*/ */
attribute AString detailsurl; attribute AString detailsurl;
/** /**
* * The URL to a HTML fragment that contains a license for this update. If
* this is specified, the user is shown the license file after they choose
* to install the update and they must agree to it before the download
* commences.
*/ */
attribute AString licenseurl; attribute AString licenseurl;
@ -99,11 +113,20 @@ interface nsIUpdate : nsISupports
attribute boolean isCompleteUpdate; attribute boolean isCompleteUpdate;
/** /**
* * When the update was installed.
*/
attribute long long installDate;
/**
* The number of patches supplied by this update.
*/ */
readonly attribute unsigned long patchCount; readonly attribute unsigned long patchCount;
/** /**
* * Retrieves a patch.
* @param index
* The index of the patch to retrieve.
* @returns The nsIUpdatePatch at the specified index.
*/ */
nsIUpdatePatch getPatchAt(in unsigned long index); nsIUpdatePatch getPatchAt(in unsigned long index);
}; };
@ -210,6 +233,35 @@ interface nsIApplicationUpdateService : nsISupports
void pauseDownload(); void pauseDownload();
}; };
[scriptable, uuid(fede66a9-9f96-4507-a22a-775ee885577e)]
interface nsIUpdateManager : nsISupports
{
/**
*
*/
readonly attribute nsISimpleEnumerator updates;
/**
*
*/
attribute nsIUpdate activeUpdate;
/**
*
*/
void addUpdate(in nsIUpdate update);
/**
*
*/
void removeUpdate(in nsIUpdate update);
/**
*
*/
void saveUpdates();
};
[scriptable, uuid(0765c92c-6145-4253-9db4-594d8023087e)] [scriptable, uuid(0765c92c-6145-4253-9db4-594d8023087e)]
interface nsIUpdateTimerManager : nsISupports interface nsIUpdateTimerManager : nsISupports
{ {

Просмотреть файл

@ -621,6 +621,53 @@ UpdateService.prototype = {
} }
}; };
function UpdateManager() {
}
UpdateManager.prototype = {
/**
* See nsIUpdateService.idl
*/
get updates() {
},
/**
* See nsIUpdateService.idl
*/
get activeUpdate() {
},
set activeUpdate(activeUpdate) {
},
/**
* See nsIUpdateService.idl
*/
addUpdate: function(update) {
},
/**
* See nsIUpdateService.idl
*/
removeUpdate: function(update) {
},
/**
* See nsIUpdateService.idl
*/
saveUpdates: function() {
},
/**
* See nsISupports.idl
*/
QueryInterface: function(iid) {
if (!iid.equals(Components.interfaces.nsIUpdateManager) &&
!iid.equals(Components.interfaces.nsISupports))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
}
};
/** /**
* Gets a preference value, handling the case where there is no default. * Gets a preference value, handling the case where there is no default.
* @param func * @param func
@ -1396,6 +1443,11 @@ var gModule = {
className : "Update Service", className : "Update Service",
factory : #1#(UpdateService) factory : #1#(UpdateService)
}, },
manager: { CID : Components.ID("{093C2356-4843-4C65-8709-D7DBCBBE7DFB}"),
contractID : "@mozilla.org/updates/update-manager;1",
className : "Update Manager",
factory : #1#(UpdateManager)
},
prompt: { CID : Components.ID("{27ABA825-35B5-4018-9FDD-F99250A0E722}"), prompt: { CID : Components.ID("{27ABA825-35B5-4018-9FDD-F99250A0E722}"),
contractID : "@mozilla.org/updates/update-prompt;1", contractID : "@mozilla.org/updates/update-prompt;1",
className : "Update Prompt", className : "Update Prompt",