Bug 838467 1/5: use DOMCursor instead of SmsCursor. Interface changes. sr=sicking, r=bent
authorVicamo Yang <vyang@mozilla.com>
Tue, 09 Apr 2013 10:21:25 +0800
changeset 139037 cc3d0f45fd4aad4e905530346bea0c4596930da2
parent 139036 ca1887b25c951d07c1da9368b186835ab905fa4b
child 139038 14846076568807b64055626f6183628ab3452f55
push idunknown
push userunknown
push dateunknown
reviewerssicking, bent
bugs838467
milestone23.0a1
Bug 838467 1/5: use DOMCursor instead of SmsCursor. Interface changes. sr=sicking, r=bent
dom/mobilemessage/interfaces/nsIDOMMobileMessageManager.idl
dom/mobilemessage/interfaces/nsIDOMSmsCursor.idl
dom/mobilemessage/interfaces/nsIDOMSmsManager.idl
dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
dom/mobilemessage/interfaces/nsIMobileMessageCursorCallback.idl
dom/mobilemessage/interfaces/nsIMobileMessageDatabaseService.idl
dom/mobilemessage/src/ipc/PMobileMessageCursor.ipdl
dom/mobilemessage/src/ipc/PSms.ipdl
dom/mobilemessage/src/ipc/PSmsRequest.ipdl
dom/mobilemessage/src/ipc/SmsTypes.ipdlh
--- a/dom/mobilemessage/interfaces/nsIDOMMobileMessageManager.idl
+++ b/dom/mobilemessage/interfaces/nsIDOMMobileMessageManager.idl
@@ -3,28 +3,29 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIDOMEventTarget.idl"
 
 interface nsIDOMEventListener;
 interface nsIDOMMozSmsRequest;
 interface nsIDOMMozSmsFilter;
 interface nsIDOMMozSmsSegmentInfo;
+interface nsIDOMDOMCursor;
 interface nsIDOMDOMRequest;
 interface nsIDOMBlob;
 
 dictionary MmsParameters
 {
   jsval      receivers; // DOMString[]
   DOMString? subject;
   DOMString? smil;
   jsval      attachments; // MmsAttachment[]
 };
 
