Bug 847744: Part 5 - IPC for retrieveMMS. r=vicamo

This commit is contained in:
Patrick Wang 2013-04-10 20:18:43 +08:00
parent 0a2809fe79
commit 6bd72d841e
7 changed files with 50 additions and 2 deletions

View File

@ -331,7 +331,7 @@ NS_IMETHODIMP
MobileMessageManager::RetrieveMMS(int32_t id,
nsIDOMDOMRequest** aRequest)
{
nsCOMPtr<nsIMmsService> mmsService = do_GetService(RIL_MMSSERVICE_CONTRACTID);
nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());

View File

@ -22,6 +22,14 @@ MmsService::Send(const JS::Value& aParameters,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::Retrieve(int32_t aId, nsIMobileMessageCallback *aRequest)
{
// TODO: Bug 860174, implement this function.
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -21,6 +21,13 @@ MmsService::Send(const JS::Value& aParameters,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::Retrieve(int32_t aId, nsIMobileMessageCallback *aRequest)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -34,6 +34,11 @@ union SendMessageRequest
SendSmsMessageRequest;
};
struct RetrieveMessageRequest
{
int32_t messageId;
};
struct GetMessageRequest
{
int32_t messageId;
@ -63,6 +68,7 @@ struct CreateThreadCursorRequest
union IPCSmsRequest
{
SendMessageRequest;
RetrieveMessageRequest;
GetMessageRequest;
DeleteMessageRequest;
MarkMessageReadRequest;

View File

@ -115,7 +115,7 @@ SmsIPCService::Send(const nsAString& aNumber,
{
return SendRequest(SendMessageRequest(SendSmsMessageRequest(nsString(aNumber),
nsString(aMessage))),
aRequest) ? NS_OK : NS_ERROR_FAILURE;
aRequest);
}
/*
@ -256,3 +256,8 @@ SmsIPCService::Send(const JS::Value& aParameters,
return SendRequest(SendMessageRequest(req), aRequest);
}
NS_IMETHODIMP
SmsIPCService::Retrieve(int32_t aId, nsIMobileMessageCallback *aRequest)
{
return SendRequest(RetrieveMessageRequest(aId), aRequest);
}

View File

@ -317,6 +317,8 @@ SmsParent::RecvPSmsRequestConstructor(PSmsRequestParent* aActor,
switch (aRequest.type()) {
case IPCSmsRequest::TSendMessageRequest:
return actor->DoRequest(aRequest.get_SendMessageRequest());
case IPCSmsRequest::TRetrieveMessageRequest:
return actor->DoRequest(aRequest.get_RetrieveMessageRequest());
case IPCSmsRequest::TGetMessageRequest:
return actor->DoRequest(aRequest.get_GetMessageRequest());
case IPCSmsRequest::TDeleteMessageRequest:
@ -436,6 +438,23 @@ SmsRequestParent::DoRequest(const SendMessageRequest& aRequest)
return true;
}
bool
SmsRequestParent::DoRequest(const RetrieveMessageRequest& aRequest)
{
nsresult rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
if (mmsService) {
rv = mmsService->Retrieve(aRequest.messageId(), this);
}
if (NS_FAILED(rv)) {
return NS_SUCCEEDED(NotifyGetMessageFailed(nsIMobileMessageCallback::INTERNAL_ERROR));
}
return true;
}
bool
SmsRequestParent::DoRequest(const GetMessageRequest& aRequest)
{

View File

@ -99,6 +99,9 @@ protected:
bool
DoRequest(const SendMessageRequest& aRequest);
bool
DoRequest(const RetrieveMessageRequest& aRequest);
bool
DoRequest(const GetMessageRequest& aRequest);