Bug 729104 - B2G SMS: Make SmsDatabaseService stub a JS component. r=mounir

This commit is contained in:
Philipp von Weitershausen 2012-02-21 01:34:18 +01:00
Родитель b965fe238e
Коммит 73bd59a760
8 изменённых файлов: 73 добавлений и 158 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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();

Просмотреть файл

@ -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 <mounir.lamouri@mozilla.com> (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

Просмотреть файл

@ -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 <mounir.lamouri@mozilla.com> (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

Просмотреть файл

@ -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]);

Просмотреть файл

@ -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