Add a new XPCOM implemented by JavaScript
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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/.
EXTRA_COMPONENTS += [
'BuiltinProviders.manifest',
'PresentationControlService.js'
]
UNIFIED_SOURCES += [
'MulticastDNSDeviceProvider.cpp',
'PresentationDeviceProviderModule.cpp',
]
EXTRA_JS_MODULES.presentation += [
'ControllerStateMachine.jsm',
'ReceiverStateMachine.jsm',
'StateMachineHelper.jsm',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
EXTRA_COMPONENTS += [
# For android presentation device
'AndroidPresentationDeviceProvider.js',
'AndroidPresentationDeviceProvider.manifest',
# for TV 2.5 device backward capability
'LegacyPresentationControlService.js',
'LegacyProviders.manifest',
]
UNIFIED_SOURCES += [
'LegacyMDNSDeviceProvider.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
UNIFIED_SOURCES += [
'DisplayDeviceProvider.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
@BINPATH@/components/AndroidPresentationDeviceProvicer.manifest
@BINPATH@/components/AndroidPresentationDeviceProvicer.js
# AndroidPresentationDeviceProvider.js
component {7394f24c-dbc3-48c8-8a47-cd10169b7c6b} AndroidPresentationDeviceProvider.js
contract @mozilla.org/presentation/android-presentation-device-provider;1 {7394f24c-dbc3-48c8-8a47-cd10169b7c6b}
category presentation-device-provider AndroidPresentationDeviceProvider @mozilla.org/presentation/android-presentation-device-provider;1
/* 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/. */
/* jshint esnext:true, globalstrict:true, moz:true, undef:true, unused:true */
/* globals Components, dump */
"use strict";
dump("AndroidPresentationDeviceProvider.js loaded.");
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
function debug(str) {
dump("-*- AndroidPresentationDeviceProvider -*-: " + str + "\n");
}
function AndroidPresentationDeviceProvider() {
debug("AndroidPresentationDeviceProvider created!");
}
AndroidPresentationDeviceProvider.prototype = {
_listener: null,
set listener(aListener) {
this._listener = aListener;
},
get listener() {
return this._listener;
},
forceDiscovery: function APDP_forceDiscovery() {},
observe: function APDP_observe(aSubject, aTopic, aData) {
var device = JSON.parse(aData);
debug(aData);
if (aTopic == "PresentationDevice:Add") {
} else if (aTopic == "PresentationDevice:Remove") {
}
},
classID: Components.ID("{7394f24c-dbc3-48c8-8a47-cd10169b7c6b}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsIPresentationDeviceProvider]),
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AndroidPresentationDeviceProvider]);