LCOV - code coverage report
Current view: directory - dom/sms/src/ipc - SmsChild.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 85 0 0.0 %
Date: 2012-06-02 Functions: 13 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Mozilla Foundation
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2011
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Mounir Lamouri <mounir.lamouri@mozilla.com> (Original Author)
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #include "SmsChild.h"
      39                 : #include "SmsMessage.h"
      40                 : #include "Constants.h"
      41                 : #include "nsIObserverService.h"
      42                 : #include "mozilla/Services.h"
      43                 : #include "mozilla/dom/ContentChild.h"
      44                 : #include "SmsRequestManager.h"
      45                 : #include "SmsRequest.h"
      46                 : 
      47                 : namespace mozilla {
      48                 : namespace dom {
      49                 : namespace sms {
      50                 : 
      51                 : bool
      52               0 : SmsChild::RecvNotifyReceivedMessage(const SmsMessageData& aMessageData)
      53                 : {
      54               0 :   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
      55               0 :   if (!obs) {
      56               0 :     return true;
      57                 :   }
      58                 : 
      59               0 :   nsCOMPtr<SmsMessage> message = new SmsMessage(aMessageData);
      60               0 :   obs->NotifyObservers(message, kSmsReceivedObserverTopic, nsnull);
      61                 : 
      62               0 :   return true;
      63                 : }
      64                 : 
      65                 : bool
      66               0 : SmsChild::RecvNotifySentMessage(const SmsMessageData& aMessageData)
      67                 : {
      68               0 :   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
      69               0 :   if (!obs) {
      70               0 :     return true;
      71                 :   }
      72                 : 
      73               0 :   nsCOMPtr<SmsMessage> message = new SmsMessage(aMessageData);
      74               0 :   obs->NotifyObservers(message, kSmsSentObserverTopic, nsnull);
      75                 : 
      76               0 :   return true;
      77                 : }
      78                 : 
      79                 : bool
      80               0 : SmsChild::RecvNotifyDeliveredMessage(const SmsMessageData& aMessageData)
      81                 : {
      82               0 :   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
      83               0 :   if (!obs) {
      84               0 :     return true;
      85                 :   }
      86                 : 
      87               0 :   nsCOMPtr<SmsMessage> message = new SmsMessage(aMessageData);
      88               0 :   obs->NotifyObservers(message, kSmsDeliveredObserverTopic, nsnull);
      89                 : 
      90               0 :   return true;
      91                 : }
      92                 : 
      93                 : bool
      94               0 : SmsChild::RecvNotifyRequestSmsSent(const SmsMessageData& aMessage,
      95                 :                                    const PRInt32& aRequestId,
      96                 :                                    const PRUint64& aProcessId)
      97                 : {
      98               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
      99               0 :     return true;
     100                 :   }
     101                 : 
     102               0 :   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessage);
     103               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     104               0 :   requestManager->NotifySmsSent(aRequestId, message);
     105                 : 
     106               0 :   return true;
     107                 : }
     108                 : 
     109                 : bool
     110               0 : SmsChild::RecvNotifyRequestSmsSendFailed(const PRInt32& aError,
     111                 :                                          const PRInt32& aRequestId,
     112                 :                                          const PRUint64& aProcessId)
     113                 : {
     114               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     115               0 :     return true;
     116                 :   }
     117                 : 
     118               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     119               0 :   requestManager->NotifySmsSendFailed(aRequestId, aError);
     120                 : 
     121               0 :   return true;
     122                 : }
     123                 : 
     124                 : bool
     125               0 : SmsChild::RecvNotifyRequestGotSms(const SmsMessageData& aMessage,
     126                 :                                   const PRInt32& aRequestId,
     127                 :                                   const PRUint64& aProcessId)
     128                 : {
     129               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     130               0 :     return true;
     131                 :   }
     132                 : 
     133               0 :   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessage);
     134               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     135               0 :   requestManager->NotifyGotSms(aRequestId, message);
     136                 : 
     137               0 :   return true;
     138                 : }
     139                 : 
     140                 : bool
     141               0 : SmsChild::RecvNotifyRequestGetSmsFailed(const PRInt32& aError,
     142                 :                                         const PRInt32& aRequestId,
     143                 :                                         const PRUint64& aProcessId)
     144                 : {
     145               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     146               0 :     return true;
     147                 :   }
     148                 : 
     149               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     150               0 :   requestManager->NotifyGetSmsFailed(aRequestId, aError);
     151                 : 
     152               0 :   return true;
     153                 : }
     154                 : 
     155                 : bool
     156               0 : SmsChild::RecvNotifyRequestSmsDeleted(const bool& aDeleted,
     157                 :                                       const PRInt32& aRequestId,
     158                 :                                       const PRUint64& aProcessId)
     159                 : {
     160               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     161               0 :     return true;
     162                 :   }
     163                 : 
     164               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     165               0 :   requestManager->NotifySmsDeleted(aRequestId, aDeleted);
     166                 : 
     167               0 :   return true;
     168                 : }
     169                 : 
     170                 : bool
     171               0 : SmsChild::RecvNotifyRequestSmsDeleteFailed(const PRInt32& aError,
     172                 :                                            const PRInt32& aRequestId,
     173                 :                                            const PRUint64& aProcessId)
     174                 : {
     175               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     176               0 :     return true;
     177                 :   }
     178                 : 
     179               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     180               0 :   requestManager->NotifySmsDeleteFailed(aRequestId, aError);
     181                 : 
     182               0 :   return true;
     183                 : }
     184                 : 
     185                 : bool
     186               0 : SmsChild::RecvNotifyRequestNoMessageInList(const PRInt32& aRequestId,
     187                 :                                            const PRUint64& aProcessId)
     188                 : {
     189               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     190               0 :     return true;
     191                 :   }
     192                 : 
     193               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     194               0 :   requestManager->NotifyNoMessageInList(aRequestId);
     195               0 :   return true;
     196                 : }
     197                 : 
     198                 : bool
     199               0 : SmsChild::RecvNotifyRequestCreateMessageList(const PRInt32& aListId,
     200                 :                                              const SmsMessageData& aMessageData,
     201                 :                                              const PRInt32& aRequestId,
     202                 :                                              const PRUint64& aProcessId)
     203                 : {
     204               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     205               0 :     return true;
     206                 :   }
     207                 : 
     208               0 :   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessageData);
     209               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     210               0 :   requestManager->NotifyCreateMessageList(aRequestId, aListId, message);
     211               0 :   return true;
     212                 : }
     213                 : 
     214                 : bool
     215               0 : SmsChild::RecvNotifyRequestGotNextMessage(const SmsMessageData& aMessageData,
     216                 :                                           const PRInt32& aRequestId,
     217                 :                                           const PRUint64& aProcessId)
     218                 : {
     219               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     220               0 :     return true;
     221                 :   }
     222                 : 
     223               0 :   nsCOMPtr<nsIDOMMozSmsMessage> message = new SmsMessage(aMessageData);
     224               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     225               0 :   requestManager->NotifyGotNextMessage(aRequestId, message);
     226               0 :   return true;
     227                 : }
     228                 : 
     229                 : bool
     230               0 : SmsChild::RecvNotifyRequestReadListFailed(const PRInt32& aError,
     231                 :                                           const PRInt32& aRequestId,
     232                 :                                           const PRUint64& aProcessId)
     233                 : {
     234               0 :   if (ContentChild::GetSingleton()->GetID() != aProcessId) {
     235               0 :     return true;
     236                 :   }
     237                 : 
     238               0 :   nsCOMPtr<nsISmsRequestManager> requestManager = do_GetService(SMS_REQUEST_MANAGER_CONTRACTID);
     239               0 :   requestManager->NotifyReadMessageListFailed(aRequestId, aError);
     240               0 :   return true;
     241                 : }
     242                 : 
     243                 : } // namespace sms
     244                 : } // namespace dom
     245                 : } // namespace mozilla

Generated by: LCOV version 1.7