Bug 787477 - Part 2: Update ContactManager and ContactService. r=gwagner

This commit is contained in:
Yoshi Huang 2012-09-07 12:31:20 +08:00
parent 2b13c5c193
commit f4225c4693
2 changed files with 15 additions and 5 deletions

View File

@ -413,6 +413,7 @@ ContactManager.prototype = {
case "Contact:Save:Return:KO":
case "Contact:Remove:Return:KO":
case "Contacts:Clear:Return:KO":
case "Contacts:GetSimContacts:Return:KO":
req = this.getRequest(msg.requestID);
if (req)
Services.DOMRequest.fireError(req.request, msg.errorMsg);
@ -579,6 +580,7 @@ ContactManager.prototype = {
"Contact:Save:Return:OK", "Contact:Save:Return:KO",
"Contact:Remove:Return:OK", "Contact:Remove:Return:KO",
"Contacts:GetSimContacts:Return:OK",
"Contacts:GetSimContacts:Return:KO",
"PermissionPromptHelper:AskPermission:OK"]);
},

View File

@ -149,11 +149,19 @@ let DOMContactManager = {
);
break;
case "Contacts:GetSimContacts":
let callback = function(aContactType, aContacts) {
if (DEBUG) debug("got SIM contacts: " + aContactType + " " + JSON.stringify(aContacts));
mm.sendAsyncMessage("Contacts:GetSimContacts:Return:OK", {requestID: msg.requestID, contacts: aContacts});
};
mRIL.getICCContacts(msg.options.contactType, callback);
mRIL.getICCContacts(
msg.options.contactType,
function (aErrorMsg, aType, aContacts) {
if (aErrorMsg) {
mm.sendAsyncMessage("Contacts:GetSimContacts:Return:KO",
{requestID: msg.requestID,
errorMsg: aErrorMsg});
} else {
mm.sendAsyncMessage("Contacts:GetSimContacts:Return:OK",
{requestID: msg.requestID,
contacts: aContacts});
}
}.bind(this));
break;
default:
if (DEBUG) debug("WRONG MESSAGE NAME: " + aMessage.name);