-[scriptable, builtinclass, uuid(645161ca-b009-461b-bd13-45c3075cdfba)]
+[scriptable, builtinclass, uuid(44346294-6c8f-4a06-a412-1f38f7d45f2e)]
 interface nsIDOMMozMobileMessageManager : nsIDOMEventTarget
 {
   nsIDOMMozSmsSegmentInfo getSegmentInfoForText(in DOMString text);
 
   // The first parameter can be either a DOMString (only one number) or an array
   // of DOMStrings.
   // The method returns a SmsRequest object if one number has been passed.
   // An array of SmsRequest objects otherwise.
@@ -33,17 +34,17 @@ interface nsIDOMMozMobileMessageManager 
   nsIDOMDOMRequest sendMMS(in jsval parameters /* MmsParameters */);
 
   [binaryname(GetMessageMoz)]
   nsIDOMDOMRequest getMessage(in long id);
 
   // The parameter can be either a message id or a nsIDOMMoz{Mms,Sms}Message.
   nsIDOMDOMRequest delete(in jsval param);
 
-  nsIDOMMozSmsRequest getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
+  nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
 
   nsIDOMDOMRequest markMessageRead(in long id, in boolean aValue);
 
   nsIDOMMozSmsRequest getThreadList();
 
   [implicit_jscontext] attribute jsval onreceived;
   [implicit_jscontext] attribute jsval onsending;
   [implicit_jscontext] attribute jsval onsent;
deleted file mode 100644
--- a/dom/mobilemessage/interfaces/nsIDOMSmsCursor.idl
+++ /dev/null
@@ -1,16 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface nsIDOMMozSmsFilter;
-interface nsIDOMMozSmsMessage;
-
-[scriptable, function, uuid(77b41d7e-ccb1-4480-8322-2af7bc437a3c)]
-interface nsIDOMMozSmsCursor : nsISupports
-{
-  // Can be null if there is no more results.
-  readonly attribute nsIDOMMozSmsMessage message;
-  void continue();
-};
--- a/dom/mobilemessage/interfaces/nsIDOMSmsManager.idl
+++ b/dom/mobilemessage/interfaces/nsIDOMSmsManager.idl
@@ -1,37 +1,38 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIDOMEventTarget.idl"
 
+interface nsIDOMDOMCursor;
 interface nsIDOMEventListener;
 interface nsIDOMMozSmsRequest;
 interface nsIDOMMozSmsFilter;
 interface nsIDOMMozSmsSegmentInfo;
 
-[scriptable, builtinclass, uuid(9bc1d6fc-6b53-48f6-99e8-793e746e5dbb)]
+[scriptable, builtinclass, uuid(aa03b43e-82ec-4325-906e-a1ea018e1b01)]
 interface nsIDOMMozSmsManager : nsIDOMEventTarget
 {
   nsIDOMMozSmsSegmentInfo getSegmentInfoForText(in DOMString text);
 
   // The first parameter can be either a DOMString (only one number) or an array
   // of DOMStrings.
   // The method returns a SmsRequest object if one number has been passed.
   // An array of SmsRequest objects otherwise.
   jsval send(in jsval number, in DOMString message);
 
   [binaryname(GetMessageMoz)]
   nsIDOMMozSmsRequest getMessage(in long id);
 
   // The parameter can be either a message id or a SmsMessage.
   nsIDOMMozSmsRequest delete(in jsval param);
 
-  nsIDOMMozSmsRequest getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
+  nsIDOMDOMCursor getMessages(in nsIDOMMozSmsFilter filter, in boolean reverse);
 
   nsIDOMMozSmsRequest markMessageRead(in long id, in boolean aValue);
 
   nsIDOMMozSmsRequest getThreadList();
 
   [implicit_jscontext] attribute jsval onreceived;
   [implicit_jscontext] attribute jsval onsending;
   [implicit_jscontext] attribute jsval onsent;
--- a/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
+++ b/dom/mobilemessage/interfaces/nsIMobileMessageCallback.idl
@@ -8,17 +8,17 @@ dictionary SmsThreadListItem
 {
   unsigned long long id;
   DOMString senderOrReceiver;
   unsigned long long timestamp;
   DOMString body;
   unsigned long long unreadCount;
 };
 
-[scriptable, builtinclass, uuid(edb1de12-8d58-11e2-b382-7bf132b20cb2)]
+[scriptable, builtinclass, uuid(47498737-972d-49c9-8d4e-80ae2da51778)]
 interface nsIMobileMessageCallback : nsISupports
 {
   /**
    * All SMS related errors that could apply to SmsRequest objects.
    * Make sure to keep this list in sync with the list in:
    * mobile/android/GeckoSmsManager.java
    */
   const unsigned short SUCCESS_NO_ERROR = 0;
@@ -37,24 +37,15 @@ interface nsIMobileMessageCallback : nsI
    * |message| can be nsIDOMMoz{Mms,Sms}Message.
    */
   void notifyMessageGot(in nsISupports message);
   void notifyGetMessageFailed(in long error);
 
   void notifyMessageDeleted(in boolean deleted);
   void notifyDeleteMessageFailed(in long error);
 
-  /**
-   * |message| can be nsIDOMMoz{Mms,Sms}Message.
-   */
-  void notifyMessageListCreated(in long listId,
-                                in nsISupports message);
-  void notifyReadMessageListFailed(in long error);
-  void notifyNextMessageInListGot(in nsISupports message);
-  void notifyNoMessageInList();
-
   void notifyMessageMarkedRead(in boolean read);
   void notifyMarkMessageReadFailed(in long error);
 
   [implicit_jscontext]
   void notifyThreadList(in jsval threadList);
   void notifyThreadListFailed(in long error);
 };
new file mode 100644
--- /dev/null
+++ b/dom/mobilemessage/interfaces/nsIMobileMessageCursorCallback.idl
@@ -0,0 +1,13 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+[scriptable, builtinclass, uuid(8fd0dba2-032e-4190-a751-07cc3782e93e)]
+interface nsIMobileMessageCursorCallback : nsISupports
+{
+  void notifyCursorError(in long error);
+  void notifyCursorResult(in nsISupports result);
+  void notifyCursorDone();
+};
--- a/dom/mobilemessage/interfaces/nsIMobileMessageDatabaseService.idl
+++ b/dom/mobilemessage/interfaces/nsIMobileMessageDatabaseService.idl
@@ -6,36 +6,33 @@
 
 %{C++
 #define MOBILE_MESSAGE_DATABASE_SERVICE_CID \
 { 0x0d84b9c2, 0x8f76, 0x4ba4,    \
 { 0xa5, 0xcd, 0xdb, 0xfb, 0x01, 0xdf, 0xda, 0x99 } }
 #define MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID "@mozilla.org/mobilemessage/mobilemessagedatabaseservice;1"
 %}
 
+interface nsICursorContinueCallback;
 interface nsIDOMMozSmsFilter;
 interface nsIMobileMessageCallback;
+interface nsIMobileMessageCursorCallback;
 
-[scriptable, uuid(4000064a-86d2-11e2-b4a6-ef0f30bd1e59)]
+[scriptable, uuid(487d15e1-fd23-40cc-ba45-7c0115032e17)]
 interface nsIMobileMessageDatabaseService : nsISupports
 {
   [binaryname(GetMessageMoz)]
   void getMessage(in long messageId,
                   in nsIMobileMessageCallback request);
 
   void deleteMessage(in long messageId,
                      in nsIMobileMessageCallback request);
 
-  void createMessageList(in nsIDOMMozSmsFilter filter,
-                         in boolean reverse,
-                         in nsIMobileMessageCallback request);
-
-  void getNextMessageInList(in long listId,
-                            in nsIMobileMessageCallback request);
-
-  void clearMessageList(in long listId);
+  nsICursorContinueCallback createMessageCursor(in nsIDOMMozSmsFilter filter,
+                                                in boolean reverse,
+                                                in nsIMobileMessageCursorCallback callback);
 
   void markMessageRead(in long messageId,
                        in boolean value,
                        in nsIMobileMessageCallback request);
 
   void getThreadList(in nsIMobileMessageCallback request);
 };
new file mode 100644
--- /dev/null
+++ b/dom/mobilemessage/src/ipc/PMobileMessageCursor.ipdl
@@ -0,0 +1,34 @@
+/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+include "mozilla/dom/mobilemessage/Types.h";
+
+include protocol PSms;
+include SmsTypes;
+
+namespace mozilla {
+namespace dom {
+namespace mobilemessage {
+
+protocol PMobileMessageCursor
+{
+  manager PSms;
+
+child:
+  NotifyResult(SmsMessageData aMessageData);
+
+  /**
+   * Sent when the asynchronous cursor request has completed.
+   */
+  __delete__(int32_t aError);
+
+parent:
+  Continue();
+};
+
+} // namespace mobilemessage
+} // namespace dom
+} // namespace mozilla
--- a/dom/mobilemessage/src/ipc/PSms.ipdl
+++ b/dom/mobilemessage/src/ipc/PSms.ipdl
@@ -1,81 +1,68 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set sw=2 ts=8 et ft=cpp : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PContent;
 include protocol PSmsRequest;
+include protocol PMobileMessageCursor;
 include SmsTypes;
 
 namespace mozilla {
 namespace dom {
 namespace mobilemessage {
 
-struct SmsFilterData {
-  uint64_t      startDate;
-  uint64_t      endDate;
-  nsString[]    numbers;
-  DeliveryState delivery;
-  ReadState     read;  
-};
-
 struct SendMessageRequest
 {
   nsString number;
   nsString message;
 };
 
 struct GetMessageRequest
 {
   int32_t messageId;
 };
 
 struct DeleteMessageRequest
 {
   int32_t messageId;
 };
 
-struct CreateMessageListRequest
+struct CreateMessageCursorRequest
 {
   SmsFilterData filter;
   bool reverse;
 };
 
-struct GetNextMessageInListRequest
-{
-  int32_t aListId;
-};
-
 struct MarkMessageReadRequest
 {
   int32_t messageId;
   bool value;
 };
 
 struct GetThreadListRequest
 {
 };
 
 union IPCSmsRequest
 {
   SendMessageRequest;
   GetMessageRequest;
   DeleteMessageRequest;
-  CreateMessageListRequest;
-  GetNextMessageInListRequest;
   MarkMessageReadRequest;
   GetThreadListRequest;
 };
 
 sync protocol PSms {
     manager PContent;
     manages PSmsRequest;
+    manages PMobileMessageCursor;
 
 child:
   NotifyReceivedMessage(SmsMessageData aMessageData);
 
   NotifySendingMessage(SmsMessageData aMessageData);
 
   NotifySentMessage(SmsMessageData aMessageData);
 
@@ -91,20 +78,23 @@ parent:
    */
   __delete__();
 
   /**
    * Sent when the child makes an asynchronous request to the parent.
    */
   PSmsRequest(IPCSmsRequest request);
 
+  /**
+   * Sent when the child makes an asynchronous cursor to the parent.
+   */
+  PMobileMessageCursor(CreateMessageCursorRequest request);
+
   sync HasSupport()
       returns (bool aHasSupport);
 
   sync GetSegmentInfoForText(nsString aText)
       returns (SmsSegmentInfoData aResult);
-
-  ClearMessageList(int32_t aListId);
 };
 
 } // namespace mobilemessage
 } // namespace dom
 } // namespace mozilla
--- a/dom/mobilemessage/src/ipc/PSmsRequest.ipdl
+++ b/dom/mobilemessage/src/ipc/PSmsRequest.ipdl
@@ -50,55 +50,26 @@ struct ReplyMessageDelete
   bool deleted;
 };
 
 struct ReplyMessageDeleteFail
 {
   int32_t error;
 };
 
-struct ReplyCreateMessageList
-{
-  int32_t listId;
-  SmsMessageData messageData;
-};
-
-struct ReplyCreateMessageListFail
-{
-  int32_t error;
-};
-
-struct ReplyGetNextMessage
-{
-  SmsMessageData messageData;
-};
-
 struct ReplyMarkeMessageRead
 {
   bool read;
 };
 
 struct ReplyMarkeMessageReadFail
 {
   int32_t error;
 };
 
-struct ReplyNoMessageInList
-{
-};
-
-struct ThreadListItem
-{
-  uint64_t id;
-  nsString senderOrReceiver;
-  uint64_t timestamp;
-  nsString body;
-  uint64_t unreadCount;
-};
-
 struct ReplyThreadList
 {
   ThreadListItem[] items;
 };
 
 struct ReplyThreadListFail
 {
   int32_t error;
@@ -107,20 +78,16 @@ struct ReplyThreadListFail
 union MessageReply
 {
   ReplyMessageSend;
   ReplyMessageSendFail;
   ReplyGetMessage;
   ReplyGetMessageFail;
   ReplyMessageDelete;
   ReplyMessageDeleteFail;
-  ReplyNoMessageInList;
-  ReplyCreateMessageList;
-  ReplyCreateMessageListFail;
-  ReplyGetNextMessage;
   ReplyMarkeMessageRead;
   ReplyMarkeMessageReadFail;
   ReplyThreadList;
   ReplyThreadListFail;
 };
 
 } // namespace mobilemessage
 } // namespace dom
--- a/dom/mobilemessage/src/ipc/SmsTypes.ipdlh
+++ b/dom/mobilemessage/src/ipc/SmsTypes.ipdlh
@@ -31,11 +31,29 @@ struct SmsMessageData
   nsString       sender;
   nsString       receiver;
   nsString       body;
   MessageClass   messageClass;
   uint64_t       timestamp; // ms since epoch.
   bool           read;
 };
 
+struct SmsFilterData
+{
+  uint64_t      startDate;
+  uint64_t      endDate;
+  nsString[]    numbers;
+  DeliveryState delivery;
+  ReadState     read;
+};
+
+struct ThreadListItem
+{
+  uint64_t id;
+  nsString senderOrReceiver;
+  uint64_t timestamp;
+  nsString body;
+  uint64_t unreadCount;
+};
+
 }
 }
 }