зеркало из https://github.com/mozilla/gecko-dev.git
Bug 854326 - B2G Multi-SIM: support multiple SIM cards for SMS/MMS (part 1, DOM API IDL). sr=hsinyi r=vicamo
This commit is contained in:
Родитель
068c9d11e0
Коммит
a5060709af
|
@ -11,18 +11,42 @@ interface nsIDOMDOMCursor;
|
|||
interface nsIDOMDOMRequest;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
[scriptable, builtinclass, uuid(3f81dcbc-00cf-11e3-ae66-538115636543)]
|
||||
[scriptable, builtinclass, uuid(d1e35354-3d21-11e3-86da-77253f4c5683)]
|
||||
interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
|
||||
{
|
||||
nsIDOMDOMRequest getSegmentInfoForText(in DOMString text);
|
||||
|
||||
// The first parameter can be either a DOMString (only one number) or an array
|
||||
// of DOMStrings.
|
||||
// The method returns a DOMRequest object if one number has been passed.
|
||||
// An array of DOMRequest objects otherwise.
|
||||
jsval send(in jsval number, in DOMString message);
|
||||
|
||||
nsIDOMDOMRequest sendMMS(in jsval parameters /* MmsParameters */);
|
||||
/**
|
||||
* Function to send SMS.
|
||||
*
|
||||
* @param number
|
||||
* Either a DOMString (only one number) or an array of numbers.
|
||||
* @param message
|
||||
* The text message to be sent.
|
||||
* @param sendParameters
|
||||
* An SmsSendParameters object.
|
||||
* @param return
|
||||
* A DOMRequest object indicating the sending result if one number
|
||||
* has been passed; an array of DOMRequest objects otherwise.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
jsval send(in jsval number, in DOMString message,
|
||||
[optional] in jsval sendParameters);
|
||||
|
||||
/**
|
||||
* Function to send MMS.
|
||||
*
|
||||
* @param parameters
|
||||
* An MmsParameters object.
|
||||
* @param sendParameters
|
||||
* An MmsSendParameters object.
|
||||
* @param return
|
||||
* A DOMRequest object indicating the sending result.
|
||||
*/
|
||||
[implicit_jscontext, optional_argc]
|
||||
nsIDOMDOMRequest sendMMS(in jsval parameters,
|
||||
[optional] in jsval sendParameters);
|
||||
|
||||
[binaryname(GetMessageMoz)]
|
||||
nsIDOMDOMRequest getMessage(in long id);
|
||||
|
@ -33,7 +57,7 @@ interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
|
|||
// Iterates through nsIDOMMoz{Mms,Sms}Message.
|
||||
nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
|
||||
|
||||
nsIDOMDOMRequest markMessageRead(in long id, in boolean aValue);
|
||||
nsIDOMDOMRequest markMessageRead(in long id, in boolean value);
|
||||
|
||||
// Iterates through nsIDOMMozMobileMessageThread.
|
||||
nsIDOMDOMCursor getThreads();
|
||||
|
|
|
@ -21,7 +21,7 @@ dictionary MmsDeliveryInfo
|
|||
DOMString? deliveryStatus;
|
||||
};
|
||||
|
||||
[scriptable, builtinclass, uuid(494bbca1-ac7c-47d2-9e90-4e7d07e1cb4f)]
|
||||
[scriptable, builtinclass, uuid(35d88c5e-2746-11e3-9d7b-83ca2203a291)]
|
||||
interface nsIDOMMozMmsMessage : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -33,6 +33,13 @@ interface nsIDOMMozMmsMessage : nsISupports
|
|||
|
||||
readonly attribute unsigned long long threadId;
|
||||
|
||||
/**
|
||||
* Integrated Circuit Card Identifier.
|
||||
*
|
||||
* Will be null if ICC is not available.
|
||||
*/
|
||||
readonly attribute DOMString iccId;
|
||||
|
||||
/**
|
||||
* Should be "not-downloaded", "received", "sending", "sent" or "error".
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(407b6d98-4140-11e3-9ec2-238ca8916558)]
|
||||
[scriptable, builtinclass, uuid(db9ff254-2745-11e3-aa37-8793b90fc643)]
|
||||
interface nsIDOMMozSmsMessage : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -16,6 +16,13 @@ interface nsIDOMMozSmsMessage : nsISupports
|
|||
|
||||
readonly attribute unsigned long long threadId;
|
||||
|
||||
/**
|
||||
* Integrated Circuit Card Identifier.
|
||||
*
|
||||
* Will be null if ICC is not available.
|
||||
*/
|
||||
readonly attribute DOMString iccId;
|
||||
|
||||
/**
|
||||
* Should be "received", "sending", "sent" or "error".
|
||||
*/
|
||||
|
|
|
@ -387,6 +387,13 @@ MmsMessage::GetThreadId(uint64_t* aThreadId)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MmsMessage::GetIccId(nsAString& aIccId)
|
||||
{
|
||||
// TODO
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MmsMessage::GetDelivery(nsAString& aDelivery)
|
||||
{
|
||||
|
|
|
@ -150,58 +150,70 @@ MobileMessageManager::Send(JSContext* aCx, JS::Handle<JSObject*> aGlobal,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::Send(const JS::Value& aNumber_, const nsAString& aMessage, JS::Value* aReturn)
|
||||
MobileMessageManager::Send(const JS::Value& aNumber_,
|
||||
const nsAString& aMessage,
|
||||
const JS::Value& aSendParams,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc,
|
||||
JS::Value* aReturn)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIScriptContext* sc = GetContextForEventHandlers(&rv);
|
||||
NS_ENSURE_STATE(sc);
|
||||
AutoPushJSContext cx(sc->GetNativeContext());
|
||||
NS_ASSERTION(cx, "Failed to get a context!");
|
||||
// TODO Send SMS based on |aSendParams.serviceId|.
|
||||
|
||||
JS::Rooted<JS::Value> aNumber(cx, aNumber_);
|
||||
JS::Rooted<JS::Value> aNumber(aCx, aNumber_);
|
||||
if (!aNumber.isString() &&
|
||||
!(aNumber.isObject() && JS_IsArrayObject(cx, &aNumber.toObject()))) {
|
||||
!(aNumber.isObject() && JS_IsArrayObject(aCx, &aNumber.toObject()))) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> global(cx, sc->GetWindowProxy());
|
||||
nsresult rv;
|
||||
nsIScriptContext* sc = GetContextForEventHandlers(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_STATE(sc);
|
||||
|
||||
JS::Rooted<JSObject*> global(aCx, sc->GetWindowProxy());
|
||||
NS_ASSERTION(global, "Failed to get global object!");
|
||||
|
||||
JSAutoCompartment ac(cx, global);
|
||||
JSAutoCompartment ac(aCx, global);
|
||||
|
||||
if (aNumber.isString()) {
|
||||
JS::Rooted<JSString*> str(cx, aNumber.toString());
|
||||
return Send(cx, global, str, aMessage, aReturn);
|
||||
JS::Rooted<JSString*> str(aCx, aNumber.toString());
|
||||
return Send(aCx, global, str, aMessage, aReturn);
|
||||
}
|
||||
|
||||
// Must be an array then.
|
||||
JS::Rooted<JSObject*> numbers(cx, &aNumber.toObject());
|
||||
JS::Rooted<JSObject*> numbers(aCx, &aNumber.toObject());
|
||||
|
||||
uint32_t size;
|
||||
JS_ALWAYS_TRUE(JS_GetArrayLength(cx, numbers, &size));
|
||||
JS_ALWAYS_TRUE(JS_GetArrayLength(aCx, numbers, &size));
|
||||
|
||||
JS::Value* requests = new JS::Value[size];
|
||||
|
||||
JS::Rooted<JS::Value> number(cx);
|
||||
JS::Rooted<JS::Value> number(aCx);
|
||||
for (uint32_t i=0; i<size; ++i) {
|
||||
if (!JS_GetElement(cx, numbers, i, &number)) {
|
||||
if (!JS_GetElement(aCx, numbers, i, &number)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> str(cx, number.toString());
|
||||
nsresult rv = Send(cx, global, str, aMessage, &requests[i]);
|
||||
JS::Rooted<JSString*> str(aCx, number.toString());
|
||||
nsresult rv = Send(aCx, global, str, aMessage, &requests[i]);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
aReturn->setObjectOrNull(JS_NewArrayObject(cx, size, requests));
|
||||
aReturn->setObjectOrNull(JS_NewArrayObject(aCx, size, requests));
|
||||
NS_ENSURE_TRUE(aReturn->isObject(), NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MobileMessageManager::SendMMS(const JS::Value& aParams, nsIDOMDOMRequest** aRequest)
|
||||
MobileMessageManager::SendMMS(const JS::Value& aParams,
|
||||
const JS::Value& aSendParams,
|
||||
JSContext* aCx,
|
||||
uint8_t aArgc,
|
||||
nsIDOMDOMRequest** aRequest)
|
||||
{
|
||||
// TODO Send MMS based on |aSendParams.serviceId|.
|
||||
|
||||
nsCOMPtr<nsIMmsService> mmsService = do_GetService(MMS_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(mmsService, NS_ERROR_FAILURE);
|
||||
|
||||
|
|
|
@ -188,6 +188,13 @@ SmsMessage::GetThreadId(uint64_t* aThreadId)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsMessage::GetIccId(nsAString& aIccId)
|
||||
{
|
||||
// TODO
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsMessage::GetDelivery(nsAString& aDelivery)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@ interface DummyInterface : EventTarget {
|
|||
void funcDNSLookupDict(optional DNSLookupDict arg);
|
||||
void funcConnStatusDict(optional ConnStatusDict arg);
|
||||
void frameRequestCallback(FrameRequestCallback arg);
|
||||
void SmsSendParameters(optional SmsSendParameters arg);
|
||||
void MmsSendParameters(optional MmsSendParameters arg);
|
||||
void MmsParameters(optional MmsParameters arg);
|
||||
void MmsAttachment(optional MmsAttachment arg);
|
||||
void AsyncScrollEventDetail(optional AsyncScrollEventDetail arg);
|
||||
|
|
|
@ -12,3 +12,13 @@ dictionary MmsParameters {
|
|||
};
|
||||
|
||||
// If we start using MmsParameters here, remove it from DummyBinding.
|
||||
|
||||
dictionary SmsSendParameters {
|
||||
unsigned long serviceId; // The ID of the RIL service which needs to be
|
||||
// specified under the multi-sim scenario.
|
||||
};
|
||||
|
||||
dictionary MmsSendParameters {
|
||||
unsigned long serviceId; // The ID of the RIL service which needs to be
|
||||
// specified under the multi-sim scenario.
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче