зеркало из https://github.com/mozilla/pjs.git
Bug 674725 - Part AE - Implement DOM and IPC boilerplate for delete(). r=smaug
This commit is contained in:
Родитель
5d12645397
Коммит
89fbea2d2b
|
@ -39,7 +39,7 @@
|
|||
interface nsIDOMEventListener;
|
||||
interface nsIDOMMozSmsRequest;
|
||||
|
||||
[scriptable, function, uuid(8bebc119-845c-4ae1-96e7-7b7ee970485b)]
|
||||
[scriptable, function, uuid(4e628d96-abc9-45e1-b158-8970885a2552)]
|
||||
interface nsIDOMMozSmsManager : nsIDOMEventTarget
|
||||
{
|
||||
unsigned short getNumberOfMessagesForText(in DOMString text);
|
||||
|
@ -51,6 +51,7 @@ interface nsIDOMMozSmsManager : nsIDOMEventTarget
|
|||
jsval send(in jsval number, in DOMString message);
|
||||
|
||||
[binaryname(GetMessageMoz)] nsIDOMMozSmsRequest getMessage(in long id);
|
||||
nsIDOMMozSmsRequest delete(in long id);
|
||||
|
||||
attribute nsIDOMEventListener onreceived;
|
||||
attribute nsIDOMEventListener onsent;
|
||||
|
|
|
@ -38,16 +38,17 @@
|
|||
|
||||
%{C++
|
||||
#define SMS_DATABASE_SERVICE_CID \
|
||||
{ 0xa33977ef, 0x1a16, 0x473a, \
|
||||
{ 0x86, 0x62, 0x44, 0x10, 0xfe, 0xf3, 0xf1, 0x2b } }
|
||||
{ 0xcc939280, 0x36ba, 0x4a03, \
|
||||
{ 0xbe, 0x20, 0xd1, 0xfa, 0x7e, 0xb0, 0x44, 0x1e } }
|
||||
#define SMS_DATABASE_SERVICE_CONTRACTID "@mozilla.org/sms/smsdatabaseservice;1"
|
||||
%}
|
||||
|
||||
[scriptable, function, uuid(f1ff6e13-d49f-4b38-8697-8e45be49f1e7)]
|
||||
[scriptable, function, uuid(8f217fbf-88d9-4e72-8399-8c4d5e5cf7d0)]
|
||||
interface nsISmsDatabaseService : nsISupports
|
||||
{
|
||||
// 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);
|
||||
|
||||
[binaryname(GetMessageMoz)] void getMessage(in long messageId, in long requestId, [optional] in unsigned long long processId);
|
||||
void deleteMessage(in long messageId, in long requestId, [optional] in unsigned long long processId);
|
||||
};
|
||||
|
|
|
@ -227,6 +227,22 @@ SmsManager::GetMessageMoz(PRInt32 aId, nsIDOMMozSmsRequest** aRequest)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsManager::Delete(PRInt32 aId, nsIDOMMozSmsRequest** aRequest)
|
||||
{
|
||||
int requestId =
|
||||
SmsRequestManager::GetInstance()->CreateRequest(mOwner, mScriptContext, aRequest);
|
||||
NS_ASSERTION(*aRequest, "The request object must have been created!");
|
||||
|
||||
nsCOMPtr<nsISmsDatabaseService> smsDBService =
|
||||
do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(smsDBService, NS_ERROR_FAILURE);
|
||||
|
||||
smsDBService->DeleteMessage(aId, requestId, 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_EVENT_HANDLER(SmsManager, received)
|
||||
NS_IMPL_EVENT_HANDLER(SmsManager, sent)
|
||||
NS_IMPL_EVENT_HANDLER(SmsManager, delivered)
|
||||
|
|
|
@ -71,6 +71,14 @@ SmsDatabaseService::GetMessageMoz(PRInt32 aMessageId, PRInt32 aRequestId,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::DeleteMessage(PRInt32 aMessageId, PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
// TODO: implement
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace sms
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -61,6 +61,14 @@ SmsDatabaseService::GetMessageMoz(PRInt32 aMessageId, PRInt32 aRequestId,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsDatabaseService::DeleteMessage(PRInt32 aMessageId, PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
NS_ERROR("We should not be here!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace sms
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -92,6 +92,8 @@ parent:
|
|||
|
||||
GetMessage(PRInt32 aMessageId, PRInt32 aRequestId, PRUint64 aProcessId);
|
||||
|
||||
DeleteMessage(PRInt32 aMessageId, PRInt32 aRequestId, PRUint64 aProcessId);
|
||||
|
||||
__delete__();
|
||||
};
|
||||
|
||||
|
|
|
@ -126,6 +126,15 @@ SmsIPCService::GetMessageMoz(PRInt32 aMessageId, PRInt32 aRequestId,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SmsIPCService::DeleteMessage(PRInt32 aMessageId, PRInt32 aRequestId,
|
||||
PRUint64 aProcessId)
|
||||
{
|
||||
GetSmsChild()->SendDeleteMessage(aMessageId, aRequestId,
|
||||
ContentChild::GetSingleton()->GetID());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace sms
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -204,6 +204,18 @@ SmsParent::RecvGetMessage(const PRInt32& aMessageId, const PRInt32& aRequestId,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SmsParent::RecvDeleteMessage(const PRInt32& aMessageId, const PRInt32& aRequestId,
|
||||
const PRUint64& aProcessId)
|
||||
{
|
||||
nsCOMPtr<nsISmsDatabaseService> smsDBService =
|
||||
do_GetService(SMS_DATABASE_SERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(smsDBService, true);
|
||||
|
||||
smsDBService->DeleteMessage(aMessageId, aRequestId, aProcessId);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace sms
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
NS_OVERRIDE virtual bool RecvSendMessage(const nsString& aNumber, const nsString& aMessage, const PRInt32& aRequestId, const PRUint64& aProcessId);
|
||||
NS_OVERRIDE virtual bool RecvSaveSentMessage(const nsString& aRecipient, const nsString& aBody, const PRUint64& aDate, PRInt32* aId);
|
||||
NS_OVERRIDE virtual bool RecvGetMessage(const PRInt32& aMessageId, const PRInt32& aRequestId, const PRUint64& aProcessId);
|
||||
NS_OVERRIDE virtual bool RecvDeleteMessage(const PRInt32& aMessageId, const PRInt32& aRequestId, const PRUint64& aProcessId);
|
||||
|
||||
protected:
|
||||
virtual void ActorDestroy(ActorDestroyReason why);
|
||||
|
|
Загрузка…
Ссылка в новой задаче