diff --git a/b2g/installer/package-manifest.in b/b2g/installer/package-manifest.in index 5e3d84ae0f6b..14653da7bb2d 100644 --- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -401,6 +401,8 @@ #ifdef MOZ_B2G_RIL @BINPATH@/components/RadioInterfaceLayer.manifest @BINPATH@/components/RadioInterfaceLayer.js +@BINPATH@/components/SmsDatabaseService.manifest +@BINPATH@/components/SmsDatabaseService.js @BINPATH@/components/nsWifiWorker.js @BINPATH@/components/nsWifiWorker.manifest #endif diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 98f687c2dac2..777be767568d 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -379,6 +379,8 @@ #ifdef MOZ_B2G_RIL @BINPATH@/components/RadioInterfaceLayer.manifest @BINPATH@/components/RadioInterfaceLayer.js +@BINPATH@/components/SmsDatabaseService.manifest +@BINPATH@/components/SmsDatabaseService.js @BINPATH@/components/nsWifiWorker.js @BINPATH@/components/nsWifiWorker.manifest #endif diff --git a/dom/sms/src/Makefile.in b/dom/sms/src/Makefile.in index 017370f2b9a2..0991ea5ed0ea 100644 --- a/dom/sms/src/Makefile.in +++ b/dom/sms/src/Makefile.in @@ -81,7 +81,6 @@ CPPSRCS = \ SmsEvent.cpp \ Constants.cpp \ SmsChild.cpp \ - SmsDatabaseService.cpp \ SmsRequest.cpp \ SmsRequestManager.cpp \ SmsFilter.cpp \ @@ -102,6 +101,15 @@ LOCAL_INCLUDES += \ -I$(topsrcdir)/dom/telephony \ -I$(topsrcdir)/dom/system/b2g \ $(NULL) + +EXTRA_COMPONENTS = \ + ril/SmsDatabaseService.js \ + ril/SmsDatabaseService.manifest \ + $(NULL) +else +CPPSRCS += \ + SmsDatabaseService.cpp \ + $(NULL) endif include $(topsrcdir)/config/config.mk diff --git a/dom/sms/src/SmsServicesFactory.cpp b/dom/sms/src/SmsServicesFactory.cpp index 72212b4cabc6..01389ffbf0aa 100644 --- a/dom/sms/src/SmsServicesFactory.cpp +++ b/dom/sms/src/SmsServicesFactory.cpp @@ -38,8 +38,13 @@ #include "SmsServicesFactory.h" #include "nsXULAppAPI.h" #include "SmsService.h" -#include "SmsDatabaseService.h" #include "SmsIPCService.h" +#ifndef MOZ_B2G_RIL +#include "SmsDatabaseService.h" +#endif +#include "nsServiceManagerUtils.h" + +#define RIL_SMS_DATABASE_SERVICE_CONTRACTID "@mozilla.org/sms/rilsmsdatabaseservice;1" namespace mozilla { namespace dom { @@ -67,7 +72,11 @@ SmsServicesFactory::CreateSmsDatabaseService() if (XRE_GetProcessType() == GeckoProcessType_Content) { smsDBService = new SmsIPCService(); } else { +#ifdef MOZ_B2G_RIL + smsDBService = do_GetService(RIL_SMS_DATABASE_SERVICE_CONTRACTID); +#else smsDBService = new SmsDatabaseService(); +#endif } return smsDBService.forget(); diff --git a/dom/sms/src/ril/SmsDatabaseService.cpp b/dom/sms/src/ril/SmsDatabaseService.cpp deleted file mode 100644 index d4e13d061df1..000000000000 --- a/dom/sms/src/ril/SmsDatabaseService.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Mozilla Foundation - * Portions created by the Initial Developer are Copyright (C) 2011 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Mounir Lamouri (Original Author) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include "SmsDatabaseService.h" - -namespace mozilla { -namespace dom { -namespace sms { - -NS_IMPL_ISUPPORTS1(SmsDatabaseService, nsISmsDatabaseService) - -NS_IMETHODIMP -SmsDatabaseService::SaveSentMessage(const nsAString& aReceiver, - const nsAString& aBody, - PRUint64 aDate, PRInt32* aId) -{ - *aId = -1; - NS_ERROR("We should not be here!"); - return NS_OK; -} - -NS_IMETHODIMP -SmsDatabaseService::GetMessageMoz(PRInt32 aMessageId, PRInt32 aRequestId, - PRUint64 aProcessId) -{ - NS_ERROR("We should not be here!"); - return NS_OK; -} - -NS_IMETHODIMP -SmsDatabaseService::DeleteMessage(PRInt32 aMessageId, PRInt32 aRequestId, - PRUint64 aProcessId) -{ - NS_ERROR("We should not be here!"); - return NS_OK; -} - -NS_IMETHODIMP -SmsDatabaseService::CreateMessageList(nsIDOMMozSmsFilter* aFilter, - bool aReverse, PRInt32 aRequestId, - PRUint64 aProcessId) -{ - NS_ERROR("We should not be here!"); - return NS_OK; -} - -NS_IMETHODIMP -SmsDatabaseService::GetNextMessageInList(PRInt32 aListId, PRInt32 aRequestId, - PRUint64 aProcessId) -{ - NS_ERROR("We should not be here!"); - return NS_OK; -} - -NS_IMETHODIMP -SmsDatabaseService::ClearMessageList(PRInt32 aListId) -{ - NS_ERROR("We should not be here!"); - return NS_OK; -} - -} // namespace sms -} // namespace dom -} // namespace mozilla diff --git a/dom/sms/src/ril/SmsDatabaseService.h b/dom/sms/src/ril/SmsDatabaseService.h deleted file mode 100644 index 4b8d652b2ae0..000000000000 --- a/dom/sms/src/ril/SmsDatabaseService.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Mozilla Foundation - * Portions created by the Initial Developer are Copyright (C) 2011 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Mounir Lamouri (Original Author) - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#ifndef mozilla_dom_sms_SmsDatabaseService_h -#define mozilla_dom_sms_SmsDatabaseService_h - -#include "nsISmsDatabaseService.h" - -namespace mozilla { -namespace dom { -namespace sms { - -class SmsDatabaseService : public nsISmsDatabaseService -{ -public: - NS_DECL_ISUPPORTS - NS_DECL_NSISMSDATABASESERVICE -}; - -} // namespace sms -} // namespace dom -} // namespace mozilla - -#endif // mozilla_dom_sms_SmsDatabaseService_h diff --git a/dom/sms/src/ril/SmsDatabaseService.js b/dom/sms/src/ril/SmsDatabaseService.js new file mode 100644 index 000000000000..c519cd4f1c0b --- /dev/null +++ b/dom/sms/src/ril/SmsDatabaseService.js @@ -0,0 +1,47 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +const RIL_SMSDATABASESERVICE_CONTRACTID = "@mozilla.org/sms/rilsmsdatabaseservice;1"; +const RIL_SMSDATABASESERVICE_CID = Components.ID("{a1fa610c-eb6c-4ac2-878f-b005d5e89249}"); + +/** + * SmsDatabaseService + */ +function SmsDatabaseService() { +} +SmsDatabaseService.prototype = { + + classID: RIL_SMSDATABASESERVICE_CID, + QueryInterface: XPCOMUtils.generateQI([Ci.nsISmsDatabaseService]), + + // nsISmsDatabaseService + + saveSentMessage: function saveSentMessage(receiver, body, date) { + return -1; + }, + + getMessage: function getMessage(messageId, requestId) { + }, + + deleteMessage: function deleteMessage(messageId, requestId) { + }, + + createMessageList: function createMessageList(filter, reverse, requestId) { + }, + + getNextMessageInList: function getNextMessageInList(listId, requestId) { + }, + + clearMessageList: function clearMessageList(listId) { + } + +}; + +const NSGetFactory = XPCOMUtils.generateNSGetFactory([SmsDatabaseService]); diff --git a/dom/sms/src/ril/SmsDatabaseService.manifest b/dom/sms/src/ril/SmsDatabaseService.manifest new file mode 100644 index 000000000000..8de5bd24d6fc --- /dev/null +++ b/dom/sms/src/ril/SmsDatabaseService.manifest @@ -0,0 +1,3 @@ +component {a1fa610c-eb6c-4ac2-878f-b005d5e89249} SmsDatabaseService.js +contract @mozilla.org/sms/rilsmsdatabaseservice;1 {a1fa610c-eb6c-4ac2-878f-b005d5e89249} +category profile-after-change SmsDatabaseService @mozilla.org/sms/rilsmsdatabaseservice;1