mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 959437 - Part 1: Add new interfaces 'notifyUserAcceptedP2P' and 'notifySendFileStatus' to MozNfcManager DOM. r+sr=smaug
This commit is contained in:
parent
6c292cbbfc
commit
690087025e
@ -164,25 +164,27 @@ mozNfc.prototype = {
|
||||
init: function init(aWindow) {
|
||||
debug("mozNfc init called");
|
||||
this._window = aWindow;
|
||||
let origin = this._window.document.nodePrincipal.origin;
|
||||
// Only System Process should listen on 'nfc-p2p-user-accept' event
|
||||
if (origin !== 'app://system.gaiamobile.org') {
|
||||
return;
|
||||
}
|
||||
let self = this;
|
||||
this._window.addEventListener("nfc-p2p-user-accept", function (event) {
|
||||
let appID = appsService.getAppLocalIdByManifestURL(event.detail.manifestUrl);
|
||||
// Notify Chrome process of User's acknowledgement
|
||||
self._nfcContentHelper.notifyUserAcceptedP2P(self._window, appID);
|
||||
});
|
||||
},
|
||||
|
||||
// Only System Process can call the following interfaces
|
||||
// 'checkP2PRegistration' , 'notifyUserAcceptedP2P' , 'notifySendFileStatus'
|
||||
checkP2PRegistration: function checkP2PRegistration(manifestUrl) {
|
||||
// Get the AppID and pass it to ContentHelper
|
||||
let appID = appsService.getAppLocalIdByManifestURL(manifestUrl);
|
||||
return this._nfcContentHelper.checkP2PRegistration(this._window, appID);
|
||||
},
|
||||
|
||||
notifyUserAcceptedP2P: function notifyUserAcceptedP2P(manifestUrl) {
|
||||
let appID = appsService.getAppLocalIdByManifestURL(manifestUrl);
|
||||
// Notify chrome process of user's acknowledgement
|
||||
this._nfcContentHelper.notifyUserAcceptedP2P(this._window, appID);
|
||||
},
|
||||
|
||||
notifySendFileStatus: function notifySendFileStatus(status, requestId) {
|
||||
this._nfcContentHelper.notifySendFileStatus(this._window,
|
||||
status, requestId);
|
||||
},
|
||||
|
||||
getNFCTag: function getNFCTag(sessionToken) {
|
||||
let obj = new MozNFCTag();
|
||||
let nfcTag = this._window.MozNFCTag._create(this._window, obj);
|
||||
|
@ -13,11 +13,18 @@ interface MozNfcManager {
|
||||
*
|
||||
* Returns success if given manifestUrl is registered for 'onpeerready',
|
||||
* otherwise error
|
||||
*
|
||||
* Users of this API should have valid permissions 'nfc-manager'
|
||||
* and 'nfc-write'
|
||||
*/
|
||||
DOMRequest checkP2PRegistration(DOMString manifestUrl);
|
||||
|
||||
/**
|
||||
* Notify that user has accepted to share nfc message on P2P UI
|
||||
*/
|
||||
void notifyUserAcceptedP2P(DOMString manifestUrl);
|
||||
|
||||
/**
|
||||
* Notify the status of sendFile operation
|
||||
*/
|
||||
void notifySendFileStatus(octet status, DOMString requestId);
|
||||
};
|
||||
|
||||
[JSImplementation="@mozilla.org/navigatorNfc;1",
|
||||
|
Loading…
Reference in New Issue
Block a user