|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
|
3 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #include "nsISupports.idl" |
|
8 |
|
9 interface nsISimpleEnumerator; |
|
10 |
|
11 /* |
|
12 * Status reporters show Firefox's service status. |
|
13 */ |
|
14 |
|
15 [scriptable, uuid(ffcb716c-deeb-44ea-9d9d-ab25dc6980a8)] |
|
16 interface nsIStatusReporter : nsISupports |
|
17 { |
|
18 readonly attribute ACString name; |
|
19 /* |
|
20 * The name of the process containing this reporter. Each reporter initially |
|
21 * has "" in this field, indicating that it applies to the current process. |
|
22 */ |
|
23 readonly attribute ACString process; |
|
24 /* |
|
25 * A human-readable status description. |
|
26 */ |
|
27 readonly attribute AUTF8String description; |
|
28 }; |
|
29 |
|
30 [scriptable, uuid(fd531273-3319-4fcd-90f2-9f53876c3828)] |
|
31 interface nsIStatusReporterManager : nsISupports |
|
32 { |
|
33 |
|
34 /* |
|
35 * Return an enumerator of nsIStatusReporters that are currently registered. |
|
36 */ |
|
37 nsISimpleEnumerator enumerateReporters(); |
|
38 |
|
39 /* |
|
40 * Register the given nsIStatusReporter. After a reporter is registered, |
|
41 * it will be available via enumerateReporters(). The Manager service |
|
42 * will hold a strong reference to the given reporter. |
|
43 */ |
|
44 void registerReporter(in nsIStatusReporter reporter); |
|
45 |
|
46 /* |
|
47 * Unregister the given status reporter. |
|
48 */ |
|
49 void unregisterReporter(in nsIStatusReporter reporter); |
|
50 |
|
51 /* |
|
52 * Initialize. |
|
53 */ |
|
54 void init(); |
|
55 |
|
56 /* |
|
57 * Dump service status as a json file |
|
58 */ |
|
59 void dumpReports(); |
|
60 }; |
|
61 |
|
62 %{C++ |
|
63 |
|
64 /* |
|
65 * Note that this defaults 'process' to "", which is usually what's desired. |
|
66 */ |
|
67 #define NS_STATUS_REPORTER_IMPLEMENT(_classname, _name, _desc_Function) \ |
|
68 class StatusReporter_##_classname MOZ_FINAL : public nsIStatusReporter { \ |
|
69 public: \ |
|
70 NS_DECL_ISUPPORTS \ |
|
71 NS_IMETHOD GetName(nsACString &name) \ |
|
72 { name.AssignLiteral(_name); return NS_OK; } \ |
|
73 NS_IMETHOD GetProcess(nsACString &process) \ |
|
74 { process.Truncate(); return NS_OK; } \ |
|
75 NS_IMETHOD GetDescription(nsACString &desc) \ |
|
76 { _desc_Function(desc); return NS_OK; } \ |
|
77 }; \ |
|
78 NS_IMPL_ISUPPORTS(StatusReporter_##_classname, nsIStatusReporter) |
|
79 |
|
80 #define NS_STATUS_REPORTER_NAME(_classname) StatusReporter_##_classname |
|
81 |
|
82 nsresult NS_RegisterStatusReporter(nsIStatusReporter *reporter); |
|
83 nsresult NS_UnregisterStatusReporter(nsIStatusReporter *reporter); |
|
84 nsresult NS_DumpStatusReporter(); |
|
85 |
|
86 #define NS_STATUS_REPORTER_MANAGER_CID \ |
|
87 { 0xe8eb4e7e, 0xf2cf, 0x45e5, \ |
|
88 { 0xb8, 0xa4, 0x6a, 0x0f, 0x50, 0x18, 0x84, 0x63 } } |
|
89 %} |