Bug 1073416 - B2G NFC: remove getDetailsNDEF impl. r=dimi

From 59914a177ef8efdf569829fd46cbdd5659517bc6 Mon Sep 17 00:00:00 2001
---
 dom/nfc/NfcContentHelper.js        | 41 --------------------------------------
 dom/nfc/gonk/Nfc.js                |  5 -----
 dom/nfc/gonk/NfcGonkMessage.h      |  4 +---
 dom/nfc/gonk/NfcMessageHandler.cpp | 36 ---------------------------------
 dom/nfc/gonk/NfcMessageHandler.h   |  2 --
 dom/nfc/nsINfcContentHelper.idl    |  3 +--
 6 files changed, 2 insertions(+), 89 deletions(-)
This commit is contained in:
Yoshi Huang 2014-09-26 17:59:36 +08:00
parent 9e93a5354f
commit faee76bec4
6 changed files with 2 additions and 89 deletions

View File

@ -50,7 +50,6 @@ const NFCCONTENTHELPER_CID =
const NFC_IPC_MSG_NAMES = [
"NFC:ReadNDEFResponse",
"NFC:WriteNDEFResponse",
"NFC:GetDetailsNDEFResponse",
"NFC:MakeReadOnlyNDEFResponse",
"NFC:ConnectResponse",
"NFC:CloseResponse",
@ -64,17 +63,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
"@mozilla.org/childprocessmessagemanager;1",
"nsISyncMessageSender");
function GetDetailsNDEFResponse(details) {
this.canBeMadeReadOnly = details.canBeMadeReadOnly;
this.isReadOnly = details.isReadOnly;
this.maxSupportedLength = details.maxSupportedLength;
}
GetDetailsNDEFResponse.prototype = {
__exposedProps__ : {canBeMadeReadOnly: 'r',
isReadOnly: 'r',
maxSupportedLength: 'r'}
};
function NfcContentHelper() {
this.initDOMRequestHelper(/* aWindow */ null, NFC_IPC_MSG_NAMES);
Services.obs.addObserver(this, "xpcom-shutdown", false);
@ -127,22 +115,6 @@ NfcContentHelper.prototype = {
},
// NFCTag interface
getDetailsNDEF: function getDetailsNDEF(window, sessionToken) {
if (window == null) {
throw Components.Exception("Can't get window object",
Cr.NS_ERROR_UNEXPECTED);
}
let request = Services.DOMRequest.createRequest(window);
let requestId = btoa(this.getRequestId(request));
this._requestMap[requestId] = window;
cpmm.sendAsyncMessage("NFC:GetDetailsNDEF", {
requestId: requestId,
sessionToken: sessionToken
});
return request;
},
readNDEF: function readNDEF(window, sessionToken) {
if (window == null) {
throw Components.Exception("Can't get window object",
@ -395,9 +367,6 @@ NfcContentHelper.prototype = {
case "NFC:ReadNDEFResponse":
this.handleReadNDEFResponse(result);
break;
case "NFC:GetDetailsNDEFResponse":
this.handleGetDetailsNDEFResponse(result);
break;
case "NFC:CheckP2PRegistrationResponse":
this.handleCheckP2PRegistrationResponse(result);
break;
@ -452,16 +421,6 @@ NfcContentHelper.prototype = {
this.fireRequestSuccess(requestId, ndefMsg);
},
handleGetDetailsNDEFResponse: function handleGetDetailsNDEFResponse(result) {
if (result.errorMsg) {
this.fireRequestError(atob(result.requestId), result.errorMsg);
return;
}
let requestId = atob(result.requestId);
this.fireRequestSuccess(requestId, new GetDetailsNDEFResponse(result));
},
handleCheckP2PRegistrationResponse: function handleCheckP2PRegistrationResponse(result) {
// Privilaged status API. Always fire success to avoid using exposed props.
// The receiver must check the boolean mapped status code to handle.

View File

@ -57,7 +57,6 @@ const NFC_IPC_MSG_NAMES = [
const NFC_IPC_READ_PERM_MSG_NAMES = [
"NFC:ReadNDEF",
"NFC:GetDetailsNDEF",
"NFC:Connect",
"NFC:Close",
];
@ -538,7 +537,6 @@ Nfc.prototype = {
break;
case "ConnectResponse": // Fall through.
case "CloseResponse":
case "GetDetailsNDEFResponse":
case "ReadNDEFResponse":
case "MakeReadOnlyNDEFResponse":
case "WriteNDEFResponse":
@ -608,9 +606,6 @@ Nfc.prototype = {
this.setConfig({powerLevel: NFC.NFC_POWER_LEVEL_DISABLED,
requestId: message.data.requestId});
break;
case "NFC:GetDetailsNDEF":
this.sendToNfcService("getDetailsNDEF", message.data);
break;
case "NFC:ReadNDEF":
this.sendToNfcService("readNDEF", message.data);
break;

View File

@ -8,13 +8,12 @@
namespace mozilla {
#define NFCD_MAJOR_VERSION 1
#define NFCD_MINOR_VERSION 9
#define NFCD_MINOR_VERSION 10
enum NfcRequest {
ConfigReq = 0,
ConnectReq,
CloseReq,
GetDetailsNDEFReq,
ReadNDEFReq,
WriteNDEFReq,
MakeReadOnlyNDEFReq,
@ -23,7 +22,6 @@ enum NfcRequest {
enum NfcResponse {
GeneralRsp = 1000,
ConfigRsp,
GetDetailsNDEFRsp,
ReadNDEFRsp,
};

View File

@ -17,7 +17,6 @@ using namespace mozilla;
using namespace mozilla::dom;
static const char* kConfigRequest = "config";
static const char* kGetDetailsNDEF = "getDetailsNDEF";
static const char* kReadNDEFRequest = "readNDEF";
static const char* kWriteNDEFRequest = "writeNDEF";
static const char* kMakeReadOnlyNDEFRequest = "makeReadOnlyNDEF";
@ -25,7 +24,6 @@ static const char* kConnectRequest = "connect";
static const char* kCloseRequest = "close";
static const char* kConfigResponse = "ConfigResponse";
static const char* kGetDetailsNDEFResponse = "GetDetailsNDEFResponse";
static const char* kReadNDEFResponse = "ReadNDEFResponse";
static const char* kWriteNDEFResponse = "WriteNDEFResponse";
static const char* kMakeReadOnlyNDEFResponse = "MakeReadOnlyNDEFResponse";
@ -46,8 +44,6 @@ NfcMessageHandler::Marshall(Parcel& aParcel, const CommandOptions& aOptions)
if (!strcmp(type, kConfigRequest)) {
result = ConfigRequest(aParcel, aOptions);
} else if (!strcmp(type, kGetDetailsNDEF)) {
result = GetDetailsNDEFRequest(aParcel, aOptions);
} else if (!strcmp(type, kReadNDEFRequest)) {
result = ReadNDEFRequest(aParcel, aOptions);
} else if (!strcmp(type, kWriteNDEFRequest)) {
@ -83,9 +79,6 @@ NfcMessageHandler::Unmarshall(const Parcel& aParcel, EventOptions& aOptions)
case NfcResponse::ConfigRsp:
result = ConfigResponse(aParcel, aOptions);
break;
case NfcResponse::GetDetailsNDEFRsp:
result = GetDetailsNDEFResponse(aParcel, aOptions);
break;
case NfcResponse::ReadNDEFRsp:
result = ReadNDEFResponse(aParcel, aOptions);
break;
@ -171,35 +164,6 @@ NfcMessageHandler::ConfigResponse(const Parcel& aParcel, EventOptions& aOptions)
return true;
}
bool
NfcMessageHandler::GetDetailsNDEFRequest(Parcel& aParcel, const CommandOptions& aOptions)
{
aParcel.writeInt32(NfcRequest::GetDetailsNDEFReq);
aParcel.writeInt32(aOptions.mSessionId);
mRequestIdQueue.AppendElement(aOptions.mRequestId);
return true;
}
bool
NfcMessageHandler::GetDetailsNDEFResponse(const Parcel& aParcel, EventOptions& aOptions)
{
aOptions.mType = NS_ConvertUTF8toUTF16(kGetDetailsNDEFResponse);
aOptions.mStatus = aParcel.readInt32();
aOptions.mSessionId = aParcel.readInt32();
if (aOptions.mStatus == NfcErrorCode::Success) {
int readOnly = aParcel.readInt32();
aOptions.mIsReadOnly = readOnly & 0xff;
aOptions.mCanBeMadeReadOnly = (readOnly >> 8) & 0xff;
aOptions.mMaxSupportedLength = aParcel.readInt32();
}
NS_ENSURE_TRUE(!mRequestIdQueue.IsEmpty(), false);
aOptions.mRequestId = mRequestIdQueue[0];
mRequestIdQueue.RemoveElementAt(0);
return true;
}
bool
NfcMessageHandler::ReadNDEFRequest(Parcel& aParcel, const CommandOptions& aOptions)
{

View File

@ -27,8 +27,6 @@ private:
bool GeneralResponse(const android::Parcel& aParcel, EventOptions& aOptions);
bool ConfigRequest(android::Parcel& aParcel, const CommandOptions& options);
bool ConfigResponse(const android::Parcel& aParcel, EventOptions& aOptions);
bool GetDetailsNDEFRequest(android::Parcel& aParcel, const CommandOptions& options);
bool GetDetailsNDEFResponse(const android::Parcel& aParcel, EventOptions& aOptions);
bool ReadNDEFRequest(android::Parcel& aParcel, const CommandOptions& options);
bool ReadNDEFResponse(const android::Parcel& aParcel, EventOptions& aOptions);
bool WriteNDEFRequest(android::Parcel& aParcel, const CommandOptions& options);

View File

@ -27,7 +27,7 @@ interface nsINfcDOMEventTarget : nsISupports
void notifyPeerLost(in DOMString sessionToken);
};
[scriptable, uuid(7eaf4c31-e1d1-422e-aa55-181f4eb156b0)]
[scriptable, uuid(d3f1bdc1-048f-44a8-abe2-bc386edce40b)]
interface nsINfcContentHelper : nsISupports
{
const long NFC_EVENT_PEER_READY = 0x01;
@ -35,7 +35,6 @@ interface nsINfcContentHelper : nsISupports
boolean checkSessionToken(in DOMString sessionToken);
nsIDOMDOMRequest getDetailsNDEF(in nsIDOMWindow window, in DOMString sessionToken);
nsIDOMDOMRequest readNDEF(in nsIDOMWindow window, in DOMString sessionToken);
nsIDOMDOMRequest writeNDEF(in nsIDOMWindow window, in nsIVariant records, in DOMString sessionToken);
nsIDOMDOMRequest makeReadOnlyNDEF(in nsIDOMWindow window, in DOMString sessionToken);