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 file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: const Cu = Components.utils; michael@0: const Cr = Components.results; michael@0: michael@0: Cu.import("resource://gre/modules/XPCOMUtils.jsm"); michael@0: Cu.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: function PushServiceLauncher() { michael@0: }; michael@0: michael@0: PushServiceLauncher.prototype = { michael@0: classID: Components.ID("{4b8caa3b-3c58-4f3c-a7f5-7bd9cb24c11d}"), michael@0: michael@0: contractID: "@mozilla.org/push/ServiceLauncher;1", michael@0: michael@0: QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, michael@0: Ci.nsISupportsWeakReference]), michael@0: michael@0: observe: function observe(subject, topic, data) { michael@0: switch (topic) { michael@0: case "app-startup": michael@0: Services.obs.addObserver(this, "final-ui-startup", true); michael@0: break; michael@0: case "final-ui-startup": michael@0: Services.obs.removeObserver(this, "final-ui-startup"); michael@0: if (!Services.prefs.getBoolPref("services.push.enabled")) { michael@0: return; michael@0: } michael@0: Cu.import("resource://gre/modules/PushService.jsm"); michael@0: PushService.init(); michael@0: break; michael@0: } michael@0: } michael@0: }; michael@0: michael@0: this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PushServiceLauncher]);