Bug 843445 - B2G MMS: provide nsIDOMMobileMessageManager.retrieveMMS() to retrieve MMS for the deferred retrieval mode, part-1:idl part. r=vyang, sr=sicking

This commit is contained in:
Chia-hung Tai 2013-03-21 17:57:41 +08:00
parent 78fef2951c
commit bb1adb758c
4 changed files with 42 additions and 3 deletions

View File

@ -10,9 +10,12 @@ interface nsIDOMBlob;
#define RIL_MMSSERVICE_CONTRACTID "@mozilla.org/mms/rilmmsservice;1"
%}
[scriptable, uuid(3ec33286-8559-11e2-9f38-e76b58650568)]
[scriptable, uuid(e5ef630a-eab7-425a-ac42-650ef5c4fcef)]
interface nsIMmsService : nsISupports
{
void send(in jsval parameters /* MmsParameters */,
in nsIMobileMessageCallback request);
void retrieve(in long id,
in nsIMobileMessageCallback request);
};

View File

@ -19,7 +19,7 @@ dictionary MmsParameters
jsval attachments; // MmsAttachment[]
};
[scriptable, builtinclass, uuid(645161ca-b009-461b-bd13-45c3075cdfba)]
[scriptable, builtinclass, uuid(4ed1f928-360d-4767-b02b-f74cdc58727d)]
interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
{
nsIDOMMozSmsSegmentInfo getSegmentInfoForText(in DOMString text);
@ -44,6 +44,8 @@ interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
nsIDOMMozSmsRequest getThreadList();
nsIDOMDOMRequest retrieveMMS(in long id);
[implicit_jscontext] attribute jsval onreceived;
[implicit_jscontext] attribute jsval onsending;
[implicit_jscontext] attribute jsval onsent;

View File

@ -15,7 +15,16 @@ interface nsIRilMobileMessageDatabaseCallback : nsISupports
void notify(in nsresult aRv, in nsISupports aDomMessage);
};
[scriptable, uuid(a31b1716-8631-11e2-afaa-2fbd087f426e)]
[scriptable, function, uuid(2be52603-5885-412c-9225-f78a78f1bbbd)]
interface nsIRilMobileMessageDatabaseRecordCallback : nsISupports
{
/**
* |aMessageRecord| Object: the mobile-message database record
*/
void notify(in nsresult aRv, in jsval aMessageRecord);
};
[scriptable, uuid(8f49216f-bc0c-420e-b77e-7f1cbdcd245f)]
interface nsIRilMobileMessageDatabaseService : nsIMobileMessageDatabaseService
{
/**
@ -65,4 +74,12 @@ interface nsIRilMobileMessageDatabaseService : nsIMobileMessageDatabaseService
in DOMString aDelivery,
in DOMString aDeliveryStatus,
[optional] in nsIRilMobileMessageDatabaseCallback aCallback);
/**
* |aMessageId| Number: the message's DB record ID.
* |aCallback| nsIRilMobileMessageDatabaseCallback: a callback which takes
* result flag and message record as parameters.
*/
void getMessageRecordById(in long aMessageId,
in nsIRilMobileMessageDatabaseRecordCallback aCallback);
};

View File

@ -322,6 +322,23 @@ MobileMessageManager::GetThreadList(nsIDOMMozSmsRequest** aRequest)
return NS_OK;
}
NS_IMETHODIMP
MobileMessageManager::RetrieveMMS(int32_t id,
nsIDOMDOMRequest** aRequest)
{
nsCOMPtr<nsIMmsService> mmsService = do_GetService(RIL_MMSSERVICE_CONTRACTID);
NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
nsRefPtr<DOMRequest> request = new DOMRequest(GetOwner());
nsCOMPtr<nsIMobileMessageCallback> msgCallback = new MobileMessageCallback(request);
nsresult rv = mmsService->Retrieve(id, msgCallback);
NS_ENSURE_SUCCESS(rv, rv);
request.forget(aRequest);
return NS_OK;
}
nsresult
MobileMessageManager::DispatchTrustedSmsEventToSelf(const nsAString& aEventName,
nsIDOMMozSmsMessage* aMessage)