nsIMicrosummaryService 编辑

toolkit/components/places/public/nsIMicrosummaryService.idlScriptable This interface provides methods for managing installed microsummaries, and the bookmarks they apply to. 1.0 66 Introduced Gecko 1.8 Obsolete Gecko 6.0 Inherits from: nsISupports Last changed in Gecko 1.9 (Firefox 3) Warning: Microsummary support was removed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)

Implemented by: @mozilla.org/microsummary/service;1 as a service:

var microsummaryService = Components.classes["@mozilla.org/microsummary/service;1"]
                          .getService(Components.interfaces.nsIMicrosummaryService);

Method overview

void addGenerator(in nsIURI generatorURI);
nsIMicrosummary createMicrosummary(in nsIURI pageURI, in nsIURI generatorURI);
nsISimpleEnumerator getBookmarks();
nsIMicrosummaryGenerator getGenerator(in nsIURI generatorURI);
nsIMicrosummarySet getMicrosummaries(in nsIURI pageURI, in long long bookmarkID);
nsIMicrosummary getMicrosummary(in long long bookmarkID);
boolean hasMicrosummary(in long long bookmarkID);
nsIMicrosummaryGenerator installGenerator(in nsIDOMDocument xmlDefinition);
boolean isMicrosummary(in long long bookmarkID, in nsIMicrosummary microsummary);
nsIMicrosummary refreshMicrosummary(in long long bookmarkID);
void removeMicrosummary(in long long bookmarkID);
void setMicrosummary(in long long bookmarkID, in nsIMicrosummary microsummary);

Methods

addGenerator()

Install the microsummary generator from the resource at the supplied URI. Callable by content via nsISidebar.addMicrosummaryGenerator().

void addGenerator(
  in nsIURI generatorURI
);
Parameters
generatorURI
The URI of the resource providing the generator.

createMicrosummary()

Create a microsummary for a given page URI and generator URI.

nsIMicrosummary createMicrosummary(
  in nsIURI pageURI,
  in nsIURI generatorURI
);
Parameters
pageURI
The URI of the page to be summarized.
generatorURI
The URI of the microsummary generator.
Return value

Returns an nsIMicrosummary for the given page and generator URIs.

getBookmarks()

Get the set of bookmarks with microsummaries. In the old RDF-based bookmarks datastore, bookmark IDs are nsIRDFResource objects. In the new Places-based datastore, they are nsIURI objects.

nsISimpleEnumerator getBookmarks();
Parameters

None.

Return value

Returns an nsISimpleEnumerator enumeration of bookmark IDs.

getGenerator()

Return a microsummary generator for the given URI.

nsIMicrosummaryGenerator getGenerator(
  in nsIURI generatorURI
);
Parameters
generatorURI
The URI of the generator.
Return value

Returns an nsIMicrosummaryGenerator for the given URI.

getMicrosummaries()

Get the set of microsummaries available for a given page. The set might change after this method returns, since this method will trigger an asynchronous load of the page in question (if it isn't already loaded) to see if it references any page-specific microsummaries.

If the caller passes a bookmark ID, and one of the microsummaries is the current one for the bookmark, this method will retrieve content from the datastore for that microsummary, which is useful when callers want to display a list of microsummaries for a page that isn't loaded, and they want to display the actual content of the selected microsummary immediately (rather than after the content is asynchronously loaded).

nsIMicrosummarySet getMicrosummaries(
  in nsIURI pageURI,
  in long long bookmarkID Optional
);
Parameters
pageURI
The URI of the page for which to retrieve available microsummaries.
bookmarkID Optional
The ID of the bookmark for which this method is being called.
Return value

Returns an nsIMicrosummarySet of nsIMicrosummaries for the given page.

getMicrosummary()

Get the current microsummary for the given bookmark.

nsIMicrosummary getMicrosummary(
  in long long bookmarkID
);
Parameters
bookmarkID
The bookmark for which to get the current microsummary.
Return value

Returns the current microsummary for the bookmark, or null if the bookmark does not have a current microsummary.

hasMicrosummary()

Whether or not the given bookmark has a current microsummary.

boolean hasMicrosummary(
  in long long bookmarkID
);
Parameters
bookmarkID
The bookmark for which to set the current microsummary.
Return value

Returns a boolean representing whether or not the given bookmark has a current microsummary.

installGenerator()

Install the microsummary generator in the given XML definition.

nsIMicrosummaryGenerator installGenerator(
  in nsIDOMDocument xmlDefinition
);
Parameters
xmlDefinition
An nsIDOMDocument XML document defining the generator.
Return value

Returns the nsIMicrosummaryGenerator that was installed.

isMicrosummary()

Reports whether or not the given microsummary is the current microsummary for the given bookmark.

boolean isMicrosummary(
  in long long bookmarkID,
  in nsIMicrosummary microsummary
);
Parameters
bookmarkID
The bookmark to check.
microsummary
The microsummary to check.
Return value

Returns whether or not the microsummary is the current one for the bookmark.

refreshMicrosummary()

Refreshes a microsummary, updating its value in the datastore and UI. If this method can refresh the microsummary instantly, it will. Otherwise, it'll asynchronously download the necessary information (the generator and/or page) before refreshing the microsummary.

Callers should check the content property of the returned microsummary object to distinguish between sync and async refreshes. If its value is null, then it's an async refresh, and the caller should register itself as an nsIMicrosummaryObserver via nsIMicrosummary.addObserver() to find out when the refresh completes.

nsIMicrosummary refreshMicrosummary(
  in long long bookmarkID
);
Parameters
bookmarkID
The bookmark whose microsummary is being refreshed.
Return value

Returns the microsummary being refreshed.

removeMicrosummary()

Remove the current microsummary for the given bookmark.

void removeMicrosummary(
  in long long bookmarkID
);
Parameters
bookmarkID
The bookmark for which to remove the current microsummary.

setMicrosummary()

Set the current microsummary for the given bookmark.

void setMicrosummary(
  in long long bookmarkID,
  in nsIMicrosummary microsummary
);
Parameters
bookmarkID
The bookmark for which to set the current microsummary.
microsummary
The microsummary to set as the current one.

See also

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

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

发布评论

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

词条统计

浏览:89 次

字数:12957

最后编辑:7 年前

编辑次数:0 次

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