1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_MobileNetworkInfo_h
8 #define mozilla_dom_MobileNetworkInfo_h
10 #include "mozilla/dom/MozMobileNetworkInfoBinding.h"
11 #include "nsIMobileNetworkInfo.h"
12 #include "nsPIDOMWindow.h"
13 #include "nsWrapperCache.h"
20 class MobileNetworkInfo MOZ_FINAL
: public nsIMobileNetworkInfo
21 , public nsWrapperCache
24 NS_DECL_NSIMOBILENETWORKINFO
25 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
26 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileNetworkInfo
)
28 MobileNetworkInfo(nsPIDOMWindow
* aWindow
);
31 Update(nsIMobileNetworkInfo
* aInfo
);
34 GetParentObject() const
40 WrapObject(JSContext
* aCx
) MOZ_OVERRIDE
;
43 static already_AddRefed
<MobileNetworkInfo
>
44 Constructor(const GlobalObject
& aGlobal
, const nsAString
& aShortName
,
45 const nsAString
& aLongName
, const nsAString
& aMcc
,
46 const nsAString
& aMnc
, const nsAString
& aState
,
49 Nullable
<MobileNetworkState
>
53 for (const EnumEntry
* entry
= MobileNetworkStateValues::strings
;
56 if (mState
.EqualsASCII(entry
->value
)) {
57 return Nullable
<MobileNetworkState
>(static_cast<MobileNetworkState
>(i
));
61 return Nullable
<MobileNetworkState
>();
65 ~MobileNetworkInfo() {}
68 nsCOMPtr
<nsPIDOMWindow
> mWindow
;
77 } // namespace mozilla
79 #endif // mozilla_dom_MobileNetworkInfo_h