gecko/dom/mobileconnection/ipc/MobileConnectionChild.h

188 lines
5.2 KiB
C
Raw Permalink Normal View History

/* -*- 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/. */
#ifndef mozilla_dom_mobileconnection_MobileConnectionChild_h
#define mozilla_dom_mobileconnection_MobileConnectionChild_h
#include "mozilla/dom/MobileConnectionInfo.h"
#include "mozilla/dom/mobileconnection/PMobileConnectionChild.h"
#include "mozilla/dom/mobileconnection/PMobileConnectionRequestChild.h"
#include "nsCOMArray.h"
#include "nsCOMPtr.h"
#include "nsIMobileConnectionService.h"
#include "nsIVariant.h"
class nsIMobileConnectionCallback;
namespace mozilla {
namespace dom {
namespace mobileconnection {
/**
* Child actor of PMobileConnection. The object is created by
* MobileConnectionIPCService and destroyed after MobileConnectionIPCService is
* shutdown. For multi-sim device, more than one instance will
* be created and each instance represents a sim slot.
*/
class MobileConnectionChild final : public PMobileConnectionChild
, public nsIMobileConnection
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILECONNECTION
explicit MobileConnectionChild(uint32_t aServiceId);
void
Init();
void
Shutdown();
private:
MobileConnectionChild() = delete;
// final suppresses -Werror,-Wdelete-non-virtual-dtor
~MobileConnectionChild()
{
MOZ_COUNT_DTOR(MobileConnectionChild);
}
protected:
bool
SendRequest(const MobileConnectionRequest& aRequest,
nsIMobileConnectionCallback* aCallback);
virtual void
ActorDestroy(ActorDestroyReason why) override;
virtual PMobileConnectionRequestChild*
AllocPMobileConnectionRequestChild(const MobileConnectionRequest& request) override;
virtual bool
DeallocPMobileConnectionRequestChild(PMobileConnectionRequestChild* aActor) override;
virtual bool
RecvNotifyVoiceInfoChanged(nsIMobileConnectionInfo* const& aInfo) override;
virtual bool
RecvNotifyDataInfoChanged(nsIMobileConnectionInfo* const& aInfo) override;
virtual bool
RecvNotifyDataError(const nsString& aMessage) override;
virtual bool
RecvNotifyCFStateChanged(const uint16_t& aAction, const uint16_t& aReason,
const nsString& aNumber, const uint16_t& aTimeSeconds,
const uint16_t& aServiceClass) override;
virtual bool
RecvNotifyEmergencyCbModeChanged(const bool& aActive,
const uint32_t& aTimeoutMs) override;
virtual bool
RecvNotifyOtaStatusChanged(const nsString& aStatus) override;
virtual bool
RecvNotifyRadioStateChanged(const int32_t& aRadioState) override;
virtual bool
RecvNotifyClirModeChanged(const uint32_t& aMode) override;
virtual bool
RecvNotifyLastNetworkChanged(const nsString& aNetwork) override;
virtual bool
RecvNotifyLastHomeNetworkChanged(const nsString& aNetwork) override;
virtual bool
RecvNotifyNetworkSelectionModeChanged(const int32_t& aMode) override;
private:
uint32_t mServiceId;
bool mLive;
nsCOMArray<nsIMobileConnectionListener> mListeners;
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi
2015-10-17 22:24:48 -07:00
RefPtr<MobileConnectionInfo> mVoice;
RefPtr<MobileConnectionInfo> mData;
int32_t mRadioState;
nsString mLastNetwork;
nsString mLastHomeNetwork;
int32_t mNetworkSelectionMode;
nsTArray<int32_t> mSupportedNetworkTypes;
};
/******************************************************************************
* PMobileConnectionRequestChild
******************************************************************************/
/**
* Child actor of PMobileConnectionRequest. The object is created when an
* asynchronous request is made and destroyed after receiving the response sent
* by parent actor.
*/
class MobileConnectionRequestChild : public PMobileConnectionRequestChild
{
public:
explicit MobileConnectionRequestChild(nsIMobileConnectionCallback* aRequestCallback)
: mRequestCallback(aRequestCallback)
{
MOZ_COUNT_CTOR(MobileConnectionRequestChild);
MOZ_ASSERT(mRequestCallback);
}
bool
DoReply(const MobileConnectionReplySuccess& aReply);
bool
DoReply(const MobileConnectionReplySuccessBoolean& aReply);
bool
DoReply(const MobileConnectionReplySuccessNetworks& aReply);
bool
DoReply(const MobileConnectionReplySuccessCallForwarding& aReply);
bool
DoReply(const MobileConnectionReplySuccessCallBarring& aReply);
bool
DoReply(const MobileConnectionReplySuccessCallWaiting& aReply);
bool
DoReply(const MobileConnectionReplySuccessClirStatus& aReply);
bool
DoReply(const MobileConnectionReplySuccessPreferredNetworkType& aReply);
bool
DoReply(const MobileConnectionReplySuccessRoamingPreference& aMode);
bool
DoReply(const MobileConnectionReplyError& aReply);
protected:
virtual
~MobileConnectionRequestChild()
{
MOZ_COUNT_DTOR(MobileConnectionRequestChild);
}
virtual void
ActorDestroy(ActorDestroyReason why) override;
virtual bool
Recv__delete__(const MobileConnectionReply& aReply) override;
private:
nsCOMPtr<nsIMobileConnectionCallback> mRequestCallback;
};
} // namespace mobileconnection
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobileconnection_MobileConnectionChild_h