michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim: set ts=8 sts=2 et sw=2 tw=80: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsISimpleEnumerator; michael@0: michael@0: /* michael@0: * Status reporters show Firefox's service status. michael@0: */ michael@0: michael@0: [scriptable, uuid(ffcb716c-deeb-44ea-9d9d-ab25dc6980a8)] michael@0: interface nsIStatusReporter : nsISupports michael@0: { michael@0: readonly attribute ACString name; michael@0: /* michael@0: * The name of the process containing this reporter. Each reporter initially michael@0: * has "" in this field, indicating that it applies to the current process. michael@0: */ michael@0: readonly attribute ACString process; michael@0: /* michael@0: * A human-readable status description. michael@0: */ michael@0: readonly attribute AUTF8String description; michael@0: }; michael@0: michael@0: [scriptable, uuid(fd531273-3319-4fcd-90f2-9f53876c3828)] michael@0: interface nsIStatusReporterManager : nsISupports michael@0: { michael@0: michael@0: /* michael@0: * Return an enumerator of nsIStatusReporters that are currently registered. michael@0: */ michael@0: nsISimpleEnumerator enumerateReporters(); michael@0: michael@0: /* michael@0: * Register the given nsIStatusReporter. After a reporter is registered, michael@0: * it will be available via enumerateReporters(). The Manager service michael@0: * will hold a strong reference to the given reporter. michael@0: */ michael@0: void registerReporter(in nsIStatusReporter reporter); michael@0: michael@0: /* michael@0: * Unregister the given status reporter. michael@0: */ michael@0: void unregisterReporter(in nsIStatusReporter reporter); michael@0: michael@0: /* michael@0: * Initialize. michael@0: */ michael@0: void init(); michael@0: michael@0: /* michael@0: * Dump service status as a json file michael@0: */ michael@0: void dumpReports(); michael@0: }; michael@0: michael@0: %{C++ michael@0: michael@0: /* michael@0: * Note that this defaults 'process' to "", which is usually what's desired. michael@0: */ michael@0: #define NS_STATUS_REPORTER_IMPLEMENT(_classname, _name, _desc_Function) \ michael@0: class StatusReporter_##_classname MOZ_FINAL : public nsIStatusReporter { \ michael@0: public: \ michael@0: NS_DECL_ISUPPORTS \ michael@0: NS_IMETHOD GetName(nsACString &name) \ michael@0: { name.AssignLiteral(_name); return NS_OK; } \ michael@0: NS_IMETHOD GetProcess(nsACString &process) \ michael@0: { process.Truncate(); return NS_OK; } \ michael@0: NS_IMETHOD GetDescription(nsACString &desc) \ michael@0: { _desc_Function(desc); return NS_OK; } \ michael@0: }; \ michael@0: NS_IMPL_ISUPPORTS(StatusReporter_##_classname, nsIStatusReporter) michael@0: michael@0: #define NS_STATUS_REPORTER_NAME(_classname) StatusReporter_##_classname michael@0: michael@0: nsresult NS_RegisterStatusReporter(nsIStatusReporter *reporter); michael@0: nsresult NS_UnregisterStatusReporter(nsIStatusReporter *reporter); michael@0: nsresult NS_DumpStatusReporter(); michael@0: michael@0: #define NS_STATUS_REPORTER_MANAGER_CID \ michael@0: { 0xe8eb4e7e, 0xf2cf, 0x45e5, \ michael@0: { 0xb8, 0xa4, 0x6a, 0x0f, 0x50, 0x18, 0x84, 0x63 } } michael@0: %}