Bug 889898 - MobileMessage: remove fallback backend, android/MmsService and SmsService::HasSupport(). r=gene

This commit is contained in:
Vicamo Yang 2013-11-15 17:07:33 +08:00
parent 09a896e6ab
commit 6b63da3aea
17 changed files with 8 additions and 411 deletions

View File

@ -13,13 +13,11 @@ interface nsIMobileMessageCallback;
#define SMS_SERVICE_CONTRACTID "@mozilla.org/sms/smsservice;1"
%}
[scriptable, builtinclass, uuid(0a28f55b-95fe-4b32-994f-b08fe8edf77a)]
[scriptable, builtinclass, uuid(cb7d7b60-01f1-4241-a0ae-2ff035c3fbe5)]
interface nsISmsService : nsISupports
{
readonly attribute unsigned long smsDefaultServiceId;
boolean hasSupport();
void getSegmentInfoForText(in DOMString text,
in nsIMobileMessageCallback request);

View File

@ -9,13 +9,8 @@
#ifdef MOZ_WIDGET_ANDROID
#include "android/MobileMessageDatabaseService.h"
#include "android/SmsService.h"
#include "android/MmsService.h"
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "gonk/SmsService.h"
#else
#include "fallback/MmsService.h"
#include "fallback/MobileMessageDatabaseService.h"
#include "fallback/SmsService.h"
#endif
#include "nsServiceManagerUtils.h"
@ -34,7 +29,11 @@ SmsServicesFactory::CreateSmsService()
if (XRE_GetProcessType() == GeckoProcessType_Content) {
smsService = new SmsIPCService();
} else {
#ifdef MOZ_WIDGET_ANDROID
smsService = new SmsService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
smsService = new SmsService();
#endif
}
return smsService.forget();
@ -47,10 +46,10 @@ SmsServicesFactory::CreateMobileMessageDatabaseService()
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mobileMessageDBService = new SmsIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mobileMessageDBService = do_GetService(RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
#else
#ifdef MOZ_WIDGET_ANDROID
mobileMessageDBService = new MobileMessageDatabaseService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mobileMessageDBService = do_GetService(RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
#endif
}
@ -67,8 +66,6 @@ SmsServicesFactory::CreateMmsService()
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mmsService = do_CreateInstance(RIL_MMSSERVICE_CONTRACTID);
#else
mmsService = new MmsService();
#endif
}

View File

@ -1,51 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#include "MobileMessageCallback.h"
#include "MmsService.h"
#include "AndroidBridge.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
NS_IMPL_ISUPPORTS1(MmsService, nsIMmsService)
NS_IMETHODIMP
MmsService::GetMmsDefaultServiceId(uint32_t* aServiceId)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::Send(uint32_t aServiceid,
const JS::Value& aParameters,
nsIMobileMessageCallback *aRequest)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::Retrieve(int32_t aId, nsIMobileMessageCallback *aRequest)
{
// TODO: Bug 860174, implement this function.
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::SendReadReport(const nsAString & messageID,
const nsAString & toAddress,
const nsAString & iccId)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -1,26 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_mobilemessage_MmsService_h
#define mozilla_dom_mobilemessage_MmsService_h
#include "nsIMmsService.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
class MmsService MOZ_FINAL : public nsIMmsService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMMSSERVICE
};
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobilemessage_MmsService_h

View File

@ -22,13 +22,6 @@ SmsService::GetSmsDefaultServiceId(uint32_t* aServiceId)
return NS_OK;
}
NS_IMETHODIMP
SmsService::HasSupport(bool* aHasSupport)
{
*aHasSupport = true;
return NS_OK;
}
NS_IMETHODIMP
SmsService::GetSegmentInfoForText(const nsAString& aText,
nsIMobileMessageCallback* aRequest)

View File

@ -1,49 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#include "MobileMessageCallback.h"
#include "MmsService.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
NS_IMPL_ISUPPORTS1(MmsService, nsIMmsService)
NS_IMETHODIMP
MmsService::GetMmsDefaultServiceId(uint32_t* aServiceId)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::Send(uint32_t aServiceId,
const JS::Value& aParameters,
nsIMobileMessageCallback *aRequest)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::Retrieve(int32_t aId, nsIMobileMessageCallback *aRequest)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
MmsService::SendReadReport(const nsAString & messageID,
const nsAString & toAddress,
const nsAString & iccId)
{
NS_NOTYETIMPLEMENTED("Implement me!");
return NS_ERROR_NOT_IMPLEMENTED;
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -1,26 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_mobilemessage_MmsService_h
#define mozilla_dom_mobilemessage_MmsService_h
#include "nsIMmsService.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
class MmsService MOZ_FINAL : public nsIMmsService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMMSSERVICE
};
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobilemessage_MmsService_h

View File

