summaryrefslogtreecommitdiffstats
path: root/dom/tethering/TetheringManager.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-06 15:53:52 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-06 15:53:52 +0200
commit941e54654eabed0a3568f7fefe424a45aa02eddb (patch)
tree49aa02b174c428962d99142d8061267bfcd79e69 /dom/tethering/TetheringManager.js
parentad9ee72dcd7981bc47b3844a224d69fadfdfd8ef (diff)
parent0daa12376295d5d796256a116eb2a348a3a9273f (diff)
downloadUXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar
UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar.gz
UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar.lz
UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.tar.xz
UXP-941e54654eabed0a3568f7fefe424a45aa02eddb.zip
Merge branch 'master' of https://github.com/MoonchildProductions/UXP into _testBranch_test_1
Diffstat (limited to 'dom/tethering/TetheringManager.js')
-rw-r--r--dom/tethering/TetheringManager.js92
1 files changed, 0 insertions, 92 deletions
diff --git a/dom/tethering/TetheringManager.js b/dom/tethering/TetheringManager.js
deleted file mode 100644
index 1e3d3a0ea..000000000
--- a/dom/tethering/TetheringManager.js
+++ /dev/null
@@ -1,92 +0,0 @@
-/* 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 {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
- "@mozilla.org/childprocessmessagemanager;1",
- "nsIMessageSender");
-
-const DEBUG = false;
-
-const TETHERING_TYPE_WIFI = "wifi";
-const TETHERING_TYPE_BLUETOOTH = "bt";
-const TETHERING_TYPE_USB = "usb";
-
-function TetheringManager() {
-}
-
-TetheringManager.prototype = {
- __proto__: DOMRequestIpcHelper.prototype,
-
- classDescription: "TetheringManager",
- classID: Components.ID("{bd8a831c-d8ec-4f00-8803-606e50781097}"),
- contractID: "@mozilla.org/dom/tetheringmanager;1",
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMGlobalPropertyInitializer,
- Ci.nsISupportsWeakReference,
- Ci.nsIObserver]),
-
- init: function(aWindow) {
- const messages = ["WifiManager:setWifiTethering:Return:OK",
- "WifiManager:setWifiTethering:Return:NO"];
- this.initDOMRequestHelper(aWindow, messages);
- },
-
- // TODO : aMessage format may be different after supporting bt/usb.
- // for now, use wifi format first.
- receiveMessage: function(aMessage) {
- let data = aMessage.data.data;
-
- let resolver = this.takePromiseResolver(data.resolverId);
- if (!resolver) {
- return;
- }
-
- switch (aMessage.name) {
- case "WifiManager:setWifiTethering:Return:OK":
- resolver.resolve(data);
- break;
- case "WifiManager:setWifiTethering:Return:NO":
- resolver.reject(data.reason);
- break;
- }
- },
-
- setTetheringEnabled: function setTetheringEnabled(aEnabled, aType, aConfig) {
- let self = this;
- switch (aType) {
- case TETHERING_TYPE_WIFI:
- return this.createPromiseWithId(function(aResolverId) {
- let data = { resolverId: aResolverId, enabled: aEnabled, config: aConfig };
- cpmm.sendAsyncMessage("WifiManager:setWifiTethering", { data: data});
- });
- case TETHERING_TYPE_BLUETOOTH:
- case TETHERING_TYPE_USB:
- default:
- debug("tethering type(" + aType + ") doesn't support");
- return this.createPromiseWithId(function(aResolverId) {
- self.takePromiseResolver(aResolverId).reject();
- });
- }
- },
-};
-
-this.NSGetFactory =
- XPCOMUtils.generateNSGetFactory([TetheringManager]);
-
-var debug;
-if (DEBUG) {
- debug = function (s) {
- dump("-*- TetheringManager component: " + s + "\n");
- };
-} else {
- debug = function (s) {};
-}