Bug 1168292 - Part 3: add tabId in notifyUserAccepted. r=dimi

This commit is contained in:
Yoshi Huang 2015-05-27 18:10:37 +08:00
parent c70a58767a
commit 5c5fafe2be
4 changed files with 11 additions and 8 deletions

View File

@ -218,9 +218,10 @@ NfcContentHelper.prototype = {
});
},
notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId) {
notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId, tabId) {
cpmm.sendAsyncMessage("NFC:NotifyUserAcceptedP2P", {
appId: appId
appId: appId,
tabId: tabId
});
},

View File

@ -292,7 +292,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
message.target.sendAsyncMessage(message.name + "Response", respMsg);
},
notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId) {
notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId, tabId) {
let target = this.peerTargets[appId];
let sessionToken = SessionHelper.getCurrentP2PToken();
let isValid = (sessionToken != null) && (target != null);
@ -301,7 +301,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
return;
}
this.notifyDOMEvent(target, {tabId: this.focusApp,
this.notifyDOMEvent(target, {tabId: tabId,
event: NFC.PEER_EVENT_READY,
sessionToken: sessionToken});
},
@ -408,7 +408,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
this.checkP2PRegistration(message);
return null;
case "NFC:NotifyUserAcceptedP2P":
this.notifyUserAcceptedP2P(message.data.appId);
this.notifyUserAcceptedP2P(message.data.appId, message.data.tabId);
return null;
case "NFC:NotifySendFileStatus":
// Upon receiving the status of sendFile operation, send the response

View File

@ -124,7 +124,7 @@ interface nsINfcBrowserAPI : nsISupports
in boolean isFocus);
};
[scriptable, uuid(75f0c8c0-2e5a-491f-a75d-4f3849c4feec)]
[scriptable, uuid(f0ed35c5-3f59-4806-b6bb-e77b879887af)]
interface nsINfcContentHelper : nsISupports
{
/**
@ -277,8 +277,10 @@ interface nsINfcContentHelper : nsISupports
*
* @param appId
* Application ID that is capable of handling NFC_EVENT_PEER_READY event
* @param tabId
* Tab Id of the window calling this interface.
*/
void notifyUserAcceptedP2P(in unsigned long appId);
void notifyUserAcceptedP2P(in unsigned long appId, in uint64_t tabId);
/**
* Notify the status of sendFile operation to parent process

View File

@ -420,7 +420,7 @@ MozNFCImpl.prototype = {
notifyUserAcceptedP2P: function notifyUserAcceptedP2P(manifestUrl) {
let appID = appsService.getAppLocalIdByManifestURL(manifestUrl);
// Notify chrome process of user's acknowledgement
this._nfcContentHelper.notifyUserAcceptedP2P(appID);
this._nfcContentHelper.notifyUserAcceptedP2P(appID, this._tabId);
},
notifySendFileStatus: function notifySendFileStatus(status, requestId) {