nsIApplicationUpdateService 编辑

toolkit/mozapps/update/nsIUpdateService.idlScriptable This interface describes a global application service that handles performing background update checks. It also provides utilities for selecting and downloading update patches. 1.0 66 Introduced Gecko 1.8 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

Method overview

void addDownloadListener(in nsIRequestObserver listener);
AString downloadUpdate(in nsIUpdate update, in boolean background);
void pauseDownload();
void removeDownloadListener(in nsIRequestObserver listener);
nsIUpdate selectUpdate([array, size_is(updateCount)] in nsIUpdate updates, in unsigned long updateCount);

Attributes

AttributeTypeDescription
backgroundCheckernsIUpdateCheckerThe update checker being used for background update checking. Read only.
canApplyUpdatesbooleantrue if the Update Service can download and install updates. Indicates if the current user has access privileges to the install directory. Read only.
canCheckForUpdatesbooleantrue if the Update Service can check for updates. Application updates might be disabled by the application and the platform the application is running on. Read only.
canUpdatebooleantrue if the update service is able to download and install updates. This depends on whether or not the current user has the necessary access privileges for the install directory. Read only. Obsolete since Gecko 1.9.1.7pre
isDownloadingbooleantrue if a download is in progress, otherwise false. Read only.

Methods

addDownloadListener()

Adds a listener that receives progress and state information about the update that is currently being downloaded. This information is most commonly used to update a user interface that informs the user as to the status of an update.

void addDownloadListener(
  in nsIRequestObserver listener
);
Parameters
listener
An object implementing nsIRequestObserver and optionally nsIProgressEventSink that will be notified of state and progress information as the update is downloaded.

downloadUpdate()

Starts downloading a software update.

 AString downloadUpdate(
   in nsIUpdate update,
   in boolean background
 );
Parameters
update
An nsIUpdate object indicating the update to download.
background
true to download the update in the background or false to download it in the foreground.
Return value

A string indicating the status of the update upon return:

"downloading"
The update is being downloaded.
"pending"
The update is ready to be applied.
"applying"
The update is in the process of being applied.
"succeeded"
The update has been installed successfully.
"download-failed"
The update failed to be downloaded.
"failed"
Installing the update failed.

pauseDownload()

Pauses the currently active update download.

void pauseDownload();
Parameters

None.

removeDownloadListener()

Removes a listener that is receiving progress and state information about the update that is currently being downloaded.

void removeDownloadListener(
  in nsIRequestObserver listener
);
Parameters
listener
The listener object to remove.

selectUpdate()

Selects the best update to install from a provided list of available updates.

nsIUpdate selectUpdate(
  [array, size_is(updateCount)] in nsIUpdate updates,
  in unsigned long updateCount
);
Parameters
updates
An array of updates that are available to install.
updateCount
The number of updates in the updates array.
Return value

An nsIUpdate object indicating the most appropriate update to install.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:50 次

字数:8257

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文