mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 21:55:31 +00:00
8fd8152982
--HG-- rename : dom/push/src/Push.js => dom/push/Push.js rename : dom/push/src/Push.manifest => dom/push/Push.manifest rename : dom/push/src/PushService.jsm => dom/push/PushService.jsm rename : dom/push/src/PushServiceLauncher.js => dom/push/PushServiceLauncher.js
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
const Cc = Components.classes;
|
|
const Ci = Components.interfaces;
|
|
const Cu = Components.utils;
|
|
const Cr = Components.results;
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
|
|
function PushServiceLauncher() {
|
|
};
|
|
|
|
PushServiceLauncher.prototype = {
|
|
classID: Components.ID("{4b8caa3b-3c58-4f3c-a7f5-7bd9cb24c11d}"),
|
|
|
|
contractID: "@mozilla.org/push/ServiceLauncher;1",
|
|
|
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
|
|
Ci.nsISupportsWeakReference]),
|
|
|
|
observe: function observe(subject, topic, data) {
|
|
switch (topic) {
|
|
case "app-startup":
|
|
Services.obs.addObserver(this, "final-ui-startup", true);
|
|
break;
|
|
case "final-ui-startup":
|
|
Services.obs.removeObserver(this, "final-ui-startup");
|
|
if (!Services.prefs.getBoolPref("services.push.enabled")) {
|
|
return;
|
|
}
|
|
Cu.import("resource://gre/modules/PushService.jsm");
|
|
PushService.init();
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
|
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PushServiceLauncher]);
|