Bug 1170053 - [Aries] Not able to share a picture using NFC. r=yoshi

This commit is contained in:
Dimi Lee 2015-06-03 15:54:55 +08:00
Родитель 5c6ae605d1
Коммит 7c669065f4
4 изменённых файлов: 8 добавлений и 11 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

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