2014-09-19 07:53:05 +00:00
|
|
|
/* 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_IccInfo_h
|
|
|
|
#define mozilla_dom_IccInfo_h
|
|
|
|
|
|
|
|
#include "MozIccInfoBinding.h"
|
|
|
|
#include "nsIIccInfo.h"
|
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
|
|
|
|
class nsPIDOMWindow;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2015-01-07 11:25:22 +00:00
|
|
|
namespace icc {
|
|
|
|
class IccInfoData;
|
|
|
|
} // namespace icc
|
|
|
|
|
|
|
|
class IccInfo : public nsIIccInfo
|
2014-09-19 07:53:05 +00:00
|
|
|
, public nsWrapperCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IccInfo)
|
2015-01-07 11:25:22 +00:00
|
|
|
NS_DECL_NSIICCINFO
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
explicit IccInfo(nsPIDOMWindow* aWindow);
|
2015-01-07 11:25:22 +00:00
|
|
|
explicit IccInfo(const icc::IccInfoData& aData);
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Update(nsIIccInfo* aInfo);
|
|
|
|
|
|
|
|
nsPIDOMWindow*
|
|
|
|
GetParentObject() const
|
|
|
|
{
|
|
|
|
return mWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
// WrapperCache
|
|
|
|
virtual JSObject*
|
2015-03-21 16:28:04 +00:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
// WebIDL interface
|
|
|
|
Nullable<IccType>
|
|
|
|
GetIccType() const;
|
|
|
|
|
|
|
|
void
|
|
|
|
GetIccid(nsAString& aIccId) const;
|
|
|
|
|
|
|
|
void
|
|
|
|
GetMcc(nsAString& aMcc) const;
|
|
|
|
|
|
|
|
void
|
|
|
|
GetMnc(nsAString& aMnc) const;
|
|
|
|
|
|
|
|
void
|
|
|
|
GetSpn(nsAString& aSpn) const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
IsDisplayNetworkNameRequired() const;
|
|
|
|
|
|
|
|
bool
|
|
|
|
IsDisplaySpnRequired() const;
|
|
|
|
|
|
|
|
protected:
|
2014-11-25 00:34:19 +00:00
|
|
|
virtual ~IccInfo() {}
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsPIDOMWindow> mWindow;
|
2015-01-07 11:25:22 +00:00
|
|
|
// To prevent compiling error in OS_WIN in auto-generated UnifiedBindingsXX.cpp,
|
|
|
|
// we have all data fields expended here instead of having a data member of
|
|
|
|
// |IccInfoData| defined in PIccTypes.h which indirectly includes "windows.h"
|
|
|
|
// See 925382 for the restriction of including "windows.h" in UnifiedBindings.cpp.
|
|
|
|
nsString mIccType;
|
|
|
|
nsString mIccid;
|
|
|
|
nsString mMcc;
|
|
|
|
nsString mMnc;
|
|
|
|
nsString mSpn;
|
|
|
|
bool mIsDisplayNetworkNameRequired;
|
|
|
|
bool mIsDisplaySpnRequired;
|
2014-09-19 07:53:05 +00:00
|
|
|
};
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class GsmIccInfo final : public IccInfo
|
2015-01-07 11:25:22 +00:00
|
|
|
, public nsIGsmIccInfo
|
2014-09-19 07:53:05 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2015-01-07 11:25:22 +00:00
|
|
|
NS_FORWARD_NSIICCINFO(IccInfo::)
|
|
|
|
NS_DECL_NSIGSMICCINFO
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
explicit GsmIccInfo(nsPIDOMWindow* aWindow);
|
2015-01-07 11:25:22 +00:00
|
|
|
explicit GsmIccInfo(const icc::IccInfoData& aData);
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Update(nsIGsmIccInfo* aInfo);
|
|
|
|
|
|
|
|
// WrapperCache
|
|
|
|
virtual JSObject*
|
2015-03-21 16:28:04 +00:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
// MozCdmaIccInfo WebIDL
|
|
|
|
void
|
|
|
|
GetMsisdn(nsAString& aMsisdn) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
~GsmIccInfo() {}
|
|
|
|
|
2015-01-07 11:25:22 +00:00
|
|
|
nsString mPhoneNumber;
|
2014-09-19 07:53:05 +00:00
|
|
|
};
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class CdmaIccInfo final : public IccInfo
|
2015-01-07 11:25:22 +00:00
|
|
|
, public nsICdmaIccInfo
|
2014-09-19 07:53:05 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2015-01-07 11:25:22 +00:00
|
|
|
NS_FORWARD_NSIICCINFO(IccInfo::)
|
|
|
|
NS_DECL_NSICDMAICCINFO
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
explicit CdmaIccInfo(nsPIDOMWindow* aWindow);
|
2015-01-07 11:25:22 +00:00
|
|
|
explicit CdmaIccInfo(const icc::IccInfoData& aData);
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
Update(nsICdmaIccInfo* aInfo);
|
|
|
|
|
|
|
|
// WrapperCache
|
|
|
|
virtual JSObject*
|
2015-03-21 16:28:04 +00:00
|
|
|
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
|
2014-09-19 07:53:05 +00:00
|
|
|
|
|
|
|
// MozCdmaIccInfo WebIDL
|
|
|
|
void
|
|
|
|
GetMdn(nsAString& aMdn) const;
|
|
|
|
|
|
|
|
int32_t
|
|
|
|
PrlVersion() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
~CdmaIccInfo() {}
|
|
|
|
|
2015-01-07 11:25:22 +00:00
|
|
|
nsString mPhoneNumber;
|
|
|
|
int32_t mPrlVersion;
|
2014-09-19 07:53:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_IccInfo_h
|
|
|
|
|