Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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/. */
6 #ifndef mozilla_dom_mobilemessage_SmsParent_h
7 #define mozilla_dom_mobilemessage_SmsParent_h
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"
17 namespace mozilla {
18 namespace dom {
20 class ContentParent;
22 namespace mobilemessage {
24 class SmsParent : public PSmsParent
25 , public nsIObserver
26 {
27 friend class mozilla::dom::ContentParent;
29 public:
30 NS_DECL_ISUPPORTS
31 NS_DECL_NSIOBSERVER
33 protected:
34 virtual bool
35 RecvAddSilentNumber(const nsString& aNumber) MOZ_OVERRIDE;
37 virtual bool
38 RecvRemoveSilentNumber(const nsString& aNumber) MOZ_OVERRIDE;
40 SmsParent();
41 virtual ~SmsParent()
42 {
43 MOZ_COUNT_DTOR(SmsParent);
44 }
46 virtual void
47 ActorDestroy(ActorDestroyReason why);
49 virtual bool
50 RecvPSmsRequestConstructor(PSmsRequestParent* aActor,
51 const IPCSmsRequest& aRequest) MOZ_OVERRIDE;
53 virtual PSmsRequestParent*
54 AllocPSmsRequestParent(const IPCSmsRequest& aRequest) MOZ_OVERRIDE;
56 virtual bool
57 DeallocPSmsRequestParent(PSmsRequestParent* aActor) MOZ_OVERRIDE;
59 virtual bool
60 RecvPMobileMessageCursorConstructor(PMobileMessageCursorParent* aActor,
61 const IPCMobileMessageCursor& aCursor) MOZ_OVERRIDE;
63 virtual PMobileMessageCursorParent*
64 AllocPMobileMessageCursorParent(const IPCMobileMessageCursor& aCursor) MOZ_OVERRIDE;
66 virtual bool
67 DeallocPMobileMessageCursorParent(PMobileMessageCursorParent* aActor) MOZ_OVERRIDE;
69 bool
70 GetMobileMessageDataFromMessage(nsISupports* aMsg, MobileMessageData& aData);
72 private:
73 nsTArray<nsString> mSilentNumbers;
74 };
76 class SmsRequestParent : public PSmsRequestParent
77 , public nsIMobileMessageCallback
78 {
79 friend class SmsParent;
81 bool mActorDestroyed;
83 public:
84 NS_DECL_ISUPPORTS
85 NS_DECL_NSIMOBILEMESSAGECALLBACK
87 protected:
88 SmsRequestParent()
89 : mActorDestroyed(false)
90 {
91 MOZ_COUNT_CTOR(SmsRequestParent);
92 }
94 virtual ~SmsRequestParent()
95 {
96 MOZ_COUNT_DTOR(SmsRequestParent);
97 }
99 virtual void
100 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
102 bool
103 DoRequest(const SendMessageRequest& aRequest);
105 bool
106 DoRequest(const RetrieveMessageRequest& aRequest);
108 bool
109 DoRequest(const GetMessageRequest& aRequest);
111 bool
112 DoRequest(const DeleteMessageRequest& aRequest);
114 bool
115 DoRequest(const MarkMessageReadRequest& aRequest);
117 bool
118 DoRequest(const GetSegmentInfoForTextRequest& aRequest);
120 bool
121 DoRequest(const GetSmscAddressRequest& aRequest);
123 nsresult
124 SendReply(const MessageReply& aReply);
125 };
127 class MobileMessageCursorParent : public PMobileMessageCursorParent
128 , public nsIMobileMessageCursorCallback
129 {
130 friend class SmsParent;
132 nsCOMPtr<nsICursorContinueCallback> mContinueCallback;
134 public:
135 NS_DECL_ISUPPORTS
136 NS_DECL_NSIMOBILEMESSAGECURSORCALLBACK
138 protected:
139 MobileMessageCursorParent()
140 {
141 MOZ_COUNT_CTOR(MobileMessageCursorParent);
142 }
144 virtual ~MobileMessageCursorParent()
145 {
146 MOZ_COUNT_DTOR(MobileMessageCursorParent);
147 }
149 virtual void
150 ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
152 virtual bool
153 RecvContinue() MOZ_OVERRIDE;
155 bool
156 DoRequest(const CreateMessageCursorRequest& aRequest);
158 bool
159 DoRequest(const CreateThreadCursorRequest& aRequest);
160 };
162 } // namespace mobilemessage
163 } // namespace dom
164 } // namespace mozilla
166 #endif // mozilla_dom_mobilemessage_SmsParent_h