LCOV - app.info - dom/sms/src/ipc/SmsIPCService.cpp

LCOV - code coverage report
| Current view: | directory - dom/sms/src/ipc - SmsIPCService.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 42 | 0 | 0.0 %
| Date: | 2012-06-02 | Functions: | 15 | 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 "mozilla/dom/ContentChild.h"
          39                 : #include "SmsIPCService.h"
          40                 : #include "nsXULAppAPI.h"
          41                 : #include "jsapi.h"
          42                 : #include "mozilla/dom/sms/SmsChild.h"
          43                 : #include "mozilla/dom/sms/SmsMessage.h"
          44                 : #include "SmsFilter.h"
          45                 :
          46                 : namespace mozilla {
          47                 : namespace dom {
          48                 : namespace sms {
          49                 :
          50                 : PSmsChild* SmsIPCService::sSmsChild = nsnull;
          51                 :
          52               0 : NS_IMPL_ISUPPORTS2(SmsIPCService, nsISmsService, nsISmsDatabaseService)
          53                 :
          54                 : /* static */ PSmsChild*
          55               0 : SmsIPCService::GetSmsChild()
          56                 : {
          57               0 :   if (!sSmsChild) {
          58               0 :     sSmsChild = ContentChild::GetSingleton()->SendPSmsConstructor();
          59                 :   }
          60                 :
          61               0 :   return sSmsChild;
          62                 : }
          63                 :
          64                 : /*
          65                 :  * Implementation of nsISmsService.
          66                 :  */
          67                 : NS_IMETHODIMP
          68               0 : SmsIPCService::HasSupport(bool* aHasSupport)
          69                 : {
          70               0 :   GetSmsChild()->SendHasSupport(aHasSupport);
          71                 :
          72               0 :   return NS_OK;
          73                 : }
          74                 :
          75                 : NS_IMETHODIMP
          76               0 : SmsIPCService::GetNumberOfMessagesForText(const nsAString& aText, PRUint16* aResult)
          77                 : {
          78               0 :   GetSmsChild()->SendGetNumberOfMessagesForText(nsString(aText), aResult);
          79                 :
          80               0 :   return NS_OK;
          81                 : }
          82                 :
          83                 : NS_IMETHODIMP
          84               0 : SmsIPCService::Send(const nsAString& aNumber, const nsAString& aMessage,
          85                 :                     PRInt32 aRequestId, PRUint64 aProcessId)
          86                 : {
          87               0 :   GetSmsChild()->SendSendMessage(nsString(aNumber), nsString(aMessage),
          88               0 :                                  aRequestId, ContentChild::GetSingleton()->GetID());
          89                 :
          90               0 :   return NS_OK;
          91                 : }
          92                 :
          93                 : NS_IMETHODIMP
          94               0 : SmsIPCService::CreateSmsMessage(PRInt32 aId,
          95                 :                                 const nsAString& aDelivery,
          96                 :                                 const nsAString& aSender,
          97                 :                                 const nsAString& aReceiver,
          98                 :                                 const nsAString& aBody,
          99                 :                                 const jsval& aTimestamp,
         100                 :                                 JSContext* aCx,
         101                 :                                 nsIDOMMozSmsMessage** aMessage)
         102                 : {
         103                 :   return SmsMessage::Create(
         104               0 :     aId, aDelivery, aSender, aReceiver, aBody, aTimestamp, aCx, aMessage);
         105                 : }
         106                 :
         107                 : /*
         108                 :  * Implementation of nsISmsDatabaseService.
         109                 :  */
         110                 : NS_IMETHODIMP
         111               0 : SmsIPCService::SaveReceivedMessage(const nsAString& aSender,
         112                 :                                    const nsAString& aBody,
         113                 :                                    PRUint64 aDate, PRInt32* aId)
         114                 : {
         115               0 :   GetSmsChild()->SendSaveReceivedMessage(nsString(aSender), nsString(aBody),
         116               0 :                                          aDate, aId);
         117                 :
         118               0 :   return NS_OK;
         119                 : }
         120                 :
         121                 : NS_IMETHODIMP
         122               0 : SmsIPCService::SaveSentMessage(const nsAString& aReceiver,
         123                 :                                const nsAString& aBody,
         124                 :                                PRUint64 aDate, PRInt32* aId)
         125                 : {
         126               0 :   GetSmsChild()->SendSaveSentMessage(nsString(aReceiver), nsString(aBody),
         127               0 :                                      aDate, aId);
         128                 :
         129               0 :   return NS_OK;
         130                 : }
         131                 :
         132                 : NS_IMETHODIMP
         133               0 : SmsIPCService::GetMessageMoz(PRInt32 aMessageId, PRInt32 aRequestId,
         134                 :                              PRUint64 aProcessId)
         135                 : {
         136                 :   GetSmsChild()->SendGetMessage(aMessageId, aRequestId,
         137               0 :                                 ContentChild::GetSingleton()->GetID());
         138               0 :   return NS_OK;
         139                 : }
         140                 :
         141                 : NS_IMETHODIMP
         142               0 : SmsIPCService::DeleteMessage(PRInt32 aMessageId, PRInt32 aRequestId,
         143                 :                              PRUint64 aProcessId)
         144                 : {
         145                 :   GetSmsChild()->SendDeleteMessage(aMessageId, aRequestId,
         146               0 :                                    ContentChild::GetSingleton()->GetID());
         147               0 :   return NS_OK;
         148                 : }
         149                 :
         150                 : NS_IMETHODIMP
         151               0 : SmsIPCService::CreateMessageList(nsIDOMMozSmsFilter* aFilter, bool aReverse,
         152                 :                                  PRInt32 aRequestId, PRUint64 aProcessId)
         153                 : {
         154               0 :   SmsFilter* filter = static_cast<SmsFilter*>(aFilter);
         155               0 :   GetSmsChild()->SendCreateMessageList(filter->GetData(), aReverse, aRequestId,
         156               0 :                                        ContentChild::GetSingleton()->GetID());
         157                 :
         158               0 :   return NS_OK;
         159                 : }
         160                 :
         161                 : NS_IMETHODIMP
         162               0 : SmsIPCService::GetNextMessageInList(PRInt32 aListId, PRInt32 aRequestId,
         163                 :                                     PRUint64 aProcessId)
         164                 : {
         165                 :   GetSmsChild()->SendGetNextMessageInList(aListId, aRequestId,
         166               0 :                                           ContentChild::GetSingleton()->GetID());
         167               0 :   return NS_OK;
         168                 : }
         169                 :
         170                 : NS_IMETHODIMP
         171               0 : SmsIPCService::ClearMessageList(PRInt32 aListId)
         172                 : {
         173               0 :   GetSmsChild()->SendClearMessageList(aListId);
         174               0 :   return NS_OK;
         175                 : }
         176                 :
         177                 : } // namespace sms
         178                 : } // namespace dom
         179                 : } // namespace mozilla

Generated by: LCOV version 1.7