mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 774621 - Part 2/5: DOM implementation, r=sicking
This commit is contained in:
parent
17ab87ad12
commit
aab0e9d617
@ -700,6 +700,7 @@ GK_ATOM(ondragstart, "ondragstart")
|
|||||||
GK_ATOM(ondrop, "ondrop")
|
GK_ATOM(ondrop, "ondrop")
|
||||||
GK_ATOM(onenabled, "onenabled")
|
GK_ATOM(onenabled, "onenabled")
|
||||||
GK_ATOM(onerror, "onerror")
|
GK_ATOM(onerror, "onerror")
|
||||||
|
GK_ATOM(onfailed, "onfailed")
|
||||||
GK_ATOM(onfocus, "onfocus")
|
GK_ATOM(onfocus, "onfocus")
|
||||||
GK_ATOM(onget, "onget")
|
GK_ATOM(onget, "onget")
|
||||||
GK_ATOM(onhashchange, "onhashchange")
|
GK_ATOM(onhashchange, "onhashchange")
|
||||||
@ -766,6 +767,7 @@ GK_ATOM(onMozBeforeResize, "onMozBeforeResize")
|
|||||||
GK_ATOM(onresize, "onresize")
|
GK_ATOM(onresize, "onresize")
|
||||||
GK_ATOM(onscroll, "onscroll")
|
GK_ATOM(onscroll, "onscroll")
|
||||||
GK_ATOM(onselect, "onselect")
|
GK_ATOM(onselect, "onselect")
|
||||||
|
GK_ATOM(onsending, "onsending")
|
||||||
GK_ATOM(onsent, "onsent")
|
GK_ATOM(onsent, "onsent")
|
||||||
GK_ATOM(onset, "onset")
|
GK_ATOM(onset, "onset")
|
||||||
GK_ATOM(onshow, "onshow")
|
GK_ATOM(onshow, "onshow")
|
||||||
|
@ -17,12 +17,6 @@ interface nsISmsRequest;
|
|||||||
[scriptable, uuid(c2cb2af7-6b96-4915-bcc8-54ad705d6110)]
|
[scriptable, uuid(c2cb2af7-6b96-4915-bcc8-54ad705d6110)]
|
||||||
interface nsISmsDatabaseService : nsISupports
|
interface nsISmsDatabaseService : nsISupports
|
||||||
{
|
{
|
||||||
// Takes some information required to save the message and returns its id.
|
|
||||||
long saveReceivedMessage(in DOMString aSender, in DOMString aBody, in DOMString aMessageClass, in unsigned long long aDate);
|
|
||||||
// Takes some information required to save the message and returns its id.
|
|
||||||
long saveSentMessage(in DOMString aReceiver, in DOMString aBody, in unsigned long long aDate);
|
|
||||||
void setMessageDeliveryStatus(in long aMessageId, in DOMString aDeliveryStatus);
|
|
||||||
|
|
||||||
[binaryname(GetMessageMoz)]
|
[binaryname(GetMessageMoz)]
|
||||||
void getMessage(in long messageId, in nsISmsRequest request);
|
void getMessage(in long messageId, in nsISmsRequest request);
|
||||||
void deleteMessage(in long messageId, in nsISmsRequest request);
|
void deleteMessage(in long messageId, in nsISmsRequest request);
|
||||||
|
@ -8,7 +8,9 @@ namespace dom {
|
|||||||
namespace sms {
|
namespace sms {
|
||||||
|
|
||||||
const char* kSmsReceivedObserverTopic = "sms-received";
|
const char* kSmsReceivedObserverTopic = "sms-received";
|
||||||
|
const char* kSmsSendingObserverTopic = "sms-sending";
|
||||||
const char* kSmsSentObserverTopic = "sms-sent";
|
const char* kSmsSentObserverTopic = "sms-sent";
|
||||||
|
const char* kSmsFailedObserverTopic = "sms-failed";
|
||||||
const char* kSmsDeliverySuccessObserverTopic = "sms-delivery-success";
|
const char* kSmsDeliverySuccessObserverTopic = "sms-delivery-success";
|
||||||
const char* kSmsDeliveryErrorObserverTopic = "sms-delivery-error";
|
const char* kSmsDeliveryErrorObserverTopic = "sms-delivery-error";
|
||||||
|
|
||||||
|
@ -10,13 +10,18 @@ namespace mozilla {
|
|||||||
namespace dom {
|
namespace dom {
|
||||||
namespace sms {
|
namespace sms {
|
||||||
|
|
||||||
extern const char* kSmsReceivedObserverTopic; // Defined in the .cpp.
|
// Defined in the .cpp.
|
||||||
extern const char* kSmsSentObserverTopic; // Defined in the .cpp.
|
extern const char* kSmsReceivedObserverTopic;
|
||||||
extern const char* kSmsDeliverySuccessObserverTopic; // Defined in the .cpp.
|
extern const char* kSmsSendingObserverTopic;
|
||||||
extern const char* kSmsDeliveryErrorObserverTopic; // Defined in the .cpp.
|
extern const char* kSmsSentObserverTopic;
|
||||||
|
extern const char* kSmsFailedObserverTopic;
|
||||||
|
extern const char* kSmsDeliverySuccessObserverTopic;
|
||||||
|
extern const char* kSmsDeliveryErrorObserverTopic;
|
||||||
|
|
||||||
#define DELIVERY_RECEIVED NS_LITERAL_STRING("received")
|
#define DELIVERY_RECEIVED NS_LITERAL_STRING("received")
|
||||||
|
#define DELIVERY_SENDING NS_LITERAL_STRING("sending")
|
||||||
#define DELIVERY_SENT NS_LITERAL_STRING("sent")
|
#define DELIVERY_SENT NS_LITERAL_STRING("sent")
|
||||||
|
#define DELIVERY_ERROR NS_LITERAL_STRING("error")
|
||||||
|
|
||||||
#define DELIVERY_STATUS_NOT_APPLICABLE NS_LITERAL_STRING("not-applicable")
|
#define DELIVERY_STATUS_NOT_APPLICABLE NS_LITERAL_STRING("not-applicable")
|
||||||
#define DELIVERY_STATUS_SUCCESS NS_LITERAL_STRING("success")
|
#define DELIVERY_STATUS_SUCCESS NS_LITERAL_STRING("success")
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
#include "nsIPermissionManager.h"
|
#include "nsIPermissionManager.h"
|
||||||
|
|
||||||
#define RECEIVED_EVENT_NAME NS_LITERAL_STRING("received")
|
#define RECEIVED_EVENT_NAME NS_LITERAL_STRING("received")
|
||||||
|
#define SENDING_EVENT_NAME NS_LITERAL_STRING("sending")
|
||||||
#define SENT_EVENT_NAME NS_LITERAL_STRING("sent")
|
#define SENT_EVENT_NAME NS_LITERAL_STRING("sent")
|
||||||
|
#define FAILED_EVENT_NAME NS_LITERAL_STRING("failed")
|
||||||
#define DELIVERY_SUCCESS_EVENT_NAME NS_LITERAL_STRING("deliverysuccess")
|
#define DELIVERY_SUCCESS_EVENT_NAME NS_LITERAL_STRING("deliverysuccess")
|
||||||
#define DELIVERY_ERROR_EVENT_NAME NS_LITERAL_STRING("deliveryerror")
|
#define DELIVERY_ERROR_EVENT_NAME NS_LITERAL_STRING("deliveryerror")
|
||||||
|
|
||||||
@ -44,7 +46,9 @@ NS_IMPL_ADDREF_INHERITED(SmsManager, nsDOMEventTargetHelper)
|
|||||||
NS_IMPL_RELEASE_INHERITED(SmsManager, nsDOMEventTargetHelper)
|
NS_IMPL_RELEASE_INHERITED(SmsManager, nsDOMEventTargetHelper)
|
||||||
|
|
||||||
NS_IMPL_EVENT_HANDLER(SmsManager, received)
|
NS_IMPL_EVENT_HANDLER(SmsManager, received)
|
||||||
|
NS_IMPL_EVENT_HANDLER(SmsManager, sending)
|
||||||
NS_IMPL_EVENT_HANDLER(SmsManager, sent)
|
NS_IMPL_EVENT_HANDLER(SmsManager, sent)
|
||||||
|
NS_IMPL_EVENT_HANDLER(SmsManager, failed)
|
||||||
NS_IMPL_EVENT_HANDLER(SmsManager, deliverysuccess)
|
NS_IMPL_EVENT_HANDLER(SmsManager, deliverysuccess)
|
||||||
NS_IMPL_EVENT_HANDLER(SmsManager, deliveryerror)
|
NS_IMPL_EVENT_HANDLER(SmsManager, deliveryerror)
|
||||||
|
|
||||||
@ -101,7 +105,9 @@ SmsManager::Init(nsPIDOMWindow *aWindow)
|
|||||||
}
|
}
|
||||||
|
|
||||||
obs->AddObserver(this, kSmsReceivedObserverTopic, false);
|
obs->AddObserver(this, kSmsReceivedObserverTopic, false);
|
||||||
|
obs->AddObserver(this, kSmsSendingObserverTopic, false);
|
||||||
obs->AddObserver(this, kSmsSentObserverTopic, false);
|
obs->AddObserver(this, kSmsSentObserverTopic, false);
|
||||||
|
obs->AddObserver(this, kSmsFailedObserverTopic, false);
|
||||||
obs->AddObserver(this, kSmsDeliverySuccessObserverTopic, false);
|
obs->AddObserver(this, kSmsDeliverySuccessObserverTopic, false);
|
||||||
obs->AddObserver(this, kSmsDeliveryErrorObserverTopic, false);
|
obs->AddObserver(this, kSmsDeliveryErrorObserverTopic, false);
|
||||||
}
|
}
|
||||||
@ -116,7 +122,9 @@ SmsManager::Shutdown()
|
|||||||
}
|
}
|
||||||
|
|
||||||
obs->RemoveObserver(this, kSmsReceivedObserverTopic);
|
obs->RemoveObserver(this, kSmsReceivedObserverTopic);
|
||||||
|
obs->RemoveObserver(this, kSmsSendingObserverTopic);
|
||||||
obs->RemoveObserver(this, kSmsSentObserverTopic);
|
obs->RemoveObserver(this, kSmsSentObserverTopic);
|
||||||
|
obs->RemoveObserver(this, kSmsFailedObserverTopic);
|
||||||
obs->RemoveObserver(this, kSmsDeliverySuccessObserverTopic);
|
obs->RemoveObserver(this, kSmsDeliverySuccessObserverTopic);
|
||||||
obs->RemoveObserver(this, kSmsDeliveryErrorObserverTopic);
|
obs->RemoveObserver(this, kSmsDeliveryErrorObserverTopic);
|
||||||
}
|
}
|
||||||
@ -335,6 +343,17 @@ SmsManager::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(aTopic, kSmsSendingObserverTopic)) {
|
||||||
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
|
if (!message) {
|
||||||
|
NS_ERROR("Got a 'sms-sending' topic without a valid message!");
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
DispatchTrustedSmsEventToSelf(SENDING_EVENT_NAME, message);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(aTopic, kSmsSentObserverTopic)) {
|
if (!strcmp(aTopic, kSmsSentObserverTopic)) {
|
||||||
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
@ -346,6 +365,17 @@ SmsManager::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(aTopic, kSmsFailedObserverTopic)) {
|
||||||
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
|
if (!message) {
|
||||||
|
NS_ERROR("Got a 'sms-failed' topic without a valid message!");
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
DispatchTrustedSmsEventToSelf(FAILED_EVENT_NAME, message);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(aTopic, kSmsDeliverySuccessObserverTopic)) {
|
if (!strcmp(aTopic, kSmsDeliverySuccessObserverTopic)) {
|
||||||
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
|
@ -69,8 +69,12 @@ SmsMessage::Create(int32_t aId,
|
|||||||
|
|
||||||
if (aDelivery.Equals(DELIVERY_RECEIVED)) {
|
if (aDelivery.Equals(DELIVERY_RECEIVED)) {
|
||||||
data.delivery() = eDeliveryState_Received;
|
data.delivery() = eDeliveryState_Received;
|
||||||
|
} else if (aDelivery.Equals(DELIVERY_SENDING)) {
|
||||||
|
data.delivery() = eDeliveryState_Sending;
|
||||||
} else if (aDelivery.Equals(DELIVERY_SENT)) {
|
} else if (aDelivery.Equals(DELIVERY_SENT)) {
|
||||||
data.delivery() = eDeliveryState_Sent;
|
data.delivery() = eDeliveryState_Sent;
|
||||||
|
} else if (aDelivery.Equals(DELIVERY_ERROR)) {
|
||||||
|
data.delivery() = eDeliveryState_Error;
|
||||||
} else {
|
} else {
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
@ -144,9 +148,15 @@ SmsMessage::GetDelivery(nsAString& aDelivery)
|
|||||||
case eDeliveryState_Received:
|
case eDeliveryState_Received:
|
||||||
aDelivery = DELIVERY_RECEIVED;
|
aDelivery = DELIVERY_RECEIVED;
|
||||||
break;
|
break;
|
||||||
|
case eDeliveryState_Sending:
|
||||||
|
aDelivery = DELIVERY_SENDING;
|
||||||
|
break;
|
||||||
case eDeliveryState_Sent:
|
case eDeliveryState_Sent:
|
||||||
aDelivery = DELIVERY_SENT;
|
aDelivery = DELIVERY_SENT;
|
||||||
break;
|
break;
|
||||||
|
case eDeliveryState_Error:
|
||||||
|
aDelivery = DELIVERY_ERROR;
|
||||||
|
break;
|
||||||
case eDeliveryState_Unknown:
|
case eDeliveryState_Unknown:
|
||||||
case eDeliveryState_EndGuard:
|
case eDeliveryState_EndGuard:
|
||||||
default:
|
default:
|
||||||
|
@ -18,6 +18,8 @@ namespace sms {
|
|||||||
enum DeliveryState {
|
enum DeliveryState {
|
||||||
eDeliveryState_Sent = 0,
|
eDeliveryState_Sent = 0,
|
||||||
eDeliveryState_Received,
|
eDeliveryState_Received,
|
||||||
|
eDeliveryState_Sending,
|
||||||
|
eDeliveryState_Error,
|
||||||
eDeliveryState_Unknown,
|
eDeliveryState_Unknown,
|
||||||
// This state should stay at the end.
|
// This state should stay at the end.
|
||||||
eDeliveryState_EndGuard
|
eDeliveryState_EndGuard
|
||||||
|
@ -11,36 +11,6 @@ namespace sms {
|
|||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(SmsDatabaseService, nsISmsDatabaseService)
|
NS_IMPL_ISUPPORTS1(SmsDatabaseService, nsISmsDatabaseService)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
SmsDatabaseService::SaveReceivedMessage(const nsAString& aSender,
|
|
||||||
const nsAString& aBody,
|
|
||||||
const nsAString& aMessageClass,
|
|
||||||
uint64_t aDate,
|
|
||||||
int32_t* aId)
|
|
||||||
{
|
|
||||||
*aId = -1;
|
|
||||||
NS_ERROR("We should not be here!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
SmsDatabaseService::SaveSentMessage(const nsAString& aReceiver,
|
|
||||||
const nsAString& aBody,
|
|
||||||
uint64_t aDate, int32_t* aId)
|
|
||||||
{
|
|
||||||
*aId = -1;
|
|
||||||
NS_ERROR("We should not be here!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
SmsDatabaseService::SetMessageDeliveryStatus(int32_t aMessageId,
|
|
||||||
const nsAString& aDeliveryStatus)
|
|
||||||
{
|
|
||||||
NS_ERROR("We should not be here!");
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
SmsDatabaseService::GetMessageMoz(int32_t aMessageId,
|
SmsDatabaseService::GetMessageMoz(int32_t aMessageId,
|
||||||
nsISmsRequest* aRequest)
|
nsISmsRequest* aRequest)
|
||||||
|
@ -75,8 +75,12 @@ sync protocol PSms {
|
|||||||
child:
|
child:
|
||||||
NotifyReceivedMessage(SmsMessageData aMessageData);
|
NotifyReceivedMessage(SmsMessageData aMessageData);
|
||||||
|
|
||||||
|
NotifySendingMessage(SmsMessageData aMessageData);
|
||||||
|
|
||||||
NotifySentMessage(SmsMessageData aMessageData);
|
NotifySentMessage(SmsMessageData aMessageData);
|
||||||
|
|
||||||
|
NotifyFailedMessage(SmsMessageData aMessageData);
|
||||||
|
|
||||||
NotifyDeliverySuccessMessage(SmsMessageData aMessageData);
|
NotifyDeliverySuccessMessage(SmsMessageData aMessageData);
|
||||||
|
|
||||||
NotifyDeliveryErrorMessage(SmsMessageData aMessageData);
|
NotifyDeliveryErrorMessage(SmsMessageData aMessageData);
|
||||||
@ -98,14 +102,6 @@ parent:
|
|||||||
sync GetNumberOfMessagesForText(nsString aText)
|
sync GetNumberOfMessagesForText(nsString aText)
|
||||||
returns (uint16_t aNumber);
|
returns (uint16_t aNumber);
|
||||||
|
|
||||||
sync SaveReceivedMessage(nsString aSender, nsString aBody, nsString aMessageClass, uint64_t aDate)
|
|
||||||
returns (int32_t aId);
|
|
||||||
|
|
||||||
sync SaveSentMessage(nsString aReceiver, nsString aBody, uint64_t aDate)
|
|
||||||
returns (int32_t aId);
|
|
||||||
|
|
||||||
SetMessageDeliveryStatus(int32_t aMessageId, nsString aDeliveryStatus);
|
|
||||||
|
|
||||||
ClearMessageList(int32_t aListId);
|
ClearMessageList(int32_t aListId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,6 +56,13 @@ SmsChild::RecvNotifyReceivedMessage(const SmsMessageData& aMessageData)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SmsChild::RecvNotifySendingMessage(const SmsMessageData& aMessageData)
|
||||||
|
{
|
||||||
|
NotifyObserversWithSmsMessage(kSmsSendingObserverTopic, aMessageData);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SmsChild::RecvNotifySentMessage(const SmsMessageData& aMessageData)
|
SmsChild::RecvNotifySentMessage(const SmsMessageData& aMessageData)
|
||||||
{
|
{
|
||||||
@ -63,6 +70,13 @@ SmsChild::RecvNotifySentMessage(const SmsMessageData& aMessageData)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
SmsChild::RecvNotifyFailedMessage(const SmsMessageData& aMessageData)
|
||||||
|
{
|
||||||
|
NotifyObserversWithSmsMessage(kSmsFailedObserverTopic, aMessageData);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SmsChild::RecvNotifyDeliverySuccessMessage(const SmsMessageData& aMessageData)
|
SmsChild::RecvNotifyDeliverySuccessMessage(const SmsMessageData& aMessageData)
|
||||||
{
|
{
|
||||||
|
@ -29,9 +29,15 @@ protected:
|
|||||||
virtual bool
|
virtual bool
|
||||||
RecvNotifyReceivedMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
RecvNotifyReceivedMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual bool
|
||||||
|
RecvNotifySendingMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RecvNotifySentMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
RecvNotifySentMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
virtual bool
|
||||||
|
RecvNotifyFailedMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RecvNotifyDeliverySuccessMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
RecvNotifyDeliverySuccessMessage(const SmsMessageData& aMessage) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
@ -95,40 +95,6 @@ SmsIPCService::CreateSmsMessage(int32_t aId,
|
|||||||
/*
|
/*
|
||||||
* Implementation of nsISmsDatabaseService.
|
* Implementation of nsISmsDatabaseService.
|
||||||
*/
|
*/
|
||||||
NS_IMETHODIMP
|
|
||||||
SmsIPCService::SaveReceivedMessage(const nsAString& aSender,
|
|
||||||
const nsAString& aBody,
|
|
||||||
const nsAString& aMessageClass,
|
|
||||||
uint64_t aDate,
|
|
||||||
int32_t* aId)
|
|
||||||
{
|
|
||||||
GetSmsChild()->SendSaveReceivedMessage(nsString(aSender), nsString(aBody),
|
|
||||||
nsString(aMessageClass), aDate, aId);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
SmsIPCService::SaveSentMessage(const nsAString& aReceiver,
|
|
||||||
const nsAString& aBody,
|
|
||||||
uint64_t aDate, int32_t* aId)
|
|
||||||
{
|
|
||||||
GetSmsChild()->SendSaveSentMessage(nsString(aReceiver), nsString(aBody),
|
|
||||||
aDate, aId);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
SmsIPCService::SetMessageDeliveryStatus(int32_t aMessageId,
|
|
||||||
const nsAString& aDeliveryStatus)
|
|
||||||
{
|
|
||||||
GetSmsChild()->SendSetMessageDeliveryStatus(aMessageId,
|
|
||||||
nsString(aDeliveryStatus));
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
SmsIPCService::GetMessageMoz(int32_t aMessageId,
|
SmsIPCService::GetMessageMoz(int32_t aMessageId,
|
||||||
nsISmsRequest* aRequest)
|
nsISmsRequest* aRequest)
|
||||||
|
@ -30,7 +30,9 @@ SmsParent::SmsParent()
|
|||||||
}
|
}
|
||||||
|
|
||||||
obs->AddObserver(this, kSmsReceivedObserverTopic, false);
|
obs->AddObserver(this, kSmsReceivedObserverTopic, false);
|
||||||
|
obs->AddObserver(this, kSmsSendingObserverTopic, false);
|
||||||
obs->AddObserver(this, kSmsSentObserverTopic, false);
|
obs->AddObserver(this, kSmsSentObserverTopic, false);
|
||||||
|
obs->AddObserver(this, kSmsFailedObserverTopic, false);
|
||||||
obs->AddObserver(this, kSmsDeliverySuccessObserverTopic, false);
|
obs->AddObserver(this, kSmsDeliverySuccessObserverTopic, false);
|
||||||
obs->AddObserver(this, kSmsDeliveryErrorObserverTopic, false);
|
obs->AddObserver(this, kSmsDeliveryErrorObserverTopic, false);
|
||||||
}
|
}
|
||||||
@ -49,7 +51,9 @@ SmsParent::ActorDestroy(ActorDestroyReason why)
|
|||||||
}
|
}
|
||||||
|
|
||||||
obs->RemoveObserver(this, kSmsReceivedObserverTopic);
|
obs->RemoveObserver(this, kSmsReceivedObserverTopic);
|
||||||
|
obs->RemoveObserver(this, kSmsSendingObserverTopic);
|
||||||
obs->RemoveObserver(this, kSmsSentObserverTopic);
|
obs->RemoveObserver(this, kSmsSentObserverTopic);
|
||||||
|
obs->RemoveObserver(this, kSmsFailedObserverTopic);
|
||||||
obs->RemoveObserver(this, kSmsDeliverySuccessObserverTopic);
|
obs->RemoveObserver(this, kSmsDeliverySuccessObserverTopic);
|
||||||
obs->RemoveObserver(this, kSmsDeliveryErrorObserverTopic);
|
obs->RemoveObserver(this, kSmsDeliveryErrorObserverTopic);
|
||||||
}
|
}
|
||||||
@ -69,6 +73,17 @@ SmsParent::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(aTopic, kSmsSendingObserverTopic)) {
|
||||||
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
|
if (!message) {
|
||||||
|
NS_ERROR("Got a 'sms-sending' topic without a valid message!");
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
unused << SendNotifySendingMessage(static_cast<SmsMessage*>(message.get())->GetData());
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(aTopic, kSmsSentObserverTopic)) {
|
if (!strcmp(aTopic, kSmsSentObserverTopic)) {
|
||||||
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
@ -80,6 +95,17 @@ SmsParent::Observe(nsISupports* aSubject, const char* aTopic,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(aTopic, kSmsFailedObserverTopic)) {
|
||||||
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
|
if (!message) {
|
||||||
|
NS_ERROR("Got a 'sms-failed' topic without a valid message!");
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
unused << SendNotifyFailedMessage(static_cast<SmsMessage*>(message.get())->GetData());
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(aTopic, kSmsDeliverySuccessObserverTopic)) {
|
if (!strcmp(aTopic, kSmsDeliverySuccessObserverTopic)) {
|
||||||
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
nsCOMPtr<nsIDOMMozSmsMessage> message = do_QueryInterface(aSubject);
|
||||||
if (!message) {
|
if (!message) {
|
||||||
@ -129,50 +155,6 @@ SmsParent::RecvGetNumberOfMessagesForText(const nsString& aText, uint16_t* aResu
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
SmsParent::RecvSaveReceivedMessage(const nsString& aSender,
|
|
||||||
const nsString& aBody,
|
|
||||||
const nsString& aMessageClass,
|
|
||||||
const uint64_t& aDate,
|
|
||||||
int32_t* aId)
|
|
||||||
{
|
|
||||||
*aId = -1;
|
|
||||||
|
|
||||||
nsCOMPtr<nsISmsDatabaseService> smsDBService =
|
|
||||||
do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE(smsDBService, true);
|
|
||||||
|
|
||||||
smsDBService->SaveReceivedMessage(aSender, aBody, aMessageClass, aDate, aId);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
SmsParent::RecvSaveSentMessage(const nsString& aRecipient,
|
|
||||||
const nsString& aBody,
|
|
||||||
const uint64_t& aDate, int32_t* aId)
|
|
||||||
{
|
|
||||||
*aId = -1;
|
|
||||||
|
|
||||||
nsCOMPtr<nsISmsDatabaseService> smsDBService =
|
|
||||||
do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE(smsDBService, true);
|
|
||||||
|
|
||||||
smsDBService->SaveSentMessage(aRecipient, aBody, aDate, aId);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
SmsParent::RecvSetMessageDeliveryStatus(const int32_t& aMessageId,
|
|
||||||
const nsString& aDeliveryStatus)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsISmsDatabaseService> smsDBService =
|
|
||||||
do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
|
|
||||||
NS_ENSURE_TRUE(smsDBService, true);
|
|
||||||
|
|
||||||
smsDBService->SetMessageDeliveryStatus(aMessageId, aDeliveryStatus);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SmsParent::RecvClearMessageList(const int32_t& aListId)
|
SmsParent::RecvClearMessageList(const int32_t& aListId)
|
||||||
{
|
{
|
||||||
|
@ -40,15 +40,6 @@ protected:
|
|||||||
virtual bool
|
virtual bool
|
||||||
RecvGetNumberOfMessagesForText(const nsString& aText, uint16_t* aResult) MOZ_OVERRIDE;
|
RecvGetNumberOfMessagesForText(const nsString& aText, uint16_t* aResult) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual bool
|
|
||||||
RecvSaveReceivedMessage(const nsString& aSender, const nsString& aBody, const nsString& aMessageClass, const uint64_t& aDate, int32_t* aId) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual bool
|
|
||||||
RecvSaveSentMessage(const nsString& aRecipient, const nsString& aBody, const uint64_t& aDate, int32_t* aId) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual bool
|
|
||||||
RecvSetMessageDeliveryStatus(const int32_t& aMessageId, const nsString& aDeliveryStatus) MOZ_OVERRIDE;
|
|
||||||
|
|
||||||
virtual bool
|
virtual bool
|
||||||
RecvClearMessageList(const int32_t& aListId) MOZ_OVERRIDE;
|
RecvClearMessageList(const int32_t& aListId) MOZ_OVERRIDE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user