dom/mobilemessage/src/ipc/SmsParent.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/mobilemessage/src/ipc/SmsParent.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,166 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.7 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef mozilla_dom_mobilemessage_SmsParent_h
    1.10 +#define mozilla_dom_mobilemessage_SmsParent_h
    1.11 +
    1.12 +#include "mozilla/dom/mobilemessage/PSmsParent.h"
    1.13 +#include "mozilla/dom/mobilemessage/PSmsRequestParent.h"
    1.14 +#include "mozilla/dom/mobilemessage/PMobileMessageCursorParent.h"
    1.15 +#include "nsIDOMDOMCursor.h"
    1.16 +#include "nsIMobileMessageCallback.h"
    1.17 +#include "nsIMobileMessageCursorCallback.h"
    1.18 +#include "nsIObserver.h"
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace dom {
    1.22 +
    1.23 +class ContentParent;
    1.24 +
    1.25 +namespace mobilemessage {
    1.26 +
    1.27 +class SmsParent : public PSmsParent
    1.28 +                , public nsIObserver
    1.29 +{
    1.30 +  friend class mozilla::dom::ContentParent;
    1.31 +
    1.32 +public:
    1.33 +  NS_DECL_ISUPPORTS
    1.34 +  NS_DECL_NSIOBSERVER
    1.35 +
    1.36 +protected:
    1.37 +  virtual bool
    1.38 +  RecvAddSilentNumber(const nsString& aNumber) MOZ_OVERRIDE;
    1.39 +
    1.40 +  virtual bool
    1.41 +  RecvRemoveSilentNumber(const nsString& aNumber) MOZ_OVERRIDE;
    1.42 +
    1.43 +  SmsParent();
    1.44 +  virtual ~SmsParent()
    1.45 +  {
    1.46 +    MOZ_COUNT_DTOR(SmsParent);
    1.47 +  }
    1.48 +
    1.49 +  virtual void
    1.50 +  ActorDestroy(ActorDestroyReason why);
    1.51 +
    1.52 +  virtual bool
    1.53 +  RecvPSmsRequestConstructor(PSmsRequestParent* aActor,
    1.54 +                             const IPCSmsRequest& aRequest) MOZ_OVERRIDE;
    1.55 +
    1.56 +  virtual PSmsRequestParent*
    1.57 +  AllocPSmsRequestParent(const IPCSmsRequest& aRequest) MOZ_OVERRIDE;
    1.58 +
    1.59 +  virtual bool
    1.60 +  DeallocPSmsRequestParent(PSmsRequestParent* aActor) MOZ_OVERRIDE;
    1.61 +
    1.62 +  virtual bool
    1.63 +  RecvPMobileMessageCursorConstructor(PMobileMessageCursorParent* aActor,
    1.64 +                                      const IPCMobileMessageCursor& aCursor) MOZ_OVERRIDE;
    1.65 +
    1.66 +  virtual PMobileMessageCursorParent*
    1.67 +  AllocPMobileMessageCursorParent(const IPCMobileMessageCursor& aCursor) MOZ_OVERRIDE;
    1.68 +
    1.69 +  virtual bool
    1.70 +  DeallocPMobileMessageCursorParent(PMobileMessageCursorParent* aActor) MOZ_OVERRIDE;
    1.71 +
    1.72 +  bool
    1.73 +  GetMobileMessageDataFromMessage(nsISupports* aMsg, MobileMessageData& aData);
    1.74 +
    1.75 +private:
    1.76 +  nsTArray<nsString> mSilentNumbers;
    1.77 +};
    1.78 +
    1.79 +class SmsRequestParent : public PSmsRequestParent
    1.80 +                       , public nsIMobileMessageCallback
    1.81 +{
    1.82 +  friend class SmsParent;
    1.83 +
    1.84 +  bool mActorDestroyed;
    1.85 +
    1.86 +public:
    1.87 +  NS_DECL_ISUPPORTS
    1.88 +  NS_DECL_NSIMOBILEMESSAGECALLBACK
    1.89 +
    1.90 +protected:
    1.91 +  SmsRequestParent()
    1.92 +    : mActorDestroyed(false)
    1.93 +  {
    1.94 +    MOZ_COUNT_CTOR(SmsRequestParent);
    1.95 +  }
    1.96 +
    1.97 +  virtual ~SmsRequestParent()
    1.98 +  {
    1.99 +    MOZ_COUNT_DTOR(SmsRequestParent);
   1.100 +  }
   1.101 +
   1.102 +  virtual void
   1.103 +  ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
   1.104 +
   1.105 +  bool
   1.106 +  DoRequest(const SendMessageRequest& aRequest);
   1.107 +
   1.108 +  bool
   1.109 +  DoRequest(const RetrieveMessageRequest& aRequest);
   1.110 +
   1.111 +  bool
   1.112 +  DoRequest(const GetMessageRequest& aRequest);
   1.113 +
   1.114 +  bool
   1.115 +  DoRequest(const DeleteMessageRequest& aRequest);
   1.116 +
   1.117 +  bool
   1.118 +  DoRequest(const MarkMessageReadRequest& aRequest);
   1.119 +
   1.120 +  bool
   1.121 +  DoRequest(const GetSegmentInfoForTextRequest& aRequest);
   1.122 +
   1.123 +  bool
   1.124 +  DoRequest(const GetSmscAddressRequest& aRequest);
   1.125 +
   1.126 +  nsresult
   1.127 +  SendReply(const MessageReply& aReply);
   1.128 +};
   1.129 +
   1.130 +class MobileMessageCursorParent : public PMobileMessageCursorParent
   1.131 +                                , public nsIMobileMessageCursorCallback
   1.132 +{
   1.133 +  friend class SmsParent;
   1.134 +
   1.135 +  nsCOMPtr<nsICursorContinueCallback> mContinueCallback;
   1.136 +
   1.137 +public:
   1.138 +  NS_DECL_ISUPPORTS
   1.139 +  NS_DECL_NSIMOBILEMESSAGECURSORCALLBACK
   1.140 +
   1.141 +protected:
   1.142 +  MobileMessageCursorParent()
   1.143 +  {
   1.144 +    MOZ_COUNT_CTOR(MobileMessageCursorParent);
   1.145 +  }
   1.146 +
   1.147 +  virtual ~MobileMessageCursorParent()
   1.148 +  {
   1.149 +    MOZ_COUNT_DTOR(MobileMessageCursorParent);
   1.150 +  }
   1.151 +
   1.152 +  virtual void
   1.153 +  ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
   1.154 +
   1.155 +  virtual bool
   1.156 +  RecvContinue() MOZ_OVERRIDE;
   1.157 +
   1.158 +  bool
   1.159 +  DoRequest(const CreateMessageCursorRequest& aRequest);
   1.160 +
   1.161 +  bool
   1.162 +  DoRequest(const CreateThreadCursorRequest& aRequest);
   1.163 +};
   1.164 +
   1.165 +} // namespace mobilemessage
   1.166 +} // namespace dom
   1.167 +} // namespace mozilla
   1.168 +
   1.169 +#endif // mozilla_dom_mobilemessage_SmsParent_h

mercurial