|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 interface nsIFeedResult; |
|
8 interface nsIFeedEntry; |
|
9 |
|
10 /** |
|
11 * nsIFeedResultListener defines a callback used when feed processing |
|
12 * completes. |
|
13 */ |
|
14 [scriptable, uuid(4d2ebe88-36eb-4e20-bcd1-997b3c1f24ce)] |
|
15 interface nsIFeedResultListener : nsISupports |
|
16 { |
|
17 /** |
|
18 * Always called, even after an error. There could be new feed-level |
|
19 * data available at this point, if it followed or was interspersed |
|
20 * with the items. Fire-and-Forget implementations only need this. |
|
21 * |
|
22 * @param result |
|
23 * An object implementing nsIFeedResult representing the feed |
|
24 * and its metadata. |
|
25 */ |
|
26 void handleResult(in nsIFeedResult result); |
|
27 }; |
|
28 |
|
29 |
|
30 /** |
|
31 * nsIFeedProgressListener defines callbacks used during feed |
|
32 * processing. |
|
33 */ |
|
34 [scriptable, uuid(ebfd5de5-713c-40c0-ad7c-f095117fa580)] |
|
35 interface nsIFeedProgressListener : nsIFeedResultListener { |
|
36 |
|
37 /** |
|
38 * ReportError will be called in the event of fatal |
|
39 * XML errors, or if the document is not a feed. The bozo |
|
40 * bit will be set if the error was due to a fatal error. |
|
41 * |
|
42 * @param errorText |
|
43 * A short description of the error. |
|
44 * @param lineNumber |
|
45 * The line on which the error occurred. |
|
46 */ |
|
47 void reportError(in AString errorText, in long lineNumber, |
|
48 in boolean bozo); |
|
49 |
|
50 /** |
|
51 * StartFeed will be called as soon as a reasonable start to |
|
52 * a feed is detected. |
|
53 * |
|
54 * @param result |
|
55 * An object implementing nsIFeedResult representing the feed |
|
56 * and its metadata. At this point, the result has version |
|
57 * information. |
|
58 */ |
|
59 void handleStartFeed(in nsIFeedResult result); |
|
60 |
|
61 /** |
|
62 * Called when the first entry/item is encountered. In Atom, all |
|
63 * feed data is required to preceed the entries. In RSS, the data |
|
64 * usually does. If the type is one of the entry/item-only types, |
|
65 * this event will not be called. |
|
66 * |
|
67 * @param result |
|
68 * An object implementing nsIFeedResult representing the feed |
|
69 * and its metadata. At this point, the result will likely have |
|
70 * most of its feed-level metadata. |
|
71 */ |
|
72 void handleFeedAtFirstEntry(in nsIFeedResult result); |
|
73 |
|
74 /** |
|
75 * Called after each entry/item. If the document is a standalone |
|
76 * item or entry, this HandleFeedAtFirstEntry will not have been |
|
77 * called. Also, this entry's parent field will be null. |
|
78 * |
|
79 * @param entry |
|
80 * An object implementing nsIFeedEntry that represents the latest |
|
81 * entry encountered. |
|
82 * @param result |
|
83 * An object implementing nsIFeedResult representing the feed |
|
84 * and its metadata. |
|
85 */ |
|
86 void handleEntry(in nsIFeedEntry entry, in nsIFeedResult result); |
|
87 }; |