@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#include "MobileMessageDatabaseService.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
NS_IMPL_ISUPPORTS1(MobileMessageDatabaseService, nsIMobileMessageDatabaseService)
NS_IMETHODIMP
MobileMessageDatabaseService::GetMessageMoz(int32_t aMessageId,
nsIMobileMessageCallback* aRequest)
{
NS_ERROR("We should not be here!");
return NS_OK;
}
NS_IMETHODIMP
MobileMessageDatabaseService::DeleteMessage(int32_t *aMessageIds,
uint32_t aLength,
nsIMobileMessageCallback* aRequest)
{
NS_ERROR("We should not be here!");
return NS_OK;
}
NS_IMETHODIMP
MobileMessageDatabaseService::CreateMessageCursor(nsIDOMMozSmsFilter* aFilter,
bool aReverse,
nsIMobileMessageCursorCallback* aCallback,
nsICursorContinueCallback** aResult)
{
NS_ERROR("We should not be here!");
return NS_OK;
}
NS_IMETHODIMP
MobileMessageDatabaseService::MarkMessageRead(int32_t aMessageId,
bool aValue,
bool aSendReadReport,
nsIMobileMessageCallback* aRequest)
{
NS_ERROR("We should not be here!");
return NS_OK;
}
NS_IMETHODIMP
MobileMessageDatabaseService::CreateThreadCursor(nsIMobileMessageCursorCallback* aCallback,
nsICursorContinueCallback** aResult)
{
NS_ERROR("We should not be here!");
return NS_OK;
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -1,27 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_mobilemessage_MobileMessageDatabaseService_h
#define mozilla_dom_mobilemessage_MobileMessageDatabaseService_h
#include "nsIMobileMessageDatabaseService.h"
#include "mozilla/Attributes.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
class MobileMessageDatabaseService MOZ_FINAL : public nsIMobileMessageDatabaseService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILEMESSAGEDATABASESERVICE
};
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobilemessage_MobileMessageDatabaseService_h

View File

@ -1,81 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#include "SmsMessage.h"
#include "SmsSegmentInfo.h"
#include "SmsService.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
NS_IMPL_ISUPPORTS1(SmsService, nsISmsService)
NS_IMETHODIMP
SmsService::GetSmsDefaultServiceId(uint32_t* aServiceId)
{
NS_ERROR("We should not be here!");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
SmsService::HasSupport(bool* aHasSupport)
{
*aHasSupport = false;
return NS_OK;
}
NS_IMETHODIMP
SmsService::GetSegmentInfoForText(const nsAString& aText,
nsIMobileMessageCallback* aRequest)
{
NS_ERROR("We should not be here!");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
SmsService::Send(uint32_t aServiceId,
const nsAString& aNumber,
const nsAString& aMessage,
const bool aSilent,
nsIMobileMessageCallback* aRequest)
{
NS_ERROR("We should not be here!");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
SmsService::IsSilentNumber(const nsAString& aNumber,
bool* aIsSilent)
{
NS_ERROR("We should not be here!");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
SmsService::AddSilentNumber(const nsAString& aNumber)
{
NS_ERROR("We should not be here!");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
SmsService::RemoveSilentNumber(const nsAString& aNumber)
{
NS_ERROR("We should not be here!");
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
SmsService::GetSmscAddress(uint32_t aServiceId,
nsIMobileMessageCallback *aRequest)
{
NS_ERROR("We should not be here!");
return NS_OK;
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -1,27 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */
#ifndef mozilla_dom_mobilemessage_SmsService_h
#define mozilla_dom_mobilemessage_SmsService_h
#include "nsISmsService.h"
#include "mozilla/Attributes.h"
namespace mozilla {
namespace dom {
namespace mobilemessage {
class SmsService MOZ_FINAL : public nsISmsService
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISMSSERVICE
};
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobilemessage_SmsService_h

View File

@ -83,13 +83,6 @@ SmsService::GetSmsDefaultServiceId(uint32_t* aServiceId)
return NS_OK;
}
NS_IMETHODIMP
SmsService::HasSupport(bool* aHasSupport)
{
*aHasSupport = true;
return NS_OK;
}
NS_IMETHODIMP
SmsService::GetSegmentInfoForText(const nsAString& aText,
nsIMobileMessageCallback* aRequest)

View File

@ -134,9 +134,6 @@ parent:
*/
PMobileMessageCursor(IPCMobileMessageCursor request);
sync HasSupport()
returns (bool aHasSupport);
AddSilentNumber(nsString aNumber);
RemoveSilentNumber(nsString aNumber);
};

View File

@ -147,17 +147,6 @@ SmsIPCService::GetSmsDefaultServiceId(uint32_t* aServiceId)
return NS_OK;
}
NS_IMETHODIMP
SmsIPCService::HasSupport(bool* aHasSupport)
{
PSmsChild* smsChild = GetSmsChild();
NS_ENSURE_TRUE(smsChild, NS_ERROR_FAILURE);
smsChild->SendHasSupport(aHasSupport);
return NS_OK;
}
NS_IMETHODIMP
SmsIPCService::GetSegmentInfoForText(const nsAString& aText,
nsIMobileMessageCallback* aRequest)

View File

@ -300,18 +300,6 @@ SmsParent::GetMobileMessageDataFromMessage(nsISupports *aMsg,
return false;
}
bool
SmsParent::RecvHasSupport(bool* aHasSupport)
{
*aHasSupport = false;
nsCOMPtr<nsISmsService> smsService = do_GetService(SMS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(smsService, true);
smsService->HasSupport(aHasSupport);
return true;
}
bool
SmsParent::RecvAddSilentNumber(const nsString& aNumber)
{

View File

@ -31,9 +31,6 @@ public:
NS_DECL_NSIOBSERVER
protected:
virtual bool
RecvHasSupport(bool* aHasSupport) MOZ_OVERRIDE;
virtual bool
RecvAddSilentNumber(const nsString& aNumber) MOZ_OVERRIDE;

View File

@ -15,7 +15,6 @@ EXPORTS.mozilla.dom.mobilemessage += [
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
SOURCES += [
'android/MmsService.cpp',
'android/MobileMessageDatabaseService.cpp',
'android/SmsService.cpp',
]
@ -35,12 +34,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
SOURCES += [
'gonk/SmsService.cpp',
]
else:
SOURCES += [
'fallback/MmsService.cpp',
'fallback/MobileMessageDatabaseService.cpp',
'fallback/SmsService.cpp',
]
EXPORTS.mozilla.dom += [
'MmsMessage.h',