gecko-dev/dom/cellbroadcast/ipc/CellBroadcastParent.cpp
Bevis Tseng 58379b8174 Bug 864484 - Part 7: Narrow down the DOMString values to predefined constants in .idl. r=vyang, r=smaug
--HG--
extra : rebase_source : 0038e0d9ba6a45f19ea7552202d9db9d165c6c88
extra : amend_source : 7ac906a928fe14fbcac03cd470da78f433a9f192
2014-09-23 18:27:03 +08:00

74 lines
2.7 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 "mozilla/dom/cellbroadcast/CellBroadcastParent.h"
#include "nsServiceManagerUtils.h"
namespace mozilla {
namespace dom {
namespace cellbroadcast {
NS_IMPL_ISUPPORTS(CellBroadcastParent, nsICellBroadcastListener)
bool
CellBroadcastParent::Init()
{
nsCOMPtr<nsICellBroadcastService> service =
do_GetService(CELLBROADCAST_SERVICE_CONTRACTID);
if (service) {
return NS_SUCCEEDED(service->RegisterListener(this));
}
return false;
}
void
CellBroadcastParent::ActorDestroy(ActorDestroyReason aWhy)
{
nsCOMPtr<nsICellBroadcastService> service =
do_GetService(CELLBROADCAST_SERVICE_CONTRACTID);
if (service) {
service->UnregisterListener(this);
}
}
/*
* nsICellBroadcastListener
*/
NS_IMETHODIMP
CellBroadcastParent::NotifyMessageReceived(uint32_t aServiceId,
uint32_t aGsmGeographicalScope,
uint16_t aMessageCode,
uint16_t aMessageId,
const nsAString& aLanguage,
const nsAString& aBody,
uint32_t aMessageClass,
DOMTimeStamp aTimestamp,
uint32_t aCdmaServiceCategory,
bool aHasEtwsInfo,
uint32_t aEtwsWarningType,
bool aEtwsEmergencyUserAlert,
bool aEtwsPopup)
{
return SendNotifyReceivedMessage(aServiceId,
aGsmGeographicalScope,
aMessageCode,
aMessageId,
nsString(aLanguage),
nsString(aBody),
aMessageClass,
aTimestamp,
aCdmaServiceCategory,
aHasEtwsInfo,
aEtwsWarningType,
aEtwsEmergencyUserAlert,
aEtwsPopup) ? NS_OK : NS_ERROR_FAILURE;
}
} // namespace cellbroadcast
} // namespace dom
} // namespace mozilla