dom/mobilemessage/src/ipc/SmsParent.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:207d7a3d3a43
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #ifndef mozilla_dom_mobilemessage_SmsParent_h
7 #define mozilla_dom_mobilemessage_SmsParent_h
8
9 #include "mozilla/dom/mobilemessage/PSmsParent.h"
10 #include "mozilla/dom/mobilemessage/PSmsRequestParent.h"
11 #include "mozilla/dom/mobilemessage/PMobileMessageCursorParent.h"
12 #include "nsIDOMDOMCursor.h"
13 #include "nsIMobileMessageCallback.h"
14 #include "nsIMobileMessageCursorCallback.h"
15 #include "nsIObserver.h"
16
17 namespace mozilla {
18 namespace dom {
19
20 class ContentParent;
21
22 namespace mobilemessage {
23
24 class SmsParent : public PSmsParent
25 , public nsIObserver
26 {
27 friend class mozilla::dom::ContentParent;
28
29 public:
30 NS_DECL_ISUPPORTS
31 NS_DECL_NSIOBSERVER
32
33 protected:
34 virtual bool
35 RecvAddSilentNumber(const nsString& aNumber) MOZ_OVERRIDE;
36
37 virtual bool
38 RecvRemoveSilentNumber(const nsString& aNumber) MOZ_OVERRIDE;
39
40 SmsParent();
41 virtual ~SmsParent()
42 {
43 MOZ_COUNT_DTOR(SmsParent);
44 }
45
46 virtual void
47 ActorDestroy(ActorDestroyReason why);
48
49 virtual bool
50 RecvPSmsRequestConstructor(PSmsRequestParent* aActor,
51 const IPCSmsRequest& aRequest) MOZ_OVERRIDE;
52
53 virtual PSmsRequestParent*
54 AllocPSmsRequestParent(const IPCSmsRequest& aRequest) MOZ_OVERRIDE;
55
56 virtual bool
57 DeallocPSmsRequestParent(PSmsRequestParent* aActor) MOZ_OVERRIDE;
58
59 virtual bool
60 RecvPMobileMessageCursorConstructor(PMobileMessageCursorParent* aActor,
61 const IPCMobileMessageCursor& aCursor) MOZ_OVERRIDE;
62
63 virtual PMobileMessageCursorParent*
64 AllocPMobileMessageCursorParent(const IPCMobileMessageCursor& aCursor) MOZ_OVERRIDE;
65
66 virtual bool
67 DeallocPMobileMessageCursorParent(PMobileMessageCursorParent* aActor) MOZ_OVERRIDE;
68
69 bool
70 GetMobileMessageDataFromMessage(nsISupports* aMsg, MobileMessageData& aData);
71
72 private:
73 nsTArray<nsString> mSilentNumbers;
74 };
75
76 class SmsRequestParent : public PSmsRequestParent
77 , public nsIMobileMessageCallback
78 {
79 friend class SmsParent;
80
81 bool mActorDestroyed;
82
83 public:
84 NS_DECL_ISUPPORTS
85 NS_DECL_NSIMOBILEMESSAGECALLBACK
86
87 protected:
88 SmsRequestParent()
89 : mActorDestroyed(false)
90 {
91 MOZ_COUNT_CTOR(SmsRequestParent);
92 }
93
94 virtual ~SmsRequestParent()
95 {
96 MOZ_COUNT_DTOR(SmsRequestParent);
97 }
98
99 virtual void
100 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
101
102 bool
103 DoRequest(const SendMessageRequest& aRequest);
104
105 bool
106 DoRequest(const RetrieveMessageRequest& aRequest);
107
108 bool
109 DoRequest(const GetMessageRequest& aRequest);
110
111 bool
112 DoRequest(const DeleteMessageRequest& aRequest);
113
114 bool
115 DoRequest(const MarkMessageReadRequest& aRequest);
116
117 bool
118 DoRequest(const GetSegmentInfoForTextRequest& aRequest);
119
120 bool
121 DoRequest(const GetSmscAddressRequest& aRequest);
122
123 nsresult
124 SendReply(const MessageReply& aReply);
125 };
126
127 class MobileMessageCursorParent : public PMobileMessageCursorParent
128 , public nsIMobileMessageCursorCallback
129 {
130 friend class SmsParent;
131
132 nsCOMPtr<nsICursorContinueCallback> mContinueCallback;
133
134 public:
135 NS_DECL_ISUPPORTS
136 NS_DECL_NSIMOBILEMESSAGECURSORCALLBACK
137
138 protected:
139 MobileMessageCursorParent()
140 {
141 MOZ_COUNT_CTOR(MobileMessageCursorParent);
142 }
143
144 virtual ~MobileMessageCursorParent()
145 {
146 MOZ_COUNT_DTOR(MobileMessageCursorParent);
147 }
148
149 virtual void
150 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
151
152 virtual bool
153 RecvContinue() MOZ_OVERRIDE;
154
155 bool
156 DoRequest(const CreateMessageCursorRequest& aRequest);
157
158 bool
159 DoRequest(const CreateThreadCursorRequest& aRequest);
160 };
161
162 } // namespace mobilemessage
163 } // namespace dom
164 } // namespace mozilla
165
166 #endif // mozilla_dom_mobilemessage_SmsParent_h

mercurial